1 function test_err = rb_test_error(model,detailed_data,reduced_data,M_test,...
3 %
function test_err = rb_test_error(model,detailed_data,reduced_data,M_test,...
6 %
function determining the test-errors, i.e. energy norm or l2-error given ty
7 %
'model.error_algorithm' at end time
for the given set of vectors `\mu`
8 % (columns in
'M_test') of the RB simulation with corresponding RB set.
11 % M_test: matrix with column vectors of parameter tuples `\mu`
for which the
12 % error between reduced and detailed simulation shall be computed.
13 % savepath: directory path where the detailed simulations shall be saved to
16 % required fields of model:
17 % error_algorithm:
function handle to
function that computes the error
18 % `\|u_h - u_{red}\|` in some norm.
20 % optional fields of model:
21 % relative_error:
boolean indicating wether relative or absolute errors shall
22 % be computed. (Default = absolut errors)
25 % test_err: vector of errors at end time
27 % Bernard Haasdonk 6.6.2007
29 %
import model specific methods
31 nmus = size(M_test,2);
32 test_err = zeros(nmus,1);
35 error('savepath must be provided in case of error as target value!');
43 %tmodel = tmodel.set_mu(model, M_test(:,i));
44 tmodel = set_mu(tmodel, M_test(:, i));
45 rb_sim_data = rb_simulation(tmodel,reduced_data);
49 rb_sim_data = rb_reconstruction(tmodel,detailed_data,rb_sim_data);
51 if isfield(detailed_data,'W')
52 err_par = detailed_data.W;
57 errs = tmodel.error_algorithm(tmodel.get_dofs_from_sim_data(sim_data),...
58 tmodel.get_dofs_from_sim_data(rb_sim_data),...
60 if isfield(tmodel,'relative_error') && tmodel.relative_error
61 errs = errs./tmodel.error_algorithm(tmodel.get_dofs_from_sim_data(sim_data), ...
66 % disp('warning, check monotonicity in errs!!!');
68 % if (i==2) & (mod(size(detailed_data.RB,2),30) == 0)
69 % save(['errs',num2str(size(detailed_data.RB,2))],'errs');
function [ sim_data , tictoc ] = load_detailed_simulation(m, savepath, params)
load single trajectory of previously saved results.
function save_detailed_simulations(model, model_data, M, savepath)
perform loop over detailed simulations and save results or check consistency with existing saved resu...