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

correct way to calculate time derivative

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2015, 19:07
Question How to calculate fvc:ddt correctly ?
  #1
New Member
 
Join Date: Aug 2013
Posts: 3
Rep Power: 12
jaroshh is on a distinguished road
Hi,

I am relatively new to OpenFOAM. For utility that i'm trying to make i need to calculate time derivative of pressure.
I have read this thread http://www.cfd-online.com/Forums/ope...58580-ddt.html and i understand that the field of which derivative will be calculated need to be create outside the time loop.
Here's some piece of test code:
Code:
int main(int argc, char *argv[])
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
timeSelector::addOptions();
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"

volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
p.oldTime(),
mesh
);
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
volScalarField dpdt
    (
        rhoRef_
      * Foam::fvc::ddt(p)
    );
label patchID = mesh.boundaryMesh().findPatchID("CYLINDER1");
scalarField ppp = p.boundaryField()[patchID];
scalarField dpdtp = dpdt.boundaryField()[patchID];
Info<<ppp<<endl;
Info<<dpdtp<<endl;




mesh.readUpdate();
}
Info<< "\nEnd\n" << endl;


return 0;
};
I know that for proper working of fvc:ddt previous values has to be stored. Unfortunately i don't know how to do this.
When method .oldTime() is switched off code compile but stores the same values in each time step, but when is active code does not want to compile.I can't do this calculation during solver's work.
It has to be done within post-processing utility. So my question is how to properly initialise values at each time step and how to store "old" values that are needed for fvc:ddt.

Last edited by jaroshh; August 23, 2015 at 08:09.
jaroshh is offline   Reply With Quote

Old   July 10, 2016, 15:23
Default
  #2
Member
 
Jack
Join Date: May 2015
Posts: 98
Rep Power: 10
Jack001 is on a distinguished road
Im also looking to do the exact same thing! Any luck?
Jack001 is offline   Reply With Quote

Reply

Tags
programming

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
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 10:08
time step directories naming issue Andrea_85 OpenFOAM 3 April 3, 2014 09:38
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 05:03
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 06:24
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58


All times are GMT -4. The time now is 02:22.