rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_init_values.m
1 function U = fv_init_values(model,model_data)
2 %function U = fv_init_values(model,model_data)
3 %
4 % function computing the init-value DOF vector by evaluating the
5 % grid-center-of-gravity. In particular used for 1st order FV-schemes.
6 %
7 % required fields of model as used in model.init_values_ptr
8 %
9 % Function supports affine decomposition, i.e. different operation modes
10 % guided by optional field decomp_mode in params. See also the
11 % contents.txt for general explanation
12 %
13 % required fileds in model
14 % init_values_ptr: function pointer to init values function
15 %
16 % in 'coefficient' mode the model_data structure is empty
17 
18 % Bernard Haasdonk 22.7.2006
19 
20 if nargin ~= 2
21  error('wrong number of parameters!');
22 end;
23 
24 % affine decomposition is supported by init_data, so automatically
25 % satisfied.
26 
27 decomp_mode = model.decomp_mode;
28 
29 % TODO: The here called function init_values is still an old one that expects a
30 % "params" structure as last argument and uses string comparisons in order to
31 % choose the right initial data function. This part should therefore be
32 % rewritten with an implementation of function pointers.
33 if decomp_mode == 2
34  U = model.init_values_ptr([],model);
35 else
36  grid = model_data.grid;
37  % initial values by midpoint evaluation
38  U = model.init_values_ptr([grid.CX(:),grid.CY(:)],model);
39 end;
40