CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... (http://www.cfd-online.com/Forums/openfoam-meshing-other/)
-   -   Import of Multi-Region Mesh from Gambit with non-conformal interfaces (http://www.cfd-online.com/Forums/openfoam-meshing-other/82549-import-multi-region-mesh-gambit-non-conformal-interfaces.html)

sebonator November 29, 2010 12:35

Import of Multi-Region Mesh from Gambit with non-conformal interfaces
 
Hi there!

I want to import a multi-region Mesh I created with Gambit. I know that there is an option for the "fluentMeshToFoam" utility, that is able to create cellZones from the regions I defined in Gambit. Well, this all works fine for conformal meshes (meshes, in which the cells on both sides of an interface exactly match). In that case, all the interior patches are named in a "Region1_To_Region2" manner by the "splitMeshRegions" utility and everything is fine.

My situation now is, that I want to simulate the heat exchange between a turbulent flow and a solid, so there is no chance to make the meshes conformal, because this would require a far more finer mesh on the solid region than I am able to allow due to simulation time.

The actual problem is, that the "splitMeshRegions" utility does not create the interior patches in this clear "Region1_To_Region2" manner, but takes all interior patches into one single patch and I am not able to set the internal transition conditions properly anymore.

I already tried to form the internal patches manually after using the "splitMeshRegions" utility, but I am not able to find out the "startFace"-Numbers of the individual internal patches. Even if I use the "-writeSets" option for the "fluentMeshToFoam" utility and look at the different facesets, I am not able to find out the "startFaces"-Numbers, because the faces listed in the "faceSets" files seem to be ordered in a way that differs from the one used in the "faceZones" file. Also, I am not able to open the "cellZones" and "faceZones" files which are created by the "fluentMeshToFoam" utility. They seem to be in a binary format or something like that, because gedit does not want to open them.

Another idea was to import all the regions seperately. This would not be that beatiful of course, but it would be OK as I only have to do that once. The problem with this idea is, that I don't know if putting the regions together by hand is enough for the chtMultiRegionFoam-Solver. The "splitMeshRegions" utility always craetes files called "cellToRegion" in several folders, but as I am not able to open those either, I can't estimate if they are necessary for the solver.

Has anybody an easy solution for solving this problem? If not, then can you please explain how to find out the "startFaces"-Numbers of the internal patches for me? If you can't help me there either, could you then please tell me what information the solver needs, when I try to put all regions together by hand?

Thank you so much for any suggestions!
Greetings Sebastian

sebonator December 6, 2010 15:51

Solution to my problem
 
Hi there!

As there were no replies to my thread, I had to find out the way to solve the problem on my own. Well, the solution is a bit complicated, but I think it is ok!

All you have to do is give the internal patches names and build up this "region1_to_region2"-structure on your own! It is a bit lengthy, because you have to keep all patches that devide your regions "disconnected" in GAMBIT and name one of the two patches "region1_to_region2" and the corresponding other "region2_to_region1". You don't have to care for a syntax or something like that, just give those patches names which you are able to find after the conversion. The only important thing is, that all patches receive the boundary type "wall" in GAMBIT, otherwise the "fluentMeshToFoam"-utility might leave one of the patches out.

With all the internal and external patches named in GAMBIT you can export the mesh as a .msh-file and then use the command "fluentMeshToFoam -writeZones" to convert the mesh into OenFOAMs polyMesh-format. Then use "splitMeshRegions -cellZones -overwrite" to split the Mesh into your regions and if all the naming in GAMBIT was right, you will receive all external patches AND all internal patches you named in GAMBIT in the corresponding files for your regions in your case directory! This should be the boundary-type file in "case/constant/region1/polyMesh/boundary" and the boundary conditions themselves in folder "case/0/region1/".

Hope I was able to help you!
Greetings Sebastian:D

mm.abdollahzadeh April 3, 2012 09:47

Hi,

I had tested creating the grid of diffrent zones seprately but it does not work . there seem that those file you mension like cellToregion and etc. is somehow connectiong the diffrent regions. in fact when i tried to solve my case there was an error regarding the boundary contion of the interface of diffrentzones that the interface is not the type directMappedwall.
however now with transforming the grid frm fluent to openfoam i can easily create sepratezones ( as you said). but i have one question. how is it possible to define diffrent boundry condition along the interface. imagine a solid cube in the stream of fluid which with two edges insulated?

Best
Mehdi

sebonator April 6, 2012 14:22

Hi Mehdi,

if I understand you correct, you have got two different zones (cube and fluid) and all the patches between those two regions are collected in only one interface, right?

If yes, then that is already the problem! You surely combined all faces in gambit into only one interface (I donít know the correct name of that in gambit) and then converted the mesh to OpenFOAM. Then you only receive one interface in OpenFOAM, of course.

Try it this way: combine only those faces in gambit that belong to the same interface, that means with the same transition condition for your calculation. E.g. combine all faces which will receive the convective heat transfer to the fluid and combine all faces that will be insulated in your calculation.

This way the conversion to OpenFOAM will give you two interfaces between the zones and of course you can then give them different boundary conditions!

Hope I was able to help you,
Kind regards Sebastian

mm.abdollahzadeh April 6, 2012 15:29

Quote:

Originally Posted by sebonator (Post 353480)
Hi Mehdi,

if I understand you correct, you have got two different zones (cube and fluid) and all the patches between those two regions are collected in only one interface, right?

If yes, then that is already the problem! You surely combined all faces in gambit into only one interface (I donít know the correct name of that in gambit) and then converted the mesh to OpenFOAM. Then you only receive one interface in OpenFOAM, of course.

Try it this way: combine only those faces in gambit that belong to the same interface, that means with the same transition condition for your calculation. E.g. combine all faces which will receive the convective heat transfer to the fluid and combine all faces that will be insulated in your calculation.

This way the conversion to OpenFOAM will give you two interfaces between the zones and of course you can then give them different boundary conditions!

Hope I was able to help you,
Kind regards Sebastian

Hi Sebastian

Many thanks for your kind reply. Yes your suggestio will work. but I have done another thing which also worked. I created my solid and fluid zone seprately. so the when I export my grids to openfoam all the boundray condition were untouched :). second I created the interface between diffrent solid and fluid zones manully with out spliting Mesh in openfoam.

gascortado April 15, 2012 15:48

I need your help! I created the mesh in gambit and after converting it to Foam I get the cellzones that i need. However when i run

splitMeshRegions -cellZones -overwrite

i get this:

Number of regions:2

Writing region per cell file (for manual decomposition) to "/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/constant/cellToRegion"

Writing region per cell as volScalarField to "/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/0/cellToRegion"

Region Cells
------ -----
0 60868
1 42768

Region Zone Name
------ ---- ----
0 0 fluid2
1 1 fluid1

Sizes inbetween regions:

Region Region Faces
------ ------ -----
0 1 1296

Reading volScalarField nuSgs
Reading volScalarField cellToRegion
Reading volScalarField p
Reading volScalarField C
Reading volScalarField T
--> FOAM Warning :
From function entry::getKeyword(keyType&, Istream&)
in file db/dictionary/entry/entryIO.C at line 78
Reading /home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/0/T
found on line 70 the punctuation token '*'
expected either } or EOF
--> FOAM Warning :
From function entry::getKeyword(keyType&, Istream&)
in file db/dictionary/entry/entryIO.C at line 78
Reading /home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/0/T
found on line 70 the punctuation token '/'
expected either } or EOF
Reading volScalarField k
Reading volScalarField nuTilda
Reading volVectorField U
Reading volTensorField B


