CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

Multiple regions with a porous zone

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

Like Tree2Likes
  • 2 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   February 15, 2013, 10:43
Default Multiple regions with a porous zone
  #1
Member
 
Join Date: Mar 2009
Posts: 72
Rep Power: 7
aerogt3 is on a distinguished road
Having read this thread (and the links), I cannot figure out how to mesh two domains. In the image below you can see I have a cube shaped domain (orange), with a black duct. The duct has a wall thickness, so air can pass through the duct or around it. Inside the duct is a "radiator," which to use porousZones, must be a separate cell zone.I have inlet (green), outlet (blue), and walls (red) for this separate zone.


the duct and the domain (and the inlet/outlet) are written to flow.stl, and the radiator inlet/outlet and walls (red) are written to rad.stl. Then I use the following snappyhexmeshdict:

Code:
// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       false;

// Geometry. Definition of all surfaces. All surfaces are of class  // searchableSurface.       // Surfaces are used
// - to specify refinement for any mesh cell intersecting it        // - to specify refinement for any mesh cell inside/outside/near        // - to 'snap' the mesh boundary to the surface

geometry
  {
      flow.stl // STL filename
      {
          type triSurfaceMesh;
          name flow;
      }
      rad.stl
      {
          type triSurfaceMesh;
          name rad;
      }
    ref
    {
        type searchableBox;
        min (-1.2 -1 -1);
        max (1 0 1.2);
    }
};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    maxLocalCells 10000000;
    maxGlobalCells 30000000;
    minRefinementCells 10;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 6;
    // Specifies a level for any cell intersected by its edges. This is a featureEdgeMesh, read from constant/triSurface for now.
    features
    (
        {
           file "rad.eMesh";
           level 5;
        }
        {
           file "flow.eMesh";
           level 0;
        }
    );

    // Surface based refinement #####################################################
    refinementSurfaces
    {
        rad
        {
            // Surface-wise min and max refinement level
            level (5 5);
            faceZone rad;
            cellZone rad;
            cellZoneInside inside;
        }
        flow
        {
            // Surface-wise min and max refinement level
            level (0 0);
            faceZone flow;
            cellZone flow;
            cellZoneInside inside;
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 30;

    // Region-wise refinement       // Specifies refinement level for cells in relation to a surface. One of three modes

    refinementRegions
    {
        ref
        {
            mode inside;
            levels ((1E15 5));
        }
    }

    // Mesh selection
    // After refinement patches get added for all refinementSurfaces and  all cells intersecting the surfaces get put into these patches. The section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even after refinement.
    locationInMesh (-2 -3 3);

    // Whether any faceZones (as specified in the refinementSurfaces) are only on the boundary of corresponding cellZones or also allow free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
}
The results is complete garbage! (see third image) Any ideas how to get a proper results? Where it says "faceZone flow;" - I have also tried "faceZone INLET", etc. with no luck either.
Attached Images
File Type: jpg image1.jpg (36.6 KB, 114 views)
File Type: jpg image0.jpg (42.5 KB, 115 views)
File Type: png temp.png (64.2 KB, 138 views)
aerogt3 is offline   Reply With Quote

Old   February 15, 2013, 11:47
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,512
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Greetings Robert,

I've moved your post from the other thread multiple regions, because this is a topic that deserves its own thread! Tobi is trying to meld several regions into a single one, while you are trying to generate a multi-region mesh with porous regions, which is a whole other problem

A few suggestions, ideas and questions:
  1. The first suggestion is to first simplify a bit the problem at hand, before doing it all in a single go, namely: your geometry is not aligned with the base mesh. That can lead to serious meshing problems, some of which are shown on the third image you provided. So first start working on a test case with the geometry aligned with the base mesh.
  2. Are you going to need to use multi-regions or just a single region with a porous zone inside it?
  3. I ask this because if you only need the radiator to be a porous zone, while the rest of the mesh is just one domain, then you only need to assign a single cell zone to said radiator!
  4. Once you've managed to get the hang of how things work with the aligned mesh, give a try to SwiftBlock: http://openfoamwiki.net/index.php/Contrib/SwiftBlock - it can help you create a base mesh that is properly aligned on that zone where you have the pipe and radiator, while having the rest of the mesh drawn with your current orientation!
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   February 15, 2013, 12:05
Default
  #3
Member
 
Join Date: Mar 2009
Posts: 72
Rep Power: 7
aerogt3 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Robert,

I've moved your post from the other thread multiple regions, because this is a topic that deserves its own thread! Tobi is trying to meld several regions into a single one, while you are trying to generate a multi-region mesh with porous regions, which is a whole other problem

A few suggestions, ideas and questions:
  1. The first suggestion is to first simplify a bit the problem at hand, before doing it all in a single go, namely: your geometry is not aligned with the base mesh. That can lead to serious meshing problems, some of which are shown on the third image you provided. So first start working on a test case with the geometry aligned with the base mesh.
  2. Are you going to need to use multi-regions or just a single region with a porous zone inside it?
  3. I ask this because if you only need the radiator to be a porous zone, while the rest of the mesh is just one domain, then you only need to assign a single cell zone to said radiator!
  4. Once you've managed to get the hang of how things work with the aligned mesh, give a try to SwiftBlock: http://openfoamwiki.net/index.php/Contrib/SwiftBlock - it can help you create a base mesh that is properly aligned on that zone where you have the pipe and radiator, while having the rest of the mesh drawn with your current orientation!
Best regards,
Bruno

Fair enough on the thread move.

1.) The problem is already a simplification! The real problem is [going to be] a full vehicle, where a duct within the bodywork carries air to and from a porous zone. I know a non-aligned mesh is bad for the solution, but I am not going to solve this - I'm just testing the meshing strategy.
2-3.) In the end I want a fluid zone that encloses the actual radiator (where I will apply porous zones), and another region which does both upstream and downstream to connect with thee external flow domain around the vehicle. So two cellZones total: external flow, and porous zone.

