CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   matching imported mesh and boundary conditions in "0" (http://www.cfd-online.com/Forums/openfoam-pre-processing/90302-matching-imported-mesh-boundary-conditions-0-a.html)

Stephy July 6, 2011 14:00

matching imported mesh and boundary conditions in "0"
 
Hello all,
I have a problem after importing my mesh.neu from Gambit. As it is imported from Gambit, it does not need a BlockMeshDict to work (as far as I noticed, but I might be wrong). So then, I have a problem when it comes to match this mesh with the files in the "0" folder, the boundary conditions like for 'p' or 'U'. How should I fil them to make them correspond to my mesh ? I have not really any wall and wall type defined as I did it in Gambit.

Could someone help me and tell me how to make it work ?

thank you very much !!

Stephy

Stephy July 8, 2011 19:06

I still cannot make it work.... anybody has an idea ?
thank you very much ! :-)

Stephy July 8, 2011 19:34

OpenFoam says, for "icoFoam" for example:
Create time
Create mesh for time=0
Reading TransportProperties
Reading field p

--> FOAM FATAL IO ERROR:
keyword wall is undefined in dictionary ".../0/p::boundaryField"
file: /home/.../0/p::boundaryField from line 25 to line 35.
From function dictionary::subDict(const word& keyword) const
in file db/dictionary/dictionary.C at line 461.
FOAM exiting


Could someone help me and tell me how to make it work ?

thank you very much !!

bigphil July 9, 2011 17:41

Hi Stephy,

To get a Gambit mesh (.neu) into OpenFOAM, first while inside the case
Code:

gambitToFoam meshFile.neu
You then need to edit the "./constant/polyMesh/boundary" file and change your boundary types to the correct type. I think gambit will probably set all the patch types to "patch" or "wall" or something like that so change them to what you want them to be i.e. wall, fixedValue, symmetryPlane, empty, etc..

Then you need to set your initial conditions in the "./0" directory. "icoFoam" wants initial conditions for pressure, "./0/p", and velocity, "./0/U", so you need to set up these files with the boundary conditions you want, with a boundary conditions for each of your patches, check out the icoFoam tutorial to see how to setup p and U initial conditions.
The error you are getting from icoFoam is because it cannot find the p initial condition for a patch called wall by the looks of things.

Hope it helps,
Philip

Stephy July 9, 2011 22:34

Philip,

Thank you very much for your help, it helps a lot as now I know where to look at. When you say

Quote:

Originally Posted by bigphil (Post 315466)
Hi Stephy,

To get a Gambit mesh (.neu) into OpenFOAM, first while inside the case
Code:

gambitToFoam meshFile.neu
You then need to edit the "./constant/polyMesh/boundary" file and change your boundary types to the correct type. I think gambit will probably set all the patch types to "patch" or "wall" or something like that so change them to what you want them to be i.e. wall, fixedValue, symmetryPlane, empty, etc..

in my boundary file there is only one thing:

FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

1
(
wall
{
type patch;
nFaces 18922;
startFace 229789;
}
)

But I clearly defined the boundary condition with Gambit (I am used to mesh with Gambit so I am sure of that, at least). The only file where I can see a part of my boundary conditions is in my mesh.msh at the very last lines:

(0 "Cells:")
(12 (0 1 1d349 0))
(12 (2 1 1d349 1 2))

(0 "Zones:")
(45 (2 fluid fluid)())
(45 (3 interface interface.4)())
(45 (4 mass-flow-inlet mass_flow_inlet.3)())
(45 (5 outflow outflow.2)())
(45 (6 wall wall.1)())
(45 (8 interior default-interior)())

But using this, I have absolutely no idea of what values to put in the boundary file
for "nfaces" and "startFace".... I also have the mesh.neu file, but I couldn't find any clear info about my boundary condition in it...

Do you know what should I do to fill correctly my boundary file ?

again, thank you very much for your help, it's very precious.

Stephy

bigphil July 10, 2011 06:15

Stephy,

The boundary patches must be defined separately in Gambit for them to appear in the 'constant/polyMesh/boundary' file. If your 'myMesh.msh' file definitively has the boundaries then import that mesh into OpenFOAM using the command:
Code:

