4 %
function which computes the initial values P_ij^0.
5 % 2 differnet functions are supportet, controled via the field
6 % model.init_value_function:
7 %
'standard': P_{i,j}^0 = K - (i*h_1 + j*h_2)_+
8 %
'max' : P_{i,j}^0 = K - max(i*h_1 , j*h_2)_+
9 % In both cases the boundary conditions P_{S1bar,j}^0 = 0 and
10 % P_{i,S2bar}^0 = 0,
for all i\in [0, S1bar], j\in [0, S2bar] hold.
12 %
function supports affine decomposition.
14 % Dominik Garmatter 21.12 2011
16 decomp_mode = model.decomp_mode;
18 if decomp_mode == 0 % No decomposition
19 k = model_data.grid.nvertices;
21 % evaluate the
function at the inner grid points
22 switch model.init_value_function
24 for j = 1 : model.N2-1
25 Ut((j-1)*model.N1+1:j*model.N1-1,1) = model.K - (model_data.grid.X((j-1)*model.N1+1:j*model.N1-1) + model_data.grid.Y((j-1)*model.N1+1:j*model.N1-1));
28 for j = 1 : model.N2-1
29 Ut((j-1)*model.N1+1:j*model.N1-1,1) = model.K - max(model_data.grid.X((j-1)*model.N1+1:j*model.N1-1), model_data.grid.Y((j-1)*model.N1+1:j*model.N1-1));
32 error(
'init_value_funtion is unknown!');
34 Ut(Ut<0) = 0; % realises (\cdot)_+
35 Ut(model.N1:model.N1:model.N1*model.N2,1) = 0; % S1bar - boundary
36 Ut(model.N1*(model.N2-1)+1:1:model.N1*model.N2-1,1) = 0; % S2bar - boundary
38 elseif decomp_mode == 1 % Only Components
39 Ut = cell(1); % components are stored in a cell
40 k = model_data.grid.nvertices;
41 Ut_entry = zeros(k,1); % the future cell entry
42 % evaluate the function at the inner grid points
43 switch model.init_value_function
45 for j = 1 : model.N2-1
46 Ut_entry((j-1)*model.N1+1:j*model.N1-1,1) = model.K - (model_data.grid.X((j-1)*model.N1+1:j*model.N1-1) + model_data.grid.Y((j-1)*model.N1+1:j*model.N1-1));
49 for j = 1 : model.N2-1
50 Ut_entry((j-1)*model.N1+1:j*model.N1-1,1) = model.K - max(model_data.grid.X((j-1)*model.N1+1:j*model.N1-1), model_data.grid.Y((j-1)*model.N1+1:j*model.N1-1));
53 error('init_value_funtion is unknown!');
55 Ut_entry(Ut_entry<0) = 0; % realises (\cdot)_+
56 Ut_entry(model.N1:model.N1:model.N1*model.N2,1) = 0; % S1bar - boundary
57 Ut_entry(model.N1*(model.N2-1)+1:1:model.N1*model.N2-1,1) = 0; % S2bar - boundary
60 elseif decomp_mode == 2 % Only Coefficients - it is always 1
61 switch model.init_value_function
67 error(
'init_value_funtion is unknown!');
function Ut = eop_init_values(model, model_data)
Ut = eop_init_values(model,model_data)