# setFieldsDict, alpha1, free surface, wigley

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

 March 17, 2011, 06:33 setFieldsDict, alpha1, free surface, wigley #1 New Member   Join Date: Feb 2011 Posts: 8 Rep Power: 10 Dear Foamers, Can anyone give me a hint on what I am doing wrong. It seems that the "water is running out of the box" Please have a look at the pictures: The first picture is showing the alpha1 status just after running the setFields command. (pre-solving) alpha1-a.jpg I don't understand why the "XMAX wall" is blue (indicating it is air)? The second picture shows what happen when I run the interFoam command and have it running for some time. alpha1-b.jpg /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object setFieldsDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // defaultFieldValues ( volScalarFieldValue alpha1 0 volVectorFieldValue U (1 0 0) ); regions ( boxToCell { box (-30 0 -30) (40 30 0.0); fieldValues ( volScalarFieldValue alpha1 1 ); } ); // ************************************************** *********************** // Thank you very much in anticipation.

 March 17, 2011, 08:26 #2 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,852 Rep Power: 32 Hi Could you also please supply us with the following information: The mesh bounding box (can be obtained by running checkMesh) The direction of the gravitational vector Boundary conditions for U, pd and alpha1 Best regards, Niels

March 17, 2011, 08:59
#3
New Member

Join Date: Feb 2011
Posts: 8
Rep Power: 10
Quote:
 Originally Posted by ngj Hi Could you also please supply us with the following information: The mesh bounding box (can be obtained by running checkMesh) The direction of the gravitational vector Boundary conditions for U, pd and alpha1 Best regards, Niels
(Det ser ud til vi har baade navn, nationalitet og uddannelse tilfaeldes, jeg hedder ogsaa niels :-)

I am quite new to OF and have a lot to learn. I have made a copy of the files below:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
points: 33201
faces: 92612
internal faces: 85948
cells: 29760
boundary patches: 7
point zones: 0
face zones: 0
cell zones: 0

Overall number of cells of each type:
hexahedra: 29760
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0

Checking topology...
Boundary definition OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
Patch Faces Points Surface topology
HULL 420 465 ok (non-closed singly connected)
XMAX 480 527 ok (non-closed singly connected)
XMIN 480 527 ok (non-closed singly connected)
YMIN 1440 1547 ok (non-closed singly connected)
YMAX 1860 1953 ok (non-closed singly connected)
ZMAX 992 1071 ok (non-closed singly connected)
ZMIN 992 1071 ok (non-closed singly connected)

Checking geometry...
Overall domain bounding box (-30 -9.46866e-07 -30) (40 30 1.15792e-12)
Mesh (non-empty, non-wedge) directions (1 1 1)
Mesh (non-empty) directions (1 1 1)
Boundary openness (-4.96357e-20 -2.4147e-18 4.46937e-19) OK.
Max cell openness = 2.58764e-16 OK.
Max aspect ratio = 23.3959 OK.
Minumum face area = 0.0390652. Maximum face area = 14.8095. Face area magnitudes OK.
Min volume = 0.0261406. Max volume = 35.3769. Total volume = 62964.9. Cell volumes OK.
Mesh non-orthogonality Max: 61.9371 average: 10.5219
Non-orthogonality check OK.
Face pyramids OK.
Max skewness = 1.68738 OK.

Mesh OK.

Gravity:
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -2 0 0 0 0];
value ( 0 0 -9.81 );
// ************************************************** ******* //

U file:

FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];
internalField uniform (1 0 0);
boundaryField
{
HULL { type slip; }
XMIN { type fixedValue; value uniform (7.86 0 0); }
YMIN { type symmetryPlane; }
YMAX { type slip; }
ZMAX { type slip; }
ZMIN { type slip; }
}

p_rgh file:

FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
XMAX
{ type fixedValue;
value uniform 0;
}
YMAX { type slip; }
YMIN { type symmetryPlane; }
ZMAX { type slip; }
ZMIN { type slip; }
}

