CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   "functions" subdictionary in controlDict for chtMultiRegionFoam (https://www.cfd-online.com/Forums/openfoam-pre-processing/209689-functions-subdictionary-controldict-chtmultiregionfoam.html)

stockzahn October 22, 2018 18:27

"functions" subdictionary in controlDict for chtMultiRegionFoam
 
Dear all,

using e.g. the simpleFoam solver I was able to save the residuals and display their evolution during solving by including "#includefunc residuals" in the subdictionary "functions" of the controlDict. However, if I do that with chtMultiRegionFoam, no "postProcessing" folder is created and no residuals are saved.

I also tried to include a function object based on the information here (https://www.openfoam.com/documentati...ieldValue.html) reading several threads here (according to which this should be possible, but they are quite old though). I tried to keep it simple for the first trials:

T0
{
type volFieldValue;
libs ("libfieldFunctionObjects.so");
log true;
writeControl writeTime;
writeFields true;
regionType all;
name titanium; //name of the solid region
operation none;
fields ( T );
}

In my understanding this function object should just copy the temperature field and name it "T0". Like with the residuals, there is no output, no error message, no info at all. However, could you tell where my mistake is or if this is not possible in chtMultiRegionFoam ?

Thanks in advance,
stockzahn

kera October 23, 2018 05:39

Hallo stockzahn,

there is a discussion here on how to capture the field residuals for cht solvers. I still do it the old fashioned way by using PyFOAM.

As for your second try with functionObject.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                              |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application    chtMultiRegionSimpleFoam;

startFrom      latestTime;

startTime      0;
.
.
.

runTimeModifiable true;


functions
{
    minMax
    {
        type            fieldMinMax;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        log            false;
        write          true;
        region          air;  // Specify the region
        fields
        (
          T
        );
    }
}

hope this helps!

Regards,
Ricky

PS: I am still using OF-2.3.x, OpenFOAM has come a long way since then.

Quote:

Originally Posted by stockzahn (Post 711969)
Dear all,

using e.g. the simpleFoam solver I was able to save the residuals and display their evolution during solving by including "#includefunc residuals" in the subdictionary "functions" of the controlDict. However, if I do that with chtMultiRegionFoam, no "postProcessing" folder is created and no residuals are saved.

I also tried to include a function object based on the information here (https://www.openfoam.com/documentati...ieldValue.html) reading several threads here (according to which this should be possible, but they are quite old though). I tried to keep it simple for the first trials:

T0
{
type volFieldValue;
libs ("libfieldFunctionObjects.so");
log true;
writeControl writeTime;
writeFields true;
regionType all;
name titanium; //name of the solid region
operation none;
fields ( T );
}

In my understanding this function object should just copy the temperature field and name it "T0". Like with the residuals, there is no output, no error message, no info at all. However, could you tell where my mistake is or if this is not possible in chtMultiRegionFoam ?

Thanks in advance,
stockzahn


stockzahn October 23, 2018 11:11

Thanks Ricky for your help. That's my status:

I tried it with
Code:

#includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"
, but this only produced an error message:


Code:

--> FOAM FATAL ERROR:
 Cannot open etc file "caseDicts/postProcessing/numerical/residuals.cfg" while reading dictionary "/home/run/InTrCoilQ1/system/controlDict.functions.residualsTitanium"

From function static bool Foam::functionEntries::includeEtcEntry::execute(Foam::dictionary&, Foam::Istream&) in file db/dictionary/functionEntries/includeEtcEntry/includeEtcEntry.C at line 127.

 FOAM exiting

However, I then just copied the lines of "residuals.cfg" into the function subdictionary of the controlDict and it started to work. Key was to insert the lines

Code:

writeControl    timeStep;
 writeInterval    1;

also for the function object "T0". The functions of my controlDict now look like this:

Code:

functions
{
    residualsTitanium
    {
    type    residuals;
    libs    ("libutilityFunctionObjects.so");
    writeControl    timeStep;
    writeInterval  1;
    regionType      all;
    region titanium;
    fields (T);
    }

    sumT0
    {
    type        volFieldValue;
    libs        ("libfieldFunctionObjects.so");
    writeControl    timeStep;   
    writeInterval  1;
    //writeFields          true;
    //regionType      all;
    region        titanium;
    operation    sum;

    fields        (T);
    }
}

for the "sumT0" it works perfectly, but unfortunately in the residuals.dat file in the postProcessing folder displays "N/A" instead of the residuals.



Do you have or does anybody has an idea how to save the residual values in the .dat-file?

oswald October 24, 2018 06:01

You should monitor "h", not T, as chtMultiRegionFoam solves for h.

stockzahn October 24, 2018 08:12

Thanks! So obvious, that wasn't very glorious of me ...


All times are GMT -4. The time now is 12:41.