# Python script to find drag force on a 2D object given differential pressure vectors

#### jeremyrosh

I am in need of a python program to calculate the drag force on a 2D object, given differential pressure acting on the object-- this will have to be calculated either manually or (hopefully) by the code. I have the exact location of each pressure vector via a .dat file, and would like to know the drag on the object by most probably integrating the pressure over area ( I think solving the Naiver-Stokes equations or other formulas wouldn't be useful for this problem). The original fluid modeler /mesher program that I will need to import the data from, outputs data which can be visualized using a program like ParaView. The program works by creating time steps, of which there are 23, before a stead state is reached. Please let me know any information you all have as to how I should solve this problem /help me by writing the code.
I have very little programming experience, so I will need to figure out a lot of things 'on the job'.

#### Woody

The basic algorithm for finding a force from a pressure is simply:
the pressure multiplied by the area the pressure is acting over.

You have a number of pressures acting over a shape.
For each of the pressures you have to decide what portion of the shape that particular pressure applies to, and thus what area it is acting over.

This gives you a list of pressures and their associated areas,
from which you can readily calculate the force applied by each pressure.

However, the Force is generated Normal to the local surface
(Normal is a term used to indicate directly up and down relative to the surface)
In other words at 90 degrees to the (average) surface of the area over which the pressure is acting.

You want the drag.
Thus you have to resolve the Forces acting over each area to derive just that portion that is acting in the windward direction .

Then finally just add all the windward forces together to get the drag.

Last edited: