|
[Sponsors] |
February 22, 2018, 12:31 |
write time derivative
|
#1 |
New Member
Join Date: Nov 2017
Posts: 4
Rep Power: 8 |
Hi,
I would like to write the following time derivative during run time. d/dt (U) Therefore I suppose I should use the coded functionobject (in controlDict) but unfortunately I'm not able to write the code (yet). I'm doing two phase simulations with interFoam. could anyone help me? Code:
functions { deriv_rhoU { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; redirectType deriv_rhoU; outputControl timeStep; code #{ tobecompleted #}; } } |
|
February 23, 2018, 03:18 |
|
#2 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15 |
Hello
more than coding like this, why don't you create a functionObject for that? Take a look to the grad one, and modify it as you need. |
|
February 23, 2018, 04:16 |
|
#3 |
New Member
Join Date: Nov 2017
Posts: 4
Rep Power: 8 |
Hi,
Agustinvo, that doesn't seem any easier to be honest Anyway, this is my first guess. Code:
functions { deriv_rhoU { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; name test; writeControl timeStep; codeWrite #{ const volVectorField& U = mesh().lookupObject<volVectorField>("U"); const volScalarField& rho = mesh().lookupObject<volScalarField>("rho"); volVectorField ddt ( IOobject ( "ddt", mesh().time().timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), ddt == fvc::ddt(rho,U); ); #}; } } Last edited by flowlinux; February 23, 2018 at 05:17. |
|
February 23, 2018, 09:33 |
|
#4 |
New Member
Join Date: Nov 2017
Posts: 4
Rep Power: 8 |
Hi,
The following code worked for me (version 4.1) Code:
functions { test { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; name test; writeControl writeTime; codeWrite #{ const volVectorField& U = mesh().lookupObject<volVectorField>("U"); const volScalarField& K = mesh().lookupObject<volScalarField>("interfaceProperties:K"); const volScalarField& rho = mesh().lookupObject<volScalarField>("rho"); // Write volVectorField t("ddt(rho,U)", fvc::ddt(rho,U)); K.write(); t.write(); #}; } } |
|
February 10, 2020, 07:26 |
|
#5 | |
New Member
zein elserfy
Join Date: May 2018
Posts: 25
Rep Power: 7 |
Quote:
does this function work properly? you just add it inside the controlDict, right? the name of the variable is t? |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 13:06 |
LES, Courant Number, Crash, Sudden | Alhasan | OpenFOAM Running, Solving & CFD | 5 | November 22, 2019 02:05 |
pressure in incompressible solvers e.g. simpleFoam | chrizzl | OpenFOAM Running, Solving & CFD | 13 | March 28, 2017 05:49 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 02:50 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 22:40 |