CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Use of function objects to terminate transient simulations

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

Like Tree1Likes
  • 1 Post By kandelabr

LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2017, 09:51
Default Use of function objects to terminate transient simulations
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 6
Luca Cornolti is on a distinguished road
I'm running a free surface problem with the interFoam solver of OpenFOAM v1706.

Schematically, the geometry can be described as a cylindrical tank with an open surface at the top, an outlet duct on the side surface and a inlet on the bottom surface.

From the inlet, I'm filling the tank only with water.
From the outlet duct both air and water flow out, as in a water channel problem.
The height of water adjusts itself such that it allows the amount of water introduced thought the inlet to flow out from the outlet duct.

I'm running some transient simulations to reach the final water level which changes with the inlet flow. In general the time needed to reach the steady state is not known a-rpiori and I have to run many simulations.

Therefore, I'd like to use the function objects in the controlDict to stop the simulation when some criteria are reached. For example, when the total water flow at the inlet at the outlet duct are equal and the outlet flow does not significantly change with time.

I checked this link to get some ideas:

And I came out with the following code:

        type            surfaceFieldValue;
        libs ("");
        writeFields     false;
        log             true;
        surfaceFormat   null;
        regionType      patch;
        name            inlet;
        operation       sum;
        writeControl    timeStep;

        name            outlet;

        type                valueAverage;
        functionObjectLibs  ( "" );

        writeControl        timeStep;
        functionObject    inletFlux;
        fields                 (???????);
        window              0.01;

        functionObjectName  outletFlux;

    // Compute flux difference
        type                ??????;

        type                runTimeControl;
        functionObjectLibs  ("");

            // Terminate when inlet and outlet fluxes difference is less than tolerance
                type                average;
                functionObjectName  Fluxdifference;
                fields              (??????);
                tolerance           1e-4;
                window              50;

            // Terminate when average OutletFlux changes by less than a tolerance
                type                average;
                functionObjectName  averageOutletFlux;
                fields              (??????);
                tolerance           1e-4;
                window              50;


The idea is to compute the total fluxes on the two patches, do a time average of these quantities as they are quite noisy and finally to use the difference of these averages as a criterion to terminate the simulation.

The problem is that I'm missing some information (lines with question marks), specifically:

1) what is the name of the field returned by inletFlux and outletFlux functionObjects on which I can operate (see the link for an example with forceCoeffs functionObjects)?

2) How to compute the difference of these two fluxes?

Thank you for your suggestions,


Last edited by Tobi; October 6, 2017 at 05:09. Reason: Please use code tags.
Luca Cornolti is offline   Reply With Quote

Old   June 18, 2019, 10:07
Senior Member
kandelabr's Avatar
Join Date: Feb 2017
Location: Slovenia
Posts: 153
Rep Power: 5
kandelabr is on a distinguished road

Did you manage to solve this conundrum? I have a very similar case at the moment.

jcappola likes this.
kandelabr is offline   Reply With Quote


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
Transient Simulations saisanthoshm88 CFX 7 July 13, 2013 07:57
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 07:27
URANS and Transient Simulations bob Main CFD Forum 0 October 1, 2003 04:54

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