CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Mesh Utilities

BlockMesh cellSet refineMesh

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

Like Tree4Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   April 10, 2014, 12:50
Default
  #21
Member
 
Nadish Saini
Join Date: Feb 2014
Location: Raleigh, North Carolina
Posts: 36
Rep Power: 3
90nash is on a distinguished road
I had created a tetrahedral mesh and want to refine the whole mesh. I looked through the code of refineMesh and from what I understand it runs for hexahedral mesh only. . Is that so?
90nash is offline   Reply With Quote

Old   April 11, 2014, 03:36
Default
  #22
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 166
Rep Power: 14
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Actually you can refine along x and y but not along z. That's what the refineMeshDict is for.

In the source folder of refineMesh you find a commented version of the dictionary. This is the case for most utilities in OpenFOAM.
So, check out $FOAM_APP/utilities/mesh/manipulation/refineMesh
GerhardHolzinger is offline   Reply With Quote

Old   May 30, 2014, 15:31
Post problems with refinemesh
  #23
New Member
 
David Fuentes
Join Date: May 2014
Posts: 4
Rep Power: 3
fondexx is on a distinguished road
hi Iīm new in openFoam, Iīm trying to model a vessel to find the resistance coefficients, using the snappyhexmesh, I have some problems to make a refinement in the box where the ship should go using refinemesh but I canīt do it, need some help
fondexx is offline   Reply With Quote

Old   May 30, 2014, 16:49
Default
  #24
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi David,

Welcome to the forum.

First of all, please do no double or triple post almost identical questions across multiple theads. Secondly, you do not describe what you have tried and how you have failed. Please read the following link, as it will make your succes on forum more probable:

How to give enough info to get help

Kind regards,

Niels
fondexx likes this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 2, 2014, 12:41
Default refining region inside blockMesh
  #25
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by idefix View Post
Hello,

do you want to refine your whole mesh or only a part?
Dear indefix,
I saw your post and I think you can help me. I am using OF2.1.1. I am using blockMesh to generate mesh and now I want to refine a specific region inside it... so what should I get or do.. please any help because I am so confused
best regards,
Sandy13,
sandy13 is offline   Reply With Quote

Old   June 5, 2014, 01:13
Default
  #26
Member
 
Join Date: Aug 2011
Posts: 81
Rep Power: 6
idefix is on a distinguished road
Hello Sandy13,

could you give me some more information?
how is the grid looking like and the area you want to refine?

See you
idefix
idefix is offline   Reply With Quote

Old   June 5, 2014, 11:02
Default
  #27
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by idefix View Post
Hello Sandy13,

could you give me some more information?
how is the grid looking like and the area you want to refine?

See you
idefix
Dear Idefix,
Thank you so much for accepting to help me. The mesh is as in the posted picture. I have a long cuboid domain and I want to simulate liquid jet coming from a circular patch from top to bottom through the domain. because I need a high resolution around the liquid through the domain, I want to to refine a specific region along the all domain just a bit bigger than the diameter of the circular patch, so I do not have to increase the mesh all over the domain which runs my case very slow. I tried blockMeshDG but still not that efficient, I want some thing like what snappyHexMesh has... refinementRegions but works on block dict. If you have any syfisticated way to do please help me. I attched my blockMesh file as well..
best wishes,
Sandy13,
Attached Images
File Type: jpg 1.jpg (15.5 KB, 38 views)
File Type: jpg 2.jpg (30.7 KB, 45 views)
File Type: jpg 3.jpg (26.8 KB, 51 views)
File Type: jpg 4.jpg (18.8 KB, 47 views)
sandy13 is offline   Reply With Quote

Old   June 10, 2014, 16:07
Default
  #28
Member
 
Join Date: Aug 2011
Posts: 81
Rep Power: 6
idefix is on a distinguished road
Hello,
am I wrong or did you forget to upload the blockMesDict?

Do you have any access to ICEM CFD?

Did I understand it correct that you want to refine a volume which has the shape of a hollow cylinder?

Greetings
idefix
idefix is offline   Reply With Quote

Old   June 18, 2014, 04:10
Default
  #29
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by idefix View Post
Hello,
am I wrong or did you forget to upload the blockMesDict?

Do you have any access to ICEM CFD?

Did I understand it correct that you want to refine a volume which has the shape of a hollow cylinder?

Greetings
idefix
Dear idefix,
I am sorry, it was my fault, I did not upload, so here we go below my blockMesh details. What I want exactly is to refine region in the centre has the same height of my domain(z-axis) but the smaller in the length and width(x and y axis).

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}

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

convertToMeters 1.0;

