CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   splitMeshRegions 1D (https://www.cfd-online.com/Forums/openfoam-solving/226297-splitmeshregions-1d.html)

Wirman April 23, 2020 03:39

splitMeshRegions 1D
 
Hi foamers,


since i have started again with openfoam, i am facing a problem with splitMeshRegions in 1D. I wanted to create a simple problem, but failed.


Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0  0    0  )
    (0.5 0    0  )
    (0.5 0.1  0  )
    (0  0.1  0  )
    (0  0    0.1)
    (0.5 0    0.1)
    (0.5 0.1  0.1)
    (0  0.1  0.1)

    (0.5 0    0  )
    (1  0    0  )
    (1  0.1  0  )
    (0.5 0.1  0  )
    (0.5 0    0.1)
    (1  0    0.1)
    (1  0.1  0.1)
    (0.5 0.1  0.1)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) solid (5 1 1) simpleGrading (1 1 1)
    hex (8 9 10 11 12 13 14 15) fluid (5 1 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9 10 14 13)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (4 5 6 7)
            (0 3 2 1)
            (12 13 14 15)
            (8 11 10 9)
            (2 3 7 6)
            (4 0 1 5)
            (10 11 15 14)
            (12 8 9 13)
        );
    }
    solid_to_fluid
    {
        type patch;
        faces
        (
            (1 2 6 5)
        );
    }
    fluid_to_solid
    {
        type patch;
        faces
        (
            (8 12 15 11)
        );
    }
);

mergePatchPairs
(
    ( solid_to_fluid fluid_to_solid)
);

// ************************************************************************* //

It is very simple, two regions solid and fluid in 1d, each 5 blocks wide in a row, for chtMultiRegionFoam.


The strange thing is, that when i start blockMesh i get a patch solid_to_fluid which i don't have, when running it in 2D or if i put the number of cells in y-direction to 2.

Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 7
Exec  : blockMesh
Date  : Apr 23 2020
Time  : 09:22:01
Host  : "cholesky"
PID    : 16662
I/O    : uncollated
Case  : /home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D
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

Overriding DebugSwitches according to controlDict
Creating block mesh from
    "/home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D/system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

    Basic statistics
        Number of internal faces : 0
        Number of boundary faces : 12
        Number of defined boundary faces : 12
        Number of undefined boundary faces : 0
    Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1
    Block 0 cell size :
        i : 0.1 .. 0.0999999999999999
        j : 0.1
        k : 0.1
    Block 1 cell size :
        i : 0.1
        j : 0.1
        k : 0.1
Creating merge patch pairs

Adding point and face zones
Creating attachPolyTopoChanger

Adding cell zones
    0    solid
    1    fluid

Writing polyMesh
----------------
Mesh Information
----------------
  boundingBox: (0 0 0) (1 0.1 0.1)
  nPoints: 44
  nCells: 10
  nFaces: 51
  nInternalFaces: 8
----------------
Patches
----------------
  patch 0 (start: 8 size: 1) name: inlet
  patch 1 (start: 9 size: 1) name: outlet
  patch 2 (start: 10 size: 40) name: frontAndBack
  patch 3 (start: 50 size: 1) name: solid_to_fluid

End

The existence of this patch after blockMesh leads to an incorrect execution of splitMeshRegions -overwrite -cellZones, because i don't get any mappedPatches out of it.


Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 7
Exec  : splitMeshRegions -overwrite -cellZones
Date  : Apr 23 2020
Time  : 09:25:24
Host  : "cholesky"
PID    : 16685
I/O    : uncollated
Case  : /home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D
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

Overriding DebugSwitches according to controlDict
Create mesh for time = 0

Creating single patch per inter-region interface.

Trying to match regions to existing cell zones.


Number of regions:2

Writing  region per cell file (for manual decomposition) to  "/home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D/constant/cellToRegion"

Writing  region per cell as volScalarField to  "/home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D/0/cellToRegion"

Region    Cells
------    -----
0    5
1    5

Region    Zone    Name
------    ----    ----
0    0    solid
1    1    fluid

Sizes of interfaces between regions:

