Boundary Value Problem
Mostra commenti meno recenti
I am trying to solve a boundary value problem in Rayleigh Benard convection (the convection of an infinite horizontal layer of fluid between two plates heated from below. I have my system of equatoins:
function df = mless(zi,f)
% f() is array of f and its derivatives: psi1 = f(1) dpsi1 = f(2) d2psi1 = f(3)
%d3psi1 = f(4) theta1 = f(5) dtheta1 = f(6) theta2 = f(7) dtheta2 = f(8)
df = zeros(8,1);
% df() is array of the derivatives of f()
df(1) = f(2);
df(2) = f(3);
df(3) = f(4);
df(4) = -k^4*f(1) + 2*k^2*f(3) + k^3*f(5);
df(5) = f(6);
df(6) = (2/(2-k^2*C*f(1)^2))*(0.5*C*k^2*f(2)*f(6) + k^2*f(5) - k*Ra*f(1) - k*f(1)*f(8));
df(7) = f(8);
df(8) = (2/(2+k^2*C*f(1)^2))*(0.5*k*f(1)*f(6) - 0.5*C*k^2*(Ra*f(1)^2+f(1)^2*f(8)) - 0.5*C*k^2*f(1)*(Ra*f(2)+f(2)*f(8)));
My initial conditions are:
at z = 0: f(1)=f(3)=f(5)=f(7)=0,
at z = 1: f(1)=f(3)=f(5)=f(7)=0,
We know that the trivial solution exists, but I would like to solve it for non-trivial solutions. I know how to solve problems with initial conditions, but not sure how to handle two boundaries. Any pointers would be appreciated. Thanks
Risposte (1)
Jan
il 12 Set 2011
0 voti
I'd use a "multiple-shooting method" with a initial trajectory near to the estimated non-trivial solution. Google finds more about this methd.
5 Commenti
Dan Stranges
il 12 Set 2011
Jan
il 12 Set 2011
BVP4C calls a user-defined function to calculate the residuals. Your initial conditions look very easy and I assume the wanted residual is simply the vector of the components with boundary conditions.
Jan
il 12 Set 2011
BVP4C calls a user-defined function to calculate the residuals. Your initial conditions look very easy and I assume the wanted residual is simply the vector of the components with boundary conditions.
function res = bc(ya, yb, parameter)
res = [ya([1,3,5,7]); yb([1,3,5,7])];
Dan Stranges
il 12 Set 2011
john
il 6 Set 2012
I am trying to run your code for shooting method but I get an error.
function df = mless(z,f)
% f() is array of f and its derivatives: psi1 = f(1) dpsi1 = f(2) d2psi1 = f(3)
%d3psi1 = f(4) theta1 = f(5) dtheta1 = f(6) theta2 = f(7) dtheta2 = f(8)
df = zeros(8,1);
% df() is array of the derivatives of f()
df(1) = f(2);
df(2) = f(3);
df(3) = f(4);
df(4) = -k^4*f(1) + 2*k^2*f(3) + k^3*f(5);
df(5) = f(6);
df(6) = (2/(2-k^2*C*f(1)^2))*(0.5*C*k^2*f(2)*f(6) + k^2*f(5) - k*Ra*f(1) - k*f(1)*f(8));
df(7) = f(8);
df(8) = (2/(2+k^2*C*f(1)^2))*(0.5*k*f(1)*f(6) - 0.5*C*k^2*(Ra*f(1)^2+f(1)^2*f(8)) - 0.5*C*k^2*f(1)*(Ra*f(2)+f(2)*f(8)));
res = [ya([1,3,5,7]); yb([1,3,5,7])];
z = linspace(0,1);
f = deval(sol,z);
plot(z,f(1,:));
end
The error is
Error using mless (line 6) Not enough input arguments.
Categorie
Scopri di più su Boundary Value Problems in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!