vertices
(

(-0.00106 -0.00106 0)//0 // points 0-7 for centerral hex
(0.00106 -0.00106 0)//1
(0.00106 0.00106 0)//2
(-0.00106 0.00106 0)//3

(-0.00106 -0.00106 0.2625)//4
(0.00106 -0.00106 0.2625)//5
(0.00106 0.00106 0.2625)//6
(-0.00106 0.00106 0.2625)//7

(0.00106 0.005 0)//8 // thes points relevent for the back hex
(-0.00106 0.005 0)//9
(0.00106 0.005 0.2625)//10
(-0.00106 0.005 0.2625)//11

(-0.005 0.005 0)//12 // thes points relevent for back left hex
(-0.005 0.00106 0)//13
(-0.005 0.005 0.2625)//14
(-0.005 0.00106 0.2625)//15

(-0.005 -0.00106 0)//16 // thes points relevent for left hex
(-0.005 -0.00106 0.2625)//17

(-0.005 -0.005 0)//18 // thes points relevent for front left hex
(-0.00106 -0.005 0)//19
(-0.005 -0.005 0.2625)//20
(-0.00106 -0.005 0.2625)//21

(0.00106 -0.005 0)//22 // thes points relevent for front hex
(0.00106 -0.005 0.2625)//23

(0.005 -0.005 0)//24 // thes points relevent for front right hex
(0.005 -0.00106 0)//25
(0.005 -0.005 0.2625)//26
(0.005 -0.00106 0.2625)//27

(0.005 0.00106 0)//28 // thes points relevent for right hex
(0.005 0.00106 0.2625)//29

(0.005 0.005 0)//30 // thes points relevent for back right hex
(0.005 0.005 0.2625)//31
);

blocks
(
hex (0 1 2 3 4 5 6 7) (8 8 800) simpleGrading (1 1 1) //0 centeral hex

hex (3 2 8 9 7 6 10 11) (8 8 800) simpleGrading (1 1 1) //1 back center
hex (3 9 12 13 7 11 14 15) (8 8 800) simpleGrading (1 1 1) //2 back left corner
hex (0 3 13 16 4 7 15 17) (8 8 800) simpleGrading (1 1 1) //3 left center
hex (0 16 18 19 4 17 20 21) (8 8 800) simpleGrading (1 1 1) //4 front left corner
hex (1 0 19 22 5 4 21 23) (8 8 800) simpleGrading (1 1 1) //5 front
hex (1 22 24 25 5 23 26 27) (8 8 800) simpleGrading (1 1 1) //6 front right corner
hex (2 1 25 28 6 5 27 29) (8 8 800) simpleGrading (1 1 1) //7 right
hex (2 28 30 8 6 29 31 10) (8 8 800) simpleGrading (1 1 1) //8 back right corner

);

edges
(
arc 2 3 (0.0 0.0015 0)
arc 3 0 (-0.0015 0.0 0)
arc 0 1 (0.0 -0.0015 0)
arc 1 2 (0.0015 0.0 0)

arc 6 7 (0.0 0.0015 0.2625)
arc 7 4 (-0.0015 0.0 0.2625)
arc 4 5 (0.0 -0.0015 0.2625)
arc 5 6 (0.0015 0.0 0.2625)

);

boundary

(


outlet
{
type patch;

faces
(
(0 3 2 1)

(2 3 9 8) //lower patches
(3 13 12 9)
(3 0 16 13)
(0 19 18 16)
(0 1 22 19)
(1 25 24 22)
(1 2 28 25)
(2 8 30 28)

);
}

inlet
{
type patch;
faces
(
(4 5 6 7)
);
}

walls
{
type patch;
faces

(
(13 15 14 12) //left wall
(16 17 15 13)
(18 20 17 16)


(18 19 21 20) // front
(19 22 23 21)
(22 24 26 23)

(24 25 27 26) //right
(25 28 29 27)
(28 30 31 29)

(12 14 11 9) //back
(9 11 10 8)
(8 10 31 30)

(7 6 10 11) // upper patches
(7 11 14 15)
(4 7 15 17)
(4 17 20 21)
(5 4 21 23)
(5 23 26 27)
(6 5 27 29)
(6 29 31 10)

);
}

);



mergePatchPairs
(
);

//.................................................. ................//#

thanks again for helping me.
Best wishes,
Sandy13
sandy13 is offline   Reply With Quote

Old   June 19, 2014, 04:15
Default
  #30
Member
 
Join Date: Aug 2011
Posts: 81
Rep Power: 6
idefix is on a distinguished road
Dear Sandy13,

thanks for the information. I assumed that the cylinder in the middle is not hollow.
What I did is the following:
I created a cylinderInner.stl-file with the geometry of the cylinder. Inside thise cylinder the cells will be refinded. If you do it, you must be careful. I donīt know why but only if the normals of the surfaces point outside the refinement later will work.
Put the file cylinderInner.stl in your case-folder (like constant and system).
Use the command:
insideCells cylinderInner.stl innerSet
(the name innerSet is chosen from me)

