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

[cfMesh] and Multi Region Meshing

Register Blogs Community New Posts Updated Threads Search

Like Tree16Likes
  • 10 Post By starykov
  • 4 Post By starykov
  • 1 Post By starykov
  • 1 Post By chaz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2015, 06:19
Default and Multi Region Meshing
  #1
Member
 
amine
Join Date: Jan 2014
Location: FRANCE
Posts: 84
Rep Power: 12
aminem is on a distinguished road
Hi,

Can I use cfMesh for Multi Region Meshing like snappyHexMesh?

Thanks
aminem is offline   Reply With Quote

Old   July 10, 2015, 07:45
Default
  #2
New Member
 
Oleksiy Starykov
Join Date: Apr 2012
Posts: 4
Rep Power: 14
starykov is on a distinguished road
You can.
Please find a sample case in attachment, the Allrun-file shows you the way to make the multi-region mesh.
Attached Files
File Type: zip tubeStl.zip (52.8 KB, 721 views)
starykov is offline   Reply With Quote

Old   June 5, 2017, 16:37
Default
  #3
New Member
 
Anonymous
Join Date: Mar 2017
Posts: 3
Rep Power: 9
thegame24 is on a distinguished road
Quote:
Originally Posted by starykov View Post
You can.
Please find a sample case in attachment, the Allrun-file shows you the way to make the multi-region mesh.
Hi.

I think the file attached has different patches, as in, different walls are defined. What should I do to define separate regions (volumes) in the mesh.

I am a beginner here, so please correct me if I'm wrong.
thegame24 is offline   Reply With Quote

Old   June 6, 2017, 03:39
Default
  #4
New Member
 
Oleksiy Starykov
Join Date: Apr 2012
Posts: 4
Rep Power: 14
starykov is on a distinguished road
Hi,

the multi-regions meshing algorithm is self-explained in Allrun-script, but I can explain it to you.

First you need to create mesh for each region. Since cfmesh has no direct possibility for doing this, you can create two cases and generate mesh for each of them (with custom meshDict-settings):
Code:
 
cartesianMesh -case cases/pipewall
cartesianMesh -case cases/pipe
Afterwards you need to copy generated meshes to the constant/polyMesh directory in order to use them as region meshes:
Code:
 
cp -r cases/pipe/constant/polyMesh/ constant/pipe
cp -r cases/pipewall/constant/polyMesh/ constant/pipewall
Now you need to correctly adress the field mappings etc. This is done via changeDictionary tool, using the system/changeDictionaryDict for each region. In system/pipe/changeDictionaryDict you have:
Code:
 
dictionaryReplacement
{
boundary
   {
   pipe_to_pipewall
     {
      type mappedWall;
      sampleMode nearestPatchFace;
      sampleRegion pipewall;
      samplePatch pipewall_to_pipe;
      }

    }
 
}
That means that in the file constant/polyMesh/pipe/boundary the entry pipe_to_pipewall will be modified with these settings. You define this boundary as mapped on the neighboring region that has name pipewall, and the neighboring patch has name pipewall_to_pipe.
You need to create such mappings for all inter-region boundaries in your system.

Of course you need to properly set the heat transfer conditions at the boundaries, usually via changeDictionaryDict files.
starykov is offline   Reply With Quote

Old   June 6, 2017, 03:44
Default
  #5
New Member
 
Anonymous
Join Date: Mar 2017
Posts: 3
Rep Power: 9
thegame24 is on a distinguished road
Thanks. You saved me.
thegame24 is offline   Reply With Quote

Old   June 6, 2018, 10:26
Default
  #6
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!

I think you should use nearestPatchFaceAMI, since your mesh at the interface is not conform.
simrego is offline   Reply With Quote

Old   June 7, 2018, 02:39
Default
  #7
New Member
 
Oleksiy Starykov
Join Date: Apr 2012
Posts: 4
Rep Power: 14
starykov is on a distinguished road
Yes, you are right.
starykov is offline   Reply With Quote

