1 function [A, r] = comsol_thermal_block_operators(model,model_data)
2 %
function [A, r] = comsol_thermal_block_operators(model,model_data)
4 %
function returns the Operators of the comsol 2D thermal block model with
5 % affine decomposition!
7 % The Operators are extracted from COMSOL
if model.use_comsol=1;
8 % Otherwise they are just forwarded from model_data where they are stored.
15 % - A, r: components (model.decomp_mode=1) or coefficients (model.decomp_mode=2)
18 % Oliver Zeeb, 25.08.2012
22 switch model.decomp_mode
24 case 0 % full matrices!
26 cmodel = model_data.comsol_model;
27 cmodel.sol('sol1').feature('v1').set('scalemethod','none');
28 cmodel.sol('sol1').feature('s1').active(false);
29 str = mphmatrix(cmodel,'sol1','Out',{
'K',
'L'});
32 cmodel.sol(
'sol1').feature(
'v1').set(
'scalemethod',
'auto');
33 cmodel.sol(
'sol1').feature(
's1').active(
true);
34 else %~model.use_comsol
35 error(
'not yet implemented (since this case is most times unneeded...)')
41 mu_old = get_mu(model);
42 cmodel = model_data.comsol_model;
43 cmodel.sol('sol1').feature('v1').set('scalemethod','none');
44 cmodel.sol('sol1').feature('s1').active(false);
45 A=cell(1,length(mu_old));
47 for k = 1:length(mu_old)
48 mu = zeros(length(mu_old),1);
50 model = set_mu(model,mu);
51 cmodel = comsol_set_mu_from_rbmatlab_model(model,cmodel);
52 str = mphmatrix(cmodel,'sol1','Out',{
'K',
'L'});
58 model=set_mu(model,mu_old);
59 cmodel = comsol_set_mu_from_rbmatlab_model(model,cmodel);
60 cmodel.sol(
'sol1').feature(
'v1').set(
'scalemethod',
'auto');
61 cmodel.sol(
'sol1').feature(
's1').active(
true);
62 if model.comsol_get_eliminated_data %cut the matrices -->
return eliminated matrices!
64 A{k} = A{k}(model_data.ind_vectors.com_DOF_ind,model_data.ind_vectors.com_DOF_ind);
67 r{k} = r{k}(model_data.ind_vectors.com_DOF_ind);
70 else %decomp_mode = 1, ~model.use_comsol
71 if model.comsol_get_eliminated_data %
return eliminated data
72 A = model_data.operators.A_comp_eliminated;
73 r = model_data.operators.f_comp_eliminated;
74 else %
return full data
75 A = model_data.operators.A_comp_full;
76 r = model_data.operators.f_comp_full;
86 error(
'unknown decomp_mode')