rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
dune_laplace.m
1 if ~(exist('steps', 'var'))
2  steps = [0, 2];
3 end
4 
5 %setenv('DUNERBHOME', '/home/mdroh_01/projects/dune/modules/dune-rb/build_2.1/dune/rb/matlabcomm/client')
6 
7 for i = 1:length(steps)
8  step = steps(i);
9  switch (step)
10  case 0
11  descr = laplace_dune_descr;
12  [dmodel, rmodel] = gen_models(descr);
13  model_data = gen_model_data(dmodel);
14  set_mu(dmodel, [1 0]);
15 
16  case 1
17  sim_data = detailed_simulation(dmodel, model_data);
18  plot_sim_data(dmodel, model_data, sim_data, []);
19  case 2
20  tic
21  detailed_data = gen_detailed_data(rmodel, model_data);
22  t_offline = toc;
23  reduced_data = gen_reduced_data(rmodel, detailed_data);
24  case 3
25  nmus = 100;
26  mus = rand_uniform(nmus, rmodel.mu_ranges);
27  dtimes = zeros(1, nmus);
28  rtimes = zeros(1, nmus);
29  rrtimes = zeros(1, nmus);
30  errs = zeros(1, nmus);
31  for mui = 1:size(mus,2)
32  disp(['computing parameter ', num2str(mui)]);
33  mu = mus(:,mui);
34  set_mu(dmodel, mu);
35  set_mu(rmodel, mu);
36  tic;
37  detailed_simulation(dmodel, model_data);
38  dtimes(mui) = toc;
39  tic;
40  rb_sim_data = rb_simulation(rmodel, reduced_data);
41  rtimes(mui) = toc;
42  tic;
43  rb_sim_data = rb_reconstruction(rmodel, detailed_data, rb_sim_data);
44  rrtimes(mui) = toc;
45  errs(mui) = rb_sim_data.Delta;
46  end
47  maxerr = max(errs);
48  avgrt = mean(rtimes);
49  avgrrt = mean(rrtimes);
50  avgdt = mean(dtimes);
51  case 4
52  mus = {[1 0], [1 0.1], [1 0.2], [10 0], [10 0.1], [10 02]};
53  nmus = length(mus);
54  for mui = 1:nmus
55  mu = mus{mui};
56  set_mu(dmodel, mu);
57  sim_data = detailed_simulation(dmodel, model_data);
58  p = plot_sim_data(dmodel, model_data, sim_data, []);
59  pause(10);
60  dest = ['/home/mdrohma/projects/diss/the_diss/images/laplace_', num2str(mui)];
61  movefile('/home/mdrohma/projects/dune/modules/dune-rb/build_2.1/dune/rb/examples/pdelab/laplaceccfv/vtk/out.png', dest);
62  close(p);
63  end
64  otherwise
65  end
66 end
function [ dmodel , rmodel ] = gen_models(ModelDescr descr,BasisGenDescr bg_descr)
generates an IDetailedModel and an IReducedModel instance from description structures.
Definition: gen_models.m:17
function p = plot_sim_data(model, model_data, sim_data, plot_params)
function performing the plot of the simulation results as specified in model.
Definition: plot_sim_data.m:17