source: issm/trunk-jpl/src/m/qmu/qmuresponse.m@ 15564

Last change on this file since 15564 was 15564, checked in by Mathieu Morlighem, 12 years ago

CHG: hutter-> SIA macayeal->SSA pattyn->HO stokes->FS

File size: 4.6 KB
RevLine 
[2112]1function response=qmuresponse(models,results,processedresults,descriptor)
[963]2%QMURESPONSE - compute response function from model results.
3
4if strcmpi(descriptor,'max_vel'),
[2112]5 response=max(processedresults.vel);
[2110]6elseif strcmpi(descriptor,'min_vel'),
[2112]7 response=min(processedresults.vel);
[2110]8elseif strcmpi(descriptor,'max_vx'),
[2112]9 response=max(processedresults.vx);
[4430]10elseif strcmpi(descriptor,'max_abs_vx'),
11 response=max(abs(processedresults.vx));
[2110]12elseif strcmpi(descriptor,'min_vx'),
[2112]13 response=min(processedresults.vx);
[2110]14elseif strcmpi(descriptor,'max_vy'),
[2112]15 response=max(processedresults.vy);
[4430]16elseif strcmpi(descriptor,'max_abs_vy'),
17 response=max(abs(processedresults.vy));
[2110]18elseif strcmpi(descriptor,'min_vy'),
[2112]19 response=min(processedresults.vy);
[4430]20elseif strncmpi(descriptor,'mass_flux',9),
21 indx=str2int(descriptor(10:end));
22 if isempty(indx) || ~indx
23 indx=1;
24 end
25
[2110]26 %call mass flux module.
27 m_dh=models.dh;
28 m_dhu=models.dhu;
29 m_ds=models.ds;
[15564]30 isSIA=m_dhu.parameters.isSIA;
31 isSSA=m_dh.parameters.isSSA;
32 isHO=m_dh.parameters.isHO;
33 isFS=m_ds.parameters.isFS;
34 if isSIA,
[4431]35
36% for now, separate all segments from double array for parallel to make cells
37 if (length(m_dhu.parameters.qmu_mass_flux_num_segments) > 1)
38 segments=m_dhu.parameters.qmu_mass_flux_segments;
39 m_dhu.parameters.qmu_mass_flux_segments=cell(size(m_dhu.parameters.qmu_mass_flux_num_segments));
40 ipt=1;
41 for i=1:length(m_dhu.parameters.qmu_mass_flux_num_segments)
42 if m_dhu.parameters.qmu_mass_flux_num_segments(i)
43 m_dhu.parameters.qmu_mass_flux_segments{i}=segments(ipt:ipt+m_dhu.parameters.qmu_mass_flux_num_segments(i)-1,:);
44 ipt=ipt+m_dhu.parameters.qmu_mass_flux_num_segments(i);
45 end
46 end
47 clear segments
48 end
49
[4430]50 if isnumeric(m_dhu.parameters.qmu_mass_flux_segments)
51 response=MassFlux(m_dhu.elements,m_dhu.nodes,m_dhu.vertices,m_dhu.loads,m_dhu.materials,m_dhu.parameters,results.u_g);
52 else
53 save=m_dhu.parameters.qmu_mass_flux_segments;
54 m_dhu.parameters.qmu_mass_flux_segments=m_dhu.parameters.qmu_mass_flux_segments{indx};
55 response=MassFlux(m_dhu.elements,m_dhu.nodes,m_dhu.vertices,m_dhu.loads,m_dhu.materials,m_dhu.parameters,results.u_g);
56 m_dhu.parameters.qmu_mass_flux_segments=save;
57 clear save
58 end
[4431]59
[15564]60 elseif isSSA || isHO,
[4430]61
62% for now, separate all segments from double array for parallel to make cells
[4431]63 if (length(m_dh.parameters.qmu_mass_flux_num_segments) > 1)
64 segments=m_dh.parameters.qmu_mass_flux_segments;
65 m_dh.parameters.qmu_mass_flux_segments=cell(size(m_dh.parameters.qmu_mass_flux_num_segments));
66 ipt=1;
67 for i=1:length(m_dh.parameters.qmu_mass_flux_num_segments)
68 if m_dh.parameters.qmu_mass_flux_num_segments(i)
69 m_dh.parameters.qmu_mass_flux_segments{i}=segments(ipt:ipt+m_dh.parameters.qmu_mass_flux_num_segments(i)-1,:);
70 ipt=ipt+m_dh.parameters.qmu_mass_flux_num_segments(i);
71 end
[4430]72 end
[4431]73 clear segments
[4430]74 end
75
76 if isnumeric(m_dh.parameters.qmu_mass_flux_segments)
77 response=MassFlux(m_dh.elements,m_dh.nodes,m_dh.vertices,m_dh.loads,m_dh.materials,m_dh.parameters,results.u_g);
78 else
79 save=m_dh.parameters.qmu_mass_flux_segments;
80 m_dh.parameters.qmu_mass_flux_segments=m_dh.parameters.qmu_mass_flux_segments{indx};
81 response=MassFlux(m_dh.elements,m_dh.nodes,m_dh.vertices,m_dh.loads,m_dh.materials,m_dh.parameters,results.u_g);
82 m_dh.parameters.qmu_mass_flux_segments=save;
83 clear save
84 end
[4431]85
[15564]86 elseif isFS,
[4431]87
88% for now, separate all segments from double array for parallel to make cells
89 if (length(m_ds.parameters.qmu_mass_flux_num_segments) > 1)
90 segments=m_ds.parameters.qmu_mass_flux_segments;
91 m_ds.parameters.qmu_mass_flux_segments=cell(size(m_ds.parameters.qmu_mass_flux_num_segments));
92 ipt=1;
93 for i=1:length(m_ds.parameters.qmu_mass_flux_num_segments)
94 if m_ds.parameters.qmu_mass_flux_num_segments(i)
95 m_ds.parameters.qmu_mass_flux_segments{i}=segments(ipt:ipt+m_ds.parameters.qmu_mass_flux_num_segments(i)-1,:);
96 ipt=ipt+m_ds.parameters.qmu_mass_flux_num_segments(i);
97 end
98 end
99 clear segments
100 end
101
[4430]102 if isnumeric(m_ds.parameters.qmu_mass_flux_segments)
103 response=MassFlux(m_ds.elements,m_ds.nodes,m_ds.vertices,m_ds.loads,m_ds.materials,m_ds.parameters,results.u_g);
104 else
105 save=m_ds.parameters.qmu_mass_flux_segments;
106 m_ds.parameters.qmu_mass_flux_segments=m_ds.parameters.qmu_mass_flux_segments{indx};
107 response=MassFlux(m_ds.elements,m_ds.nodes,m_ds.vertices,m_ds.loads,m_ds.materials,m_ds.parameters,results.u_g);
108 m_ds.parameters.qmu_mass_flux_segments=save;
109 clear save
110 end
[2110]111 else
112 error('qmuresponse error message: unsupported analysis type for mass_flux computation!');
113 end
[963]114else
[4430]115 error(['qmuresponse error message: unknown descriptor ' descriptor]);
[963]116end
Note: See TracBrowser for help on using the repository browser.