CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] Mesh Refinement (https://www.cfd-online.com/Forums/openfoam-meshing/61512-mesh-refinement.html)

mattijs October 18, 2005 07:41

viewMesh http://www.cfd-on
 
viewMesh

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif viewMesh.bz2

khleitz May 15, 2007 12:14

Hallo Ali, I have just seen y
 
Hallo Ali,
I have just seen your mesh. It is exactly what I would need for my problem. Would you mind sending me
the blockmeshdict file?
Best regards,
Karl-Heinz

vinz May 16, 2007 03:00

Hi Karl-Heinz, I worked on
 
Hi Karl-Heinz,

I worked on a cylinder mesh for my thesis, and I also did a converter from the software GridPro to OpenFOAM.
You can download the converter here: http://www.rtech.fr/GridPro2FOAM_2.0.zip
Inside you have two different meshes for the cylinder, one created with blockMesh (in OpenFoamFiles/cylinder). The other one, which is much better in my opinion can be generated using the converter and the GridPro files placed in GridProFiles/Cylinder.

I explained everything earlier in this thread:
http://www.cfd-online.com/OpenFOAM_D...es/1/3456.html
Have a look there, and ask me if you have problems.

Best regards,

Vincent

khleitz May 18, 2007 09:26

Hallo, I am trying to refine
 
Hallo,
I am trying to refine a certain part of my mesh. I have defined a certain region with the cellSet command. However refineMesh always refines the whole mesh.
Can anybody help me?
Best regards,
Karl-Heinz

pidry July 11, 2007 10:09

Try refineMesh $FOAM_RUN ca
 
Try

refineMesh $FOAM_RUN caseName -dict

with a refineMeshdict file in your system directory (You can find an example fine in the refineMesh source directory)

pnguyen1 October 22, 2007 12:25

Hi everybody, I also have a c
 
Hi everybody,
I also have a case: channel containing a cylinder (2D). You can see the bc:

inlet
{
type patch;
nFaces 90;
startFace 24900;
}
outlet
{
type patch;
nFaces 90;
startFace 24990;
}
upperWall
{
type wall;
nFaces 150;
startFace 25080;
}
cylinderWall
{
type wall;
nFaces 120;
startFace 25230;
}
lowerWall
{
type wall;
nFaces 150;
startFace 25350;
}
front
{
type empty;
nFaces 12600;
startFace 25500;
}
back
{
type empty;
nFaces 12600;
startFace 38100;
}

I want to make Adaptive Mesh Refiement based on an error estimation (icoErrorEstimate) with the refineMeshDict:

patchLocalCoeffs
{
patch cylinderWall; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
tan2 (0 1 0);
}
// List of directions to refine
directions
(
tan1
tan2
);

I want to refine according to the cylinderWall. But it does not work with the second direction "tan2". I have read attentively the information in this thread but I could not come out the solution.

Any hints are welcome !!

Thanks alot!
Danh

mattijs October 23, 2007 02:53

Does it work with e.g. the cav
 
Does it work with e.g. the cavity tutorial? Using patch 'movingWall' and tan1=(1 0 0) and tan2=(0 0 1)?

mattijs October 23, 2007 02:54

Does it work with a 'square' c
 
Does it work with a 'square' case, e.g. the cavity tutorial? Using patch 'movingWall' and tan1=(1 0 0) and tan2=(0 0 1)?

pnguyen1 October 23, 2007 03:39

Hello Mattijs, Thank you for
 
Hello Mattijs,
Thank you for your response!
Yes, the Adaptive Mesh Refinement (based on icoErrorEstimate) works very nicel with 'square' cases. I tried aldready with cavity tutorial. I tested also in a micro-mixing case (reactangular channel with two inlets and one oulet). All these worked well.

But it crashed when I refined according to a circular wall.

When I used :
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
}
it did not cut on the middle of the edges in the regions controlled by the "circle".

When I used:
patchLocalCoeffs
{
patch cylinderWall;
tan1 (1 0 0);
tan2 (0 1 0);
}
the program did not recognize the second direction "tan2".

I INCLUDE HERE THE blockMeshDict FOR THE CASE:

