# boundary conditions for simpleFoam calculation

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

February 19, 2010, 03:49
boundary conditions for simpleFoam calculation
#1
New Member

Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
Hello everyone,

I am currently simulating the airflow over a car. I know what the results should look like, but after changing the boundary condition numerous times I am still unable to get realistic results (tried with both kepsilon model and komega model). I posted a picture of my simulation below (blended out some walls) as well as added the boundary conditions.

fvSchemes and fvSolution were taken from either the motorbike tutorial (for k omega model) or pitzDaily tutorial (k epsilon model). I am calculating with simpleFoam. R, omega and k were also taken from these tutorials.

Appreciate the help .

Patrick

P.S Which model (k epsilon / k omega model) is better for this calculation?

epsilon:

Code:
```

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

internalField   uniform 14.855;

boundaryField
{

“car_.*”
{
type            epsilonWallFunction;
value           uniform 14.855;
}

{
type            epsilonWallFunction;
value           uniform 14.855;
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
type            fixedValue;
value           uniform 14.855;
}
outlet
{
}
{
type            slip;
}
}```
nut:

Code:
```dimensions      [0 2 -1 0 0 0 0];

internalField   uniform 0;

boundaryField
{

“car_.*”
{
type            nutWallFunction;
value           uniform 0;
}
{
type            nutWallFunction;
value           uniform 0;
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            calculated;
value           uniform 0;
}
sidewall
{
type            calculated;
value           uniform 0;
}
inlet
{
type            calculated;
value           uniform 0;
}
outlet
{
type            calculated;
value           uniform 0;
}
{
type            calculated;
value           uniform 0;
}
}```
p:

Code:
```dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{

“car_.*”
{
}

{
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
}
outlet
{
type            fixedValue;
value           uniform 0;
}
{
type            slip;
}
}```
U:

Code:
```dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (27.77 0 0);

boundaryField
{
“car_.*”
{
type            fixedValue;
value           uniform (0 0 0);
}

{
type            fixedValue;
value           uniform (0 0 0);
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
type            fixedValue;
value           uniform (27.77 0 0);
}
outlet
{
}
{
type            slip;
}
}```
k:

Code:
```dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0.24;

boundaryField
{
“car_.*”
{
type            kqRWallFunction;
value           uniform 0.24;
}
{
type            kqRWallFunction;
value           uniform 0.24;
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
type            fixedValue;
value           uniform 0.24;
}
outlet
{
type            inletOutlet;
inletValue      uniform 0.24;
value           uniform 0.24;
}
{
type            slip;
}
}```
omega:

Code:
```dimensions      [0 0 -1 0 0 0 0];

internalField   uniform 1.78;

boundaryField
{
“car_.*”
{
type            omegaWallFunction;
value           uniform 1.78;
}
{
type            omegaWallFunction;
value           uniform 1.78;
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
type            fixedValue;
value           uniform 1.78;
}
outlet
{
type            fixedValue;
value           uniform 1.78;
}
{
type            slip;
}
}```
R:

Code:
```dimensions      [0 2 -2 0 0 0 0];

internalField   uniform (0 0 0 0 0 0);

boundaryField
{
“car_.*”
{
}
{
}
symmetry
{
type            symmetryPlane;
}
topwall
{
type            slip;
}
sidewall
{
type            slip;
}
inlet
{
type            fixedValue;
value           uniform (0 0 0 0 0 0);
}
outlet
{
}
{
type            slip;
}
}```
Attached Images
 simulation1.jpg (16.0 KB, 274 views)

 February 26, 2010, 02:03 #2 New Member   Patrick Wang Join Date: Dec 2009 Location: Stuttgart, Germany Posts: 26 Rep Power: 16 problem solved

 March 2, 2010, 04:04 #3 Member   Ben Racine Join Date: Mar 2009 Location: Seattle, WA, USA Posts: 62 Rep Power: 17 Do you like your drag results?

 March 2, 2010, 07:03 #4 New Member   Patrick Wang Join Date: Dec 2009 Location: Stuttgart, Germany Posts: 26 Rep Power: 16 I haven't had the chance to implement liftDrag from OF 1.2. I have to do that when I have time. If you know a different way to calculate the drag coefficient with OF please share .

 March 2, 2010, 14:37 #5 Member   Ben Racine Join Date: Mar 2009 Location: Seattle, WA, USA Posts: 62 Rep Power: 17 functions { forces { type forces; functionObjectLibs ("libforces.so"); outputControl timeStep; outputInterval 1; patches (OBJECT_OBJECT); pName p; Uname U; log true; rhoName rhoInf; rhoInf 1.17; magUInf 0.0045; CofR (1.25 0 4); } forceCoeffs { type forceCoeffs; functionObjectLibs ("libforces.so"); outputControl timeStep; outputInterval 1; patches (OBJECT_OBJECT); pName p; Uname U; log true; rhoName rhoInf; rhoInf 1.17; magUInf 0.0045; CofR (1.25 0 4); liftDir (0.0 1.0 0.0); dragDir (1.0 0.0 0.0); pitchAxis (0 0 0); lRef 0.5; Aref 12.56; } I use something like this in my /system/controlDict file. You must alter for your case, but this is a start. I'm not sure in which version that a forces function object (vocabulary?) was introduced off-hand. Regards, Ben Racine

 March 2, 2010, 14:50 #6 Member   Ben Racine Join Date: Mar 2009 Location: Seattle, WA, USA Posts: 62 Rep Power: 17 The following thread is the reference for the above statements. http://www.cfd-online.com/Forums/ope...es-v1-6-a.html

 March 3, 2010, 06:10 #7 New Member   Patrick Wang Join Date: Dec 2009 Location: Stuttgart, Germany Posts: 26 Rep Power: 16 Hey Ben, Thanks for the code. I tried it and it worked without any problems. I have a couple of question regarding this code. 1. Which patches should I use for my simulation? Do I use every patch that defines the vehicle (I split the car into multiple parts: wheels, windshields and so on)? 2. And what is lRef? How do I calculate it? 3. Do you know a method for calculating Aref? Appreciate the help Patrick Wang

 March 3, 2010, 20:17 #8 Member   Ben Racine Join Date: Mar 2009 Location: Seattle, WA, USA Posts: 62 Rep Power: 17 1. Which patches should I use for my simulation? Do I use every patch that defines the vehicle (I split the car into multiple parts: wheels, windshields and so on)? Yes 2. And what is lRef? How do I calculate it? I believe it's the the length-scale used for finding Re number. 3. Do you know a method for calculating Aref? Aref is probably best done by doing a 2D frontal area projection of your surface model in some CAD package... as I believe it's typical to use frontal area in vehicle aerodynamics when calculating drag coefficients. Hope this helps and someone can correct if I'm wrong anywhere. Ben

 July 1, 2015, 08:07 baklanton #9 New Member   Anton Join Date: Nov 2014 Posts: 2 Rep Power: 0 Hi Patrick, I am also experiencing an issue which is similar to the one you explained in your first post. Could you please explain how you solved it? Thank you!