Interface    Region    Region    Faces
---------    ------    ------    -----

Reading geometric fields

Reading volScalarField cellToRegion


Adding patches


Adding patches


Region 0
--------
Creating mesh for region 0 solid
Testing:"/home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D/system/solid/fvSchemes"
Mapping fields
Mapping field cellToRegion
Deleting empty patches
Writing new mesh
Writing addressing to base mesh
Writing map pointRegionAddressing from region0 points back to base mesh.
Writing map faceRegionAddressing from region0 faces back to base mesh.
Writing map cellRegionAddressing from region0 cells back to base mesh.
Writing map boundaryRegionAddressing from region0 boundary back to base mesh.

Region 1
--------
Creating mesh for region 1 fluid
Testing:"/home/wirman/OpenFOAM/wirman-7/run/Promotion/04_chtSIMPLEHeatTransfer_1D/system/fluid/fvSchemes"
Mapping fields
Mapping field cellToRegion
Deleting empty patches
Writing new mesh
Writing addressing to base mesh
Writing map pointRegionAddressing from region1 points back to base mesh.
Writing map faceRegionAddressing from region1 faces back to base mesh.
Writing map cellRegionAddressing from region1 cells back to base mesh.
Writing map boundaryRegionAddressing from region1 boundary back to base mesh.
End

Because if i set the number of cells in y-direction to 2, then i get
Code:

...


 Adding cell zones
    0    solid
    1    fluid

Writing polyMesh
----------------
Mesh Information
----------------
  boundingBox: (0 0 0) (1 0.1 0.1)
  nPoints: 66
  nCells: 20
  nFaces: 92
  nInternalFaces: 28
----------------
Patches
----------------
  patch 0 (start: 28 size: 2) name: inlet
  patch 1 (start: 30 size: 2) name: outlet
  patch 2 (start: 32 size: 60) name: frontAndBack

End

and


Code:

...


 Region    Cells
------    -----
0    10
1    10

Region    Zone    Name
------    ----    ----
0    0    solid
1    1    fluid

Sizes of interfaces between regions:

Interface    Region    Region    Faces
---------    ------    ------    -----
0        0    1    2

Reading geometric fields

Reading volScalarField cellToRegion


Adding patches


Adding patches

For interface between region solid and fluid added patches
    3    solid_to_fluid
    4    fluid_to_solid


...

and so everything works fine and i have my patches for coupling.



What am I missing here? Or is 1D not expected for splitMeshRegions?


Thanks in advance and best regards
Wirman

Wirman April 23, 2020 03:41

Oh man, i posted it in the false section. Please move it to meshing. Sorry!

Wirman April 30, 2020 06:17

Has anyone an idea? Do you need more information?


Best regards
Wirman

Bloerb May 4, 2020 14:53

I suppose mergePatchPairs does not function properly in 1D. Maybe a bug, I haven't tested your file though. But you could try this, since defining the patches is not necessary in the first place:

Code:


defaultPatch
{
    name frontAndBack;
    type empty;
}


boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9 10 14 13)
        );
    }
);

The defaultPatch thing is just nice to know, since it helps on more complex meshes, since you do not need to name every patch, but it is not necessary. I basically removed the fluid_to_solid and solid_to_fluid patches you defined. As well as the mergePatchPairs part. You do not need those, since splitMeshRegions will create those automatically. Another option is to create two blockMesh files in each region with just one block and one of the patches like this:
Code:

    fluid_to_solid
    {
        type                mappedWall;
        sampleMode    nearestPatchFace;
        sampleRegion  solid;
        samplePatch    solid_to_fluid;
        faces
        (
            (1 2 6 5)
        );
    }

You can mesh those with blockMesh -region fluid and blockMesh -region solid

Wirman May 5, 2020 16:05

Thank you very much, the second suggestion does the trick.

Maybe its not the problem with blockMesh, instead its splitMeshRegions.
If i only create the defaultPatches and the inlet and outlet patch and run splitMeshRegions thereafter, splitMeshRegions is again not creating the mapped patches.


Best Regards
Wirman


All times are GMT -4. The time now is 11:24.