fluentMeshToFoam myMesh.msh
Then check if the separate boundaries are in the 'constant/polyMesh/boundary' file.

I think your 'mesh.neu' doesn't have any boundaries defined maybe because Gambit deleted all the boundaries when you change solver type at the top of Gambit.

Philip

Stephy July 10, 2011 16:50

Philip,

Thank you again for your help, you were completely right, Gambit reset the boundary conditions when I changed the solver. So now I have my correct boundary file, like this:
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

4
(
wall
{
type wall;
nFaces 11332;
startFace 229789;
}
outflow
{
type patch;
nFaces 446;
startFace 241121;
}
inflow
{
type patch;
nFaces 452;
startFace 241567;
}
freesurface
{
type patch;
nFaces 6692;
startFace 242019;
}
)

I am currently trying to figure out how what to put instead of "patch" and how to fill "p" and "U". Do you know if there is a type that corresponds to a non-slip condition at the surface (for my hull and my bottom floor, noted "wall". by the way, should I separate them in two different "wall" ?) ? I saw people using "zerogradient" but doesn't that mean that they are using a slip condition ?

I am also wondering what to put for the freesurface (which is the top surface of my mesh). As I want to represent the water elevation/trough around the hull, I am still not sure if I am doing the correct things as I guess the flow cannot go outside the mesh...

Do you have any idea ?

again, thank you very much for your help,

Stephy

bigphil July 10, 2011 17:24

Stephy,


That's good that the mesh is now in OpenFOAM.

As regards boundary conditions, you should check what boundary conditions are used in the tutorial cases for the solver you are using. Check out the cavity tutorial boundary conditions (it's in the User Guide).

If you are still unsure then search this forum for posts about boundary conditions for solver eg "icoFoam boundary conditions".

You could also try google.

If you are still unsure then create a post and there are lots of smart people here who will help you (Unfortunately I don't deal much with fluids so can't help you with the boundary conditions).

If you would like to model a free surface then you should check out interFoam and the damBreak tutorial (in the User Guide).


Hope it helps,
Philip

Stephy July 10, 2011 22:41

Philip,

I am trying to run my mesh in the most basic case, using icoFoam and looking closely to the cavity case. I managed to find how to fill "p" and "U" to make OpenFoam go to computations, but now here is what I get:

Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.1

Courant Number mean: 0.000506547 max: 0.315347
DILUPBiCG: Solving for Ux, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 3.31525e-08, No Iterations 2


--> FOAM FATAL ERROR:
Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux : 41.8405
Specified mass inflow : 0
Specified mass outflow : 185.25
Adjustable mass outflow : 0


From function adjustPhi(surfaceScalarField& phi, const volVectorField& U,const volScalarField& p
in file cfdTools/general/adjustPhi/adjustPhi.C at line 116.

FOAM exiting
-------

and my "p" and "U" are as follow:

p:
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
wall
{
type buoyantPressure;
}

outflow
{
type freestreamPressure;
}

inflow
{
type freestreamPressure;
}

symmetry
{
type zeroGradient;
}
}
---------

U:
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
wall
{
type fixedValue;
value uniform (0 0 0);
}

outflow
{
type zeroGradient;
}

inflow
{
type fixedValue;
value uniform (0 0 1);
}

symmetry
{
type zeroGradient;
}
}
------
"symmetry" corresponding to the free surface.
I tried to run potentialFoam but I get "--> FOAM FATAL IO ERROR:
keyword potentialFlow is undefined in dictionary ..[...]... FOAM Exiting".

Please let me know if you have any suggestion about this issue,

thank you very much,

Stephy

bigphil July 11, 2011 07:57

Hi Stephy,


That's good that you are able to run your solver now albeit with errors.

As I said I don't know much about the correct boundary conditions for icoFoam but I imagine they are the cause of your continuity error.

By the way, after importing your mesh into OpenFOAM it is always a good idea to run
Code:

checkMesh
This will check the quality of your mesh and check for any mesh errors.

Maybe some body else here could help you better with your boundary conditions, maybe start a new thread (with a nice clear title like what boundary conditions for icoFoam or something like that) and there are lots of people who know their stuff who will help.


Philip


All times are GMT -4. The time now is 23:27.