Backward Euler / Implicit Integration Implementation

In summary, you are trying to solve for x(t+1) in implicit integration for the pendulum problem. You are not sure if you need to solve for the derivative of the acceleration or write the motion function in matrix notation. You are also very confused.
  • #1
jacki
3
0
Hi all,


I am trying to implement the backward euler integration (in c++) for the pendulum problem. I have the forward euler implemented, but frankly I don't know where to even start from for the implicit integration. I understand the update expressions for implicit, and of course the pendulum motion (theta'' = -gravity / length * sin (theta) ).

Almost all content online explaining implicit integration give the update expressions and say that you have to solve for x (t+1), but I haven't found any resources that actually explain how to solve them.

I am not looking for libraries that do this already, I would like to learn the process and do it myself (except maybe for matrix inversion etc). If you understand the process of solving for x(t+1) would you please enlighten me? Do I need to find the derivative of the acceleration? Do I need to write the motion function ( -gravity / length * sin (theta) ) in matrix notation?

Very confused.

Thank you so much!
 
Physics news on Phys.org
  • #2
For forward Euler I had seen a number of times similar problem posted to this forum. Normally people use RK4 method to solve.

Just let [tex] x_1=\theta , x_2=\dot{\theta}[/tex]
then expressed your equation as a system of DE
[tex]\dot{\vec x} = \boldsymbol A \vec x[/tex]

where A=[0 1; -g/L*sin(x1) 0]
 
  • #3
matematikawan said:
For forward Euler I had seen a number of times similar problem posted to this forum. Normally people use RK4 method to solve.

Just let [tex] x_1=\theta , x_2=\dot{\theta}[/tex]
then expressed your equation as a system of DE
[tex]\dot{\vec x} = \boldsymbol A \vec x[/tex]

where A=[0 1; -g/L*sin(x1) 0]


Thanks, but that's for forward euler? I'm asking about backward euler.
 
  • #4
Yeap I didn't answer your question and I know that. I'm trying to express what little knowledge that I have on the subject :biggrin:

Now I remember that I had seen a similar problem, but much simplier in the forum.
https://www.physicsforums.com/showthread.php?t=301890

Looking back at that thread I think, for the Backward Euler we have to work on semi-implicit (I didn't create this term). My guess for the iteration is

Xn+1 = Xn + h*(I - hJ)-1*F(Xn)


where X=[x1 x2]t
J is the Jacobian matrix [0 1; -g/L*cos(x1) 0]
F(X)= [x2 -g/L*sin(x1)]t
 
  • #5
Hi! I have the same problem! Ihave to implement some natural effects with implicit integration,for example if I have a particle with an acceleration toward a point (orbit) so there is this force:

F(m, epsilon)=m/(r^2)+epsilon
with euler explicit I have this code:

Code:
f
loat magdt = magnitude * dt;
float max_radiusSqr = max_radius * max_radius;
if(max_radiusSqr < P_MAXFLOAT) {
for (ParticleList::iterator it = ibegin; it != iend; it++) {
Particle_t &m = (*it);
pVec dir(center - m.pos// Step velocity with acceleration
if(rSqr < max_radiusSqr)
m.vel += dir * (magdt / (sqrtf(rSqr) * (rSqr + epsilon)));//sqrtf is for to normalize rSqr
[\code]


How can I implement this with implicit integration?

thank you..
 
  • #6
I'm not that familier with C++ code. If you could express your problem mathematically, probably we could come out with the algorithm.
 
  • #7
ok thank you! sorry!
My problem is:
I have a particle systems and I have to simulate an effect called atom, and with Explicit Euler for to calculate particle's acceleration, I have this:

new_vel = old_vel + dt * (m /( r^2+epsilon));

epsilon serves to dampen the inverse square so that f(r) does not approach infinity as r approches zero, r is the distance from gravity source.
Now my question is:how can I calcute the same new_vel using an implicit integration?
 
  • #8
I'm not sure whether I properly understand your problem here. I think your r is also a dependant variable in t. Epsilon and m are constants.

Vn+1 = Vn + dt*f(rn+1,tn+1)

We need another DE in dr/dt.
 

What is Backward Euler / Implicit Integration Implementation?

Backward Euler / Implicit Integration Implementation is a numerical method used to solve differential equations. It is an implicit method, meaning that the future values of the solution are calculated based on the current values, rather than using forward differences.

How does Backward Euler / Implicit Integration Implementation work?

Backward Euler / Implicit Integration Implementation works by approximating the derivative of the solution at a given time step using the current solution value and the solution value at the previous time step. This approximation is then used to calculate the solution at the next time step.

What are the advantages of using Backward Euler / Implicit Integration Implementation?

One advantage of Backward Euler / Implicit Integration Implementation is its stability. It can handle stiff equations, which are equations with rapidly changing solutions, without producing inaccurate results. Additionally, it is relatively easy to implement and does not require as small of a time step as other numerical methods.

What are the limitations of Backward Euler / Implicit Integration Implementation?

One limitation of Backward Euler / Implicit Integration Implementation is that it can be computationally expensive, as it requires solving a system of equations at each time step. It also does not provide as accurate results as other methods, such as Runge-Kutta methods, for non-stiff equations.

How is Backward Euler / Implicit Integration Implementation used in scientific research?

Backward Euler / Implicit Integration Implementation is used in many fields of scientific research that involve solving differential equations, such as physics, engineering, and biology. It is particularly useful for simulating systems with stiff equations, as well as for predicting the behavior of systems in the future.

Similar threads

Replies
2
Views
4K
Replies
2
Views
3K
Replies
4
Views
1K
  • Differential Equations
Replies
1
Views
9K
Replies
2
Views
2K
  • Differential Equations
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
293
  • Differential Equations
Replies
1
Views
2K
Replies
3
Views
829
Replies
4
Views
2K
Back
Top