## How to calculate the forces due the pressure in navier-stoke

Post processing utility for Elmer
rodrigodga
Posts: 16
Joined: 04 May 2010, 18:20

### How to calculate the forces due the pressure in navier-stoke

Hi group,

I simulated a incompressible flow through a channel with a hydrofoil in the center, modeled as a wall (3d navier-stokes).
The analysis finished without problem and i could saw the results in Elmer post, but I only could see the pressure in the walls and the velocity vector of the fluid.
How can I calculate the forces in x, y, e z coordinates in the hydrofoil due the pressure caused by the flow??

Thanks,
Rodrigo

hamed
Posts: 110
Joined: 12 Oct 2009, 18:28

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Rodrigo
Take a look at the following post, it will help much.
viewtopic.php?f=7&t=32&p=98&hilit=drag#p98
Besides:

Code: Select all

Solver 2
Exec Solver = After All
Equation = Fluidic Force
Procedure ="FluidicForce" "ForceCompute"
Calculate Viscous Force = True
End
Regards, Hamed

rodrigodga
Posts: 16
Joined: 04 May 2010, 18:20

### Re: How to calculate the forces due the pressure in navier-stoke

Hi hamed,

thank you very much for the link.
I 'm a new user of Elmer and have some doubts yet. Can you help me?
I have to add the code that you give me directly in the sif( solver 2.....), is that correct?
do I have to put the codes that Raback told in the link to?

Best regards,
Rodrigo

hamed
Posts: 110
Joined: 12 Oct 2009, 18:28

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Rodrigo
Yes, you have to add it to your sif file. Below I add two of my old sif files that will give you further help. You can follow either of them but the 1st one is more accurate. Take a special look at "boundary condition 3" where I wanted to calculate forces in both sif files.
Regards, Hamed
1-

Code: Select all

Header
Mesh DB "." "BMF"
End
Constants
End

Simulation
Coordinate System = Cartesian 2D
Steady State Max Iterations = 50
Steady State Min Iterations = 2
Output Intervals = 1
Output File = "fsi.result"
Post File = "fsi.ep"
End
Body 1
Equation = 1
Material = 1
End
Material 1
Density = 1000.0
Viscosity = 1
Youngs Modulus = Variable time
Real Procedure "FsiStuff" "Youngs"
End

Solver 1
Equation = Navier-Stokes
Stabilize = True
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Preconditioning = ILU2
Linear System Max Iterations = 500
Linear System Convergence Tolerance = 1.0e-8
Nonlinear System Max Iterations = 10
Nonlinear System Convergence Tolerance = 1.0e-5
Nonlinear System Newton After Tolerance = 1.0e-5
Nonlinear System Newton After Iterations = 20
Nonlinear System Relaxation Factor = 1.0
Steady State Convergence Tolerance = 1.0e-4
End
Solver 2
Procedure = "SaveData" "SaveScalars"
Filename = dragforce.dat
Operator 1 = boundary sum
Variable 1 = Flow Solution Loads 1
Variable 2 = Flow Solution Loads 2
End

Equation 1
Active Solvers(2) = 1 2
End

! Inlet
Boundary Condition 1
Target Boundaries = 12
Velocity 1 = Variable Time
Real Procedure "FsiStuff" "InFlow"
Velocity 2 = 0.0
Mesh Update 1 = 0.0
End

! Outlet
Boundary Condition 2
Target Boundaries = 3
Velocity 2 = 0.0
Pressure = 0.0
Mesh Update 1 = 0.0
End

! Internal boundaries
Boundary Condition 3
Target Boundaries(2) = 17 20
Velocity 1 = 0.0
Velocity 2 = 0.0
Displacement 1 = 0.0
Displacement 2 = 0.0
Save Scalars = Logical True
End

! Top and bottom
Boundary Condition 4
Target Boundaries(2) = 1 8
Velocity 1 = 0.0
Velocity 2 = 0.0
Mesh Update 2 = 0.0
End

! Beam end
Boundary Condition 5
Target Boundaries = 19
Displacement 1 = 0.0
Displacement 2 = 0.0
End

2-

Code: Select all

Header
Mesh DB "." "BMF"
End

Constants
End

Simulation
Coordinate System = Cartesian 2D
Steady State Max Iterations = 50
Steady State Min Iterations = 2
Output Intervals = 1
Output File = "fsi.result"
Post File = "fsi.ep"
End

Body 1
Equation = 1
Material = 1
End

Material 1
Density = 1000.0
Viscosity = 1
Youngs Modulus = Variable time
Real Procedure "FsiStuff" "Youngs"
End

Solver 1
Equation = Navier-Stokes
Stabilize = True
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStab
Linear System Preconditioning = ILU2
Linear System Max Iterations = 500
Linear System Convergence Tolerance = 1.0e-8
Nonlinear System Max Iterations = 10
Nonlinear System Convergence Tolerance = 1.0e-5
Nonlinear System Newton After Tolerance = 1.0e-5
Nonlinear System Newton After Iterations = 20
Nonlinear System Relaxation Factor = 1.0
Steady State Convergence Tolerance = 1.0e-4
End

Solver 2
Exec Solver = After All
Equation = Fluidic Force
Procedure ="FluidicForce" "ForceCompute"
Calculate Viscous Force = True
End

Solver 3
Exec Solver = After All
Equation = SaveScalars
Procedure = "SaveData" "SaveScalars"
Filename = "flowdata.dat"
End

