CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Get output of time derivative (http://www.cfd-online.com/Forums/openfoam-solving/94553-get-output-time-derivative.html)

nandiganavishal November 18, 2011 17:49

Get output of time derivative
 
Dear Foamers,

I would like to know, if we can get the time derivative of a variable as the output. For instance, if I am solving the transient Navier Stokes, is it possible to get the acceleration (du/dt) too at every time step as an output.

Kindly let me know.

Regards

Vishal Nandigana

alberto November 20, 2011 21:47

Use fvc::ddt(yourField) to store it in a volField of the same type of your field. Setting the IOobject to AUTO_WRITE will have the time derivative stored.

nandiganavishal November 21, 2011 12:45

Thanks Alberto. It worked well.

Andrea_85 March 14, 2012 13:53

Hi,
how can i get the same in a postprocessing? If i use this code:

read U
read rho

volVectorField ddt
(
IOobject
(
"ddt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),

fvc::ddt(rho,U)
);

ddt.write()

it returns always zero.

best
andrea

alberto March 14, 2012 14:04

Quote:

Originally Posted by Andrea_85 (Post 349471)
Hi,
how can i get the same in a postprocessing? If i use this code:

read U
read rho

volVectorField ddt
(
IOobject
(
"ddt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),

fvc::ddt(rho,U)
);

ddt.write()

it returns always zero.

best
andrea

If you only declared the field in createFields.H, it is normal. You have to

a) declare the field as you did in createFields.H

b) add the line

Code:

ddt == fvc::ddt(rho,U);
at the end of pEqn.H, so you have the corrected velocity. You do not need the .write() call if you define the field with AUTO_WRITE in the global scope.

Best,


All times are GMT -4. The time now is 08:00.