If there is a problem in this step, create a folder "sets":
constant/polyMes/sets
then try it again
now there is a new cell set in constant/polyMesh/sets which is called "innerSet"
you can look at it with:

foamToVTK -cellSet innerSet
or
foamToVTK -constant -cellSet innerSet

now you need the file refinementMesh in system:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Cells to refine; name of 'cellSet'
set innerSet;


// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
// x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
// patchLocalCoeffs section below.
coordinateSystem global;

// Specifies 2 directions by a name and a vector. The normal direction is
// calculated as tan1^tan2
globalCoeffs
{
//Verfeinerung in x-Richtung
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
// Verfeinerung in y-Richtung
// tan1 ( 0 1 0 );
// tan2 ( 1 0 0 );
// Verfeinerung in z-Richtung
// tan1 ( 0 0 1 );
// tan2 ( 0 1 0 );

}

patchLocalCoeffs
{
// Normal direction is face normal of zero'th face of patch
patch outside;
tan1 ( 1 0 0 );
tan2 ( 0 0 1 );
}

// Specifies the direction to be refined by the name used above
// To refine in the third direction, use the keyword 'normal'
directions
(
tan1
tan2
normal
);

// 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 yes;

// Cut purely geometric (will cut hexes through vertices) or take
// topology into account. Incompatible with 'useHexTopology'
geometricCut no;

// Write meshes from intermediate steps
writeMesh no;



here:
// Cells to refine; name of 'cellSet'
set innerSet;

you have to use the same name as the cellSet (created with "insideCells ...")

in the next step just use
refineMesh –dict

a new time step will be created which contains your new grid.

The refineMeshDict refines the cells in every direction. If you just want to refine in one direction you have to change it.
If you want to refine the cells several time I suggest that you use at a first step a bigger cylinder for the first refinement. For the second refinement use a smaller cylinder. Otherwise the cells donīt look nice any more.

I hope it helps, otherwise feel free to ask again.
I had to zip the *.stl file because otherwise I couldnīt upload it.

See you
idefix
Attached Files
File Type: zip cylinderInner.zip (17.4 KB, 16 views)
Milad06 likes this.
idefix is offline   Reply With Quote

Old   June 19, 2014, 10:18
Default
  #31
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by idefix View Post
sorry this was doubled - I donīt know where to delete
Dear idefix,
Thank you very much for supporting me, I do not know how to thank you, I will try the suggestion you posted to me and let you know If I had success..
best wishes,
Sandy13,
sandy13 is offline   Reply With Quote

Old   June 19, 2014, 10:43
Default
  #32
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by idefix View Post
Dear Sandy13,

thanks for the information. I assumed that the cylinder in the middle is not hollow.
What I did is the following:
I created a cylinderInner.stl-file with the geometry of the cylinder. Inside thise cylinder the cells will be refinded. If you do it, you must be careful. I donīt know why but only if the normals of the surfaces point outside the refinement later will work.
Put the file cylinderInner.stl in your case-folder (like constant and system).
Use the command:
insideCells cylinderInner.stl innerSet
(the name innerSet is chosen from me)

If there is a problem in this step, create a folder "sets":
constant/polyMes/sets
then try it again
now there is a new cell set in constant/polyMesh/sets which is called "innerSet"
you can look at it with:

foamToVTK -cellSet innerSet
or
foamToVTK -constant -cellSet innerSet

now you need the file refinementMesh in system:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Cells to refine; name of 'cellSet'
set innerSet;


// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
// x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
// patchLocalCoeffs section below.
coordinateSystem global;

// Specifies 2 directions by a name and a vector. The normal direction is
// calculated as tan1^tan2
globalCoeffs
{
//Verfeinerung in x-Richtung
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
// Verfeinerung in y-Richtung
// tan1 ( 0 1 0 );
// tan2 ( 1 0 0 );
// Verfeinerung in z-Richtung
// tan1 ( 0 0 1 );
// tan2 ( 0 1 0 );

}

patchLocalCoeffs
{
// Normal direction is face normal of zero'th face of patch
patch outside;
tan1 ( 1 0 0 );
tan2 ( 0 0 1 );
}

// Specifies the direction to be refined by the name used above
// To refine in the third direction, use the keyword 'normal'
directions
(
tan1
tan2
normal
);

// 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 yes;

// Cut purely geometric (will cut hexes through vertices) or take
// topology into account. Incompatible with 'useHexTopology'
geometricCut no;

// Write meshes from intermediate steps
writeMesh no;



