rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
conv_flux_burgers.m
Go to the documentation of this file.
1 function [flux, lambda] = conv_flux_burgers(glob, U, params)
2 % function flux = conv_flux_burgers(glob, params)
3 % function computing the convective flux of a Burgers problem.
4 %
5 % 'flux' is a '2xnpoints' matrix, representing the 'x'/'y'-coordinates of the
6 % velocity in the edge midpoints.
7 %
8 % required fields of params:
9 % flux_vx : x coordinate of flux vector
10 % flux_vy : y coordinate of flux vector
11 % flux_pdeg : exponent `e` in Burgers term `f(u) = v \cdot u^e`
12 
13 % glob column check
14 if params.debug
15  if ~isempty(glob) && size(glob,1) < size(glob,2)
16  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
17  if params.debug > 2
18  keyboard;
19  end
20  end
21 end
22 
23 % i.e. constant velocity v = (params.flux_vx, params.flux_vy) times u^pdeg
24 % u is assumed to be bounded by 1, such that lambda can be
25 % specified in advance
26 Upower = real(U(:).^params.flux_pdeg);
27 flux = [ params.flux_vx * ones(size(U(:))) .* Upower, ...
28  params.flux_vy * ones(size(U(:))) .* Upower ];
29 
30 umax = 1;
31 i = find(abs(U)>1.5,1);
32 if ~isempty(i) && params.verbose >=10
33  disp(['U not bounded by 1 as assumed by flux, lambda may be ',...
34  'too large.']);
35 end;
36 vmax = sqrt(params.flux_vy^2 + params.flux_vx^2);
37 lambda = 1/ (vmax * 2 * umax^(params.flux_pdeg-1));
38 
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
Definition: verbose.m:17
function [ flux , lambda ] = conv_flux_burgers(glob, U, params)
function computing the convective flux of a Burgers problem.