function pclaw_ex_obstacle
%PCLAW_EX_OBSTACLE
%   Example for PARTICLECLAW, a numerical scheme for scalar
%   conservation and balance laws
%       u_t+(f(u))_x = g(x,u)
%   in one space dimension.
%   
%   Example: Flow over obstacle
%       f(u) = u^2/2
%       g(x,u) = phi(x)*u
%   with Riemann initial data,
%   where phi(x) = pi*sin(pi*x)*(4.5<=x&x<=5.5)
%   is the gradient of the ground profile.
%
%   The source is given by a function. PARTICLECLAW integrates
%   the characteristic equations as black box. Here, since g
%   is discontinuous, only first order accuracy is achieved.
%   In contrast, PCLAW_EX_OBSTACLE_DISODE, shows how a problem
%   specific ODE solver can be provided in the example file.
%
%   Copyright (c) 2008 Benjamin Seibold and Yossi Farjoun
%   http://math.mit.edu/~seibold/research/particleclaw
%   http://arxiv.org/abs/0809.0726

%===============================================================================
parameters = struct(...
'name','Flow over obstacle',...  % name of example
'f',@f,'f1',@f1,'f2',@f2,...     % flux function and derivatives (below)
'g',@g,...                       % source term (if 'none', computation faster)
'ic',@ic,...                     % initial conditions (below)
'xbox',[0 12],...                % computational domain
'ubox',[-.1 3.1],...             % axis for function values (for plotting only)
'd',[0 1.25e-1 inf],...          % [d_min d_init d_max]
'tfinal',6,...                   % final time
'dtmax',1e-3,...                 % maximum time step (only relevant for sources)
'steps',250,...                  % number of output steps
'flag_plot',1,...                % if yes, animation gets plotted in figure
'flag_sharpen',0,...             % if yes, shocks get sharpened upon output
'flag_save',0      );            % if yes, solution gets stored in data files
%===============================================================================
particleclaw(parameters)
%===============================================================================
function y = f(u),  y = u.^2/2;
function y = f1(u), y = u;
function y = f2(u), y = u*0+1;
function y = g(x,u), y = pi*sin(pi*x).*(4.5<x&x<5.5).*u;
function y = ic(x), y = 1+(x<1);

%===============================================================================
% Copyright (c) 2008 Benjamin Seibold and Yossi Farjoun
% 
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction for non-commercial purposes, including
% without limitation the rights to use, copy, modify, merge, publish, and/or
% distribute copies of the Software, and to permit persons to whom the
% Software is furnished to do so, subject to the following conditions:
% 
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software, and credit has to be
% given to the authors in publications that are in any form based on this
% Software.
% 
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.
%===============================================================================

