Drawing parabolic pipe flow
Show older comments

I am trying to plot this on matlab for varying pressures. u_r is just velocity, r radius, and p_1 pressure for the flow through a pipe, but having no luck. Any help would be greatly appreciated!!
Answers (1)
Star Strider
on 8 Mar 2017
I let the Symbolic Math Toolbox solve for ‘p_1(z)’ and ‘u_r’. I am not certain what you want.
syms a p_1(z) r u_r z p_10 dp_10
dp_1dz = diff(p_1,z); % First Derivative
d2p_1dz2 = diff(p_1,z,2); % Second Derivative
Eqn = u_r == (1/a^2) * d2p_1dz2 * (2 - r^2)*r; % Differential Equation
P_1s = dsolve(Eqn, p_1(0) == p_10, dp_1dz(0) == dp_10); % Solve For ‘p_1(z)’
U_r = solve(P_1s == p_1, u_r); % Solve For ‘u_r’
p_1_fcn = matlabFunction(P_1s) % Create Anonymous Function
u_r_fcn = matlabFunction(U_r) % Create Anonymous Function
p_1_fcn = @(a,dp_10,p_10,r,u_r,z) p_10+dp_10.*z-(a.^2.*u_r.*z.^2.*(1.0./2.0))./(r.*(r.^2-2.0));
u_r_fcn = @(a,dp_10,p_10,r,z) 1.0./a.^2.*r.*1.0./z.^2.*(r.^2-2.0).*(p_10-p_1(z)+dp_10.*z).*2.0;
The ‘p_1_fcn’ and ‘u_r_fcn’ are anonymous function versions of those functions that you can use in regular MATLAB code without the Symbolic Math Toolbox. The ‘p_10’ and ‘dp_10’ variables are the initial conditions (values) for ‘p_1(z)’ and ‘dp_1/dz’ respectively.
I leave the rest to you.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!