Thank you very much in anticipation.

 March 17, 2011, 09:16 #4 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,852 Rep Power: 32 Hi Niels Some things, which might cause problems: 1. Your bounding box is larger than your computational domain. Try using larger values in the two horizontal directions than strictly necessary, e.g x\in [-10000 10000]. 2. Your velocity in setFieldsDict differ from the value on the xmin boundary. This will definitely cause problems, i.e. chock waves. 3. You write that the water flows out of xmax, but as the x-coordinate of xmax appears to be smaller than xmin (your first figure) and xmin is your inlet, then the velocity on this boundary is in the wrong direction. Thus your inlet is a sink, oops 4. Why are you using the surface tracking methods if you are filling the computational domain completely with water? 5. What are the boundary conditions for alpha1? Hope it helps, Niels P.S. Hvor arbejder du med dette problem? Jeg er bare nysgerrig, da det altid er spændende at høre om virksomheder, som bruger OF.

 March 17, 2011, 09:30 #5 New Member   Join Date: Feb 2011 Posts: 8 Rep Power: 10 Hej Niels, Thank you very much for this valuable information! I am going to look into the issues you mentioned. The reason I have the domain full of water was a panic try. I will for sure have a air layer on top of the water surface. So fare I have little clue of what I am doing - but I try to learn... And yes I forgot to present the alpha1 BC: dimensions [0 0 0 0 0 0 0]; internalField uniform 1; boundaryField { XMAX { type zeroGradient; } YMAX { type zeroGradient; } YMIN { type symmetryPlane; } XMIN { type zeroGradient; } ZMAX { type zeroGradient; } ZMIN { type zeroGradient; } HULL { type zeroGradient; } } Thank you so much for your help! NB Jeg tror jeg har fundet dig paa LinkedIn - Du er PhD paa DTU og har arbejdet for DHI? (Vi kan fortsaette samtalen der)

 March 17, 2011, 09:34 #6 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,852 Rep Power: 32 Ok, good luck. Please do not hesitate to ask questions. - Niels P.S. Ja, det er mig, men lad os tage diskussionen her i forummet og på engelsk, så andre også kan lære noget, hvis de støder ind i lign. problemer.

March 17, 2011, 09:42
#7
New Member

Join Date: Feb 2011
Posts: 8
Rep Power: 10
Quote:
 Originally Posted by ngj Ok, good luck. Please do not hesitate to ask questions. - Niels P.S. Ja, det er mig, men lad os tage diskussionen her i forummet og på engelsk, så andre også kan lære noget, hvis de støder ind i lign. problemer.

Ja vi fortsaetter med OF kommunikationen her.
Jeg mente mht hvor jeg arbejde og hvad jeg lave etc. kan vi kommunikere over LinkedIn.

But for now I have work to do. Will come back on this topic as soon I have progress.

Thank you.

March 17, 2011, 10:50
#8
New Member

Join Date: Feb 2011
Posts: 8
Rep Power: 10
Quote:
 Originally Posted by ngj Hi Niels Some things, which might cause problems: 1. Your bounding box is larger than your computational domain. Try using larger values in the two horizontal directions than strictly necessary, e.g x\in [-10000 10000]. 2. Your velocity in setFieldsDict differ from the value on the xmin boundary. This will definitely cause problems, i.e. chock waves. 3. You write that the water flows out of xmax, but as the x-coordinate of xmax appears to be smaller than xmin (your first figure) and xmin is your inlet, then the velocity on this boundary is in the wrong direction. Thus your inlet is a sink, oops 4. Why are you using the surface tracking methods if you are filling the computational domain completely with water? 5. What are the boundary conditions for alpha1? Hope it helps, Niels P.S. Hvor arbejder du med dette problem? Jeg er bare nysgerrig, da det altid er spændende at høre om virksomheder, som bruger OF.
Niels,

you wrote:

1. Your bounding box is larger than your computational domain. Try using larger values in the two horizontal directions than strictly necessary, e.g x\in [-10000 10000].

I am not sure how to correct the problem. Where do I control the size of the computational domain? I have not generated the mesh my self. (I have just taken it from some examples from this forum.

I am not quite sure what you mean with : e.g x\in [-10000 10000]

Sorry for my very basic questions.

Best regards,
Niels

 March 17, 2011, 11:43 #9 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,852 Rep Power: 32 Hi Niels In the setFieldsDict you merely extend the box to very large dimensions, so e.g. do Code: box (-1000 -1000 -1000) (1000 1000 seaLevel); then you are completely sure, that the computational domain in the horizontal directions is within the part, where you want to have water. Bests, Niels

 October 23, 2013, 16:14 Setfields not changing the field value #10 New Member   anonymous Join Date: Oct 2013 Posts: 9 Rep Power: 8 I am using setFields but value of the field for region(axisymetric) which I am defining in the setfields is not changing.My T file in 0 stil has ""internalField uniform 278;"" I dont know why it is not changing.I am also running the command setFields. My setFileds file is as : /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object setFieldsDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // defaultFieldValues ( volVectorFieldValue U ( 0 0 0 ) volScalarFieldValue T 278. volScalarFieldValue p 1 ); regions ( boxToCell { box ( 9.5 0 0) ( 10.5 0.4 0.1 ) ; fieldValues ( volScalarFieldValue T 2000 volScalarFieldValue p 10 ) ; } ); // ************************************************** *********************** //

April 3, 2015, 06:05
How to define set fields for two volumes
#11
New Member

Join Date: Mar 2015
Posts: 15
Rep Power: 6
Dear all,

I have a geometry similar to the picture attached. I have generated the mesh in ICEM CFD and imported to OpenFOAM.

How to set intial value for air and liquid ?

Regards,
Sam
Attached Images
 model.jpg (26.0 KB, 31 views)

 Tags freesurface, setfieldsdict, ship, wigley