Adding patches


Adding patches

For interface between region 0 and 1 added patch 8 fluid2_to_fluid1

Region 0
--------
Creating mesh for region 0 fluid2
Testing:"/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/system/fluid2/fvSchemes"


--> FOAM FATAL ERROR:
Exposed face:303431 fc:(0.997209 0.0753073 0.19) has owner region 0 and neighbour region 0 when handling region:0

From function createRegionMesh(..)
in file splitMeshRegions.C at line 798.

FOAM exiting


any idea of what I'm doing wrong?? I really appreciate any help

mm.abdollahzadeh April 15, 2012 16:39

I think you didnt put correct initial files in your 0 folder.
when you are spilititing mesh with fluent it is not nessary to creat by your own the folder of fluid and solid at the begining. but you need to have the files for all initial varibles in 0.

gascortado April 15, 2012 21:22

Hi thanks for you reply. I fixed the files and this is what i get:

Create time

Create mesh for time = 0

Trying to match regions to existing cell zones.


Number of regions:2

Writing region per cell file (for manual decomposition) to "/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/constant/cellToRegion"

Writing region per cell as volScalarField to "/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/0/cellToRegion"

Region Cells
------ -----
0 60868
1 42768

Region Zone Name
------ ---- ----
0 0 fluid2
1 1 fluid1