/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object blockMeshDict;
}

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

convertToMeters 1;

vertices
(

(0 0 -0.0005) // vertex number 0
(0 0.164645 -0.0005) // vertex number 1
(0 0.2 -0.0005) // vertex number 2
(0 0.235355 -0.0005) // vertex number 3
(0 0.41 -0.0005) // vertex number 4

(0.164645 0 -0.0005) // vertex number 5
(0.164645 0.164645 -0.0005) // vertex number 6
(0.15 0.2 -0.0005) // vertex number 7
(0.164645 0.235355 -0.0005) // vertex number 8
(0.164645 0.41 -0.0005) // vertex number 9

(0.2 0 -0.0005) // vertex number 10
(0.2 0.15 -0.0005) // vertex number 11
(0.2 0.25 -0.0005) // vertex number 12
(0.2 0.41 -0.0005) // vertex number 13

(0.235355 0 -0.0005) // vertex number 14
(0.235355 0.164645 -0.0005) // vertex number 15
(0.25 0.2 -0.0005) // vertex number 16
(0.235355 0.235355 -0.0005) // vertex number 17
(0.235355 0.41 -0.0005) // vertex number 18

(0.75 0 -0.0005) // vertex number 19
(0.75 0.164645 -0.0005) // vertex number 20
(0.75 0.2 -0.0005) // vertex number 21
(0.75 0.235355 -0.0005) // vertex number 22
(0.75 0.41 -0.0005) // vertex number 23

(2.2 0 -0.0005) // vertex number 24
(2.2 0.164645 -0.0005) // vertex number 25
(2.2 0.2 -0.0005) // vertex number 26
(2.2 0.235355 -0.0005) // vertex number 27
(2.2 0.41 -0.0005) // vertex number 28



(0 0 0.0005) // vertex number 29
(0 0.164645 0.0005) // vertex number 30
(0 0.2 0.0005) // vertex number 31
(0 0.235355 0.0005) // vertex number 32
(0 0.41 0.0005) // vertex number 33

(0.164645 0 0.0005) // vertex number 34
(0.164645 0.164645 0.0005) // vertex number 35
(0.15 0.2 0.0005) // vertex number 36
(0.164645 0.235355 0.0005) // vertex number 37
(0.164645 0.41 0.0005) // vertex number 38

(0.2 0 0.0005) // vertex number 39
(0.2 0.15 0.0005) // vertex number 40
(0.2 0.25 0.0005) // vertex number 41
(0.2 0.41 0.0005) // vertex number 42

(0.235355 0 0.0005) // vertex number 43
(0.235355 0.164645 0.0005) // vertex number 44
(0.25 0.2 0.0005) // vertex number 45
(0.235355 0.235355 0.0005) // vertex number 46
(0.235355 0.41 0.0005) // vertex number 47

(0.75 0 0.0005) // vertex number 48
(0.75 0.164645 0.0005) // vertex number 49
(0.75 0.2 0.0005) // vertex number 50
(0.75 0.235355 0.0005) // vertex number 51
(0.75 0.41 0.0005) // vertex number 52

(2.2 0 0.0005) // vertex number 53
(2.2 0.164645 0.0005) // vertex number 54
(2.2 0.2 0.0005) // vertex number 55
(2.2 0.235355 0.0005) // vertex number 56
(2.2 0.41 0.0005) // vertex number 57

);

