2 % a simple demo script which produces scm_offline_data
for the inf-sup
4 % [0,1] the exact constant beta(mu), the lower bound beta_{LB}(mu) and
5 % the exact cercivity constant alpha(mu) are computet and the results are
8 % there on it is only inf-sup stable. For mu = 0.5 it is neither cercive
9 % nor inf-sup stable. The main point is to show, that the SCM is working
10 % fine
for little
'lin_stat' inf-sup stable problems.
12 % Dominik Garmatter 20.09 2012
15 % generate model and model_data
18 model_data = gen_model_data(model);
19 K = model.get_inner_product_matrix(model_data);
20 % add components to data
21 old_decomp_mode = model.decomp_mode;
22 model.decomp_mode = 1;
23 A_comp = model.operators(model, model_data);
24 model.decomp_mode = old_decomp_mode;
25 model_data.A_comp = A_comp;
27 model.scm_eps_tol = eps;
28 model.scm_size_C = 20;
29 model.scm_M_alpha = 20;
30 model.scm_M_plus = 200;
31 % generate offline_data
for beta
32 model.scm_desired_constant = 2;
33 scm_offline_data_beta =
scm_offline(model, model_data);
34 % write into reduced data
35 reduced_data_beta = [];
36 reduced_data_beta.scm_offline_data = scm_offline_data_beta;
37 %
for every mu
get the direct constant, and the lower bound
39 gather_alpha = zeros(mu_fineness+1,1);
40 gather_beta = zeros(mu_fineness+1,1);
41 gather_beta_LB = zeros(mu_fineness+1,1);
42 for i = 1 : mu_fineness+1
44 model = set_mu(model, 0 + (i-1)/mu_fineness); % realises discrete [0,1]
45 model.decomp_mode = 2;
46 A_coeff = model.operators(model, model_data);
47 A = lincomb_sequence(A_comp, A_coeff);
48 % also solve the EWP
for the coercivity constant
49 LM_alpha = eigs(0.5*(A+A
'),K,1,'LM
');
51 gather_alpha(i) = eigs(0.5*(A+A') - (LM_alpha+1e-10)*K,K,1,
'LM') + (LM_alpha+1e-10);
53 gather_alpha(i) = LM_alpha;
55 LM_beta = sqrt(eigs(A*K*A
',K,1,'LM
'));
57 gather_beta(i) = sqrt(eigs(A*K*A' - (LM_beta+1e-10)*K,K,1,
'LM') + (LM_beta+1e-10)); % inv(K) == K (normally it would be A*inv(K)*A
')
59 gather_beta(i) = LM_beta;
61 gather_beta_LB(i) = scm_lower_bound(model, reduced_data_beta);
68 plot(0:1/mu_fineness:1,gather_alpha,'r
')
70 leg = legend('\alpha
','\alpha_{LB}
');
71 set(leg,'Location
','Best
')
73 plot(0:1/mu_fineness:1,gather_beta,'r:
',0:1/mu_fineness:1,gather_beta_LB,'g--
')
75 leg = legend('\beta
','\beta_{LB}
');
76 set(leg,'Location
','Best
')
77 axes('position
',[0,0,1,1],'visible
','off
');
78 text(0.15,0.97,['This plot shows that the scm\_minimal\_model is coercive up to \mu =
' mat2str(0.5) ' and always inf-sup stable (except
for \mu =
' mat2str(0.5) '). The main point is that the scm is working fine
for small lin\_stat inf-sup stable problems.
'])
79 set(gcf,'Color
','white
')
function scm_demo()
scm_demo.m a simple demo script which produces scm_offline_data for the inf-sup constant of the scm_m...
function scm_offline_data = scm_offline(model, detailed_data, M_train, D_train)
scm_offline_data = scm_offline(model, detailed_data, M_train, D_train)
function model = scm_minimal_model(size)
model = scm_minimal_model(size)