Old   March 7, 2019, 08:01
Default
  #8
New Member
 
Bastian Heitkötter
Join Date: Mar 2018
Posts: 3
Rep Power: 8
Bastian@MM is on a distinguished road
Hi starykov,


I have a question about MultiRegion-Meshing with cfMesh. I have a case with 6 region andbe able to mesh them. But to run chtMultiRegionSimpleFoam I need the cellToRegion file in 0. How did you create it?
Bastian@MM is offline   Reply With Quote

Old   December 23, 2020, 10:19
Default it doesn't work
  #9
Senior Member
 
julien
Join Date: Dec 2018
Posts: 107
Rep Power: 7
julieng is on a distinguished road
Hello,

I try to mesh multiregions, I found this topic and I try the case attached by starykov. When I do the Allrun command it complains with

HTML Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
/*   Windows 32 and 64 bit porting by blueCAPE: http://www.bluecape.com.pt   *\
|  Based on Windows porting (2.0.x v4) by Symscape: http://www.symscape.com   |
\*---------------------------------------------------------------------------*/
Build  : 5.x-963176928289
Exec   : C:/PROGRA~1/BLUECF~1/OpenFOAM-5.x/platforms/mingw_w64GccDPInt32Opt/bin/changeDictionary.exe -region pipe
Date   : Dec 23 2020
Time   : 15:04:35
Host   : "PC_JULIEN"
PID    : 9648
I/O    : uncollated
Case   : C:/PROGRA~1/BLUECF~1/OFUSER~1/run/CFMESH~1/forum/tubeStl
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 pipe for time = 0

Read dictionary changeDictionaryDict with replacements for dictionaries 1(dictionaryReplacement)
Reading polyMesh/boundary file to extract patch names
Loaded dictionary boundary with entries
3
(
minY
maxY
pipe_to_pipewall
)

Replacing entries in dictionary dictionaryReplacement
Loading dictionary dictionaryReplacement


--> FOAM FATAL ERROR:
cannot find file "C:/PROGRA~1/BLUECF~1/OFUSER~1/run/CFMESH~1/forum/tubeStl/0/pipe/dictionaryReplacement"

    From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 522.

FOAM exiting
It is a problem with changeDictionnaryDict file I think but I don't know how to resolve this. I see also that there is no directory constant/polyMesh created. Maybe the problem comes from to this.

I work with bluecorecfd on windows 10.

Best regards
julieng is offline   Reply With Quote

Old   December 23, 2020, 16:15
Default
  #10
New Member
 
Oleksiy Starykov
Join Date: Apr 2012
Posts: 4
Rep Power: 14
starykov is on a distinguished road
Hello,

for this particular problem you have to remove that dictionaryReplacement with
{} parentheses in the dict file. The file format changed in the meantime.

But there are other changes, you have to adjust your files. Look at the heater-tutorials in the heatTransfer directory and update them accordingly.

Quote:
Originally Posted by julieng View Post
Hello,
YatengQ likes this.
starykov is offline   Reply With Quote

Old   March 6, 2022, 08:49
Default Error with tubeStl case
  #11
New Member
 
Aditya
Join Date: Jun 2021
Posts: 2
Rep Power: 0
Adibantwal is on a distinguished road
Hi, after running Allrun with your case, it gives this error:

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1912                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _f3950763fe-20191219 OPENFOAM=1912
Arch   : "LSB;label=32;scalar=64"
Exec   : changeDictionary -region pipewall
Date   : Mar 06 2022
Time   : 18:17:54
Host   : LAPTOP-TT50BSP8
PID    : 21018
I/O    : uncollated
Case   : /mnt/c/Users/Aditya/Desktop/learrn/tubeStl/tubeStl
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

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

Create mesh pipewall for time = 0

