CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Can OpenFOAM give an resistance/velocity curve as output? (

lim August 1, 2011 13:05

Can OpenFOAM give an resistance/velocity curve as output?
Dear all

I'm new with openFOAM and I'm trying to simulate te resistance of a small boat in OpenFOAM after it didn't succeed in FLOW3D due to the inability to simulate skin friction.
I'm quite new so I want to now:
  1. Is it possible to get a resistance/velocity curve out OpenFoam?
  2. Has someone simulated boat resistances before?
  3. Is the solution accurate?
Thanks in advance


daveatstyacht August 1, 2011 15:10

In answer to your questions:
1) Yes it is possible to develop a series of runs at different speeds to develop a resistance curve for a hull (you need to have different boundary layer meshes at each speed to maintain the same y+ value).
2) You can use either interFoam or LTSinterFoam for fixed heave and trim cases or interDyMFoam for cases where trim and heave matter (though with some effort and no guarantee of it being entirely stable). Alternatively consider using the modified solver shipFoam.
3) The solution accuracy is only as good as your mesh, boundary conditions and solver setting permit which in large part comes down to experience. If those are good your accuracy should be as well. Consider using a standard validation case such as a Wigley hull as a way to validate your setup is correct and if possible validate against tank test data of your actual hull if available.

Surfboy September 5, 2011 17:54

how to get the resistance?
how do i use shipFoam?

and if i use LTSInterFoam and get U and P, how can i calculate the resirance?

is there a solver/code for that? or i need to go to matlab and integrate the data for the pressure and velocity?..


daveatstyacht September 5, 2011 19:03

The integration of forces can be done using the forces library. You place in the controlDict file:

type forces;
functionObjectLibs ("");
log true;
outputControl timeStep;
outputInterval 5;
patches (hull); //Name of patche to integrate forces
rhoInf 1025.0; //Reference density for fluid - can be changed later ...
CofR (-3.23 0 1.21); //Origin for moment calculations

For more details, about the forces library search "forces in OF 1.6" (might be OF 1.5, I forget which) in the forum. There is a example file set for shipFoam in the ship OF hydrodynamics group, though you should know that shipFoam currently doesn't work for OF 1.7 or 2.0, though it does work in 1.6.

parkh32 May 10, 2012 05:15

Hi daveatstyacht

I'v run the Foam with the "controlDict" and got the "forces" and "forceCoeffs" folders. Each folder has "forces.dat" and "forceCoeffs.dat". Could you give me some guides how to visualize the data?



lovecraft22 May 10, 2012 06:00

You can load those data within whatever software you like and then plot them…
Some examples:
libreoffice calc
openoffice calc

parkh32 May 10, 2012 06:11



parkh32 May 10, 2012 18:06


Do you have any reference to interpret the result of calculations (forces and forceCoeffs)?

thanks again


lovecraft22 May 11, 2012 04:05

The first column is the iteration/time, the second one is the force/force coefficient.

parkh32 May 11, 2012 05:50


sorry for uncertain question, English is my second language.

I mean,

1) In "forces.dat", can i calculate "pressure force" and "viscous force" at specific time as "Pf= SRT[(Pf_x)^2 + (Pf_y)^2 +(Pf_z)^2]" and "Vf= SRT[(Vf_x)^2 + (Vf_y)^2 +(Vf_z)^2]" ?
and is Total_forces on the hull surface, "Tf= Pf + Vf" ?

2) In "forcesCoeffs.dat", Cd, Cl, and Cm are just coefficients, right? How can I use these coefficients to calculate Resistance, Lift, and Pitch ? I think frictional resistance of hull can be calculated as "(1/2)*rho*(v^2)*wetted_surface_area*Cd".

3) In each file, there are "forces" and "coefficients" for each iteration. The last iterated value is used to calculate forces or drag for the hull ? or calculate each forces or drag at each iteration then sum whole iteration ?

thanks again,


parkh32 May 16, 2012 03:27

Hi lovecraft22

Do you have any comment about above post?



lovecraft22 May 16, 2012 03:54

1. Don't have experience on free surface flow. Anyway what you get in forces is the total force, i.e. pressure and viscous force.

2. Yes, depending on how you define them you should change the reference area.

3. You should use the values for some converged iterations and the average them. Let's say your simulation converged at time 1000. Keep it running until time 1500 then average the last 500 values.

parkh32 May 16, 2012 04:03


in "forces.dat", there are "force(viscous, pressure)" and "moment(viscous, pressure)".

# Time forces(pressure, viscous) moment(pressure, viscous)
10 (((-115911 -9821.58 -1.76054e+06) (477.818 0.216173 -22.1441)) ((8560.4 6.33051e+06 -35146.9) (-2.9727 466.215 16.1051)))
20 (((10768.1 182.562 166635) (455.248 0.138734 -11.4165)) ((-1585.44 -703266 1934.63) (-2.10171 392.186 12.8028)))
30 (((5886.75 -4.82486 131072) (433.074 0.192013 -4.92419)) ((143.617 -875162 -240.688) (-1.58389 350.027 12.3352)))


parkh32 May 16, 2012 04:08

2. Yes, depending on how you define them you should change the reference area.

--> in my case, the reference area is hull wetted_surface_area.

parkh32 May 16, 2012 04:16

3. You should use the values for some converged iterations and the average them. Let's say your simulation converged at time 1000. Keep it running until time 1500 then average the last 500 values.

--> i got the "forceCoeffs.dat" as below, for instance, to calculate Drag of the hull, Cd is average value of (Cd@10 + ....+Cd@300)/30 ?

# Time Cd Cl Cm
10 0.000128828 -1.98816e-06 2.01831e-06
20 6.78435e-05 -7.86827e-07 3.79263e-07
30 5.26177e-05 6.45394e-07 5.54262e-07
40 4.73338e-05 1.32233e-06 3.19874e-07
50 4.66191e-05 2.57221e-07 5.23645e-07
60 4.69513e-05 -1.30883e-06 7.36664e-07
70 4.87506e-05 -2.55959e-06 9.88149e-07
80 5.18026e-05 -5.86174e-06 1.40848e-06
90 5.50988e-05 -7.95755e-06 2.02403e-06
100 5.82616e-05 -1.18472e-05 2.42179e-06
110 6.24615e-05 -1.48948e-05 3.16372e-06
120 6.67133e-05 -1.71842e-05 3.69373e-06
130 7.01388e-05 -2.16093e-05 3.88813e-06
140 7.37891e-05 -2.29909e-05 4.06339e-06
150 7.88668e-05 -2.15329e-05 3.43333e-06
160 8.11324e-05 -2.05101e-05 2.83645e-06
170 8.33297e-05 -1.70105e-05 1.6466e-06
180 8.39984e-05 -9.09247e-06 1.45903e-07
190 8.49289e-05 -6.11879e-07 -1.09168e-06
200 8.51563e-05 7.23095e-06 -1.76413e-06
210 8.39894e-05 1.14279e-05 -1.89112e-06
220 8.31182e-05 1.49578e-05 -1.98931e-06
230 8.18796e-05 1.62699e-05 -1.88601e-06
240 8.0021e-05 1.76896e-05 -1.97983e-06
250 7.93598e-05 2.16389e-05 -2.34374e-06
260 7.80435e-05 1.94241e-05 -2.54275e-06
270 7.87433e-05 1.72517e-05 -2.01372e-06
280 7.56193e-05 2.29923e-05 -2.81159e-06
290 7.38596e-05 2.18482e-05 -2.97748e-06
300 7.23155e-05 2.42475e-05 -2.92539e-06

All times are GMT -4. The time now is 14:59.