In my simulation of the twin paradox, i used the Lorentz transformation formulas to map events from one inertial reference frame into another IRF.

Reading through various threads here, i read that spacetime is curved and that space can be considered flat only for small distances.

So my question is, is my simulation inaccurate even though there is negligible gravity involved (empty space with the clocks' weight in my simulation being negligible). Hence, do the Lorentz transformation formulas hold for long distances when no gravity is involved?

If it is not 100% accurate, then what would i have to change?

(Referring to this simulation in case someone does not know already)

If there is no gravity, or gravity is negligible in the scenario, then the Lorentz transforms are global transforms (although technically only approximately in the latter case). Since the twin paradox really only needs three arbitrarily low mass clocks, the Lorentz transforms are fine, however large the distances involved.

If you want to do a variant where the travelling twin does a tight orbit around a black hole to turn round, you need general relativity. There is no obvious One True Way to depict that, though.

Then i don't understand why according to some here "spacetime can be considered flat for short distances". Shouldn't they instead say that spacetime can be considered flat for short distances or any distances when there is no gravity involved?

There's always gravity involved in the real world. Also, I think you're being tautological. Flat spacetime and no gravity are two ways of saying the same thing (although I'd say the former is more precise).

Do note that "short" is a context-sensitive term. If you go out to the Kuiper belt and then do a twin paradox experiment travelling to a similar distance from Alpha Centauri, the error from neglecting the curvature of spacetime is lost in other sources of noise. Do the same between galactic superclusters and you'll run in to curvature on cosmological scales. Do it between black holes that are in the late stages of inward spiralling and you'll notice curvature on a much shorter scale.

This is a mathematical property of a manifold. Regardless of the curvature, there is some length scale over which it is approximately flat. If there is no curvature then that length scale is infinite. If the curvature is extreme then that length scale may be microscopic. "Short distances" is the idea that there is some scale by which the distances can be judged as long or short.

But the curvature of spacetime is a function mass and the resulting gravity alone. Is that a correct statement? Or do i need to be concerned about any other possible curvature or possibly other things which would render spacetime non-flat, as in for example if the universe is closed or open or anything else, without claiming i would really understand what closed or open would mean to the full extend.

Peter is just correcting my earlier statement that the stress-energy tensor is the only source of curvature. The cosmological constant is incredibly small and, again, you'd need to be travelling between galactic clusters before you would have to worry about its effects.

It's a little difficult to see what your video is showing because there are a lot of black numbers that obscure the detail, at least for me, and no description. But I think you're just showing a spacetime diagram of a twin paradox experiment in the absence of gravity. That's fine.

What about discontinuous regions of space time? Are those not allowed in GR? Is that what a black hole is? (honestly I can't think of anything else that could fit the description of a discontinuity in space time)

I'm not sure what you mean by this, but I think the answer is, if there were some spacetime region that was not continous with ours, we could never detect or interact with it, so it doesn't matter.

No. The black hole solution is a single continuous spacetime manifold.

What I mean by discontinuity is some region that you cannot look at smaller and smaller regions to find a flat area because it is not smooth. Like in piece-wise function such as f(x) = {x^{2}, x ≥ 1; 2-x, x < 1}. (as I said, finding some real world physical description escapes me, especially now that you pointed out that black holes don't fit the description) That is, a region in which you can't take a derivative.

Does such a thing even make sense? I realize now it's a pretty pointless question, especially given that a physical counterpart seems ridiculous.

GR does not consider any such possibility; it models spacetime as a smooth manifold. We won't know whether such a "discontinuous" model is workable at all on small enough scales until we have a good theory of quantum gravity. And since by "small enough scales" we mean something on the order of the Planck length, i.e., 20 orders of magnitude smaller than an atomic nucleus, this question has no practical significance; modeling spacetime as a smooth manifold works extremely well for all phenomena we can currently test experimentally.

I figured it was more or less a useless question as it pertains to physics, but this is good information to know.

This seems vaguely like topology. Of course I have pretty much zero experience in that other than the kid stuff you do for science fair presentations in your freshmen year for math class. Weird because I'd always thought of tensors as extensions of linear algebra, and since GR is so tensor heavy, and since the more I look into it the more it looks like topology too, it seems it's all kind of connecting into one thing in GR.

All that useless stuff said, I noticed one key thing that might completely answer my question. The chapter mentions the following

Since the real numbers are continuous, if it looks locally like R^{2}, then it has to be continuous. Otherwise we're doing something else entirely, I guess.

Thanks for this link. It is actually perfect because it starts out just above my level, rather than way above it or right at it like so many other sources I've seen (either way those two levels don't really help; this however, is a very useful link to me).

Yes, topology is quite important. The manifold has a topology as well as a metric. The metric seems to get most of the attention, but Carroll does a good job making sure that the topology is at least mentioned in the foundational chapters.

In general, every number is just an event which for the teal observer happens at x,t in the left diagram, while on the right diagram, the event happens at x', t' measured from an observer at x'=0 t'=0 on the right diagram.
More precise, the numbers are clock counters, and if you connected the numbers, which are vertical on the left side, with a line, you would get the worldline of a specific clock.

The video is just a demonstration of the capabilities of the software I coded. In the video description is a link to download either the source code and compile it, or use the pre-compiled .jar file to execute it (given you have a JVM installed).
You can zoom in with the mousewheel and remove the black clocks altogether using the main program, if they confuse you.

As for the white numbers, those are dynamic and represent clock counts/worldlines which are in the same IRF the white observer is _currently_ in, hence different clocks depending on the Vrel.

The observer locally to the teal clock on the left diagram, is _not_ at the same location as the observer locally to the white clock (as the twin moves), and therefore, additional to the lorentz transformations, i have to move the centre of the diagram in my calculations.

For example:

When the white circle, representing the location of the travelling twin is at x=5, t=0 travelling at v=0.5c as he just reached the turned around point, that would translate to

x' ~ 5.7735..ls and t' = 2.88675..s are the coordinates an observer who is local to the stay at home twin, and is travelling at 0.5c relative to the stay at home twin would register. That observer would be at rest relative to the travelling twin who just reached the turn around point, travelling at 0.5c still (before he starts accelerating back).
However, I keep the travelling twin in the right diagram always at x'=0 ls, t'=0 s. Therefore instead of him(the travelling twin) being at x' ~ 5.7735..ls and t' = 2.88675s, the stay at home twin coordinates(the instance of the stay at home twin which is depicted as a teal filled circle) become x' ~ -5.7735..ls and t' = 2.88675s.

Same as in the left diagram, I choose a reference frame in which the stay at home twin is always at x=0ls, t=0s. Basically drawing a new x/t diagram each and every time, and placing the observer always in the middle at x=0ls, t=0s while drawing everything else relative to his position "as time passes".

At the turn around point, at a near instantaneous acceleration, Vrel changes of course, and x' and t' change along with it. Which is why you see the teal filled circle move, representing the spacetime location of one of the instances of the stay at home twin being on the blue worldline, measured from the travelling twin's perspective.

The blue filled circle _in the right diagram_ represents the instance of the stay at home twin, which crosses the simultaneity axis. Hence an instance of the stay at home twin which is measured to be always at t'=0s relative to the travelling twin.

This is the instance we usually refer to, when describing how the travelling twin would "measure" the stay at home's twin clock along his journey. You can see how it "ticks" faster when the travelling twin is accelerating back.
The two smaller diagrams below the main diagrams, with the clocks rendered were added to emphasise this. Showing in the case of the right (smaller) diagram, how the travelling twin would measure(imagine) the stay at home twin's clock( blue) to be ticking while he moves/accelerates. A clock which he imagine to be on the simultaneity axis.

The more I describe, the more complicated it seems to get as a lot depends on how you interpret the diagrams, especially the different instances of the clocks changing locations within the diagrams.

So in the end, I have to retreat back to my original statement. In general, the numbers in the left diagram are all events which happen at x,t measured from the perspective of the stay at home twin, which are then rendered at x', t' in the right diagram as measured from the travelling twin's perspective, all while choosing their frames such that both are always at the middle of their respective diagram.

I must say, it was easier programming this, than describing/interpreting it and so I would rather leave it to you to interpret it after just describing the core characteristics of the two diagrams.

Imagine you are the travelling twin. As you travel, you draw x/t diagrams periodically, where you place yourself at x=0 and t=0 while plotting every other event you calculate/measure within the diagram. In the case of my diagrams, several instances of clocks which are at rest relative to the stay at home twin(black, blue, green colors) and a few instances of clocks which are at rest relative to your(the travelling twin) current IFR (white clocks).
Then you would create an animation/video of those plots. The right diagram is what you would get.

The left diagram is the same as above, but from the perspective of the stay at home twin.