CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

write time derivative

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2018, 12:31
Default write time derivative
  #1
New Member
 
Join Date: Nov 2017
Posts: 4
Rep Power: 8
flowlinux is on a distinguished road
Hi,

I would like to write the following time derivative during run time.
d/dt (\rhoU)
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
    #};
    } 
}
thank you
flowlinux is offline   Reply With Quote

Old   February 23, 2018, 03:18
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
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.
agustinvo is offline   Reply With Quote

Old   February 23, 2018, 04:16
Default
  #3
New Member
 
Join Date: Nov 2017
Posts: 4
Rep Power: 8
flowlinux is on a distinguished road
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.
flowlinux is offline   Reply With Quote

Old   February 23, 2018, 09:33
Default
  #4
New Member
 
Join Date: Nov 2017
Posts: 4
Rep Power: 8
flowlinux is on a distinguished road
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();
    #};
    } 
}
flowlinux is offline   Reply With Quote

Old   February 10, 2020, 07:26
Default
  #5
New Member
 
zein elserfy
Join Date: May 2018
Posts: 25
Rep Power: 7
zeinelserfy is on a distinguished road
Quote:
Originally Posted by flowlinux View Post
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();
    #};
    } 
}
@ flowlinux

does this function work properly?
you just add it inside the controlDict, right?
the name of the variable is t?
zeinelserfy is offline   Reply With Quote

Reply


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
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


All times are GMT -4. The time now is 10:32.