forked from project-asgard/DG-SparseGrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfk6d_vlasov4_check.m
51 lines (41 loc) · 1.33 KB
/
fk6d_vlasov4_check.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function isok = fk6d_vlasov4_check(testCase)
% isok = fk6d_vlasov4_check(testCase)
%
idebug = 1;
addpath(genpath(pwd));
disp(sprintf('Testing with valsov4, testCase=%d',testCase));
switch(testCase)
case 1
quiet = 1; lev = 3; deg = 2; TEND = 1; compression = 0;
case 2
quiet = 1; lev = 3; deg = 2; TEND = 1; compression = 1;
case 3
quiet = 1; lev = 3; deg = 2; TEND = 1; compression = 2;
case 4
quiet = 1; lev = 3; deg = 2; TEND = 1; compression = 3;
case 5
quiet = 1; lev = 3; deg = 2; TEND = 1; compression = 4;
otherwise
error(sprintf('fk6d_vlasov4_check: invalid testCase=%d',testCase));
end;
act_f = fk6d(Vlasov4,lev,deg,TEND,quiet,compression);
load('tests/vlasov4/solution.mat');
exp_f = fval;
isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0;
tol = 1e-4;
isok = all( abs(act_f(:)-exp_f(:)) <= tol * abs( exp_f(:) ) );
if (idebug >= 1),
if (~isok),
maxerr = max(abs(act_f(:)-exp_f(:)));
error(sprintf('testCase=%d, maxerr = %g', testCase,maxerr ));
end;
end;
if (~isOctave),
verifyEqual(testCase,act_f,exp_f,'RelTol',tol);
end;
end
%!test assert(fk6d_vlasov4_check(1))
%!test assert(fk6d_vlasov4_check(2))
%!test assert(fk6d_vlasov4_check(3))
%!test assert(fk6d_vlasov4_check(4))
%!test assert(fk6d_vlasov4_check(5))