Sizes inbetween regions:

Region Region Faces
------ ------ -----
0 1 1296

Reading volScalarField nuSgs
Reading volScalarField cellToRegion
Reading volScalarField p
Reading volScalarField C
Reading volScalarField T
Reading volScalarField k
Reading volScalarField nuTilda
Reading volVectorField U
Reading volTensorField B


Adding patches


Adding patches

For interface between region 0 and 1 added patch 8 fluid2_to_fluid1

Region 0
--------
Creating mesh for region 0 fluid2
Testing:"/home/santiago/OpenFOAM/santiago-1.6-ext/run/Thesis/SegundaEtapa/workstationMapped/fluid/system/fluid2/fvSchemes"


--> FOAM FATAL ERROR:
Exposed face:303431 fc:(0.997209 0.0753073 0.19) has owner region 0 and neighbour region 0 when handling region:0

From function createRegionMesh(..)
in file splitMeshRegions.C at line 798.

FOAM exiting

I basically have a domain that I generated in Gambit and I need to have two different regions. Any other idea of what could be wrong? Thanks again

mm.abdollahzadeh April 16, 2012 04:15

Hi,

I think the problem is not with your grid in gambit or exporting to openfoam.
the thing is that you need to have diffrent subfolders in the system folder. and each of this folder should contain fvscheme and fvsoultion files. it is not important that what is in the fvschemes but it should be there. then after exporting your grid succusfully you can modigy those files.

sebonator April 16, 2012 12:42

hi gascortado,

I dont know the exact solution of your problem, but if you have trouble with your directory structure, then why dont you take the structure of a tutorial of e.g. chtMultiRegionFoam and adapt it for your case?

This way you can see all files and folders you need to have in order to work probably with multiple cell zones.

kind regards,
Sebastian

gascortado April 16, 2012 13:17

1 Attachment(s)
I will try to that. Thanks for the suggestion. Would you mind looking at my mesh in Gambit and tell me if you see any problem with the way I generated it? At the interface where I'm trying to split the to regions I have a wall called "1to2". I'm not sure if I need to have two walls called "1to2" and "2to1". You just have to read the journal file and thats it. Thanks

sebonator April 16, 2012 16:29

Hi gascortado,

Wow, do you really script your whole mesh with gambit? Respect... ;-)

Mhm, I did not find the error I expected in the script. I thought you might have connected the faces representing the interface between your two regions. You have to keep them seperated in gambit and should give them good names like 1to2 and 2to1 or something like that.

One thing I saw in your script: You declared the "inlet" as a velocity inlet and the "upperWall" and "outlet" as pressure outlets. Take a look at my second post in this blog:

Quote:

Hi there!

