1 function U_der = lin_evol_opt_rb_fd_derivative(model, detailed_data,reduced_data, mu)
2 %
function U_der = lin_evol_opt_rb_fd_derivative(model, reduced_data, mu)
4 %
function calculating the derivative solution via a finite difference
5 % procedure
for the parameter mu.
7 % Markus Dihlmann 03.02.2011
13 old_mu = get_mu(model);
17 compute_derivative_old = model.compute_derivative_info;
19 model.compute_derivative_info =0;
21 sim_data = rb_simulation(model, reduced_data);
22 sim_data = rb_reconstruction_derivative(model,detailed_data, sim_data);
29 %is mu+h inside mu_range?
30 if (mu(i)+h>=model.mu_ranges{i}(1))&&(mu(i)+h<=model.mu_ranges{i}(2))
32 model = set_mu(model,mu);
33 sim_data = rb_simulation(model, reduced_data);
34 sim_data = rb_reconstruction_derivative(model, detailed_data,sim_data);
36 model = set_mu(model,mu);
38 U_der{i} = (sim_data.U-U_fix)./h;
41 model = set_mu(model,mu);
42 sim_data = rb_simulation(model, reduced_data);
43 sim_data = rb_reconstruction_derivative(model, detailed_data,sim_data);
45 model = set_mu(model,mu);
47 U_der{i} = (-sim_data.U+U_fix)./h;
52 model = set_mu(model, old_mu);
53 model.compute_derivative_info = compute_derivative_old;