heat and mass transfer problem nonlinear differential equations
5 次查看(过去 30 天)
显示 更早的评论
The code is running, the graph is also came. But it does not give the convergence for the curves s, , θ, and f.
fluid_Sol_bvp4c2
function fluid_Sol_bvp4c2
Pr = 10;
Le = 10;
Nr = 0.5;
Nb = 0.5;
Nt = 0.5;
% Defining parameters
solinit = bvpinit(linspace(0, 10, 100), [0 0 1 1 0 1 0]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y
% Plotting of the functions
figure(1)
plot(x, y(1,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('s(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of the velocity
figure(2)
plot(x, y(2,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('s^{\prime}(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(4,:), 'linewidth', 1), grid
hold on
xlabel('\eta ', 'fontweight', 'bold', 'fontsize', 16)
ylabel('\theta ', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of the fun
figure(4)
plot(x, y(6,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('f(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1); % y1 to start at 0
y0(2); % y2 to start at 0
y0(4) - 1; % y4 to start at 1
y0(6) - 1; % y6 to start at 1
yinf(2) - 0; % desire y2 to converge to 0
yinf(4) - 0; % desire y4 to converge to 0
yinf(6) - 0]; % desire y5 to converge to 0
end
% System of First Order ODEs
function dydx = bvp2D(~, y)
yy1 = - 1/(4*Pr)*(3*y(1)*y(3) - 2*y(2)^2) - y(4) + Nr*y(6);
yy2 = - 3/4*y(1)*y(5) - Nb*y(7)*y(5) - Nt*y(5)^2;
yy3 = - 3/4*Le*y(7) - (Nt/Nb)*yy2;
dydx = [y(2); y(3); yy1; y(5); yy2; y(7); yy3];
end
end
I dont know whether i have to use extend code in bvp4c. Please help me do the needful. Thanks in advance.
1 个评论
Torsten
2024-1-31
Please include equations and boundary conditions in a mathematical notation so that we can check whether your implementation is correct.
采纳的回答
更多回答(1 个)
Sam Chak
2024-1-31
Hi @uma
I wanted to inform you that I have discovered five sets of Equilibrium Points for the system. However, it appears that the system is unstable. To address this instability, it would be advisable to introduce some manipulatable variables into the system. As a temporary solution, I have incorporated a guess() function into your code. This adjustment has resulted in a different solution when using bvp4c().
%% Equilibrium Points
ye1 = zeros(1, 7);
ye2 = [1, 0, 0, 0, 0, 0, 0];
ye3 = [0, 0, 0, 0.2, 0, 0.4, 0];
ye4 = [0, 0, 0, 0.4, 0, 0.8, 0];
ye5 = [0, 0, 0, 0.6, 0, 1.2, 0];
fluid_Sol_bvp4c2
function fluid_Sol_bvp4c2
Pr = 10;
Le = 10;
Nr = 0.5;
Nb = 0.5;
Nt = 0.5;
% Defining parameters
a = 0;
b = 10;
xmesh = linspace(a, b, 101);
solinit = bvpinit(xmesh, @guess);
sol = bvp4c(@bvp2D, @bc2D, solinit);
% solinit = bvpinit(linspace(0, 10, 100), [0 0 1 1 0 1 0]);
% sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the functions
figure(1)
plot(x, y(1,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('s(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of the velocity
figure(2)
plot(x, y(2,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('s^{\prime}(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(4,:), 'linewidth', 1), grid
hold on
xlabel('\eta ', 'fontweight', 'bold', 'fontsize', 16)
ylabel('\theta ', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Plotting of the fun
figure(4)
plot(x, y(6,:), 'linewidth', 1), grid
hold on
xlabel('\eta', 'fontweight', 'bold', 'fontsize', 16)
ylabel('f(\eta)', 'fontweight', 'bold', 'fontsize', 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1); % y1 to start at 0
y0(2); % y2 to start at 0
y0(4) - 1; % y4 to start at 1
y0(6) - 1; % y6 to start at 1
yinf(2) - 0; % desire y2 to converge to 0
yinf(4) - 0; % desire y4 to converge to 0
yinf(6) - 0]; % desire y5 to converge to 0
end
% System of First Order ODEs
function dydx = bvp2D(~, y)
yy1 = - 1/(4*Pr)*(3*y(1)*y(3) - 2*y(2)^2) - y(4) + Nr*y(6);
yy2 = - 3/4*y(1)*y(5) - Nb*y(7)*y(5) - Nt*y(5)^2;
yy3 = - 3/4*Le*y(7) - (Nt/Nb)*yy2;
dydx = [y(2); y(3); yy1; y(5); yy2; y(7); yy3];
end
end
% initial guess
function g = guess(x)
g = [sin(x);
cos(x);
-sin(x);
-cos(x);
sin(x);
cos(x);
-sin(x)];
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Boundary Value Problems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!