This is an animation of the relativistic “twins” scenario. One twin stays on Earth. The other travels away at a high rate of velocity and then comes back.
Typically when you see this situation analysed in a textbook, they have the travelling twin doing something like going out at half the speed of light then instantaneously changing direction and coming back in at the same speed. They then proceed to use the two different frames of reference (going out and coming back in) to show that the travelling twin ages less than the one who stayed at home.
I wanted to try to model a more “realistic” scenario. One that could, at least in principle, actually happen. So what I’ve done here is to have the travelling twin accelerate out at 1 Earth gravity for half the “out” trip. Then the traveller decelerates at 1g for the other half of the way out, coming to a stop at the outward point. This 1g acceleration and deceleration if the repeated on the way back home.
So, instead of two frames of reference, we are “integrating over an infinite number of frames.” Of course, this is actually a numeric simulation and approximates the situation with a finite number of calculations.
The green “grid” lines represent the space and time coordinate systems of the travelling twin, as seen in the Earth frame. Note that, as the traveller “approaches” the speed of light, it’s not possible to draw “enough” grid lines.