Boundary Value Problem

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

Answers (1)

Jan
Jan on 12 Sep 2011

0 votes

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 Comments

I am currently trying to use bvp4c and I looked at the multiple shooting method as you suggested but I am having the same problem with it. The problem with both (or so it seems to me), is that I need a way to specify which variable I am declaring a boundary condition for and at which boundary I am describing. Not all the variables have a BC, just the ones specified at each boundary. The examples I have found are for very simple situations such as y'' + abs(y) = 0 where y is specified at the boundaries. I need to specify different variables at the boundaries and have yet to find a method of doing so. Are you aware of how to do that?
Jan
Jan on 12 Sep 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
Jan on 12 Sep 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])];
Interesting that simply putting ya([1,3,5,7]) defines the boundary conditions that easily for f(1), f(3), f(5), f(7) . Matlab never ceases to amaze me.
You say that bvp4c calculates the residuals. On this page (http://www.mathworks.com/help/techdoc/ref/bvp4c.html), it is used to solve the function and obtain the values for y. When I run the code with the bc function defined as you have suggested, I then use the following to obtain my solution over z:
z = linspace(0,1);
f = deval(sol,z);
plot(z,f(1,:));
The answer it gives is on the order of 10^(-18) for f(1) over the interval when I am expecting an answer of order 1. I appreciate all your input very much. Matlab always seems to evade me.
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.

Sign in to comment.

Tags

Asked:

on 9 Sep 2011

Community Treasure Hunt

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

Start Hunting!