rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
test_lin_nonlin_evol.m
Go to the documentation of this file.
1 % small script performing one time step in linear and nonlinear
2 % mode and comparing the error. The error should ideally only be in the
3 % order of 10^-15
4 
5 % Bernard Haasdonk 21.5.2007
6 
7 % setup parameters, that switching between lin-evol and nonlin-evol
8 % is possible
9 load demo_nonlin_evol_params
10 params.operators_algorithm = 'fv_operators_implicit_explicit';
11 %params.T = 100*params.T/params.nt;
12 %params.nt = 100;
13 params.c_init = 1; % in case of no structure
14 params.k = 5e-8;
15 
16 % get solution in linear case:
17 params.rb_problem_type = 'lin_evol';
18 grid = construct_grid(params);
19 Ulin = detailed_simulation(grid,params);
20 
21 % get solution in nonlinear-case
22 params.rb_problem_type = 'nonlin_evol';
23 Unonlin = detailed_simulation(grid,params);
24 
25 % compare
26 if ~isequal(Ulin(:,1),Unonlin(:,1))
27  error('initial data does not correspond!!');
28 end;
29 
30 % visualize error
31 params.title = 'difference Unonlin-Ulin';
32 plot_element_data_sequence(grid,Unonlin-Ulin,params);
33 
34 disp('detailed_simulation for lin_evol and nonlin_evol give');
35 if max(max(abs(Unonlin-Ulin))) > 1e-14
36  disp('different results! Test failed');
37 else
38  disp('identical result! Test OK');
39 end;
40 
41 % TO BE ADJUSTED TO NEW SYNTAX
42 %| \docupdate