CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: blockMesh (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/)
-   -   refined mesh (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/91034-refined-mesh.html)

OFU July 28, 2011 07:54

refined mesh
 
1 Attachment(s)
Hello,

I want to simulate a flow through a pie-shaped geometry like shown in the attached picture. Therefore I want to refine the mesh near the inflow and the outflow. I tried to do it with the simpleGrading option, but only the mesh near inflow was refined and not near the outflow. Does anybody know how to refine the mesh on both sides? Do I have to split the geometry into two blocks? I don't know how to solve this problem.

Thanks,
Jennifer

MartinB July 28, 2011 13:58

Hi Jennifer,

you can use blockMeshDoubleGrading as described and provided in this thread:
http://www.cfd-online.com/Forums/ope...e-grading.html

Or you can split your geometry into two blocks, just as you already mentioned.

Martin

OFU July 29, 2011 06:11

1 Attachment(s)
Hi Martin,

thanks for your answer. I tried to use blockMeshDoubleGrading, but I didn't succeed in refining in the right direction. I inserted

blocks
(
hex (0 2 3 1 4 6 7 5) (45 50 1) doubleGrading (1 -5 1)
);

in the blockMeshDict file and got the mesh shown in the attached picture.
But I want to refine the mesh towards the outflow and inflow and not like in the picture towards the outer and inner wall of the geometry.
So tried to use
doubleGrading (-5 1 1), but then I got errors. Can you tell me how to use it correctly?

Thanks
Jennifer

MartinB July 29, 2011 06:19

Hi Jennifer,

(-5 1 1) should be correct. Can you provide your blockMeshDict?

Martin

OFU July 29, 2011 08:19

Hi Martin,

when I run blockMeshDoubleGrading no errors occur.
Create time

Creating block mesh from
"/OpenFOAM/ofu-1.7.0/run/2drefined_doubleGrading/constant/polyMesh/blockMeshDict"

Creating blockCorners
Creating curved edges
Creating blocks
Creating patches
Creating block mesh topology
Default patch type set to empty
Check block mesh topology
Basic statistics
Number of internal faces : 0
Number of boundary faces : 6
Number of defined boundary faces : 6
Number of undefined boundary faces : 0
Checking patch -> block consistency
Creating block offsets
Creating merge list .
Creating points with scale 1
Creating cells
Creating patches
Creating mesh from block mesh
Default patch type set to empty
Writing polyMesh
End


But when I run checkMesh an error occurs:
Create time
Create polyMesh for time = 0
Time = 0
Mesh stats
points: 4590
internal points: 0
faces: 8894
internal faces: 4306
cells: 2250
boundary patches: 6
point zones: 0
face zones: 0
cell zones: 0
Overall number of cells of each type:
hexahedra: 2200
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 50
Checking topology...
Boundary definition OK.
Point usage OK.
#0 Foam::error::printStack(Foam::Ostream&) in "/ofu/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/ofu/OpenFOAM/OpenFOAM-1.7.0//lib/linux64GccDPOpt/libOpenFOAM.so"
#2 in "/lib64/libc.so.6"
#3 Foam::primitiveMesh::checkUpperTriangular(bool, Foam::HashSet<int, Foam::Hash<int> >*) const in "/ofu/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#4
in "/ofu/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/checkMesh"
#5
in "/ofu/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/checkMesh"
#6 __libc_start_main in "/lib64/libc.so.6"
#7
at /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116
Segmentation fault


Because I can not use paraFoam I always use foamToVTK to visualize the results or the mesh. When I try to run the application I get the message:
Create time
Create mesh for time = 0
Deleting old VTK files in "/OpenFOAM/ofu-1.7.0/run/2drefined_doubleGrading/VTK"
Time: 0
volScalarFields : T p
volVectorFields : U
Internal : "/OpenFOAM/ofu-1.7.0/run/2drefined_doubleGrading/VTK/2drefined_doubleGrading_0.vtk"

--> FOAM FATAL ERROR:
bad set size -50
From function List<T>::setSize(const label)
in file /OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/List.C at line 340.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&) in "/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::List<int>::setSize(int) in "/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/foamToVTK"
#3
in "/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/foamToVTK"
#4
in "/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/foamToVTK"
#5
in "/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/foamToVTK"
#6 __libc_start_main in "/lib64/libc.so.6"
#7
at /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116
Aborted


Do you have any idea, what I do wrong or how to change the values, that it works?


Thanks
Jennifer

MartinB July 29, 2011 09:24

Hi Jennifer,

there seem to be some minor bugs in the blockMeshDoubleGrading. Here is a workaround:
- change the order of your arc definition to:
Code:

    arc 1 3 (0.25 0 0)  // <--- this was "arc 3 1" before
    arc 5 7 (0.25 0 0.001)
    arc 0 2 (0.185 0 0)
    arc 4 6 (0.185 0 0.001)

