|
[Sponsors] |
August 21, 2015, 18:07 |
How to calculate fvc:ddt correctly ?
|
#1 |
New Member
Join Date: Aug 2013
Posts: 3
Rep Power: 12 |
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; }; 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 07:09. |
|
July 10, 2016, 14:23 |
|
#2 |
Member
Jack
Join Date: May 2015
Posts: 98
Rep Power: 10 |
Im also looking to do the exact same thing! Any luck?
|
|
Tags |
programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple floating objects | CKH | OpenFOAM Running, Solving & CFD | 14 | February 20, 2019 09:08 |
time step directories naming issue | Andrea_85 | OpenFOAM | 3 | April 3, 2014 08:38 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 04:03 |
Orifice Plate with a fully developed flow - Problems with convergence | jonmec | OpenFOAM Running, Solving & CFD | 3 | July 28, 2011 05:24 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 02:58 |