2 % Detailed model
for a linear stationary problem with a discretization
3 % implemented in Dune-RB
5 % This is a detailed model
for a problem type
'rb_problem_type' =
8 % It solves discretization of the form
10 % with a matrix `A` and a right hand side `r` returned by
11 %
'[A,r] = descr.operators(descr, model_data)'
13 % Furthermore, an output fuctional can be defined by the description field
14 %
'descr.operators_output(descr, model_data);'
17 function dm = DetailedModel(descr)
19 % constructor based on problem description
22 % descr: structure describing the problem and the descretization
26 function this = set_mu(
this, mu)
27 %
function this = set_mu(
this, mu, propagate)
28 % sets the active parameter vector `\mu \in {\cal M}`
30 % The parameter set here, is used by the detailed_simulation() function.
32 % The default implementation sets all fieldnames 'descr.mu_names' in the
36 % mu: The parameter vector `\boldsymbol\mu`.
41 assert(length(mu) == length(this.descr.mu_names));
43 this.descr.mexptr(
'set_mu', mu);
46 function mu = get_mu(
this)
47 %
function mu = get_mu(
this)
48 % returns the active parameter vector `\boldsymbol\mu \in {\cal M}`
50 % The
default implementation returns a vector of the values of the fields
51 % of the #descr structure with names
'descr.mu_names'.
54 % mu: The parameter vector `\boldsymbol\mu`
56 mu = this.descr.mexptr(
'get_mu');
58 function sim_data = detailed_simulation(
this, model_data)
59 sim_data = this.descr.mexptr('detailed_simulation');
62 function model_data = gen_model_data(this)
63 model_data.
id = this.descr.mexptr('gen_model_data');
64 model_data.mexptr = this.descr.mexptr;
67 function p =
plot_sim_data(this, model_data, sim_data, plot_params)
69 if ~isfield(plot_params, 'gcf') || isempty(plot_params.gcf)
70 ud.descr = this.descr;
72 ud.sim_data = sim_data;
73 fig_handle = lin_stat_plot_control;
74 set(fig_handle, 'UserData', ud);
76 fig_handle = plot_params.gcf;
78 fig_ud = get(fig_handle, 'UserData');
79 if ~isempty(fig_ud) && isfield(fig_ud, 'plot_dir')
80 plot_dir = fig_ud.plot_dir;
82 outdir = fullfile(this.descr.run_dir, sim_data.outdir);
83 args = ['-c ', sim_data.cell_array_name, ' ', outdir, ' ', sim_data.prefix];
84 [status, res] = system([fullfile(rbmatlabhome, 'dune', 'lin_stat_visualize.sh'), ' ', args]);
85 plot_dir = strtrim(res);
87 fig_ud.plot_dir = plot_dir;
88 set(fig_handle, 'UserData', fig_ud);
92 if ~isfield(plot_params, 'angle')
93 plot_params.angle = 0;
96 if isfield(plot_params, 'reload_required') && plot_params.reload_required
107 function U = get_dofs_from_sim_data(sim_data)
112 % function U = get_dofs_at_time(sim_data, time)
117 methods (Static, Hidden=true)
119 function issue_plot_command(plot_dir, command)
120 f = fopen(fullfile(plot_dir, 'control.cfg'), 'w');
123 system(['kill -SIGINT $(cat ', fullfile(plot_dir, 'tsv.pid'), ')']);
126 function close_figure_and_vtk_plot(src, event)
127 fig_ud = get(gcf, 'UserData');
128 if ~isempty(fig_ud) && isfield(fig_ud, 'plot_dir')
129 plot_dir = fig_ud.plot_dir;
134 disp('Could not issue the exit command to the Paraview renderer');
137 if exist(fullfile(plot_dir, 'tsv.pid'), 'file')
138 system(['rm -rf ', plot_dir]);
Detailed model for a linear stationary problem with a discretization implemented in Dune-RB...
This is the interface for a detailed model providing methods to compute high dimensional simulation s...
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.