rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
test_stochastic_assessment.m
Go to the documentation of this file.
1 function OK = test_stochastic_assessment
2  % consistency check for the StochasticAssessment helper classes
3  %
4  % Test cases:
5  % - 1. compute errors for fixed (M,N) combinations
6  % - 2. compute error estimators for fixed (M,N) combinations
7  % - 3. same as 2, but compute operator conditions as well.
8  %
9  % Finally all three outputs are merged
10  % TODO: compare the result with some expected values
11 
12  OK = 1;
13 
14  matfile = fullfile(rbmatlabhome, 'test', 'test_rb_richards_fv_data');
15  load(matfile);
16 
17  rbdd = get_by_description(detailed_data.datatree, 'rb', rbmodel);
18 
19  disp('Test 1');
20  rbmodel.enable_error_estimator = false;
21  rbmodel.Mstrich = 0;
22  assessment1 = Postprocess.StochasticAssessment.Assessment(matfile, rbmodel, 3);
23  assessment1.M_by_N_ratio = 0;
24  assessment1.compute_errors = true;
25  assessment1.samples = {[0.1 0.5 1]};
26  try
27  evalc('output1 = assessment1.compute();');
28  catch exception
29  OK = false;
30  disp('> failed');
31  disp(getReport(exception));
32  end
33  if OK
34  disp('> passed');
35  end
36 
37  disp('Test 2');
38  assessment2 = copy(assessment1);
39  assessment2.compute_estimates = true;
40  assessment2.rmodel.enable_error_estimator = true;
41  assessment2.rmodel.Mstrich = 1;
42 
43  try
44  evalc('output2 = assessment2.compute();');
45  catch exception
46  OK = false;
47  disp('> failed');
48  disp(getReport(exception));
49  end
50  if OK
51  disp('> passed');
52  end
53 
54  disp('Test 3');
55  assessment3 = copy(assessment2);
56  assessment3.compute_conditions = true;
57  try
58  evalc('output = assessment3.compute();');
59  catch exception
60  OK = false;
61  disp('> failed');
62  disp(getReport(exception));
63  end
64  if OK
65  disp('> passed');
66  end
67 
68  output1.merge(output2);
69  output.merge(output1);
70 
71 end
72