Home > Src > Burgers > fburgers.m

fburgers

PURPOSE ^

FBURGERS Defines the non-per Burgers function for nonperiodic_burgers.m

SYNOPSIS ^

function [f]=fburgers(tt,deltat,u0,A,dx,w,visc,uex,uex1,bc);

DESCRIPTION ^

 FBURGERS Defines the non-per Burgers function for nonperiodic_burgers.m

 [f]=fburgers(tt,deltat,u0,A,dx,w,visc,uex,uex1,bc);

 Input : tt =time
         deltat = time step
         u0 = initial data
         A = matrix related to differential operator
         dx = LGL first derivative matrix
         w = LGL weights array
         visc = viscosity coefficient (constant > 0)
         uex  = exact solution (uex=@(x)[uex(x)], with .*, .^, ./)
         uex1 = exact solution (uex=@(x)[uex(x)], with .*, .^, ./)
         bc     = choice of boundary conditions: 1 == Dirichlet 
                                                 2 == Neumann 

 Output: f = array with evaluation of fburgers
   Written by Paola Gervasio
   $Date: 2007/04/01$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [f]=fburgers(tt,deltat,u0,A,dx,w,visc,uex,uex1,bc);
0002 % FBURGERS Defines the non-per Burgers function for nonperiodic_burgers.m
0003 %
0004 % [f]=fburgers(tt,deltat,u0,A,dx,w,visc,uex,uex1,bc);
0005 %
0006 % Input : tt =time
0007 %         deltat = time step
0008 %         u0 = initial data
0009 %         A = matrix related to differential operator
0010 %         dx = LGL first derivative matrix
0011 %         w = LGL weights array
0012 %         visc = viscosity coefficient (constant > 0)
0013 %         uex  = exact solution (uex=@(x)[uex(x)], with .*, .^, ./)
0014 %         uex1 = exact solution (uex=@(x)[uex(x)], with .*, .^, ./)
0015 %         bc     = choice of boundary conditions: 1 == Dirichlet
0016 %                                                 2 == Neumann
0017 %
0018 % Output: f = array with evaluation of fburgers
0019 %   Written by Paola Gervasio
0020 %   $Date: 2007/04/01$
0021 %
0022 
0023 np=length(u0);
0024 b=zeros(np,1);
0025 if bc ==2
0026 t=tt;
0027 uu1=uex(-1); ux1=uex1(-1);
0028 b(1)=0.5*uu1^2-visc*ux1;
0029 uu1=uex(1); ux1=uex1(1);
0030 b(np)=-0.5*uu1^2+visc*ux1;
0031 end
0032 f=(b-A*u0+0.5*dx'*diag(w)*(u0.*u0))./w;
0033 
0034 return
0035

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003