Is there a way to insert a correction term in order to counterbalance the gain of energy due to the explicit Euler method ? In particular, let's assume I know the total energy E_0 of my system at time t=0 (due to the initial conditions). And the energy is defined locally at time t on a grid which is of total size N^2 : e(i,j,t).

Ayanna Jarvis

Ayanna Jarvis

Answered question

2022-10-16

Is there a way to insert a correction term in order to counterbalance the gain of energy due to the explicit Euler method ?
In particular, let's assume I know the total energy E 0 of my system at time t = 0 (due to the initial conditions). And the energy is defined locally at time t on a grid which is of total size N 2 : e ( i , j , t ). Would it make sense to correct at each iteration (time t): e ( i , j , t ) = e ( i , j , t ) i e ( i , j , t ) E 0 N 2 ?

Answer & Explanation

getrdone07tl

getrdone07tl

Beginner2022-10-17Added 23 answers

Yes, you can use a symplectic Euler method to solve the Hamiltonian system
p ˙ = q H ( p , q ) , q ˙ = p H ( p , q ) .
One example of a symplectic Euler method is given by
p n + 1 = p n h q H ( p n + 1 , q n ) , q n + 1 = q n + h p H ( p n + 1 , q n ) .
Observe that we must first solve for p n + 1 before q n + 1 can be computed. This symplectic Euler method has order 1. It preserves the total energy of a system which is O ( h ) away from the system which you are trying to simulate, i.e., your total energy can fluctuate, but only a tiny bit and the error does not grow over time.

It is vital that you do not try to repair your simulation by adding or subtracting energy. How to best understand and remember this forever? Consider the inevitable rounding errors done during floating point calculations. Adjusting the total energy to "compensate" for rounding errors at the end of each iteration amounts to representing the errors as the result of an outside force acting on your real physical system. This is not acceptable, because there is no such force!

The explicit Euler method is "bad" for systems where the preservation of energy is important. The symplectic Euler method or a higher order symplectic method should be used instead.

A great reference on symplectic methods is the book by Hairer et al. "Geometric numerical integration". This is a graduate textbook which requires a solid background in mathematics, but it comes with some very fine examples and clear illustrations.
Sonia Elliott

Sonia Elliott

Beginner2022-10-18Added 4 answers

Thanks for answer!

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?