rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lin_ds_advection_vconst_fast_model.m
1 function ds_model = lin_ds_advection_vconst_fast_model(params)
2 %function ds_model = lin_ds_advection_vconst_fast_model(params)
3 %
4 % function providing the advection_fv_output_vconst_model with some
5 % accelerated pointers as a linear dynamical system, i.e. a lin_ds model
6 
7 % Bernard Haasdonk 30.3.2010
8 
9 lin_evol_model = advection_fv_output_vconst_model(params);
10 %lin_evol_model.debug = 1;
11 %lin_evol_model_data = gen_model_data(lin_evol_model);
12 
13 % set some additional fields in model which will be copied into
14 % ds model depending on whether constants are known or not:
15 estimate_constants = 0;
16 if estimate_constants
17  %%% if constant estimaton has to be performed:
18  lin_evol_model.estimate_lin_ds_nmu = 4;
19  lin_evol_model.estimate_lin_ds_nX = 10;
20  lin_evol_model.estimate_lin_ds_nt = 4;
21 else
22  %%% otherwise:
23  % the following values are rough bounds, so could be
24  % non-rigorous, then larger search must be performed.
25  lin_evol_model.state_bound_constant_C1 = 1;
26  lin_evol_model.output_bound_constant_C2 = 1.2916;
27 end;
28 
29 ds_model = lin_ds_from_lin_evol_model(lin_evol_model);
30 % set accelerated data functions from below
31 ds_model.A_function_ptr = @(model,model_data) ...
32  eval_affine_decomp(@A_components,...
33  @A_coefficients,...
34  model,model_data);
35 
36 ds_model.B_function_ptr = @(model,model_data) ...
37  eval_affine_decomp(@B_components,...
38  @B_coefficients,...
39  model,model_data);
40 %ds_model.u_function_ptr = @(params) 0.1; % define new
41 
42 %ds_model.theta = 1;
43 %disp('set theta to 1!!!');
44 %keyboard;
45 
46 
47 
48 
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 % auxialiary coefficient functions for acceleration of
51 % advection model: explicit implementation of coefficients
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 
54 function Acomp = A_components(model,model_data)
55 Acomp = model_data.A_components;
56 
57 function Acoeff = A_coefficients(model);
58 %model.base_model.decomp_mode = 2;
59 %model.base_model.t = model.t;
60 %mu = get_mu(model);
61 %model.base_model = model.set_mu(model.base_model,mu);
62 %[L_I_coeff, L_E_coeff, b_coeff] = ...
63 % model.base_model.operators_ptr(model.base_model, );
64 %% L_E = Id + Delta t * A
65 %Acoeff = L_E_coeff(2:end)/model.base_model.dt;
66 %keyboard;
67 %Acoeff = -model.base_model.dt * ...
68 % model.base_model.velocity_coefficients_ptr(model.base_model);
69 %if model.t>0
70  Acoeff = - [model.vx_weight, model.vy_weight]*0.5; %*(1-model.t);
71 % keyboard;
72 %end;
73 
74 function Bcomp = B_components(model,model_data)
75 Bcomp = model_data.B_components;
76 
77 function Bcoeff = B_coefficients(model);
78 % hmmm the coefficients are now called twice in A and B
79 % should somehow be cached later...
80 %model.base_model.decomp_mode = 2;
81 %model.base_model.t = model.t;
82 %mu = get_mu(model);
83 %model.base_model = model.set_mu(model.base_model,mu);
84 %[L_I_coeff, L_E_coeff, b_coeff] = ...
85 % model.base_model.operators_ptr(model.base_model, );
86 %% L_E = Id + Delta t * A
87 %Bcoeff2 = b_coeff/model.base_model.dt;
88 vcoeff = - [model.vx_weight, model.vy_weight]*0.5;%*(1-model.t);
89 Q_0 = model.base_model.cone_number;
90 dcoeff = zeros(1,Q_0);
91 max_pos = model.base_model.cone_weight * (Q_0-1)+1;
92 t = model.t;
93 for q = 1:Q_0
94  dcoeff(q) = (1-(max_pos-q))*(1-t) * ((max_pos>=q) && (max_pos < q+1)) ...
95  + (1+(max_pos-q))*(1-t) * ((max_pos>=q-1) && (max_pos < q));
96 end;
97 v = -(vcoeff(:)*(dcoeff(:)'));
98 Bcoeff = v(:)*model.cone_amplitude;
99 %if model.t>0
100 %keyboard;
101 %end;
102 
103 %function Ccomp = C_components(model,model_data)
104 %Ccomp = model_data.C_components;
105 %
106 %function Ccoeff = C_coefficients(model);
107 %model.base_model.decomp_mode = 2;
108 %model.base_model.t = model.t;
109 %mu = get_mu(model);
110 %model.base_model = model.set_mu(model.base_model,mu);
111 %Ccoeff = ...
112 % model.base_model.operators_output(model.base_model);
113