here:
// Cells to refine; name of 'cellSet'
set innerSet;

you have to use the same name as the cellSet (created with "insideCells ...")

in the next step just use
refineMesh –dict

a new time step will be created which contains your new grid.

The refineMeshDict refines the cells in every direction. If you just want to refine in one direction you have to change it.
If you want to refine the cells several time I suggest that you use at a first step a bigger cylinder for the first refinement. For the second refinement use a smaller cylinder. Otherwise the cells donīt look nice any more.

I hope it helps, otherwise feel free to ask again.
I had to zip the *.stl file because otherwise I couldnīt upload it.

See you
idefix
Daer idefix,
I tried to do as you told me exactly. So I saved the the stl file you done and saved it in both constant and systemfolder, then ran the command you sent after blockMesh, but I got this error message
Create time

Create polyMesh for time = 0

Reading surface from "cylinderInner.stl"


--> FOAM FATAL ERROR:
Cannnot read "cylinderInner.stl"

From function triSurface::read(const fileName&, const word&, const bool)
in file triSurface/triSurface.C at line 369.

FOAM exiting
Then I did sets folder inside poly folder and put the stl file you sent as you said and ran the same command but it did not run and I got the same error message. I am using OF2.1.1 version. As the error message says I need to red this file from triSurface, so inside constant folder I done triSurface and put the stl file, but still I get the same error message when I run the command you sent.. Do you please have any solution?
best wishes,
Sandy13,
sandy13 is offline   Reply With Quote

Old   June 19, 2014, 11:12
Default
  #33
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by sandy13 View Post
Daer idefix,
I tried to do as you told me exactly. So I saved the the stl file you done and saved it in both constant and systemfolder, then ran the command you sent after blockMesh, but I got this error message
Create time

Create polyMesh for time = 0

Reading surface from "cylinderInner.stl"


--> FOAM FATAL ERROR:
Cannnot read "cylinderInner.stl"

From function triSurface::read(const fileName&, const word&, const bool)
in file triSurface/triSurface.C at line 369.

FOAM exiting
Then I did sets folder inside poly folder and put the stl file you sent as you said and ran the same command but it did not run and I got the same error message. I am using OF2.1.1 version. As the error message says I need to red this file from triSurface, so inside constant folder I done triSurface and put the stl file, but still I get the same error message when I run the command you sent.. Do you please have any solution?
best wishes,
Sandy13,
Dear idefix,
Okay - prolbem solved

the STL has to be in the "case" diroctory. Not in the triSurface.
best wishes,
Sandy13,
sandy13 is offline   Reply With Quote

Old   June 20, 2014, 09:22
Default
  #34
Member
 
sandy
Join Date: Mar 2013
Location: Cardiff, UK
Posts: 71
Rep Power: 4
sandy13 is on a distinguished road
Quote:
Originally Posted by sandy13 View Post
Dear idefix,
Okay - prolbem solved

the STL has to be in the "case" diroctory. Not in the triSurface.
best wishes,
Sandy13,
Dear idefix,
I tried using the method you suggested, It works very well, but not as I want because this utility refine the all mesh across the all domain not like I want. I want to refine just a cuboid smaller than my domain inside it and keep the rest of mesh as it is. Please help me if you have any Idea...
best wishes,
Sandy13
sandy13 is offline   Reply With Quote

Old   August 19, 2014, 04:54
Default
  #35
Senior Member
 
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 185
Rep Power: 7
vonboett is on a distinguished road
Hi Sandy,

the magic is in
// Cells to refine; name of 'cellSet'
set innerSet;
when using refineMesh. You can create all kinds of cellSets to select the cells you want to refine, for example only choosing certain cells that contain a certain range of flow velocity or pressure, by using topoSet. once you have created a cellSet with topoSet that contains the cells you want to refine, you can control wether you want to split the cells in x, y or x y and z directions in the refineMeshDict dependent on the presence of tan1, tan2 and normal in
directions
(
tan1 // x
tan2 // y
normal // z
);
But you have to be aware that you call refineMesh as 'refineMesh -dict system/refinemeMeshDict' in OF 2.3
fsifsi likes this.
vonboett 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
Create a cellSet out of the gamma directory cricke OpenFOAM Running, Solving & CFD 11 July 12, 2009 03:52
CellSet question bobbicknell OpenFOAM Post-Processing 0 February 24, 2009 17:50
RefineMesh warning mgz1985 OpenFOAM Native Meshers: blockMesh 1 August 29, 2008 08:45
Using refineMesh matteo_gautero OpenFOAM Mesh Utilities 0 February 11, 2008 10:07
Center coordinates of all the cells in a cellset lizhihua CD-adapco 0 August 21, 2006 03:59


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