blocks
(
hex (0 5 6 1 29 34 35 30) (30 30 1) simpleGrading (0.25 0.25 1) //block 0
hex (1 6 7 2 30 35 36 31) (30 15 1) simpleGrading (0.25 1 1) //block 1
hex (2 7 8 3 31 36 37 32) (30 15 1) simpleGrading (0.25 1 1) //block 2
hex (3 8 9 4 32 37 38 33) (30 30 1) simpleGrading (0.25 4 1) //block 3

hex (5 10 11 6 34 39 40 35) (15 30 1) simpleGrading (1 0.25 1) //block 4
hex (8 12 13 9 37 41 42 38) (15 30 1) simpleGrading (1 4 1) //block 5
hex (10 14 15 11 39 43 44 40) (15 30 1) simpleGrading (1 0.25 1) //block 6
hex (12 17 18 13 41 46 47 42) (15 30 1) simpleGrading (1 4 1) //block 7

hex (14 19 20 15 43 48 49 44) (50 30 1) simpleGrading (7.5 0.25 1) //block 8
hex (15 20 21 16 44 49 50 45) (50 15 1) simpleGrading (7.5 1 1) //block 9
hex (16 21 22 17 45 50 51 46) (50 15 1) simpleGrading (7.5 1 1) //block 10
hex (17 22 23 18 46 51 52 47) (50 30 1) simpleGrading (7.5 4 1) //block 11

hex (19 24 25 20 48 53 54 49) (40 30 1) simpleGrading (3 0.25 1) //block 12
hex (20 25 26 21 49 54 55 50) (40 15 1) simpleGrading (3 1 1) //block 13
hex (21 26 27 22 50 55 56 51) (40 15 1) simpleGrading (3 1 1) //block 14
hex (22 27 28 23 51 56 57 52) (40 30 1) simpleGrading (3 4 1) //block 15
);

edges
(

arc 11 6 (0.175 0.1567 -0.0005)
arc 6 7 (0.1567 0.175 -0.0005)
arc 7 8 (0.1567 0.225 -0.0005)
arc 8 12 (0.175 0.2433 -0.0005)
arc 12 17 (0.225 0.2433 -0.0005)
arc 17 16 (0.2433 0.225 -0.0005)
arc 16 15 (0.2433 0.175 -0.0005)
arc 15 11 (0.225 0.1567 -0.0005)

arc 40 35 (0.175 0.1567 0.0005)
arc 35 36 (0.1567 0.175 0.0005)
arc 36 37 (0.1567 0.225 0.0005)
arc 37 41 (0.175 0.2433 0.0005)
arc 41 46 (0.225 0.2433 0.0005)
arc 46 45 (0.2433 0.225 0.0005)
arc 45 44 (0.2433 0.175 0.0005)
arc 44 40 (0.225 0.1567 0.0005)

);

patches
(
patch inlet
(
(0 1 30 29)
(1 2 31 30)
(2 3 32 31)
(3 4 33 32)
)
patch outlet
(
(25 24 53 54)
(26 25 54 55)
(27 26 55 56)
(28 27 56 57)
)
wall upperWall
(
(4 9 38 33)
(9 13 42 38)
(13 18 47 42)
(18 23 52 47)
(23 28 57 52)
)
wall cylinderWall
(
(6 11 40 35)
(7 6 35 36)
(8 7 36 37)
(12 8 37 41)
(17 12 41 46)
(16 17 46 45)
(15 16 45 44)
(11 15 44 40)
)
wall lowerWall
(
(5 0 29 34)
(10 5 34 39)
(14 10 39 43)
(19 14 43 48)
(24 19 48 53)
)
empty front
(
(0 5 6 1)
(1 6 7 2)
(2 7 8 3)
(3 8 9 4)
(5 10 11 6)
(8 12 13 9)
(10 14 15 11)
(12 17 18 13)

(14 19 20 15)
(15 20 21 16)
(16 21 22 17)
(17 22 23 18)

(19 24 25 20)
(20 25 26 21)
(21 26 27 22)
(22 27 28 23)
)

empty back
(
(29 30 35 34)
(30 31 36 35)
(31 32 37 36)
(32 33 38 37)
(34 35 40 39)
(37 38 42 41)
(39 40 44 43)
(41 42 47 46)

(43 44 49 48)
(44 45 50 49)
(45 46 51 50)
(46 47 52 51)

(48 49 54 53)
(49 50 55 54)
(50 51 56 55)
(51 52 57 56)
)

);

mergePatchPairs
(
);

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

THE BC FOR U:
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "/home/pnguyen1/OpenFOAM/pnguyen1-1.3/run/tutorials/icoFoamLiftDrag";
case "cylinder_2D_hex12600_AMR";
instance ""0"";
local "";

