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] BlockMesh cellSet refineMesh (https://www.cfd-online.com/Forums/openfoam-meshing/61518-blockmesh-cellset-refinemesh.html)

mattijs November 13, 2008 13:35

BlockMesh cellSet refineMesh
 
refineMesh by default refines the whole mesh. Use

refineMesh -dict

to refine according to the dictionary.

alexm November 16, 2008 20:56

Thank you very much for your h
 
Thank you very much for your help. This has been the fine but important information, I needed.

In my refineMeshDict above seems to be a little mistake. The third refinement direction should be named as "normal", not "tan3":

directions
(
tan1
tan2
normal
);

Hrushi August 26, 2010 00:51

refineMesh tetrahedral
 
Quote:

Originally Posted by mattijs (Post 195725)
refineMesh by default refines the whole mesh. Use

refineMesh -dict

to refine according to the dictionary.

Hi mattijs,

Does refineMesh utility works on tetrahedral mesh? If no, is there any other utility available in OpenFOAM to do that?

Hrushikesh

Maulik September 21, 2010 03:26

how does tan1, tan2 get calculated while refining Mesh?
I am new to CFD so couldnt get how does it calculate...
please help me out..
Thanks

challenger November 16, 2010 05:53

Solution for a faster refinement
 
Hello Mattijs,

I am using refineHexMesh to refine different parts of my domain. Since I have around 10 different refinement parts, after the first few, it starts getting really slow.
My assumption is due to the entire domain being under consideration for refinements. Can I isolate it with sets and just include that region during refinement so that the process is much faster then later combine these sets or merge it into the main mesh file?

Challenger

lindstroem November 26, 2010 04:03

Hi there,

as you are using the refineMesh utility I would like to ask you, how to use it. I found out, that the "refineMeshDict" has to be in the system/ folder. When I start refineMesh -dict it says that the file
user-1.7.1/run/cases/mesh/constant/polyMesh/sets/c0 at line 0.
cannot be found.
The mesh was created with the blockMesh-command and is simply a box. How do i get the sets "c0" and so on?

Thanks for your help!

challenger November 26, 2010 04:53

Quote:

Originally Posted by lindstroem (Post 284867)
user-1.7.1/run/cases/mesh/constant/polyMesh/sets/c0 at line 0.
cannot be found.

[In 1.6] (should be the same for 1.7)
In order to refine a mesh, you need to specify which part or which cells are being selected. To do this, use the command setSets, this creates set which are later used by the refineMeshDict to refine the mesh.

then include this set name in the refineMeshDict in order to refine those cells.

setSet requires a batch file the file is just an info on which cells are selected. this is what I do,

cellSet ref new boxToCell (-10 -35.0 -10) (10 35 87.6) > refinement
setSet -batch refinement -latestTime
refineMesh -dict

the dict should include the refinement set name. in this case its ref

Hope that helped.

Cheers!

lindstroem November 26, 2010 05:07

Hi challenger!

Thanks! Yes, it helps! I just started with the cellSetDict to create the sets which should be the same what you are doing with cellSet command. I just refined my first "little area". Now I'll see how it works with multiple cellSets and maybe I'll have a great weekend ;)

Greetings!

giovanni10 October 31, 2011 10:54

Quote:

Originally Posted by lindstroem (Post 284878)
Hi challenger!

Thanks! Yes, it helps! I just started with the cellSetDict to create the sets which should be the same what you are doing with cellSet command. I just refined my first "little area". Now I'll see how it works with multiple cellSets and maybe I'll have a great weekend ;)

Greetings!

Hi,
Could you explain me how I can refine a specific region in a cavity? What can I do exactly? Thanks in advance!


emirust January 16, 2013 08:49

Foamers!

Do anybody know what to specify if I want to have an extra refined mesh in a region?

By default, refineMesh divides cells in 4 for a 2D case, or by 8 for a 3D case. I would like the refinement to be better than this.

Thanks!

nlinder January 16, 2013 08:55

you can run it twice, or as often as you need it...

emirust January 16, 2013 09:22

1 Attachment(s)
Tried, but doesnt serve my purpose of increasing the cell resolution in the central part (as seen in screenshot where I ran the utility three times)

nlinder January 16, 2013 09:42

1 Attachment(s)
I do it quite often, but maybe different. You can see it in the attachment. I have several cellSet Files with some space in between them. So I run cellSet (with file 1) refineMesh, then the next CellSet and again refineMesh and so on..

