Pressure Field From Velocity Field

I have a velocity field in MATLAB as two 641x861 arrays (Vx and Vy) and I need to convert it to a pressure field to determine the pressure difference / gradient between two points. I've tried a handful of approaches (pressure Poisson, Euler equation, etc.) but am struggling with the fact that I already have the velocity field over time and don't need to find u* / v*, u^n+1 / v^n+1.
Right now, I'm trying to use the attached equations but the pressure field values don't seem correct. Do I need to set up a separate mesh even though I already have the velocity at specific points? I assumed that I could use the size of my Vx and Vy arrays as my mesh. I'm also unsure how to appropriately integrate the partial derivatives over a path.
Here's my current code:
imin = 2; imax = m;
jmin = 2; jmax = n;
Px = zeros(imax,jmax);
Py = zeros(imax,jmax);
dx = 1;
dy = 1;
for j = jmin:jmax
for i = imin:imax
Px(i,j) = -rho*(Vx(i,j)*((Vx(i+1,j)-Vx(i-1,j))*0.5*dx)+Vy(i,j)*((Vx(i,j+1)-Vx(i,j-1))*0.5*dy));
Py(i,j) = -rho*(Vx(i,j)*((Vy(i+1,j)-Vy(i-1,j))*0.5*dx)+Vy(i,j)*((Vy(i,j+1)-Vy(i,j-1))*0.5*dy));
end
end
Should I be going about this a different way? Thank you in advance for any feedback!

5 Comments

How can you solve for the velocity without getting a pressure field ? The two are coupled - thus in order to solve for velocity, you automatically have to solve for pressure with the help of the continuity equation.
Further (although for dx = dy = 1, it doesn't matter)
Px(i,j) = -rho*(Vx(i,j)*(Vx(i+1,j)-Vx(i-1,j))/(2*dx)+Vy(i,j)*(Vx(i,j+1)-Vx(i,j-1))/(2*dy));
Py(i,j) = -rho*(Vx(i,j)*(Vy(i+1,j)-Vy(i-1,j))/(2*dx)+Vy(i,j)*(Vy(i,j+1)-Vy(i,j-1))/(2*dy));
instead of
Px(i,j) = -rho*(Vx(i,j)*((Vx(i+1,j)-Vx(i-1,j))*0.5*dx)+Vy(i,j)*((Vx(i,j+1)-Vx(i,j-1))*0.5*dy));
Py(i,j) = -rho*(Vx(i,j)*((Vy(i+1,j)-Vy(i-1,j))*0.5*dx)+Vy(i,j)*((Vy(i,j+1)-Vy(i,j-1))*0.5*dy));
The velocity field is determined experimentally from imaging so I import it directly into MATLAB. I don’t have to solve for it, only determine a pressure field from it.
In principle, the equations
Px(i,j) = -rho*(Vx(i,j)*(Vx(i+1,j)-Vx(i-1,j))/(2*dx)+Vy(i,j)*(Vx(i,j+1)-Vx(i,j-1))/(2*dy));
Py(i,j) = -rho*(Vx(i,j)*(Vy(i+1,j)-Vy(i-1,j))/(2*dx)+Vy(i,j)*(Vy(i,j+1)-Vy(i,j-1))/(2*dy));
are correct to determine dP/dx and dP/dy.
But I don't know how noisy your velocity measurements are so that you might get garbage for the pressure gradient.
Thanks for your response. Do you have any insight on how to go about taking the integral of dP/dx and dP/dy over a path? I'm not sure which method is appropriate given that it's discrete data and a partial derivative.
Torsten
Torsten on 6 Sep 2022
Edited: Torsten on 6 Sep 2022
Solve the Pressure Poisson Equation (1.1.3.1) in the domain:
You will have to know pressure on the boundaries and your velocity field must be divergence-free.

Sign in to comment.

Answers (0)

Categories

Asked:

on 6 Sep 2022

Edited:

on 6 Sep 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!