class volVectorField;
object U;
}

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

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type fixedValue;
value nonuniform List<vector>
90
(
(0 0 0)
(0.000404091 0 0)
(0.000770294 0 0)
(0.00110211 0 0)
(0.00140273 0 0)
(0.00167503 0 0)
(0.00192163 0 0)
(0.00214494 0 0)
(0.00234709 0 0)
(0.00253007 0 0)
(0.00269565 0 0)
(0.00284546 0 0)
(0.00298096 0 0)
(0.00310348 0 0)
(0.00321425 0 0)
(0.00331436 0 0)
(0.0034048 0 0)
(0.00348649 0 0)
(0.00356024 0 0)
(0.00362681 0 0)
(0.00368686 0 0)
(0.00374102 0 0)
(0.00378984 0 0)
(0.00383382 0 0)
(0.00387343 0 0)
(0.00390908 0 0)
(0.00394115 0 0)
(0.00396998 0 0)
(0.00399588 0 0)
(0.00401913 0 0)
(0.00403979 0 0)
(0.00405856 0 0)
(0.00407616 0 0)
(0.00409259 0 0)
(0.00410785 0 0)
(0.00412194 0 0)
(0.00413487 0 0)
(0.00414662 0 0)
(0.00415721 0 0)
(0.00416663 0 0)
(0.00417488 0 0)
(0.00418196 0 0)
(0.00418787 0 0)
(0.00419261 0 0)
(0.00419618 0 0)
(0.00419858 0 0)
(0.00419982 0 0)
(0.00419988 0 0)
(0.00419878 0 0)
(0.00419651 0 0)
(0.00419307 0 0)
(0.00418846 0 0)
(0.00418268 0 0)
(0.00417573 0 0)
(0.00416762 0 0)
(0.00415833 0 0)
(0.00414787 0 0)
(0.00413625 0 0)
(0.00412346 0 0)
(0.0041095 0 0)
(0.0040933 0 0)
(0.00407414 0 0)
(0.00405234 0 0)
(0.00402761 0 0)
(0.00399961 0 0)
(0.00396797 0 0)
(0.00393229 0 0)
(0.00389213 0 0)
(0.00384698 0 0)
(0.0037963 0 0)
(0.0037395 0 0)
(0.00367589 0 0)
(0.00360475 0 0)
(0.00352526 0 0)
(0.00343652 0 0)
(0.00333756 0 0)
(0.00322727 0 0)
(0.00310444 0 0)
(0.00296776 0 0)
(0.00281576 0 0)
(0.00264681 0 0)
(0.00245914 0 0)
(0.00225078 0 0)
(0.00201956 0 0)
(0.00176311 0 0)
(0.00147877 0 0)
(0.00116366 0 0)
(0.000814568 0 0)
(0.000427976 0 0)
(0 0 0)
)
;
}
outlet
{
type zeroGradient;
}
upperWall
{
type fixedValue;
value uniform (0 0 0);
}
cylinderWall
{
type fixedValue;
value uniform (0 0 0);
}
lowerWall
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type empty;
}
back
{
type empty;
}
}


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



THE BC FOR P:

/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "/home/pnguyen1/OpenFOAM/pnguyen1-1.3/run/tutorials/icoFoamLiftDrag";
case "cylinder_2D_hex12600_AMR";
instance ""0"";
local "";

class volScalarField;
object p;
}

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

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
upperWall
{
type zeroGradient;
}
cylinderWall
{
type zeroGradient;
}
lowerWall
{
type zeroGradient;
}
front
{
type empty;
}
back
{
type empty;
}
}


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

Any more helps are welcomed!

Kind regards,
Danh

mattijs October 23, 2007 04:24

Your patch cylinderWall has no
 
Your patch cylinderWall has normal in x and y direction so the undefined direction is the z so my local coordinate system can be:

patchLocalCoeffs
{
patch cylinderWall;
tan1 (0 0 1);
}


Then the directions to refine are (if I do not want to refine in z direction)

directions
(
normal
tan2
);

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif refineMeshDict

pnguyen1 October 23, 2007 06:37

Many thanks to Mattijs, It
 
Many thanks to Mattijs,