Basically, the only way I can mesh this correctly is for the mesh to stop at the inlets and outlets (and not mesh inside the radiator). What I am looking for is a way to tell snappyhexmesh that the inlet and outlet faces are just faceZones that I want included in the mesh, not walls where the mesh should end! Any ideas? I know I would just mesh the outside first, the inside separately, and then merge them - with a non conformal interface set on the shared inlet/outlet faces. But doing it in one step would be quicker and easier!
aerogt3 is offline   Reply With Quote

Old   February 15, 2013, 12:35
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,512
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
From what I saw now in the tutorial "incompressible/porousSimpleFoam/angledDuctExplicit", you do need the mesh to be generated the way that you've described, namely to have both cell zones: one for the radiator and another for the external air.
Having just the face zones won't be enough.

When snappyHexMesh handles cell zones, it has to mesh all sides of the surfaces, which can lead to some problems if mesh resolution and mesh orientation aren't well adjusted locally. It's not a solution issue, it's a meshing issue! This is why I was suggesting that you align the base mesh as much as possible with the radiator surfaces.
wyldckat is offline   Reply With Quote

Old   February 17, 2013, 07:59
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,512
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Hi Robert,

I've been playing around with snappyHexMesh since yesterday and the best I got is here: https://www.dropbox.com/s/m3mnh3js6x...tSnappy.tar.gz
... at least while doing things without the assistance of SwiftBlock and SwiftSnap.

It is based on the tutorial "incompressible/porousSimpleFoam/angledDuctImplicit", where I replaced using blockMesh+m4 with blockMesh+snappyHexMesh. The scripts Allrun and Allclean do all of the necessary steps for running and cleaning the case.

Best regards,
Bruno
fabian_roesler and woodwick like this.
wyldckat is offline   Reply With Quote

Old   February 21, 2013, 08:18
Default
  #6
Member
 
Join Date: Mar 2009
Posts: 72
Rep Power: 7
aerogt3 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
From what I saw now in the tutorial "incompressible/porousSimpleFoam/angledDuctExplicit", you do need the mesh to be generated the way that you've described, namely to have both cell zones: one for the radiator and another for the external air.
Having just the face zones won't be enough.

When snappyHexMesh handles cell zones, it has to mesh all sides of the surfaces, which can lead to some problems if mesh resolution and mesh orientation aren't well adjusted locally. It's not a solution issue, it's a meshing issue! This is why I was suggesting that you align the base mesh as much as possible with the radiator surfaces.
Well, I think I have made some progress, but not enough to fully solve the problem. Using blockMesh I generate a cellZone called "external" which is the flow around the geometry. The geometry is the duct itself, and has no faces for the radiator at all (see image 1). Then, I have a second file, rad.stl which is just the radiator - inlet/outlet faces, plus the side walls of the radiator. (shown in pic 2) Both geometries are open to the left side in the images because that is the symmetry plane. These two stl's are appropriately handled in snappyhexmeshdict.

When I run snappyhex, I get two cellZones, just as I hoped! However, I need a faceZone in between them (to measure mass flow rate), and this zone doesn't exist! In paraview I can see the radiator inlet/outlet patch, but it is empty! The third photo shows the resulting two-cellZone mesh read into paraview. You can see the radiator in the middle, but there is clearly non a conformal interface between the radiator cellzone and the external cellZone.

This means (if I understand correctly) that there should be a patch in between the two, but the patch that would define this surface (OUTLET_to_flow) is empty (0 faces)! I noticed the following statements in the log about this zone, which are curious.... I am attaching my files, so anyone interested can have a better look.... just run blockmesh and snappyhexmesh to reproduce the case.

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Read mesh in = 0.08 s

Overall mesh bounding box  : (-20.48 -10.24 -1.024) (46.08 0 10.24)
Relative tolerance         : 1e-06
Absolute matching distance : 6.82786e-05

Reading refinement surfaces.
Read refinement surfaces in = 0 s

Reading refinement shells.
Refinement level 3 for all cells inside ref
Read refinement shells in = 0 s

Setting refinement level of surface to be consistent with shells.
Checked shell refinement in = 0 s

Reading features.
Refinement level 5 for all cells crossed by feature "box.eMesh" (50 points, 64 edges).
Detected 25 featurePoints out of 50 on feature box.eMesh
Read features in = 0 s


Determining initial surface intersections
-----------------------------------------

Edge intersection testing:
    Number of edges             : 25146
    Number of edges to retest   : 25146
    Number of intersected edges : 12
Calculated surface intersections in = 0.08 s

Initial mesh : cells:7865  faces:25146  points:9504
Cells per refinement level:
    0    7865

Adding patches for surface regions
----------------------------------

Patch    Type    Region
-----    ----    ------
box.stl:

6    wall    WALL_L_BOX

rad.stl:

7    wall    rad.stl_WALL_L_RAD
8    wall    OUTLET_to_flow
There has to be some way to add this STL region as a FACE and not a WALL, right?

Code:
Introducing zones for interfaces
--------------------------------

Surface : rad.stl
    faceZone : OUTLET_to_flow
    cellZone : zoneA
Found 1 closed, named surfaces. Assigning cells in/outside these surfaces to the corresponding cellZone.

Walking from location-in-mesh (-2 -3 3) to assign cellZones - crossing a faceZone face changes cellZone

Found point (-2 -3 3) in cell 18752 in global region 0 out of 4 regions.
CellZones:
    fluid_external    size:12977
    zoneA    size:88656

FaceZones:
    OUTLET_to_flow    size:5862

Edge intersection testing:
    Number of edges             : 326557
    Number of edges to retest   : 0
    Number of intersected edges : 13992
Code:
Morphing phase
--------------

Converting zoned faces into baffles ...
For surface rad.stl found faceZone OUTLET_to_flow and patch rad.stl_WALL_L_RAD
Edge intersection testing:
    Number of edges             : 330401
    Number of edges to retest   : 24318
    Number of intersected edges : 14982
Created 4306 baffles in = 0.61 s
Attached Images
File Type: jpg image0.jpg (44.0 KB, 53 views)
File Type: jpg image1.jpg (45.6 KB, 51 views)
File Type: jpg temp.jpg (98.7 KB, 67 views)
Attached Files
File Type: gz rad_box.tar.gz (11.2 KB, 24 views)

Last edited by aerogt3; February 21, 2013 at 09:23.
aerogt3 is offline   Reply With Quote

Old   February 21, 2013, 13:30
Default
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 7,512
Blog Entries: 33
Rep Power: 74
wyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the roughwyldckat is a jewel in the rough
Quick answer: I can't look into this any time soon, but my suggestion is that you search for information on how to use "topoSetDict", because I vaguely remember it's possible to make a selection of faces (a "faceSet") by using an STL file as a reference. Then you can convert that "faceSet" to a "faceZone" with topoSet or setSet.
wyldckat is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 13 January 22, 2014 05:11
fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 May 2, 2013 11:52
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 18:51
Modelling Combustion in Porous Zone tanjinjack FLUENT 0 November 19, 2010 12:23
Problem in IMPORT of ICEM input file in FLUENT csvirume FLUENT 2 September 9, 2009 02:08


All times are GMT -4. The time now is 19:28.