1 function sim_data = ldg_conv_detailed_simulation(model,model_data,dummy)
2 %
function sim_data = ldg_conv_detailed_simulation(model,model_data,dummy)
4 % required fields of model:
6 % nt : number of time-intervals until T, i.e. nt+1
7 % solution slices are computed
8 % init_values_algorithm: name of
function for computing the
9 % initvalues-DOF with arguments (grid, params)
10 % example: init_values_cog
11 % operators_algorithm: name of
function for computing the
12 % L_E,L_I,b-operators with arguments (grid, params)
13 % example operators_conv_diff
14 % data_const_in_time :
if this optional field is 1, the time
15 % evolution is performed with constant operators,
16 % i.e. only the initial-time-operators are computed
17 % and used throughout the time simulation.
19 % fields of sim_data: U an array of columnwise degrees of freedom-vectors
21 % Bernard Haasdonk 27.8.2009
23 disp(
' to be adjusted!! ');
26 disp([
'entered detailed simulation ']);
29 if isempty(model_data)
30 model_data = gen_model_data(model);
33 model.decomp_mode = 0; % == complete;
36 % initial values by midpoint evaluation
37 U0 = model.init_values_algorithm(model,model_data);
43 U = zeros(length(U0),model.nt+1);
45 model.dt = model.T/model.nt;
46 %operators_required = 1;
47 %if ~isfield(model,'data_const_in_time')
48 % model.data_const_in_time = 0;
52 params.axis_equal = 1;
53 model.plot(U0,model_data.grid,params);
56 % loop over time-steps
60 disp(['entered time-loop step ',num2str(t)]);
65 % get matrices and bias-vector
68 model.t = (t-1)*model.dt;
69 [L_I, L_E, b] = model.operators_ptr(model, model_data);
70 if model.data_const_in_time
71 operators_required = 0;
75 rhs = L_E * U{t}.dofs + b;
76 if isequal(L_I, speye(size(L_I)))
80 % disp(
'check symmetry and choose solver accordingly!');
82 % nonsymmetric solvers:
83 % [U(:,t+1), flag] = bicgstab(L_I,rhs,[],1000);
84 % [U(:,t+1), flag] = cgs(L_I,rhs,[],1000);
86 % symmetric solver, non pd:
88 % see bug_symmlq.mat
for a very strange bug: cannot solve identity system!
89 % reported to matlab central, but no solution up to now.
90 % [U(:,t+1), flag] = symmlq(L_I,rhs,[],1000);
92 % [U(:,t+1), flag] = minres(L_I,rhs,[],1000);
93 % symmetric solver, pd:
94 %[U(:,t+1), flag] = pcg(L_I,rhs,[],1000);
95 % bicgstab works also quite well:
96 %[U(:,t+1), flag] = bicgstab(L_I,rhs,[],1000);
97 U{t+1}.dofs = L_I \ rhs;
100 % disp([
'error in system solution, solver return flag = ', ...
107 if model.verbose == 9
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...