rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
detailed_simulation.m
1 function sim_data = detailed_simulation(dmodel,model_data)
2 % function sim_data = detailed_simulation(dmodel,model_data)
3 % function performing the detailed simulation of a lin-stat model,
4 % i.e. the matrix and RHS assembly and solving of the system,
5 % possibly also output computation.
6 %
7 % Required fields of model_data:
8 % df_info: feminfo object holding info about the @ref fem function space.
9 %
10 % Return values:
11 % sim_data: structure holding the `H`-dimensional simulation data.
12 %
13 % Generated fields of sim_data:
14 % uh: a femdiscfunc simulation result.
15 % s: DOFs of the output functional.
16 %
17 
18 % B. Haasdonk 22.2.2011
19 
20 model = dmodel.descr;
21 
22 old_mode = model.decomp_mode;
23 model.decomp_mode = 0; % complete
24 
25 sim_data =[];
26 
27 [A,r] = model.operators(model,model_data);
28 
29 % solution variable:
30 uh = femdiscfunc([],model_data.df_info);
31 uh.dofs = A\r;
32 
33 % return results:
34 sim_data.uh = uh;
35 
36 % compute output
37 if model.compute_output_functional
38  % the following can be used for any, also nonlinear functionals:
39  %sim_data.s =
40  %model.output_functional(model,model_data,sim_data.uh);
41  % for linear operators, get vector:
42  v = model.operators_output(model,model_data);
43  sim_data.s = (v(:)') * sim_data.uh.dofs;
44 end;
45 
46 model.decomp_mode = old_mode;
class representing a continous piecewise polynomial function of arbitrary dimension. DOFS correspond to the values of Lagrange-nodes.
Definition: femdiscfunc.m:17
structure representing the fem-space information shared by all fem-functions. Implemented as handle c...
Definition: feminfo.m:17