Read dictionary changeDictionaryDict with replacements for dictionaries 1(dictionaryReplacement)
Reading polyMesh/boundary file to extract patch names
Loaded dictionary boundary with entries 4(minY maxY wall pipewall_to_pipe)
Replacing entries in dictionary dictionaryReplacement
Loading dictionary dictionaryReplacement
--> FOAM Warning :
    From function int main(int, char**)
    in file changeDictionary.C at line 709
    Requested field to change dictionaryReplacement does not exist in "/mnt/c/Users/Aditya/Desktop/learrn/tubeStl/tubeStl/0/pipewall"

End
Adibantwal is offline   Reply With Quote

Old   July 26, 2022, 03:50
Default
  #12
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by starykov View Post
Yes, you are right.
Hi starykov

Though we apply nearestPatchFaceAMI in sampleMode (fields will be mapped in those two different regions in the process of simulation), the generated mesh in Paraview is still not conform, is there a way of creating a conformal mesh in this case in cfmesh?

Looking forward to hearing from you.

Best Regards,

Kit
itsme_kit is offline   Reply With Quote

Old   September 4, 2024, 00:10
Default example file not running
  #13
New Member
 
Chaz
Join Date: Mar 2012
Posts: 24
Rep Power: 14
chaz is on a distinguished road
Hello,
Has anyone been able to get the sample file provided running?
There have been a few issues noted in the thread, and in order to get close to have it running in of2312, there was a missing g file, missing "uniform" designation on boundary, and some other issues.


Now, I get the following errors. changeDictionary is not changing the boundaries. It shows a warning, but if it is not executing, that My modified case is attached.




Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2312                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _e651d635-20240208 OPENFOAM=2312 patch=240220 version=2312
Arch   : "LSB;label=32;scalar=64"
Exec   : changeDictionary -region pipe
Date   : Sep 03 2024
Time   : 22:01:03
Host   : zalbuntuSpeed
PID    : 83053
I/O    : uncollated
Case   : /home/m/Sync/LNC_Sync/engineering/2024_08_foam_practice/07tubeStl
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

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

Create mesh pipe for time = 0

Read dictionary changeDictionaryDict with replacements for dictionaries 1(dictionaryReplacement)
Reading polyMesh/boundary file to extract patch names
Loaded dictionary boundary with entries 3(minY maxY pipe_to_pipewall)
Replacing entries in dictionary dictionaryReplacement
Loading dictionary dictionaryReplacement
--> FOAM Warning : 
    From int main(int, char**)
    in file changeDictionary.C at line 704
    Requested field to change dictionaryReplacement does not exist in "/home/m/Sync/LNC_Sync/engineering/2024_08_foam_practice/07tubeStl/0/pipe"

End
The chtmultiregion has an error, and it appears that this is because changedict is not changing the dictionaries.
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2312                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _e651d635-20240208 OPENFOAM=2312 patch=240220 version=2312
Arch   : "LSB;label=32;scalar=64"
Exec   : chtMultiRegionFoam
Date   : Sep 03 2024
Time   : 22:08:23
Host   : zalbuntuSpeed
PID    : 88316
I/O    : uncollated
Case   : /home/m/Sync/LNC_Sync/engineering/2024_08_foam_practice/07tubeStl
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

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

Create fluid mesh for region pipe for time = 0

Create solid mesh for region pipewall for time = 0

*** Reading fluid mesh thermophysical properties for region pipe

    Adding to thermoFluid

Selecting thermodynamics package 
{
    type            heRhoThermo;
    mixture         pureMixture;
    transport       const;
    thermo          hConst;
    equationOfState perfectFluid;
    specie          specie;
    energy          sensibleEnthalpy;
}



--> FOAM FATAL ERROR: (openfoam-2312 patch=240220)
Incorrect patch type wall for patch pipe_to_pipewall of field T in file "/home/m/Sync/LNC_Sync/engineering/2024_08_foam_practice/07tubeStl/0/pipe/T"
Type should be a mappedPatch

    From static const Foam::mappedPatchBase& Foam::mappedPatchFieldBase<Type>::mapper(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = double]
    in file ./src/finiteVolume/lnInclude/mappedPatchFieldBase.C at line 954.

