CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [cfMesh] and Multi Region Meshing (https://www.cfd-online.com/Forums/openfoam-community-contributions/151557-multi-region-meshing.html)

aminem April 13, 2015 05:19

and Multi Region Meshing
 
Hi,

Can I use cfMesh for Multi Region Meshing like snappyHexMesh?

Thanks

starykov July 10, 2015 06:45

1 Attachment(s)
You can.
Please find a sample case in attachment, the Allrun-file shows you the way to make the multi-region mesh.

thegame24 June 5, 2017 15:37

Quote:

Originally Posted by starykov (Post 554856)
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.

starykov June 6, 2017 02:39

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.

thegame24 June 6, 2017 02:44

Thanks. You saved me.

simrego June 6, 2018 09:26

Hi!

I think you should use nearestPatchFaceAMI, since your mesh at the interface is not conform.

starykov June 7, 2018 01:39

Yes, you are right.

Bastian@MM March 7, 2019 07:01

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?

julieng December 23, 2020 09:19

it doesn't work
 
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

starykov December 23, 2020 15:15

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 (Post 791409)
Hello,


Adibantwal March 6, 2022 07:49

Error with tubeStl case
 
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


itsme_kit July 26, 2022 02:50

Quote:

Originally Posted by starykov (Post 694919)
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


All times are GMT -4. The time now is 17:38.