CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

simple one dof oscillator without fluid force gives increasing oscillation amplitude

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2020, 15:49
Default simple one dof oscillator without fluid force gives increasing oscillation amplitude
  #1
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 17
mAlletto will become famous soon enough
Hello all,


I set up a simple test case to test the 6dof solver in OF. The OF version is OF1912 It is a circular cylinder in a fluid at rest attached at a linear spring without damper. The density and viscosity of the fluid is set zero in order that no fluid force acts on the cylinder. After releasing the cylinder from an initial position where the spring is at tension, the amplitude of the oscillations increase instead to keep at a constant value like expected. The increase of the amplitude is smaller for smaller time steps but even for a very small time step of dt = 0.00005 the amplitude increases of 5% after ten cycles.



Any clue if I messed up something. Has anyone similar experiences?



I attached the case files with an Allrun script.
Attached Images
File Type: png z.png (9.9 KB, 20 views)
Attached Files
File Type: gz send.tar.gz (40.2 KB, 1 views)
mAlletto is offline   Reply With Quote

Old   July 5, 2020, 11:12
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 17
mAlletto will become famous soon enough
I just used the symplectic solver to update the position of the mass connected to the spring and I got the analytical solution for all time step sized used above (see plot).


Hm interesting. Have to check the implementation of the Newmark method.
Attached Images
File Type: png z.png (8.2 KB, 10 views)
mAlletto is offline   Reply With Quote

Old   July 6, 2020, 10:33
Default
  #3
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 17
mAlletto will become famous soon enough
Following wikipedia https://en.wikipedia.org/wiki/Newmark-beta_method the Newmark method is as follows (without external forces):


\dot z_{n+1} =  \dot z_{n} + (1+\gamma)\Delta t  \ddot z_{n} + \gamma \Delta t  \ddot z_{n+1}


z_{n+1} =  z_{n} + \dot z_{n}\Delta t + 0.5 (\Delta t )^2 ((1-2\beta) \ddot z_{n}  + 2\beta \ddot z_{n+1})

M \ddot z_{n+1} + C \dot z_{n+1} + K z_{n+1} = 0


It is an implicit method. This means that we have three equations for the three unknowns: the position z_{n+1}, the velocity \dot z_{n+1} and acceleration \ddot z_{n+1}, at the new time step. Since the equations are linear we can rearrange the equation and find a solution.






I checked the code of the Newmark method implemented in openfoam:


Code:
void Foam::sixDoFSolvers::Newmark::solve
(
    bool firstIter,
    const vector& fGlobal,
    const vector& tauGlobal,
    scalar deltaT,
    scalar deltaT0
)
{
    // Update the linear acceleration and torque
    updateAcceleration(fGlobal, tauGlobal);

    // Correct linear velocity
    v() =
        tConstraints()
      & (v0() + aDamp()*deltaT*(gamma_*a() + (1 - gamma_)*a0()));

    // Correct angular momentum
    pi() =
        rConstraints()
      & (pi0() + aDamp()*deltaT*(gamma_*tau() + (1 - gamma_)*tau0()));

    // Correct position
    centreOfRotation() =
        centreOfRotation0()
      + (
            tConstraints()
          & (
                deltaT*v0()
              + aDamp()*sqr(deltaT)*(beta_*a() + (0.5 - beta_)*a0())
            )
        );

    // Correct orientation
    vector piDeltaT =
        rConstraints()
      & (
            deltaT*pi0()
          + aDamp()*sqr(deltaT)*(beta_*tau() + (0.5 - beta_)*tau0())
        );
    Tuple2<tensor, vector> Qpi = rotate(Q0(), piDeltaT, 1);
    Q() = Qpi.first();
}
For me it seems that the method is explicit since the acceleration is calculated before solving for the velocity and the new position. At this time only the values at the previous time step is known. So the system of equations solved in OF look more like this:


\dot z_{n+1} =  \dot z_{n} + (1+\gamma)\Delta t  \ddot z_{n} + \gamma \Delta t  \ddot z_{n+1}


z_{n+1} =  z_{n} + \dot z_{n}\Delta t + 0.5 (\Delta t )^2 ((1-2\beta) \ddot z_{n}  + 2\beta \ddot z_{n+1})

M \ddot z_{n+1} + C \dot z_{n} + K z_{n} = 0


So maybe the calculation of the acceleration at the new time step using old velocity and position values lead to divergence.



Or maybe I'm wrong. Are there any comments from the community?



Best


Michael
mAlletto is offline   Reply With Quote

Old   July 23, 2020, 07:15
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 17
mAlletto will become famous soon enough
Just wanted to say that I summarized some results in this small tutorial:


https://wiki.openfoam.com/1Dof_sprin...ichael_Alletto
mAlletto is offline   Reply With Quote

Old   May 31, 2024, 17:32
Default wrong implementation
  #5
New Member
 
Chennakesava Kadapa
Join Date: Apr 2023
Posts: 2
Rep Power: 0
chennak is on a distinguished road
The implementation of the Newmark scheme in Openfoam is incorrect. The implementation is explicit; however, it is not stable for gamma=0.5 and beta=0.25.
chennak is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
Force can not converge colopolo CFX 13 October 4, 2011 22:03
Fluid Force _output jiko FLOW-3D 2 September 29, 2010 12:11
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 07:59
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 19:35.