FOAM exiting
Given this case and the modifications noted in the thread, any idea what this hangup could be?
Attached Files
File Type: zip 07tubeStl.zip (55.5 KB, 1 views)
chaz is offline   Reply With Quote

Old   September 4, 2024, 04:29
Default
  #14
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,203
Rep Power: 28
Yann will become famous soon enough
Hello Chaz,

Your changeDictionaryDict uses a different syntax than the one in OpenFOAM-v2312.

You need to update your changeDictionaryDict to match v2312 syntax.

Errors using cfmesh and muliple regions (chtmultiregionsimplefoam)

Cheers,
Yann
Yann is offline   Reply With Quote

Old   September 4, 2024, 19:29
Default It works!
  #15
New Member
 
Chaz
Join Date: Mar 2012
Posts: 24
Rep Power: 14
chaz is on a distinguished road
Thank you Yann. Yes, you noted that I asked this question elsewhere, and you answered it already. My memory is failing.


For any future readers, please see the attached case that works in OF V2312 or similar.
-.stl files are converted to meshes using cfmesh
-the meshes at the boundary DO NOT conform, but heat flows across the boundary using mapping
-result looks reasonable....
Attached Images
File Type: jpg shot.jpg (59.7 KB, 6 views)
Attached Files
File Type: zip 07tubeStlWorking.zip (57.7 KB, 7 views)
Yann likes this.
chaz is offline   Reply With Quote

Old   October 9, 2024, 08:28
Default
  #16
New Member
 
Skill-Lync CFD
Join Date: Sep 2024
Location: Chennai
Posts: 18
Rep Power: 2
CFD_with_Skill-Lync is on a distinguished road
Hi Yann,
How are the patches (pipe to pipe wall and pipe wall to pipe) mapped for chtMultiRegionFoam? The free version of cfMesh doesn't allow for multi-region mesh and sorely lacks this one capability. Even when we merge meshes, the mapping doesn't get done properly.
Thanks
Team Skill-Lync
CFD_with_Skill-Lync is offline   Reply With Quote

Old   October 10, 2024, 06:42
Default
  #17
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,203
Rep Power: 28
Yann will become famous soon enough
Hello,

The usual workflow when meshing with snappy:
  1. Mesh all regions at once in snappy, defining cellZones for each regions. You end up with one single mesh containing all regions.
  2. Use splitMeshRegions to split the mesh into separate meshes for each region. This automatically creates interfaces using mappedWall type.

If you use mergeMeshes, you will end up with one single mesh for all regions, but with separate patches at the interface. This is probably why splitMeshRegions will not detect the interfaces and does not create it. After merging the meshes you should use something like stitchMesh to stitch your meshes together and remove the patches at interfaces before running splitMeshRegions.

If you mesh each regions separately, you will probably not have conformal mesh at the interfaces, so I am not sure how stitchMesh will perform (there are several options to deal with conformal or not conformal meshes)

The other way around could be to use createPatch to manually create interfaces between regions based on your existing patches. (possibly using cyclicAMI if your interfaces are non conformal).

One more thought: I don't use cfMesh, but can't you mesh all your regions at once and define cellZones for each regions as it is done in snappy? How does it work when your need to define a cellZone somewhere in your mesh to do something with it later in your simulation? (like in fvOptions, or using MRF or whatever)

Yann
Yann 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
[snappyHexMesh] New multi region meshing tutorial with sHM Tobi OpenFOAM Meshing & Mesh Conversion 0 November 24, 2014 18:42
[snappyHexMesh] Multi Region Meshing bruce OpenFOAM Meshing & Mesh Conversion 12 July 31, 2013 11:09
[snappyHexMesh] Multi region meshing & recovering the original patch names fluidpath OpenFOAM Meshing & Mesh Conversion 4 May 19, 2013 20:13
[snappyHexMesh] Multi Region Meshing with sHM marango OpenFOAM Meshing & Mesh Conversion 3 March 27, 2012 01:51
Multi region meshing noob@cfd Siemens 2 March 26, 2012 13:32


All times are GMT -4. The time now is 00:35.