rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
stokes_detailed_simulation.m
Go to the documentation of this file.
1 function sim_data = stokes_detailed_simulation(model, model_data)
2 %function sim_data = stokes_detailed_simulation(model, model_data)
3 % Performs a detailed simulation of a (Navier-)stokes problem
4 %
5 % In general this can also be used for every linear stationary problem.
6 % Uses a fixed point defect correction algorithm.
7 
8 % I. Maier, 22.01.2014
9 
10 
11 % initialization
12 start_total = tic;
13 
14 model.decomp_mode = 0;
15 
16 % assemble linear terms
17 [A, f] = model_data.operators(model, model_data);
18 
19 % solution variable
20 uh = Fem.DiscFunc([], model_data.df_info);
21 
22 % prepare algorithm
23 params = cell(1, 4);
24 if model.has_nonlinearity
25  S(1).type = '.';
26  S(1).subs = 'uh';
27  S(2).type = '.';
28  S(2).subs = 'dofs';
29  model.uh = uh;
30  params{1} = @(x) model.operators(subsasgn(model, S, x), model_data);
31  if isfield(model, 'fp_tolerance')
32  params{2} = model.fp_tolerance;
33  end
34  if isfield(model, 'fp_maxiter')
35  params{3} = model.fp_maxiter;
36  end
37  if isfield(model, 'fp_damping')
38  params{4} = model.fp_damping;
39  end
40 end
41 
42 % execute algorithm
43 [uh.dofs, defect, niterations] = ...
44  VecMat.fixed_point_algorithm(A, f, params{:}, max(model.verbose-2, 0));
45 
46 % return results:
47 sim_data.uh = uh;
48 sim_data.defect = sqrt(defect' * model.get_inner_product_matrix(model_data) * defect);
49 sim_data.niterations = niterations;
50 sim_data.total_time = toc(start_total);
51 
52 end
function sim_data = stokes_detailed_simulation(model, model_data)
Performs a detailed simulation of a (Navier-)stokes problem.