Equation 1
Active Solvers(3) = 1 2 3
End

! Inlet
Boundary Condition 1
Target Boundaries = 12
Velocity 1 = Variable Time
Real Procedure "FsiStuff" "InFlow"
Velocity 2 = 0.0
Mesh Update 1 = 0.0
End

! Outlet
Boundary Condition 2
Target Boundaries = 3
Velocity 2 = 0.0
Pressure = 0.0
Mesh Update 1 = 0.0
End

! Internal boundaries
Boundary Condition 3
Target Boundaries(2) = 17 20
Velocity 1 = 0.0
Velocity 2 = 0.0
Displacement 1 = 0.0
Displacement 2 = 0.0
Calculate Fluidic Force = True
End

! Top and bottom
Boundary Condition 4
Target Boundaries(2) = 1 8
Velocity 1 = 0.0
Velocity 2 = 0.0
Mesh Update 2 = 0.0
End

! Beam end
Boundary Condition 5
Target Boundaries = 19
Displacement 1 = 0.0
Displacement 2 = 0.0
End



rodrigodga
Posts: 16
Joined: 04 May 2010, 18:20

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Hamed,
It was a great help!! thank you very much!
I have only one doubt.
Is the sif file that you sent me for a 2D simulation? Because i only saw velocities 1 and 2.
Is it possible use this calculation for a 3D analysis?

Best regards,
Rodrigo

hamed
Posts: 110
Joined: 12 Oct 2009, 18:28

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Rodrigo
Yes, my test case was a 2D simulation. I didn't try it for 3D simulations myself but I think it will also work for 3D problems. The extension from 2D to 3D must be straightforward.
Regards, Hamed

rodrigodga
Posts: 16
Joined: 04 May 2010, 18:20

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Hamed,

I tried the first metod and apparently it worked very well. The values of pressure and velocity appear to be consistent and two dat files were created, but I will need a litle help to interpret the forces results. Can you help me again?
I 'm sending attached the postpro image with the pressure results. The simulation is water passing through a fin of 110 milimeters, with velocity of 1 m\s.
I used 948 Kg\m^3 for density and 0,001 N.s \ m^2 for viscosity (default).
The forces values seems strange to me (follow below) considering the pressure. Why the values are negative? What direction are the forces?

Thank you very much for the tips and help,

regards
Rodrigo
Attachments
dragforce.txt
pressao - quilha a zero grau v 1ms.JPG (21.86 KiB) Viewed 8143 times

hamed
Posts: 110
Joined: 12 Oct 2009, 18:28

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Rodrigo
You should not be worried about the negative value for the pressure, since it's not the absolute pressure but the relative pressure(relative for example to the atmosphere pressure). Let explain it for you this way. Assume that the fluid flow is lossless so it obeys the Bernouli equation, i.e., ro*v1^/2+p1=ro*v2^/2+p2, where index 1 refers to the inlet. If in the inlet you define v1=1 and p1=0 (p=0 means the pressure is equal to the atmosphere pressure) then in some regions of airfoil that velocity increases (the blue regions in your image) the pressure value (p2) must decrease to satisfy the Bernouli equation. Since you defined p1=0, p2 will be negative and it's not wrong since it's the pressure relative to the atmosphere pressure. If you sum it with atmosphere pressure (10^5 Pa) you will have the absolute pressure which is not negative anymore.
Regards, Hamed

rodrigodga
Posts: 16
Joined: 04 May 2010, 18:20

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Hamed,

First I would like to thank you for all explanations and your patience. I'm a Mechanical Engineer, but without knowledge in CFD and you are giving me a good foundation to learn about it.
If I understood correctly: The values described in the bars of the post pro image are the relative pressure of each points of the mesh.
The procedure that you taught me generates a .dat file that contains the sum os the relative pressure for the bondaries described by me (follow below).

.dat file name
File started at: 2010/05/28 20:28:34
Variables in columns of matrix: dragforce.dat
1: boundary sum: flow solution loads 1 over bc 1
2: boundary sum: flow solution loads 1 over bc 2
3: boundary sum: flow solution loads 1 over bc 3
4: boundary sum: flow solution loads 1 over bc 4

.dat file
-2.153568617542E+003 -2.644249973207E+005 -2.980330116155E+005 0.000000000000E+000

So, if I want know the force in Newton active in the straight surface of my fin (that is the bc 2), I need to sum the atmosphere pressure (10^5 Pa) with the relative pressure sum of the bc 2 (-2,644249.... x 10^5) and multiply by the área. Is it correcty??

Is there a way to know this value automatically??

Best regards,
Rodrigo

raback
Posts: 3512
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: How to calculate the forces due the pressure in navier-stoke

Hi Rodrigo

I think Hamed was just trying to make a point that for incompressible flow the reference pressure doesn't really matter. The level is implicitely set at the outlet to be zero. However, the exact level should not have any relefance to the computed forces on the fin. They are good as they are.

Assume that you would have a constant offset to your pressure. If you take integral over the fin \int p n dA (where n is the normal vector) you can rather easily reason that the resulting force is normal to the base of the fin i.e. doesn't cause any drag. For objects fully surrounded by fluid there is no net force at all.

So your forces should be ok as they are. They are not a result of pressure offset but more of the pressure profile over the fin and the viscous drag.

-Peter