It worked well for the 1st refinement as your indications above. But at the 2nd refinement, a error was produced as follows:

Exec : refineMesh . cylinder_2D_hex8100_AMR_1st -dict
...

Create polyMesh for time = 500

Refining according to refineMeshDict

Read 2738 cells from cellSet "constant/polyMesh/sets/mag(resErrorU)"

--> FOAM FATAL ERROR : useHexTopology specified but cell 2474 on face 0 of patch cylinderWall is not a hex

From function propagateDirection
in file meshCut/directions/directions.C at line 158.

FOAM exiting

OF COURSE, after the 1st refinement the mesh consists of hexahedra and polyhedra (unrefined cells sharing edges with refined cells).

I make you waste your time! In deed, any ideas for that will be constructive for us!

Danh

pnguyen1 October 23, 2007 12:19

I am here one more time. --
 
I am here one more time.

--> FOAM FATAL ERROR : useHexTopology specified but cell 2474 on face 0 of patch cylinderWall is not a hex

==> This error says that there is a cell on the patch cylinderWall is polyhedral!

I read in the "refineMeshDict" file:
// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology true;

Is it a very severe condition? All cells on the patch cylindrWall must be hexahedral !!

Any clarifications ?

Thanks,
Danh

mattijs October 23, 2007 14:05

Only for a hex are directions
 
Only for a hex are directions (normal, tan1, tan2) defined. For polyhedral cells it reverts to geometric cutting (with a plane through the cell centre) which will probably fail on your curved mesh.

pnguyen1 October 23, 2007 14:53

Hi, Thanks for your explanati
 
Hi,
Thanks for your explanation, Mattijs.

I am very surprised about it. Because the cylinder case is the same as that in Jasak's PhD. He refined nicely suscessively the curved mesh. Did he use a cutting technique that is not available in OpenFOAM ??

It would be nice if Jasak gives us a hint ?

kind regards,
Danh

johan December 4, 2008 04:20

Hi, I have been using the r
 
Hi,

I have been using the refineMesh utility to refine the mesh for the cylinder in the engineFoam/kivaTest tutorial. this produces a new polyMesh directory (which is fine), but how to produce the other files such as b, ft, meshPhi, rho,.. with initial values needed for starting the computations.

Best regards,

Johan

wassja December 4, 2008 06:22

Hi Johan, I think you can us
 
Hi Johan,
I think you can use mapFields to map your results from your coarser mesh as initial values to your finer mesh.

regards

Wassja

johan December 4, 2008 08:31

Thank you Wassja for your real
 
Thank you Wassja for your really quick reply. This seems to be helpful.

Regards,

Johan

Victor June 28, 2010 05:53

Hi at all,

for my 2D-Simulations of flame detonations I'm looking for a utility to refine the mesh only at the recent position of the flame. I tried to use dynamicRefineFvMesh but the problem is that it refines in all dimensions, what is not suitable to my 2D-case!
Using multiDirRefinement causes the problem, that there is no possibility to unrefine cells later, so the number of cells increases enormously.
Does anybody have an solution for this problem?
Thanks a lot in advance!

Victor

blackbirdinapie April 9, 2012 12:23

Prism mesh refinement
 
Hi,

I am trying to refine a 2D prismatic (triangular) mesh to generate a 3D mesh. Essentially I need to divide the 2D mesh in the direction corresponding to the Z axis.

I am using refineMesh to create this - and it works fine except that it seems like it can only divide once for every time its called - so if I want to divide 1 cell into 16 cells in the Z direction in need to call it 5 times. Is this right or is there a way to do this using just one call?

The second, and larger, problem is that when I try to refine the mesh, the resultant mesh is no longer pure prismatic - but has tetrahedral cells. Is there any way to prevent this?

I have set useHexTopology to True and geometricCut to False.

Thanks a lot for your help.

emirust January 16, 2013 09:38

As blackbird in post 39, I am also wondering if there is a way of using refineMesh to divide cells in more than 4 cells (for a 2D case), or if the only solution is to call "refineMesh" again. Doesn't seem like good practice to me...

Help is appreciated :D


All times are GMT -4. The time now is 15:54.