CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to Create .msh file so that when converted to OpenFOAM will have some BC (https://www.cfd-online.com/Forums/openfoam/102856-how-create-msh-file-so-when-converted-openfoam-will-have-some-bc.html)

jaypatel June 4, 2012 14:49

How to Create .msh file so that when converted to OpenFOAM will have some BC
 
Hi all, I am a beginner in OpenFOAM. I want to know how we can create .msh (Fluent mesh file) so that it contains some details about Boundary Conditions. On OpenFOAM website it is told that Fluent BC may not have complete decoding using OpenFOAM. If I am Creating any mesh file in the Boundary file of case problem, I am having following output:
1
(
wall-solid
{
type wall;
nFaces 640;
startFace 1930;
}
)


I want it to be something like this automatically:
3
(
movingWall
{
type wall;
nFaces 20;
startFace 760;
}
fixedWalls
{
type wall;
nFaces 60;
startFace 780;
}
frontAndBack
{
type empty;
nFaces 800;
startFace 840;
}
)


Hoping for solution
Thanks,
Jay

fs82 June 6, 2012 08:30

As far as I know it is not a good idea to define a specific boundary conditions when creating the Fluent Mesh file. You should define all boundaries you would like to have as wall when creating the Fluent Mesh file. After conversion with fluentMeshToFoam you will have your boundaries available in OF named like you defined it in your Fluent mesh file. Then change the ones which are no walls to type "patch" and apply the BC in the specific field file (U,p, and so on).

Kind regards,
Fabian

jaypatel June 6, 2012 10:55

Hi Fabian,

Thanks for quick reply. I didn't get you when you say "OF named". I tried name selection after I created the mesh to name various surfaces which I am going to give special BCs and what it does is creation of new file (.mshdb, which is a mesh database file). I don't know any way by which I can have these informations written on .msh file itself.

As I told in earlier post that by default I am getting only one Boundary and that to with a Boundary condition of wall. I want to know the way I can get more Boundaries and then I can change there BC's using patch option.

Thanks,
Jay

fs82 June 6, 2012 11:53

Which program do you use to create the mesh?

jaypatel June 6, 2012 11:57

I used ANSYS Fluent, so I have .msh file. I change the environmental variable AWP_WRITE_FLUENT_MESH_ASCII=1, so I am getting output .msh file in ASCII instead of Binary.

Thanks,
Jay

falke126 June 6, 2012 12:02

As far as I know, Fluent is no meshing program...

Did you mean ANsys Meshing?

jaypatel June 6, 2012 12:06

Yes, I used ANSYS Meshing. But we have various output formats of mesh in ANSYS itself. I used the mesh generated by ANSYS Meshing for Fluent Solver and not for CFX or Polyflow solver. So I used the term Fluent Mesh.

Thaks,
Jay

fs82 June 6, 2012 12:07

Mmh I only know Gambit, but the basic principle should be the same. You create your geometry, mesh it and define your BCs with ANSYS Fluent. Define every BC you need, e.g. a for a cube each of the six sides. Define each BC of type "Wall" and give it a unique name, e.g. "side 1", "side2" and so on. Do not use the other Fluent BCs, only walls. Export the mesh as Fluent 5/6 .msh file and convert it with fluentMeshToFoam. Then you should have a look into the file <OF-case-dir>/constant/polyMesh/boundary
There should be a list of all boundaries with the unique name you specified when created the BCs in ANSYS Fluent. But all of them are of type "wall". It should look like this:

bottom
{
type wall;
nFaces 90000;
startFace 32238000;
}
top
{
type wall;
nFaces 90000;
startFace 32328000;
}
So change the type by hand to "patch" for every BC which is not a wall and your done. The type "patch" could be every boundary condition you would like to specifiy in a volVectorField. Look into the handbook for more details.

falke126 June 6, 2012 12:08

Quote:

Originally Posted by jaypatel (Post 365042)
Thanks for quick reply. I didn't get you when you say "OF named". I tried name selection after I created the mesh to name various surfaces which I am going to give special BCs and what it does is creation of new file (.mshdb, which is a mesh database file). I don't know any way by which I can have these informations written on .msh file itself.

I guess that you use Ansys Meshing...

You have to define Named Selections. Then use the export function to export the *.msh.
You will see that the named selections are available as patches in OF.

fs82 June 6, 2012 12:12

Ah ok this seems to be a problem with Ansys Meshing and not with the conversion of the mesh between Ansys and OpenFoam. So I am out :-D because I never used Ansys Meshing.

kind regards,
Fabian

jaypatel June 6, 2012 12:29

I got it. The solution is name the surfaces first and then create mesh.
Thanks for your help Fab.
Jay

jaypatel June 7, 2012 11:33

Thanks Hanes..

ansab December 5, 2016 12:29

Quote:

Originally Posted by jaypatel (Post 365060)
I used ANSYS Fluent, so I have .msh file. I change the environmental variable AWP_WRITE_FLUENT_MESH_ASCII=1, so I am getting output .msh file in ASCII instead of Binary.

Thanks,
Jay

Hello, can you please specify the process how to set the environment variable. I am quite new to this stuff. Thanks in advance

deepbandivadekar November 9, 2017 08:44

Quote:

Originally Posted by ansab (Post 628396)
Hello, can you please specify the process how to set the environment variable. I am quite new to this stuff. Thanks in advance

If anyone still stumbles across this, in the latest 18.2 version, you can set this from
Code:

Tools->Options->Export->"Format of Input File" and select ASCII
in the ANSYS Meshing module.


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