comparison +noname/testCfl.m @ 2:bce9e28c1e26

Added a cfl paramater to getTimestepper in Discretization. Added function to get cfl value for a Discr.
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 18 Sep 2015 12:50:52 +0200
parents
children 7249f105e67b
comparison
equal deleted inserted replaced
1:5ae4f23d9130 2:bce9e28c1e26
1 function testCfl(discr, timestepper_method, T, alpha0, tol,threshold)
2 default_arg('tol',0.00005);
3 default_arg('threshold',1e2);
4
5 alpha0(2) = alpha0(1)+2*(alpha0(2)-alpha0(1));
6
7 while( (alpha0(2)-alpha0(1))/alpha0(1) > tol)
8 alpha = mean(alpha0);
9
10 ts = discr.getTimestepper(timestepper_method,[],alpha);
11
12 warning('off','all')
13 ts.evolve(T,true);
14 warning('on','all')
15
16 [v,t] = ts.getV();
17
18 max_val = max(v);
19
20 if isnan(max_val) || max_val == Inf || max_val > threshold
21 alpha0(2) = alpha;
22 else
23 alpha0(1) = alpha;
24 end
25
26 fprintf('[%.3e,%.3e]: a = %.3e, max= %.2e\n',alpha0(1),alpha0(2), alpha,max_val);
27
28 end
29
30 fprintf('T = %-3d dof = %-4d order = %d: clf = %.4e\n',T, discr.size(), discr.order, alpha0(1));
31
32 end