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

"functions" subdictionary in controlDict for chtMultiRegionFoam

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

Like Tree6Likes
  • 2 Post By kera
  • 2 Post By stockzahn
  • 2 Post By oswald

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2018, 18:27
Default "functions" subdictionary in controlDict for chtMultiRegionFoam
  #1
Member
 
stockzahn's Avatar
 
Join Date: Oct 2018
Location: France
Posts: 34
Rep Power: 7
stockzahn is on a distinguished road
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 is offline   Reply With Quote

Old   October 23, 2018, 05:39
Default
  #2
Member
 
Ricky
Join Date: Jul 2014
Location: Germany
Posts: 78
Rep Power: 11
kera is on a distinguished road
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 View Post
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
Krapf and stockzahn like this.
__________________
If it is easy, then something is fishy!
kera is offline   Reply With Quote

Old   October 23, 2018, 11:11
Default
  #3
Member
 
stockzahn's Avatar
 
Join Date: Oct 2018
Location: France
Posts: 34
Rep Power: 7
stockzahn is on a distinguished road
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?
kostnermo and Krapf like this.
stockzahn is offline   Reply With Quote

Old   October 24, 2018, 06:01
Default
  #4
Member
 
Join Date: Sep 2010
Location: Leipzig, Germany
Posts: 93
Rep Power: 15
oswald is on a distinguished road
You should monitor "h", not T, as chtMultiRegionFoam solves for h.
granzer and stockzahn like this.
oswald is offline   Reply With Quote

Old   October 24, 2018, 08:12
Default
  #5
Member
 
stockzahn's Avatar
 
Join Date: Oct 2018
Location: France
Posts: 34
Rep Power: 7
stockzahn is on a distinguished road
Thanks! So obvious, that wasn't very glorious of me ...
stockzahn is offline   Reply With Quote

Reply

Tags
chtmultiregionfoam, function objects, residuals

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
InterFoam (PimpleFoam) not obeying DeltaT in ControlDict walakaka OpenFOAM Running, Solving & CFD 2 March 1, 2018 13:57
sampleDict and controlDict musahossein OpenFOAM Post-Processing 39 July 17, 2016 11:00
controlDict and sampleDict giving different results Shenan OpenFOAM Post-Processing 2 November 15, 2014 11:15
Forces not calculated when including a library in controlDict fusij OpenFOAM 2 May 13, 2011 08:25
writing controlDict as otherfields ubaid OpenFOAM 5 September 29, 2010 08:28


All times are GMT -4. The time now is 03:57.