i have coupled odes with slip boundary conditions.
Show older comments
Dear sir/medam, i have coupled odeswith slip boundary conditions, i am unable to write the code for thse equations because my BCs are coupled velocity slip condition. here i am attaching the code kindly help me to write the code.
2 Comments
Torsten
on 8 Jul 2026
It would help if you also posted the equations and initial/boundary conditions.
sunitha k
on 8 Jul 2026
Edited: Walter Roberson
on 9 Jul 2026
Accepted Answer
More Answers (1)
Can't you deduce an analytical expression for w'' with only derivatives up to first order of the other solution variables and insert this expression for w'' into the boundary condition at eta = 1 ?
5 Comments
sunitha k
on 9 Jul 2026
sunitha k
on 9 Jul 2026
Since the equation for the concentration has 2nd derivatives of omega and theta, there should appear dydeta(6) = d^2 theta/d eta^2 in the definition of dydeta(7). But this is not the case in your code. I corrected it according to your commented equations.
But a negative velocity is quite unusual ...
%This is my matlab code containing the coupled equations with corresponding boundary coditions
%velocity Equation
%(x1/(1+d1))*(1/eta*(dw/deta)+(d^2w/deta^2))-0.1-(x1/Da+(x2*M^2/(1+m1^2))*(w+1)+(k^2*Uhs*Phi)+(x3*(Gt*theta+Gc*Omega)*sin(alpha))=0.
%Temparature Equation
%((1/eta*(dtheta/deta))+(d^2theta/deta^2))+((x1/x4)*(Br/(1+d1))*(dw/deta)^2)+(S/x4)+((1/x4)*(Nb*(dtheta/deta)*(dOmega/deta)+Nt*(dtheta/deta)^2)))+(x2/x4)*chi=0.
%Concentration Equation
%((1/eta*(dOmega/deta))+(d^2Omega/deta^2))+(Nt/Nb)*((1/eta*(dtheta/deta))+(d^2theta/deta^2))=0.
%Electric Potential
%((1/eta*(dPhi/deta))+(d^2Phi/deta^2))-(k^2)*Phi=0.
%Boundary Conditions
%dw/deta=0,dtheta/deta=0,dOmega/deta=0,dPhi/deta=0. at eta=0;
%w+((x1/1+d1)*(Alpha1*(dw/deta)))=-1,
%theta+(Alpha2*(dtheta/deta))=0,Omega+(Alpha3*(dOmega/deta))=0,Phi = 1. at eta = h = 1;
main()
function main()
clear
clc
M = 0.2;
m1 = 0.5;
Da = 5;
Alpha1 = 0.05;
Alpha2 = 0.05;
Alpha3 = 0.05;
k = 2;
Uhs = 0.1;
Nt = 0.1;
Nb = 0.5;
E = 0.5;%zeta = 0.5;
%Phi1 = 0.1;
z = 0.25;
S = 0.2;
Br = 0.3;
chi = 0.5;%Xi = 0.5;%zai = 0.5;
Gt = 0.5;
Gc = 0.5;
d1 = 0.3;%Lamda1 = 0.3;
alpha = pi/3;
phi1 = 0.01;
phi2 = 0.01;
Ro1 = 19320;
Ro2 = 3970;
Rof = 1063;
Cp1 = 129;
Cp2 = 765;
Cpf = 3594;
K1 = 314;
K2 = 40;
Kf = 0.492;
sigma1 = 4.1*(10^7);
sigma2 = 35*(10^6);
sigmaf = 6.67*(10^(-1));
Gama1 = 1.42*(10^(-5));
Gama2 = 0.85*(10^(-5));
Gamaf = 1.8*(10^(-4));
x1 = 1./((1-phi1)^2.5*(1-phi2)^2.5);
sigmanf = ((sigma1+2*sigmaf-2*phi1*(sigmaf-sigma1))./(sigma1+2*sigmaf+phi1*(sigmaf-sigma1)))*sigmaf;
sigmahnf = ((sigma2+2*sigmanf-2*phi2*(sigmanf-sigma2))./(sigma2+2*sigmanf+phi2*(sigmanf-sigma2)))*sigmanf;
x2 = sigmahnf./sigmaf;
x3 = (1-phi2)*((1-phi1)+phi1*((Ro1*Gama1)./(Rof*Gamaf)))+phi2*((Ro2*Gama2)./(Rof*Gamaf));
Knf = ((K1+(m1-1)*Kf-(m1-1)*phi1*(Kf-K1))./(K1+(m1-1)*Kf+phi1*(Kf-K1)))*Kf;
Khnf = ((K2+(m1-1)*Knf-(m1-1)*phi2*(Knf-K2))./(K2+(m1-1)*Knf+phi2*(Knf-K2)))*Knf;
x4 = Khnf./Kf;
h = 1;
function dydeta = odefun(eta,y)
if eta < 1e-8
invr = 0;
else
invr = 1/eta;
end
dydeta = zeros(8,1);
dydeta(1) = y(5);
dydeta(2) = y(6);
dydeta(3) = y(7);
dydeta(4) = y(8);
dydeta(5) = -(invr)*y(5)+((1+d1)/x1)*(0.1+(x1/Da+x2*M^2/(1+m1^2))*(y(1)+1)-k^2*Uhs*y(4)-x3*(Gt*y(2)+Gc*y(3))*sin(alpha)); % Velocity equation
dydeta(6) = -(invr)*y(6)-(x1/x4)*(Br/(1+d1)*y(5)^2)-S/x4-((Nb*y(6)*y(7)+Nt*y(6)^2)/x4)-(x2/x4)*chi;% Temperature equation
dydeta(7) = -(invr)*y(7)-Nt/Nb*(invr*y(6)+dydeta(6));% Concentration equation
dydeta(8) = -(invr)*y(8)+k^2*y(4);% Electric potential equation
%dydeta = [y(5);
% y(6);
% y(7);
% y(8);
% -(invr)*y(5)+((1+d1)/x1)*(0.1+(x1/Da+x2*M^2/(1+m1^2))*(y(1)+1)-k^2*Uhs*y(4)-x3*(Gt*y(2)+Gc*y(3))*sin(alpha)); % Velocity equation
% -(invr)*y(6)-(x1/x4)*(Br/(1+d1)*y(5)^2)-S/x4-((Nb*y(6)*y(7)+Nt*y(6)^2)/x4)-(x2/x4)*chi;% Temperature equation
% -(invr)*y(7)-Nt/Nb*(invr*y(6)+theta2);% Concentration equation
% -(invr)*y(8)+k^2*y(4)];% Electric potential equation
end
function res=bcfun(ya,yb)
res=[ya(5);
yb(1)+(x1*Alpha1/(1+d1))*yb(5)+1;
ya(6);
yb(2)+Alpha2*yb(6);
ya(7);
yb(3)+Alpha3*yb(7);
ya(8);
yb(4)-1
];
end
%yinit = [1-exp(-eta);exp(-eta);exp(-eta);exp(-eta);exp(-eta);-exp(-eta);-exp(-eta);exp(-eta)];
yinit=@(eta)[
-1+eta.^2;
eta.^2;
eta.^2;
1-eta.^2;
2*eta;
2*eta;
2*eta;
-2*eta];
solinit = bvpinit(linspace(1e-6,h,150),yinit);%Real term
%options = bvpset('AbsTol',1e-7);
options = bvpset('AbsTol',1e-6,'RelTol',1e-4,'stats','off','Nmax',1000); %to find error in table stats on or else for graphs stats off
U1=bvp4c(@odefun,@bcfun,solinit,options);
%hold on
figure
plot(U1.x,U1.y(1,:),'b','LineWidth',2)
grid on
%plot(U1.x,real([U1.y(1,:)]),'b','linewidth',1.5)
end
Maybe of interest:
and some other contributions from @P
sunitha k
on 10 Jul 2026
Torsten
on 10 Jul 2026
If you use
yb(1)+x1/(1+d1)*(Alpha1*yb(5)+Alpha2*(-1/h*yb(5)+((1+d1)/x1)*(0.1+(x1/Da+x2*M^2/(1+m1^2))*(yb(1)+1)-k^2*Uhs*yb(4)-x3*(Gt*yb(2)+Gc*yb(3))*sin(alpha))));
instead of
yb(1)+(x1*Alpha1/(1+d1))*yb(5)+1;
in function "bcfun", the slip boundary condition should also be included.
Note that
-1/h*yb(5)+((1+d1)/x1)*(0.1+(x1/Da+x2*M^2/(1+m1^2))*(yb(1)+1)-k^2*Uhs*yb(4)-x3*(Gt*yb(2)+Gc*yb(3))*sin(alpha))
equals w'' at eta = h.
Categories
Find more on Boundary Value Problems 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!
