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

How to run scalarTransport functionObject?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By frodooon
  • 1 Post By tomf

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2020, 10:05
Default How to run scalarTransport functionObject?
  #1
New Member
 
Join Date: May 2009
Posts: 12
Rep Power: 16
frodooon is on a distinguished road
Hello,


I have the solution field of a test case ran with simpleFoam (the windTurbine tutorial, to be precise), and I am running on OFv6. So, this is a steady-state case.

I now want to compute a scalarTransport based on the last iteration that I have saved, which in this case is iteration 400.

For this, I added the following lines to my controlDict:

Code:
functions
{
    BlackCarbon                                                         
    {   
        type            scalarTransport;
        libs            ("libsolverFunctionObjects.so");

        field           s;  
        schemesField    U;  
        D               1e-09;
    }   
}
and I added a "s" file in my 400/ folder, which is the following:


Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |   
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    location    "400";
    object      s;  
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

sInlet          1;  

dimensions      [0 0 0 0 0 0 0];  // s can represent any scalar
                                  // with any dimensional units
internalField   uniform 0;

boundaryField
{
    inlet
    {   
        type            fixedValue;
        value           uniform $sInlet;
    }   
    outlet
    {   
        type            zeroGradient;
    }   
    ground
    {   
        type            fixedValue;
        value           uniform 0;
    }   
    frontAndBack
    {   
        type            symmetry; 
    }   
    buildings
    {   
        type            fixedValue;
        value           uniform 0;
    }   

    #includeEtc "caseDicts/setConstraintTypes"
}

// ************************************************************************* //
And finally, I execute by typing


Quote:
simpleFoam -postProcess -latestTime
I see then the log, which shows that the code executes without error but:
  1. It only iterates once, and
  2. It doesn't write anything! (it does not replace the 400/s file, nor it creates new time directories..)
The log is the following:


Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 6
Exec   : simpleFoam -postProcess -latestTime
Date   : Aug 06 2020
Time   : 15:56:27
Host   : "node0853"
PID    : 17590
I/O    : uncollated
Case   : /home/cenaero/acandael/scalarTransportTest
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 400


SIMPLE: Convergence criteria found
        p: tolerance 0.0001
        U: tolerance 0.0001
        "(k|omega|epsilon|s)": tolerance 0.0001

Time = 400
Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kEpsilon
RAS
{
    RASModel        kEpsilon;
    turbulence      on;
    printCoeffs     on;
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    C3              0;
    sigmak          1;
    sigmaEps        1.3;
}

No MRF models present

No finite volume options present
scalarTransport write:
smoothSolver:  Solving for s, Initial residual = 1, Final residual = 0.0480613, No Iterations 2


End
My question is therefore: why doesn't it compute further, and why doesn't it write anything?
In this case, in my controlDict I specified
Code:
application     simpleFoam;
startFrom       latestTime;
startTime       400;
stopAt          endTime;
endTime         500;
deltaT          1;  
writeControl    timeStep;
writeInterval   50;

...is it the way it is supposed to be? I am as well a bit confuse on the fact that scalarTransport solves an unsteady equation, but is nevertheless accessible from a simpleFoam (steady) command..


Anyway, any help would be greatly appreciated!!


Thanks a lot,
Arnaud.
allanZHONG likes this.
frodooon is offline   Reply With Quote

Old   August 7, 2020, 04:45
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

The scalarTransport functionObject should be added to a running simulation. It is not a single-step post-processing after the run. You could instead copy your U, phi fields to a new case where you run scalarTransportFoam, although in that case you probably will not have turbulent diffusion.

Probably best to start running simpleFoam again from iteration 400 with the scalarTransport functionObject in your controlDict. Then it should have an updated s field at the next writeTime.

Cheers,
Tom
jadidi.cfd likes this.
tomf is offline   Reply With Quote

Old   August 7, 2020, 06:39
Default
  #3
New Member
 
Join Date: May 2009
Posts: 12
Rep Power: 16
frodooon is on a distinguished road
Hello,


Thank you for your answer. It does make sense..

To your knowledge, is there any available utility allowing to compute a scalar transport on a converged steady field?


Furthermore, if I am not mistaken, scalarTransportFoam and the functionObject scalarTransport are 2 different things (running on the same base code, indeed), no? So, I get that running scalarTransportFoam requires to re-run, but isn't the goal of the scalarTransport functionObject to allow such post-processing action?


Thanks a lot!
frodooon is offline   Reply With Quote

Old   August 7, 2020, 08:10
Default
  #4
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

scalarTransportFoam was already available long before functionObjects became available. However it was just a post-processing tool. So one needed to have a converged (steady-state) field and then run the solver scalarTransportFoam. When it became a functionObject it allowed much more options as you now also have access to the turbulence fields and it will work with compressible/incompressible/multiphase solvers. But it does not run like the standalone solver.

You can still make a similar tool yourself, based on scalarTransportFoam, but my idea would be to just add this single equation to the set of equations you are already solving in the first place and then you have the scalar field that you are after at the end of the simulation. Of course if you want to track the scalar field as it develops, you would probably prefer to make the scalarTransportFoam with all relevant physics. It is not how the functionObject itself now works. That being said, it might be an option to run a transient solver with the scalarTransportFoam functionObject turned on, while you have a frozen flow field, but that would also require some coding I guess. Maybe you can copy the pimpleFoam solver and then just turn off solving the pEqn, UEqn and turbulence field equations?

Unless someone else knows about a different solution?

Hope this answers your new questions.

Cheers,
Tom
tomf is offline   Reply With Quote

Old   August 11, 2020, 03:37
Default
  #5
New Member
 
Join Date: May 2009
Posts: 12
Rep Power: 16
frodooon is on a distinguished road
Hello Tom,


Thanks again for your answer, this clarifies it for me.
I did think about adding the transport equation to my solver, I think it might be the way to go.


Thanks again,
Arnaud
frodooon 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
[OpenFOAM.org] paraFoam Fatal Error upon run Gallienus OpenFOAM Installation 2 April 14, 2020 19:23
Cannot run phoenix on linux opensuse 13.1 kde mabal Phoenics 0 June 15, 2014 06:16
[mesh manipulation] Cannot get refineMesh to run in parallel smschnob OpenFOAM Meshing & Mesh Conversion 2 June 3, 2014 11:20
functionObject to control run time marc.immer OpenFOAM Programming & Development 0 March 25, 2014 10:43
First Parallel Run - need some help Gian Maria OpenFOAM 3 June 17, 2011 12:08


All times are GMT -4. The time now is 11:09.