- choose a pair number of elements for x direction (in general the doubleGrading direction):
hex (0 2 3 1 4 6 7 5) (46 50 1) doubleGrading (-5 1 1) // <--- 46 instead of 45

Now it should work fine.

Martin

OFU July 29, 2011 12:49

Hi Martin,

thanks again for your answer.
I will try to insert your changes on Monday, when I will be at work again and I will let you know, if it works :-)

Have a nice weekend.
Jennifer

OFU August 2, 2011 03:24

1 Attachment(s)
Hello again,

yesterday I changed my blockMeshDict file and blockMeshDoubleGrading seemed to run correctly. But checkMesh gave me two errors:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create polyMesh for time = 0
Time = 0
Mesh stats
points: 4794
internal points: 0
faces: 9296
internal faces: 4504
cells: 2300
boundary patches: 6
point zones: 0
face zones: 0
cell zones: 0
Overall number of cells of each type:
hexahedra: 2300
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0
Checking topology...
Boundary definition OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).
Checking patch topology for multiply connected surfaces ...
Patch Faces Points Surface topology
inside 46 94 ok (non-closed singly connected)
outside 46 94 ok (non-closed singly connected)
bottom 2300 2397 ok (non-closed singly connected)
top 2300 2397 ok (non-closed singly connected)
outflow 50 102 ok (non-closed singly connected)
inflow 50 102 ok (non-closed singly connected)
Checking geometry...
Overall domain bounding box (0.130815 -0.176777 0) (0.25 0.176777 0.001)
Mesh (non-empty, non-wedge) directions (1 1 0)
Mesh (non-empty) directions (1 1 0)
***Number of edges not aligned with or perpendicular to non-empty directions: 2200
<<Writing 4400 points on non-aligned edges to set nonAlignedEdges
Boundary openness (2.46676e-18 3.85577e-19 5.12864e-16) OK.
Max cell openness = 1.15757e-15 OK.
Max aspect ratio = 31.5465 OK.
Minumum face area = 1.3e-06. Maximum face area = 9.68891e-05. Face area magnitudes OK.
Min volume = 3.3719e-09. Max volume = 1.63389e-08. Total volume = 2.18008e-05. Cell volumes OK.
Mesh non-orthogonality Max: 89.1267 average: 65.8611
*Number of severely non-orthogonal faces: 2222.
Non-orthogonality check OK.
<<Writing 2222 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
***Max skewness = 13.2232, 1702 highly skew faces detected which may impair the quality of the results
<<Writing 1702 skew faces to set skewFaces
Failed 2 mesh checks.


And I think the generated mesh looks a little bit strange. Or is it right?

Jennifer

MartinB August 2, 2011 04:55

3 Attachment(s)
Hi Jennifer,

looks like the problem coming from the sequence of the arc definition.

Well, here are my blockMeshDoubleGrading source codes for OF17x and OF2x.

For the OpenFOAM 2.0.x version you must build a library first. Unpack the src_20x.tar.gz file into your users OpenFOAM folder, navigate via shell to the directory containing the "Make" folder, and call "wmake libso".

Good luck

Martin

OFU August 4, 2011 04:30

Hi Martin,

now it works. Thanks for your help :-)

Jennifer

safre December 21, 2011 12:22

Problems with cells with very high aspect ratios
 
I manage to get the blockMeshDG to work. The mesh looks very nice and graded in this simple geometry but I get one layer of cells with very high aspect ratios in the middle of the geometry.

Colud you please give a hint on what the problem might be?

My blockMeshDict file is as:

convertToMeters 1.0;


vertices
(
(-1 -1 0)
( 1 -1 0)
( 1 1 0)
(-1 1 0)

(-1 -1 1)
( 1 -1 1)
( 1 1 1)
(-1 1 1)

);

blocks
(
hex (0 1 2 3 4 5 6 7) (80 80 65) doubleGrading (1 1 -5)
);

edges
(
);

boundary
(
bottom
{
type wall;
faces ((0 3 2 1));
}
surface
{
type wall;
faces ((4 5 6 7));
}
side_half0
{
type cyclic;
neighbourPatch side_half1;
faces
(
(0 4 7 3)
);
}
side_half1
{
type cyclic;
neighbourPatch side_half0;
faces
(
(2 6 5 1)
);
}
frontAndBack_half0
{
type cyclic;
neighbourPatch frontAndBack_half1;
faces
(
(3 7 6 2)
);
}
frontAndBack_half1
{
type cyclic;
neighbourPatch frontAndBack_half0;
faces
(
(1 5 4 0)
);
}
);

mergePatchPairs
(

);

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

MartinB December 21, 2011 12:41

Hi Sam,

there is a bug in the code, I think... a workaround is to define a pair number of cells in z direction (changed from 65 to 64):
hex (0 1 2 3 4 5 6 7) (80 80 64) doubleGrading (1 1 -5)

Martin

safre December 22, 2011 06:04

Thank you - works perfect!
 
Thank you - works perfect!


All times are GMT -4. The time now is 09:50.