Home > demos > rbconv > rbconvf.m

rbconvf

PURPOSE ^

pde for Rayleigh-Benard convection in vorticity formulation

SYNOPSIS ^

function [c,a,f,b]=rbconvf(p,u,lam)

DESCRIPTION ^

 pde for Rayleigh-Benard convection in vorticity formulation

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [c,a,f,b]=rbconvf(p,u,lam) 
0002 % pde for Rayleigh-Benard convection in vorticity formulation
0003 [ux,uz]=pdegrad(p.points,p.tria,u); 
0004 u=pdeintrp(p.points,p.tria,u);
0005 om  = u(2,:); 
0006 % derivatives:
0007 psix=ux(1,:); psiz=uz(1,:); 
0008 omx =ux(2,:); omz =uz(2,:); 
0009 Tx  =ux(3,:); Tz  =uz(3,:); 
0010 R=lam; P=1; c=[1;1;P;P;1;1];
0011 % variant 1: all in f
0012 %b=0; a=0;
0013 % f1 = -om; % Lap psi=om
0014 %f2 = R*P*Tx-(psix.*omz-psiz.*omx);
0015 %f3 = psix  -(psix.*Tz -psiz.*Tx);
0016 % variant 2: use a, b
0017 a = zeros(p.neq^2,1); a(4)=1; % p.neq entries = diagonal a
0018 b = zeros(p.neq^2*2,1); % initialize; here 3^2*2=12
0019 b(2*p.neq*2+3) = R*P; % b231: (partial_x)_3 in second eqn.
0020 b(2*2+1) = 1;   % b311: (partial_x)_1 in third eqn.
0021 f1 = 0*om;f2 = -(psix.*omz-psiz.*omx);f3 = -(psix.*Tz -psiz.*Tx);
0022 f=[f1;f2;f3];

Generated on Wed 15-Aug-2012 12:53:02 by m2html © 2005