CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Resetting all fields and mesh motion (http://www.cfd-online.com/Forums/openfoam-programming-development/102074-resetting-all-fields-mesh-motion.html)

wavemaster May 21, 2012 13:00

Resetting all fields and mesh motion
 
Dear all,
I am attempting to write some implicit solver for a body moved by a fluid.
I would like to move the body boundary, calculate the fluid, obtain accelerations and then reset to where I started and repeat as often as I need before advancing the timestep.

The .prevIter(); seems to store all fields all right, so before entering into my implicit loop I am able to save all my fields like this.
Inside the implicit loop I use something like
Code:

U=U.prevIter();
to get back to the starting point of the current timestep.

I can run a case without moving the mesh and it seems to repeat every timestep a couple of times which shows i am OK, I suppose.
Moving meshes run but diverge, so I must be resetting something badly.
The same case as an explicit method works, so with my additional iterations it should only take longer...
I use the same for cellDisplacement and pointDisplacement as above.
But how do i reset the mesh motion best?
Is something like this correct?
Code:

mesh.movePoints(mesh.oldPoints());
Is there a structure/method to reset the whole simulation to the previous state more elegantly? I do not yet understand some aspects of time, so that could be an error ...
Any comments are much appreciated,
Cheers,
Pal


All times are GMT -4. The time now is 13:25.