rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
compute_pressure.m
1 function p = compute_pressure(model, gradx, grady)
2 %
3 % function, computing the pressure according to bernoulli equation on every
4 % point of a grid
5 % this function is adapted to the porsche_model
6 %
7 % input:
8 % model
9 % gradx : x-vector of the gradient of the solution of the PDE (physically
10 % this is the x-coordinate of the velocity-field in every point
11 % of the grid
12 % grady : y-vector of the gradient of the solution of the PDE (physically
13 % this is the x-coordinate of the velocity-field in every point
14 % of the grid
15 %
16 % needed fields of model:
17 % model.speed : defining the speed of the car, that means the speed of the
18 % air on the left boundary
19 %
20 % output:
21 % p: vector with the pressure according to bernoulli equation
22 %
23 %
24 %
25 p_in = 101325; % standard pressure in pascal = kg/(m*s²) = N/m2
26 rho = 1.2041; % airdensity in kg/m3
27 u_in_sqr = model.speed^2 * 3.6^2; % model.speed is
28  % in km/h, so conversion to m/s2 is needed
29 abs_vel_sqr = (gradx.^2 + grady.^2) * 3.6^2;
30  % absolute value of velocity square for every point in m/s2
31 p = (p_in + 0.5*rho * (u_in_sqr - abs_vel_sqr)); % pressure p in pascal
32 p = p*1e-5; %pressure p in bar
33 
34