As there were no replies to my thread, I had to find out the way to solve the problem on my own. Well, the solution is a bit complicated, but I think it is ok!

All you have to do is give the internal patches names and build up this "region1_to_region2"-structure on your own! It is a bit lengthy, because you have to keep all patches that devide your regions "disconnected" in GAMBIT and name one of the two patches "region1_to_region2" and the corresponding other "region2_to_region1". You don't have to care for a syntax or something like that, just give those patches names which you are able to find after the conversion. The only important thing is, that all patches receive the boundary type "wall" in GAMBIT, otherwise the "fluentMeshToFoam"-utility might leave one of the patches out.

With all the internal and external patches named in GAMBIT you can export the mesh as a .msh-file and then use the command "fluentMeshToFoam -writeZones" to convert the mesh into OenFOAMs polyMesh-format. Then use "splitMeshRegions -cellZones -overwrite" to split the Mesh into your regions and if all the naming in GAMBIT was right, you will receive all external patches AND all internal patches you named in GAMBIT in the corresponding files for your regions in your case directory! This should be the boundary-type file in "case/constant/region1/polyMesh/boundary" and the boundary conditions themselves in folder "case/0/region1/".

Hope I was able to help you!
Greetings Sebastian:D
As you see, the faces should not be declared as anything else than "wall" in gambit. Thats simply a conversion problem to OpenFoam, I dont know if the problem has been fixed since I used all that stuff last year.

Please give an answer if you solved your problem,
Thanks and good luck,
Sebastian

gascortado April 16, 2012 19:47

Thanks a lot man for your reply. So just to clarify, lets say I have a rectangular domain that I want to separate into two regions. Then at the interface I need to have 2 faces, one for the left side and one for the right side. Those two regions must also be disconnected in Gambit. Also, all of the boundaries must be "walls" including the interfaces. Then it should work.

Please let me know if any of my statements above are incorrect. Thanks again

sebonator April 17, 2012 15:47

Hi gascortado,

almost right, but that surely is a typing error:

You wrote:

Quote:

Those two regions must also be disconnected in Gambit
But of course you have two keep the two faces that form the interface between the two regions (one belongs to region1, the other belongs to region2) disconneted!

All other statements are correct, at least for the version of OpenFOAM i used last year! I am not working with OpenFOAM at the moment, so I unfortunately don't know if the usage of the import function changed.

But you should definetely give it a try! Please let us know if it solved your problem afterwards.

Kind regards
Sebastian

Mojtaba.a July 19, 2013 04:59

Quote:

Originally Posted by sebonator (Post 285237)
Hi there!
I want to import a multi-region Mesh I created with Gambit. I know that there is an option for the "fluentMeshToFoam" utility, that is able to create cellZones from the regions I defined in Gambit. Well, this all works fine for conformal meshes (meshes, in which the cells on both sides of an interface exactly match). In that case, all the interior patches are named in a "Region1_To_Region2" manner by the "splitMeshRegions" utility and everything is fine.

Dear Sebastian,
I read the whole posts but unfortunately still I am not able to import my multi region mesh to OF.
Well I ave serious problems to do what you said above.

I have worked on this days and nights, but no success.

I have some questions:

1- Do you make multiple zones (They are not called regions in GAMBIT) in GAMBIT? I mean do you make multiple zones, in each there is a volume which will be defined as a separate region later in OF?

2- How do you define interfaces? do you put all surfaces of both sides in one boundary and call it interface?

or do you make two separates boundaries for separate regions, each contain interfaces of those regions?

3- So when you import mesh into OF do you use this command:

"fluentMeshToFoam name.msh -writeSets" ?

4- when you checkMesh does OF tells to you that:

*Number of regions: 2
The mesh has multiple regions which are not connected by any face.

Here number of regions is different case by case. This step is so important for me. As I can see in the tutorial multiRegionHeater, There is just 1 region, even after splitting it using splitMeshRegions commands !! why? aren't we supposed to have multiple regions?

5- after running fluentMeshToFoam do you have just one interface in constant/polymesh/boundary file?

as i see in multiRegionHeater tutorial there is no interface boundary in constant/polymesh/boundary, instead interfaces are just defined in for example:

constant/region0/polymesh/boundary
constant/region1/polymesh/boundary
.
.

6- until now I haven't been able to run splitMeshRegions command, correctly. I can't get region1_to_region2 type boundary conditions in my boundary files. instead I get the only interface region which was in "constant/polymesh/boundary" for each boundary files in:

constant/region0/polymesh/boundary
constant/region1/polymesh/boundary
.
.

and I have no idea if I have to change them manually.

Do you have any idea how can I get out of this problem?
Any helps are greatly appreciated.

Thank you very much,
Mojtaba

Mojtaba.a July 21, 2013 14:13

Quote:

Originally Posted by Mojtaba.a (Post 440746)
2- How do you define interfaces? do you put all surfaces of both sides in one boundary and call it interface?
or do you make two separates boundaries for separate regions, each contain interfaces of those regions?

OK, I got the solution myself. In case if anyone have problems about this in future just follow this:

- in GAMBIT there have got to be a face which is owned by both conjugate volumes. I didn't know this. I thought each volume must have its own face. so in total there will be two faces lying on each other.

- Define any boundaries as wall except the common face. define it as internal (not interface, I don't know if it works).

- export the mesh as *.msh file

- fluentMeshToFoam meshName.msh -writeSets

- setsToZones -noFlipMap

- splitMeshRegions -cellZones -overwrite

- And Hola ! You are Done :)

best

sebonator July 23, 2013 06:46

Hi mojtaba,

I am happy you found the solution on your own. Honestly, I would not have been able to help you as all my work belonging to this post was in 2010/2011 and I did not really work with OpenFOAM any more since that time.

Good luck for your future work, maybe you can keep this post alive from now on!

Best regards,
Sebastian

8529050 June 25, 2014 03:41

interface problem
 
Quote:

Originally Posted by Mojtaba.a (Post 441072)
OK, I got the solution myself. In case if anyone have problems about this in future just follow this:

- in GAMBIT there have got to be a face which is owned by both conjugate volumes. I didn't know this. I thought each volume must have its own face. so in total there will be two faces lying on each other.

- Define any boundaries as wall except the common face. define it as internal (not interface, I don't know if it works).

- export the mesh as *.msh file

- fluentMeshToFoam meshName.msh -writeSets

- setsToZones -noFlipMap

- splitMeshRegions -cellZones -overwrite

- And Hola ! You are Done :)

best


Salam Mojtaba

I have a similar problem and I checked your solution but it didn't work
I have a cylinder over a cube and due to different number of mesh on base of each volume i need to define two faces in one plece( one face for each volume) and when i import .mesh file with your method the program made a new default_wall at place of two common internal faces and deleted them.
now i have to define this new boundary for my 0 folder's files.
what type should i define it?

thank you
Mahdi

Mojtaba.a June 25, 2014 11:09

Quote:

Originally Posted by 8529050 (Post 498563)
Salam Mojtaba

I have a similar problem and I checked your solution but it didn't work
I have a cylinder over a cube and due to different number of mesh on base of each volume i need to define two faces in one plece( one face for each volume) and when i import .mesh file with your method the program made a new default_wall at place of two common internal faces and deleted them.
now i have to define this new boundary for my 0 folder's files.
what type should i define it?

thank you
Mahdi

Salam,
Dear Mahdi,

In my method, saving the mesh file will remove the internal face itself, regardless of importing into openfoam or not.
In other words in my method there is no boundary to define any type for it.
I am not sure about yours but maybe you could try to have a same face for two conjugate volumes. I think it is possible for your case.

Best


All times are GMT -4. The time now is 22:44.