CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

fieldFunctionObject all region

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Yann
  • 1 Post By HorstvanGrass

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 26, 2021, 17:23
Default fieldFunctionObject all region
  #1
Member
 
Horst van Gras
Join Date: Oct 2018
Posts: 45
Rep Power: 8
HorstvanGrass is on a distinguished road
Hi,
i have a multi region simulation and working on some postprocess routines. However I have to specify each time the region to get the value. However, I would like to have the functions looping over all regions.


Code:
functions
{

        CellVolumeSteel
        {       
                // Mandatory entries (unmodifiable)
                type            writeCellVolumes;
                libs            (fieldFunctionObjects);
                
                // Optional (inherited) entries
                region          steel;
                enabled         true;
                log             true;
                executeControl      writeTime;
                writeControl        writeTime;
        }
Is there a kind of command like 'allRegion'?
HorstvanGrass is offline   Reply With Quote

Old   July 27, 2021, 04:34
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi,

There is a new multiregion function object allowing to do this in the latest ESI-OpenCFD release (OpenFOAM-v2106) : https://www.openfoam.com/news/main-n...ng#multiregion
AFAIK, there is nothing similar in the older versions nor in the foundation branch, but I would be happy to know if somebody else has a solution for this.

As a workaround to save you a little bit of time, you can do something like this in order to avoid duplicating the function definition:

Code:
functions
{

    CellVolumeSteel
    {       
            // Mandatory entries (unmodifiable)
            type            writeCellVolumes;
            libs            (fieldFunctionObjects);
            
            // Optional (inherited) entries
            region            steel;
            enabled         true;
            log             true;
            executeControl    writeTime;
            writeControl    writeTime;
    }
    
    CellVolumeRegion2
    {
        $CellVolumeSteel
        region                region2;
    }
    
    ...
}

Another way around would be to write a script yourself to loop over all the regions and automatically generate the proper code. It could be worth spending to write such a script if you have a lot of regions in your case.

Cheers,
Yann
HorstvanGrass likes this.
Yann is offline   Reply With Quote

Old   July 28, 2021, 11:30
Default
  #3
Member
 
Horst van Gras
Join Date: Oct 2018
Posts: 45
Rep Power: 8
HorstvanGrass is on a distinguished road
Hi,
thanks for this. It works like a charm with ESI Toolbox version2012. I have 3 regions. Therefore I don't think that I will code a loop


This new function is indeed quite useful. But I will have to adapt my custom solver to it.
Yann likes this.
HorstvanGrass is offline   Reply With Quote

Reply

Tags
fieldfunctionobjects, multiregion, postprocess


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
Error when solving p_rgh bob94 OpenFOAM 0 March 17, 2020 09:12
Problem simulating the temperature rise in a composite material (chtMultiRegionFoam) Adam_K OpenFOAM Running, Solving & CFD 2 March 27, 2019 07:51
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
[Other] StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


All times are GMT -4. The time now is 13:33.