edit: and maybe switch of decompose polyhedrons in paraview...

Attachment 18230

emirust January 17, 2013 03:24

Ok! It will serve my purpose, and you screenshot is exactly what I am looking for :).

How did you automate this? I need to do it maybe 8 times, and modifying the dict files each time is not a good solution.

How do you create your cellSets? Do you have a cellSetDict you manually edit for each refinement? Ideally, I could create the sets from the command line so I can include it in my shell script...

Thanks!

nlinder January 18, 2013 04:48

Yes i use a script.
You need several cellSet files called cellSetDict.1, cellSetDict.2 .... I created them manually.
Then I use the following script (credits to the one who wrote it, I actually don't know)

Code:

refineMeshByCellSet()
{
  while [ $# -ge 1 ]
  do
      echo "creating cell set for primary zone - $1"
      cp system/cellSetDict.$1 system/cellSetDict
      cellSet > log.cellSet.$1 2>&1

      echo "refining primary zone - $1"
      refineMesh -dict -overwrite > log.refineMesh.$1 2>&1
      shift
  done
}

runApplication blockMesh
echo "BlockMesh finish"
refineMeshByCellSet 1 2 3
echo "refineMeshByCellSet finish"

The second last line defines how often it will be refined..

Greetings

idefix July 30, 2013 08:17

Hello,

I donīt know how to go on.

what I did so far:
snappyHexMesh -overwrite --> creation of the mesh (creation of folder 0 )
insideCells refine.stl cellSet --> creation of a set of cells from the mesh
refineMesh -dict --> refinement of the cells in the set cellSet (creation of folder 1)

everything is fine, the mesh is refined

Afterwards I want to do a refinement again (the .stl-file covers a part of the first .stl-file)
insideCells refine2.stl cellSet2
refineMesh -dict
(I changed the name cellSet to cellSet2 in the refineMeshDict)
I get the following error:

Create time

Create polyMesh for time = 1

#0 Foam::error::printStack(Foam::Ostream&) in "/home/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/home/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib64/libc.so.6"
#3
in "/home/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/refineMesh"
#4
in "/home/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/refineMesh"
#5 __libc_start_main in "/lib64/libc.so.6"
#6
at /usr/src/packages/BUILD/glibc-2.11.2/csu/../sysdeps/x86_64/elf/start.S:116
Gleitkomma-Ausnahme

can anybody help? What do I have to change when I want to refine the mesh twice?

Thanks a lot
idefix

GerhardHolzinger September 23, 2013 09:45

Quote:

Originally Posted by mattijs (Post 195725)
refineMesh by default refines the whole mesh. Use

refineMesh -dict

to refine according to the dictionary.


I don't really like this behaviour, but this post of yours saved my day!

I assumed that refineMesh uses the dictionary by default, and that the -dict option is used to point to an alternative dictionary.

90nash February 5, 2014 19:37

Problems in refineMesh
 
Hello Foamers,
I am new to openfoam and thus am struggling with some commands. I had created a mesh in Salome and imported it into Openfoam. I have run one analysis and now want to refine my mesh. But when i am using 'refineMesh -overwrite' command it terminates with "Aborted- Core Dumped". A bunch of files are written in my case directory but the mesh is not refined (verified this using checkMesh). I am using OF-2.2.2

Can anyone please suggest what i am doing wrong. Thank you in advance for your help! :)

idefix February 11, 2014 03:13

Hello,

do you want to refine your whole mesh or only a part?

be_inspired April 10, 2014 12:38

I suppose that this utility is not valid if I want to refine along x and y direction but not along z direction because keeping the first cell height is a must.
In that case, what utility can I use? Maybe Mesquite?

90nash April 10, 2014 12:50

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?

GerhardHolzinger April 11, 2014 03:36

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

fondexx May 30, 2014 15:31

problems with refinemesh
 
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

ngj May 30, 2014 16:49

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:

http://www.cfd-online.com/Forums/ope...-get-help.html

Kind regards,

Niels

sandy13 June 2, 2014 12:41

refining region inside blockMesh
 
Quote:

Originally Posted by idefix (Post 474395)
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,

idefix June 5, 2014 01:13

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

sandy13 June 5, 2014 11:02

4 Attachment(s)
Quote:

Originally Posted by idefix (Post 495633)
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,

idefix June 10, 2014 16:07

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

sandy13 June 18, 2014 04:10

Quote:

Originally Posted by idefix (Post 496451)
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

idefix June 19, 2014 04:15

1 Attachment(s)
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

sandy13 June 19, 2014 10:18

Quote:

Originally Posted by idefix (Post 497749)
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 June 19, 2014 10:43

Quote:

Originally Posted by idefix (Post 497746)
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 June 19, 2014 11:12

Quote:

Originally Posted by sandy13 (Post 497809)
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 June 20, 2014 09:22

Quote:

Originally Posted by sandy13 (Post 497811)
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

vonboett August 19, 2014 04:54

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

Maimouna February 8, 2016 09:31

1 Attachment(s)
Hi all,

in the attached picture, I have two blockMeshDict file one for fluid and another for solid as following
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
convertToMeters 1;//dimensions in meters --> conversion 1
 
vertices
(
(0 0 0) //vertex 0
(5 0 0) //vertex 1
(6 0 0) //vertex 2
(10 0 0)//vertex 3
(20 0 0) //vertex 4
 
(0 4 0) //vertex 5
(5 4 0) //vertex 6
(6 4 0)//vertex 7
(10 4 0) //vertex 8
(20 4 0) //vertex 9
 
(0 7 0) //vertex 10
(5 7 0)//vertex 11
(6 7 0) //vertex 12
(10 7 0) //vertex 13
(20 7 0) //vertex 14
 
(0 11 0)//vertex 15
(5 11 0) //vertex 16
(6 11 0) //vertex 17
(10 11 0) //vertex 18
(20 11 0)//vertex 19
 
(0 0 11) //vertex 20
(5 0 11) //vertex 21
(6 0 11) //vertex 22
(10 0 11)//vertex 23
(20 0 11) //vertex 24
 
(0 4 11) //vertex 25
(5 4 11) //vertex 26
(6 4 11)//vertex 27
(10 4 11) //vertex 28
(20 4 11) //vertex 29
 
(0 7 11) //vertex 30
(5 7 11)//vertex 31
(6 7 11) //vertex 32
(10 7 11) //vertex 33
(20 7 11) //vertex 34
 
(0 11 11)//vertex 35
(5 11 11) //vertex 36
(6 11 11) //vertex 37
(10 11 11) //vertex 38
(20 11 11)//vertex 39
 
);
 
blocks
(
hex (0 1 6 5 20 21 26 25) (20 15 20) simpleGrading (1 1 1) //block 0
hex (1 2 7 6 21 22 27 26) (20 15 20) simpleGrading (1 1 1) //block 1 
hex (2 3 8 7 22 23 28 27) (20 15 20) simpleGrading (1 1 1) //block 2
hex (3 4 9 8 23 24 29 28) (20 15 20) simpleGrading (1 1 1) //block 3
hex (5 6 11 10 25 26 31 30) (20 15 20) simpleGrading (1 1 1) //block 4
hex (6 7 12 11 26 27 32 31) (20 15 20) simpleGrading (1 1 1) //block 5
hex (7 8 13 12 27 28 33 32) (20 15 20) simpleGrading (1 1 1) //block 6
hex (8 9 14 13 28 29 34 33) (20 15 20) simpleGrading (1 1 1) //block 7
hex (10 11 16 15 30 31 36 35) (20 15 20) simpleGrading (1 1 1) //block 8
hex (11 12 17 16 31 32 37 36) (20 15 20) simpleGrading (1 1 1) //block 9
hex (12 13 18 17 32 33 38 37) (20 15 20) simpleGrading (1 1 1) //block 10
hex (13 14 19 18 33 34 39 38) (20 15 20) simpleGrading (1 1 1) //block 11
);
 
edges
(
);
 
patches
(
 
patch top
(
(0 5 6 1)
(3 8 9 4)
(5 10 11 6)
(8 13 14 9)
(10 15 16 11)
(11 16 17 12)
(12 17 18 13)
(13 18 19 14)
)
 
patch bottom
(
(20 25 26 21)
(23 28 29 24)
(25 30 31 26)
(28 33 34 29)
(30 35 36 31)
(31 36 37 32)
(32 37 38 33)
(33 38 39 34)
)
 
patch output //right
(
(19 14 34 39)
(14 9 29 34)
(9 4 24 29)
)
 
patch input //left
(
(15 10 30 35)
(10 5 25 30)
(5 0 20 25)
)
 
patch cylinder
(
(1 6 7 2)
(6 11 12 7)
(21 26 27 22)
(26 31 32 27)
)
 
wall plate
(
(2 7 8 3)
(7 12 13 8)
(22 27 28 23)
(27 32 33 28)
)
 
patch frontPlane
(
(0 1 21 20)
(1 2 22 21)
(2 3 23 22)
(3 4 24 23)
)
 
patch backPlane
(
(15 16 36 35)
(16 17 37 36)
(17 18 38 37)
(18 19 39 38)
)
 
);
 
mergePatchPairs
(
);
 
// ************************************************************************* //

solid
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
convertToMeters 1;//dimensions in meters --> conversion 1
 
vertices
(
    (6 0 0) //vertex 0
    (10 0 0)//vertex 1
    (6 4 0)//vertex 2
    (10 4 0) //vertex 3
    (6 7 0) //vertex 4
    (10 7 0) //vertex 5
 
    (6 0 11) //vertex 6
    (10 0 11)//vertex 7
    (6 4 11)//vertex 8
    (10 4 11) //vertex 9
    (6 7 11) //vertex 10
    (10 7 11) //vertex 11
);
 
blocks
(
      hex (0 1 2 3 4 5 6 7) (20 15 20) simpleGrading (1 1 1) 
 
    //hex (2 3 8 7 22 23 28 27) (20 15 20) simpleGrading (1 1 1) //block 2
    //hex (7 8 13 12 27 28 33 32) (20 15 20) simpleGrading (1 1 1) //block 6
);
 
edges
(
);
 
patches
(
    patch plateFix
    (
        (3 7 4 0)
    )
 
    //patch plate
      wall plate
    (
      (3 2 6 7)
      (6 2 1 5)
      (1 0 4 5)
    )
 
    symmetryPlane frontPlane
    (
    (0 1 2 3)
    )
   
    symmetryPlane backPlane
    (
    (7 6 5 4)
    )
);
 
mergePatchPairs
(
);
 
// ************************************************************************* //

that because I'm working with FSI (fsiFoam solver).

The thickness of the plate (foil) is 0.06, I would like to refine the mesh near the foil. How could do that? Help me please by write all steps in order to do that.

Lots of thanks in advanced.

Maimouna

eb19 July 6, 2016 11:48

1 Attachment(s)
Hi,

I am using refineMesh to refine the cells locally. But from this refinement, some tetrahedral cells with high skewness are generated. How to get rid of these elements?
Can I maintain the size of the original cells which are adjacent to the refined cells? Attached is the mesh after having been refined. You could see the tetrahedral cells at cell faces between the refined cells (right or upper cells) and the cells not being refined (left cells).

I would imagine if this can be done, eventually i will have some non-conformal cells or maybe some inner faces. This is what I want to have from my mesh. The local refinement but without any tetrahedral cells. Please anyone who had the same problem share your experience here. Thanks.


Best

ebb19

eb19 September 6, 2017 17:27

Hi,

I know this is an old post. Can you tell me how to generate an stl file from the program that idefix attached. I tried saving a file generated by that program in an stl file and I openned the file, but the content of the file is unreadable.

How do we then include this stl file into constant folder of OpenFOAM? I am confused about using this stl file. My intention is to specify a region to be refined. I can not use typical cellSources such as cylindertoCell, boxtoCell, etc because nono of them is exactly as I want. Can you please explain to me how you used the stl file to refine a specific region in your domain?

amuzeshi January 20, 2019 23:14

4 Attachment(s)
Quote:

Originally Posted by emirust (Post 402209)
Tried, but doesnt serve my purpose of increasing the cell resolution in the central part (as seen in screenshot where I ran the utility three times)

A brief manual on refineMesh

Hello There
You've gone the wrong way. Follow the right method on the following, which differs only in one more topoSet.

Present case
As an example, I ran refining on cavity case. I created two sets named mediumCellSet and hiCellSet ; images are attached. We want to refine mediumCellSet less and hiCellSet more.

Wrong method
1- blockMesh
2- topoSet
3- refineMesh (on mediumCellSet)
4- refineMesh (on hiCellSet)
5- Result:wrongMethod.jpg (attached)

Right method
- before step 4 mentioned above, execute a topoSet again.
- Result:rightMethod.jpg (attached)

zp_chem August 29, 2019 06:57

Hi:
I want to konw have you solved this problem?


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