Changeset 27
- Timestamp:
- 04/24/09 10:14:10 (16 years ago)
- Location:
- issm/trunk/src/m/classes
- Files:
-
- 14 added
- 1 deleted
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/@continuous_design/continuous_design.m
r1 r27 7 7 properties 8 8 descriptor=''; 9 initpt = NaN; 10 lower = NaN; 11 upper = NaN; 9 initpt = 0.; 10 lower =-Inf; 11 upper = Inf; 12 scale_type='none'; 13 scale = 1.; 12 14 end 13 15 … … 35 37 otherwise 36 38 cdv.descriptor=varargin{1}; 37 cdv.initpt =varargin{2}; 38 if (nargin >= 3) 39 cdv.lower =varargin{3}; 40 if (nargin >= 4) 41 cdv.upper =varargin{4}; 42 if (nargin > 4) 43 warning('continuous_design:extra_arg',... 44 'Extra arguments for object of class ''%s''.',... 45 class(cdv)); 39 40 if (nargin >= 2) 41 cdv.initpt =varargin{2}; 42 if (nargin >= 3) 43 cdv.lower =varargin{3}; 44 if (nargin >= 4) 45 cdv.upper =varargin{4}; 46 if (nargin >= 5) 47 cdv.scale_type=varargin{5}; 48 if (nargin >= 6) 49 cdv.scale =varargin{6}; 50 if (nargin > 6) 51 warning('continuous_design:extra_arg',... 52 'Extra arguments for object of class ''%s''.',... 53 class(cdv)); 54 end 55 end 56 end 46 57 end 47 58 end … … 50 61 51 62 end 52 function [desc] = dvar_desc(cdv)63 function [desc] =prop_desc(cdv) 53 64 desc=cell(size(cdv)); 54 65 for i=1:numel(cdv) … … 57 68 desc=allempty(desc); 58 69 end 59 function [initpt]= dvar_initpt(cdv)70 function [initpt]=prop_initpt(cdv) 60 71 initpt=zeros(size(cdv)); 61 72 for i=1:numel(cdv) 62 73 initpt(i)=cdv(i).initpt; 63 74 end 75 initpt=allequal(initpt,0.); 64 76 end 65 function [lower] = dvar_lower(cdv)77 function [lower] =prop_lower(cdv) 66 78 lower=zeros(size(cdv)); 67 79 for i=1:numel(cdv) 68 80 lower(i)=cdv(i).lower; 69 81 end 70 lower=all nan(lower);82 lower=allequal(lower,-Inf); 71 83 end 72 function [upper] = dvar_upper(cdv)84 function [upper] =prop_upper(cdv) 73 85 upper=zeros(size(cdv)); 74 86 for i=1:numel(cdv) 75 87 upper(i)=cdv(i).upper; 76 88 end 77 upper=all nan(upper);89 upper=allequal(upper, Inf); 78 90 end 79 function [mean] = dvar_mean(cdv)91 function [mean] =prop_mean(cdv) 80 92 mean=[]; 81 93 end 82 function [stddev]= dvar_stddev(cdv)94 function [stddev]=prop_stddev(cdv) 83 95 stddev=[]; 84 96 end 85 function [initst]= dvar_initst(cdv)97 function [initst]=prop_initst(cdv) 86 98 initst=[]; 99 end 100 function [stype] =prop_stype(cdv) 101 stype=cell(size(cdv)); 102 for i=1:numel(cdv) 103 stype(i)=cellstr(cdv(i).scale_type); 104 end 105 stype=allequal(stype,'none'); 106 end 107 function [scale] =prop_scale(cdv) 108 scale=zeros(size(cdv)); 109 for i=1:numel(cdv) 110 scale(i)=cdv(i).scale; 111 end 112 scale=allequal(scale,1.); 87 113 end 88 114 end -
issm/trunk/src/m/classes/@continuous_design/display.m
r1 r27 20 20 disp(sprintf(' initpt: %g' ,cdv(i).initpt)); 21 21 disp(sprintf(' lower: %g' ,cdv(i).lower)); 22 disp(sprintf(' upper: %g\n' ,cdv(i).upper)); 22 disp(sprintf(' upper: %g' ,cdv(i).upper)); 23 disp(sprintf(' scale_type: ''%s''' ,cdv(i).scale_type)); 24 disp(sprintf(' scale: %g' ,cdv(i).scale)); 23 25 end 24 26 -
issm/trunk/src/m/classes/@continuous_state/continuous_state.m
r1 r27 7 7 properties 8 8 descriptor=''; 9 initst = NaN;10 lower = NaN;11 upper = NaN;9 initst = 0.; 10 lower =-Inf; 11 upper = Inf; 12 12 end 13 13 … … 35 35 otherwise 36 36 csv.descriptor=varargin{1}; 37 csv.initst =varargin{2}; 38 if (nargin >= 3) 39 csv.lower =varargin{3}; 40 if (nargin >= 4) 41 csv.upper =varargin{4}; 42 if (nargin > 4) 43 warning('continuous_state:extra_arg',... 44 'Extra arguments for object of class ''%s''.',... 45 class(csv)); 37 38 if (nargin >= 2) 39 csv.initst =varargin{2}; 40 if (nargin >= 3) 41 csv.lower =varargin{3}; 42 if (nargin >= 4) 43 csv.upper =varargin{4}; 44 if (nargin > 4) 45 warning('continuous_state:extra_arg',... 46 'Extra arguments for object of class ''%s''.',... 47 class(csv)); 48 end 46 49 end 47 50 end … … 50 53 51 54 end 52 function [desc] = dvar_desc(csv)55 function [desc] =prop_desc(csv) 53 56 desc=cell(size(csv)); 54 57 for i=1:numel(csv) … … 57 60 desc=allempty(desc); 58 61 end 59 function [initpt]= dvar_initpt(csv)62 function [initpt]=prop_initpt(csv) 60 63 initpt=[]; 61 64 end 62 function [lower] = dvar_lower(csv)65 function [lower] =prop_lower(csv) 63 66 lower=zeros(size(csv)); 64 67 for i=1:numel(csv) 65 68 lower(i)=csv(i).lower; 66 69 end 67 lower=all nan(lower);70 lower=allequal(lower,-Inf); 68 71 end 69 function [upper] = dvar_upper(csv)72 function [upper] =prop_upper(csv) 70 73 upper=zeros(size(csv)); 71 74 for i=1:numel(csv) 72 75 upper(i)=csv(i).upper; 73 76 end 74 upper=all nan(upper);77 upper=allequal(upper, Inf); 75 78 end 76 function [mean] = dvar_mean(csv)79 function [mean] =prop_mean(csv) 77 80 mean=[]; 78 81 end 79 function [stddev]= dvar_stddev(csv)82 function [stddev]=prop_stddev(csv) 80 83 stddev=[]; 81 84 end 82 function [initst]= dvar_initst(csv)85 function [initst]=prop_initst(csv) 83 86 initst=zeros(size(csv)); 84 87 for i=1:numel(csv) 85 88 initst(i)=csv(i).initst; 86 89 end 90 initst=allequal(initst,0.); 91 end 92 function [stype] =prop_stype(csv) 93 stype={}; 94 end 95 function [scale] =prop_scale(csv) 96 scale=[]; 87 97 end 88 98 end -
issm/trunk/src/m/classes/@least_squares_term/least_squares_term.m
r1 r27 48 48 49 49 end 50 function [desc] = dresp_desc(lst)50 function [desc] =prop_desc(lst) 51 51 desc=cell(size(lst)); 52 52 for i=1:numel(lst) 53 53 desc(i)=cellstr(lst(i).descriptor); 54 54 end 55 desc=allempty(desc); 55 56 end 56 function [stype ]=dresp_stype(lst)57 function [stype] =prop_stype(lst) 57 58 stype=cell(size(lst)); 58 59 for i=1:numel(lst) 59 60 stype(i)=cellstr(lst(i).scale_type); 60 61 end 62 stype=allequal(stype,'none'); 61 63 end 62 function [scale] = dresp_scale(lst)64 function [scale] =prop_scale(lst) 63 65 scale=zeros(size(lst)); 64 66 for i=1:numel(lst) 65 67 scale(i)=lst(i).scale; 66 68 end 69 scale=allequal(scale,1.); 67 70 end 68 function [weight]= dresp_weight(lst)71 function [weight]=prop_weight(lst) 69 72 weight=zeros(size(lst)); 70 73 for i=1:numel(lst) 71 74 weight(i)=lst(i).weight; 72 75 end 76 weight=allequal(weight,1.); 73 77 end 74 function [lower] = dresp_lower(lst)78 function [lower] =prop_lower(lst) 75 79 lower=[]; 76 80 end 77 function [upper] = dresp_upper(lst)81 function [upper] =prop_upper(lst) 78 82 upper=[]; 79 83 end 80 function [target]= dresp_target(lst)84 function [target]=prop_target(lst) 81 85 target=[]; 82 86 end -
issm/trunk/src/m/classes/@model/model.m
r1 r27 88 88 89 89 %Materials parameters 90 md.rho_ice= 0;91 md.rho_water= 0;90 md.rho_ice=917; 91 md.rho_water=1023; 92 92 md.heatcapacity=2093; 93 93 md.latentheat=3.34*10^5; %(J/kg); … … 99 99 100 100 %Physical parameters 101 md.g= 0;101 md.g=9.81; 102 102 md.yts=365*24*3600; 103 103 md.drag=NaN; … … 148 148 149 149 %Statics parameters 150 md.eps_rel=0 ;151 md.eps_abs= 0;150 md.eps_rel=0.01; 151 md.eps_abs=10; 152 152 md.acceleration=0; 153 md.sparsity=0 ;153 md.sparsity=0.001; 154 154 md.connectivity=10; 155 155 md.lowmem=0; … … 172 172 173 173 %Control 174 md.control_type= 'drag';174 md.control_type={'drag'}; 175 175 md.cont_vx=NaN; 176 176 md.cont_vy=NaN; … … 181 181 md.nsteps=0; 182 182 md.maxiter=[]; 183 md.tolx= 0;183 md.tolx=10^-4; 184 184 md.optscal=[]; 185 185 md.mincontrolconstraint=0; … … 188 188 md.epsvel=eps; 189 189 md.meanvel=0; 190 190 191 191 %Output parameters 192 192 md.parameteroutput={}; … … 199 199 md.strainrate=NaN; 200 200 md.plot=1; 201 201 202 202 %debugging 203 203 md.debug=1; … … 247 247 %Cielo parameters 248 248 md.solverstring=' -mat_type aijmumps -ksp_type preonly -pc_type lu -mat_mumps_icntl_14 40 '; 249 250 % Needed for running in parallel249 250 %Trash, still to organize 251 251 md.analysis_type=''; 252 252 … … 260 260 261 261 %qmu 262 md.variables=struct([]); 263 md.responses=struct([]); 262 md.variables =struct(); 263 md.responses =struct(); 264 md.qmu_method=struct(); 265 md.qmu_params=struct(); 264 266 md.dakotaresults=NaN; 265 md.dakotain =NaN; 266 md.dakotaout=NaN; 267 md.dakotadat=NaN; 268 % md.method ='sampling'; 269 md.seed =1234; 270 md.samples =10; 271 md.sample_type ='lhs'; 272 md.method ='local reliability'; 273 md.interval_type ='forward'; 274 md.fd_gradient_step_size= 0.01; 275 md.evaluation_concurrency= 2; 276 md.npart = 1; 277 278 md.analysis_driver =''; 279 md.analysis_components=''; 267 md.dakotain =NaN; 268 md.dakotaout =NaN; 269 md.dakotadat =NaN; 270 271 md.npart =1; 280 272 281 273 %Solver options -
issm/trunk/src/m/classes/@nonlinear_equality_constraint/nonlinear_equality_constraint.m
r1 r27 7 7 properties 8 8 descriptor=''; 9 target = NaN;9 target = 0.; 10 10 scale_type='none'; 11 11 scale = 1.; … … 52 52 53 53 end 54 function [desc] = dresp_desc(nec)54 function [desc] =prop_desc(nec) 55 55 desc=cell(size(nec)); 56 56 for i=1:numel(nec) 57 57 desc(i)=cellstr(nec(i).descriptor); 58 58 end 59 desc=allempty(desc); 59 60 end 60 function [stype ]=dresp_stype(nec)61 function [stype] =prop_stype(nec) 61 62 stype=cell(size(nec)); 62 63 for i=1:numel(nec) 63 64 stype(i)=cellstr(nec(i).scale_type); 64 65 end 66 stype=allequal(stype,'none'); 65 67 end 66 function [scale] = dresp_scale(nec)68 function [scale] =prop_scale(nec) 67 69 scale=zeros(size(nec)); 68 70 for i=1:numel(nec) 69 71 scale(i)=nec(i).scale; 70 72 end 73 scale=allequal(scale,1.); 71 74 end 72 function [weight]= dresp_weight(nec)75 function [weight]=prop_weight(nec) 73 76 weight=[]; 74 77 end 75 function [lower] = dresp_lower(nec)78 function [lower] =prop_lower(nec) 76 79 lower=[]; 77 80 end 78 function [upper] = dresp_upper(nec)81 function [upper] =prop_upper(nec) 79 82 upper=[]; 80 83 end 81 function [target]= dresp_target(nec)84 function [target]=prop_target(nec) 82 85 target=zeros(size(nec)); 83 86 for i=1:numel(nec) 84 87 target(i)=nec(i).target; 85 88 end 89 target=allequal(target,0.); 86 90 end 87 91 end -
issm/trunk/src/m/classes/@nonlinear_inequality_constraint/nonlinear_inequality_constraint.m
r1 r27 7 7 properties 8 8 descriptor=''; 9 lower = NaN;10 upper = NaN;9 lower =-Inf; 10 upper = 0.; 11 11 scale_type='none'; 12 12 scale = 1.; … … 54 54 55 55 end 56 function [desc] = dresp_desc(nic)56 function [desc] =prop_desc(nic) 57 57 desc=cell(size(nic)); 58 58 for i=1:numel(nic) 59 59 desc(i)=cellstr(nic(i).descriptor); 60 60 end 61 desc=allempty(desc); 61 62 end 62 function [stype ]=dresp_stype(nic)63 function [stype] =prop_stype(nic) 63 64 stype=cell(size(nic)); 64 65 for i=1:numel(nic) 65 66 stype(i)=cellstr(nic(i).scale_type); 66 67 end 68 stype=allequal(stype,'none'); 67 69 end 68 function [scale] = dresp_scale(nic)70 function [scale] =prop_scale(nic) 69 71 scale=zeros(size(nic)); 70 72 for i=1:numel(nic) 71 73 scale(i)=nic(i).scale; 72 74 end 75 scale=allequal(scale,1.); 73 76 end 74 function [weight]= dresp_weight(nic)77 function [weight]=prop_weight(nic) 75 78 weight=[]; 76 79 end 77 function [lower] = dresp_lower(nic)80 function [lower] =prop_lower(nic) 78 81 lower=zeros(size(nic)); 79 82 for i=1:numel(nic) 80 83 lower(i)=nic(i).lower; 81 84 end 85 lower=allequal(lower,-Inf); 82 86 end 83 function [upper] = dresp_upper(nic)87 function [upper] =prop_upper(nic) 84 88 upper=zeros(size(nic)); 85 89 for i=1:numel(nic) 86 90 upper(i)=nic(i).upper; 87 91 end 92 upper=allequal(upper,0.); 88 93 end 89 function [target]= dresp_target(nic)94 function [target]=prop_target(nic) 90 95 target=[]; 91 96 end -
issm/trunk/src/m/classes/@normal_uncertain/normal_uncertain.m
r1 r27 9 9 mean = NaN; 10 10 stddev = NaN; 11 lower = NaN;12 upper = NaN;11 lower =-Inf; 12 upper = Inf; 13 13 end 14 14 … … 44 44 nuv.mean =varargin{2}; 45 45 nuv.stddev =varargin{3}; 46 46 47 if (nargin >= 4) 47 48 nuv.lower =varargin{4}; … … 58 59 59 60 end 60 function [desc] = dvar_desc(nuv)61 function [desc] =prop_desc(nuv) 61 62 desc=cell(size(nuv)); 62 63 for i=1:numel(nuv) … … 65 66 desc=allempty(desc); 66 67 end 67 function [initpt]= dvar_initpt(nuv)68 function [initpt]=prop_initpt(nuv) 68 69 initpt=[]; 69 70 end 70 function [lower] = dvar_lower(nuv)71 function [lower] =prop_lower(nuv) 71 72 lower=zeros(size(nuv)); 72 73 for i=1:numel(nuv) 73 74 lower(i)=nuv(i).lower; 74 75 end 75 lower=all nan(lower);76 lower=allequal(lower,-Inf); 76 77 end 77 function [upper] = dvar_upper(nuv)78 function [upper] =prop_upper(nuv) 78 79 upper=zeros(size(nuv)); 79 80 for i=1:numel(nuv) 80 81 upper(i)=nuv(i).upper; 81 82 end 82 upper=all nan(upper);83 upper=allequal(upper, Inf); 83 84 end 84 function [mean] = dvar_mean(nuv)85 function [mean] =prop_mean(nuv) 85 86 mean=zeros(size(nuv)); 86 87 for i=1:numel(nuv) … … 88 89 end 89 90 end 90 function [stddev]= dvar_stddev(nuv)91 function [stddev]=prop_stddev(nuv) 91 92 stddev=zeros(size(nuv)); 92 93 for i=1:numel(nuv) … … 94 95 end 95 96 end 96 function [initst]= dvar_initst(nuv)97 function [initst]=prop_initst(nuv) 97 98 initst=[]; 99 end 100 function [stype] =prop_stype(nuv) 101 stype={}; 102 end 103 function [scale] =prop_scale(nuv) 104 scale=[]; 98 105 end 99 106 end -
issm/trunk/src/m/classes/@objective_function/objective_function.m
r1 r27 48 48 49 49 end 50 function [desc] = dresp_desc(of)50 function [desc] =prop_desc(of) 51 51 desc=cell(size(of)); 52 52 for i=1:numel(of) 53 53 desc(i)=cellstr(of(i).descriptor); 54 54 end 55 desc=allempty(desc); 55 56 end 56 function [stype ]=dresp_stype(of)57 function [stype] =prop_stype(of) 57 58 stype=cell(size(of)); 58 59 for i=1:numel(of) 59 60 stype(i)=cellstr(of(i).scale_type); 60 61 end 62 stype=allequal(stype,'none'); 61 63 end 62 function [scale] = dresp_scale(of)64 function [scale] =prop_scale(of) 63 65 scale=zeros(size(of)); 64 66 for i=1:numel(of) 65 67 scale(i)=of(i).scale; 66 68 end 69 scale=allequal(scale,1.); 67 70 end 68 function [weight]= dresp_weight(of)71 function [weight]=prop_weight(of) 69 72 weight=zeros(size(of)); 70 73 for i=1:numel(of) 71 74 weight(i)=of(i).weight; 72 75 end 76 weight=allequal(weight,1.); 73 77 end 74 function [lower] = dresp_lower(of)78 function [lower] =prop_lower(of) 75 79 lower=[]; 76 80 end 77 function [upper] = dresp_upper(of)81 function [upper] =prop_upper(of) 78 82 upper=[]; 79 83 end 80 function [target]= dresp_target(of)84 function [target]=prop_target(of) 81 85 target=[]; 82 86 end -
issm/trunk/src/m/classes/@response_function/response_function.m
r1 r27 52 52 53 53 end 54 function [desc] = dresp_desc(rf)54 function [desc] =prop_desc(rf) 55 55 desc=cell(size(rf)); 56 56 for i=1:numel(rf) 57 57 desc(i)=cellstr(rf(i).descriptor); 58 58 end 59 desc=allempty(desc); 59 60 end 60 function [stype ]=dresp_stype(rf)61 function [stype] =prop_stype(rf) 61 62 stype={}; 62 63 end 63 function [scale] = dresp_scale(rf)64 function [scale] =prop_scale(rf) 64 65 scale=[]; 65 66 end 66 function [weight]= dresp_weight(rf)67 function [weight]=prop_weight(rf) 67 68 weight=[]; 68 69 end 69 function [lower] = dresp_lower(rf)70 function [lower] =prop_lower(rf) 70 71 lower=[]; 71 72 end 72 function [upper] = dresp_upper(rf)73 function [upper] =prop_upper(rf) 73 74 upper=[]; 74 75 end 75 function [target]= dresp_target(rf)76 function [target]=prop_target(rf) 76 77 target=[]; 77 78 end 78 function [respl,probl,rell,grell]= dresp_levels(rf)79 function [respl,probl,rell,grell]=prop_levels(rf) 79 80 respl=cell(size(rf)); 80 81 probl=cell(size(rf)); -
issm/trunk/src/m/classes/public/SectionValues.m
r1 r27 83 83 %Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system 84 84 offset=10^-10; 85 bed=griddata_mesh_to_mesh _3d(md.elements,md.x,md.y,md.z,md.bed,X,Y,Z,'node')+offset;86 surface=griddata_mesh_to_mesh _3d(md.elements,md.x,md.y,md.z,md.surface,X,Y,Z,'node')-offset;85 bed=griddata_mesh_to_mesh(md.elements2d,md.x2d,md.y2d,project2d(md,md.bed,1),X,Y,'node')+offset; 86 surface=griddata_mesh_to_mesh(md.elements2d,md.x2d,md.y2d,project2d(md,md.surface,1),X,Y,'node')+offset; 87 87 88 88 %Some useful parameters -
issm/trunk/src/m/classes/public/ThicknessCorrection.m
r1 r27 20 20 21 21 in=ArgusContourToMesh(md.elements,md.x,md.y,expread(filename,1),'node',1); 22 pos_shelf=find(in & md.gridoniceshelf);23 pos_sheet=find(in & ~md.gridoniceshelf);22 pos_shelf=find(in & ~md.gridonicesheet); 23 pos_sheet=find(in & md.gridonicesheet); 24 24 for i=1:length(pos_shelf) 25 25 %search the grid on ice sheet the closest to i -
issm/trunk/src/m/classes/public/displaycontrol.m
r1 r27 10 10 11 11 disp(sprintf(' ''%s''','control')); 12 disp(sprintf(' control_type: %s (control type, ex: ''drag'', or ''B'')',md.control_type)); 12 %control type 13 control_string=''; 14 for i=1:length(md.control_type), 15 parameter=md.control_type{i}; 16 %check this parameter is a field from model! 17 if ~isfield(struct(md),parameter), 18 error('displaysolutionparameters error message: one of the control type parameters does not exist!'); 19 end 20 control_string=[control_string parameter ' and ']; 21 end 22 control_string=control_string(1:length(control_string)-5); 23 disp(sprintf(' control_type: %s %s',control_string,'(list of parameters where inverse control is carried out; ex: {''drag''}, or {''drag'',''B''})')); 13 24 disp(sprintf(' fit: (%i) (''absolute: 0'', ''relative: 1'', or ''logarithmic: 2''. default is ''absolute: 0'', for each optimization steps)',length(md.fit))); 14 25 disp(sprintf(' meanvel: %g (velocity scaling factor when evaluating relative or logarithmic misfit)',md.meanvel)); -
issm/trunk/src/m/classes/public/displayqmu.m
r1 r27 10 10 11 11 disp(sprintf(' ''%s''','qmu using Dakota')); 12 12 13 disp(sprintf(' variables: (arrays of each variable class)')); 13 14 fnames=fieldnames(md.variables); … … 16 17 fnames{i},size(md.variables.(fnames{i})),class(md.variables.(fnames{i})))); 17 18 end 19 18 20 disp(sprintf(' responses: (arrays of each response class)')); 19 21 fnames=fieldnames(md.responses); … … 22 24 fnames{i},size(md.responses.(fnames{i})),class(md.responses.(fnames{i})))); 23 25 end 26 27 disp(sprintf(' qmu_method: (array of dakota_method class)')); 28 for i=1:numel(md.qmu_method); 29 if strcmp(class(md.qmu_method(i)),'dakota_method') 30 disp(sprintf(' method%s : ''%s''',... 31 string_dim(md.qmu_method,i),md.qmu_method(i).method)); 32 end 33 end 34 35 for i=1:numel(md.qmu_params) 36 disp(sprintf(' qmu_params%s: (array of method-independent parameters)',... 37 string_dim(md.qmu_params,i))); 38 fnames=fieldnames(md.qmu_params(i)); 39 maxlen=0; 40 for j=1:numel(fnames) 41 maxlen=max(maxlen,length(fnames{j})); 42 end 43 44 for j=1:numel(fnames) 45 disp(sprintf([' %-' num2str(maxlen+1) 's: %s'],... 46 fnames{j},any2str(md.qmu_params(i).(fnames{j})))); 47 end 48 end 49 24 50 disp(sprintf(' dakotaresults: 1x%i {dvar,rfunc,scm,pcm,srcm,prcm}',length(md.dakotaresults))); 25 51 if isempty(md.dakotain), disp(sprintf(' dakotain: N/A')); else disp(sprintf(' dakotain: not displayed (can be accessed by typing md.dakotain)'));end 26 52 if isempty(md.dakotaout), disp(sprintf(' dakotaout: N/A')); else disp(sprintf(' dakotaout: not displayed (can be accessed by typing md.dakotaout)'));end 27 53 if isempty(md.dakotadat), disp(sprintf(' dakotadat: N/A')); else disp(sprintf(' dakotadat: not displayed (can be accessed by typing md.dakotadat)'));end 28 disp(sprintf(' method: ''%s'' (''local reliability'' or ''sampling'')',md.method)); 29 disp(sprintf(' seed: %g (random seed number)',md.seed)); 30 disp(sprintf(' samples: %i (number of samples)',md.samples)); 31 disp(sprintf(' sample_type: ''%s'' (type of sampling, ''random'' or ''lhs'')',md.sample_type)); 32 disp(sprintf(' interval_type: ''%s'' (FD ''forward'' or ''central'')',md.interval_type)); 33 disp(sprintf(' fd_gradient_step_size: %g (FD gradient step size, default= .001) ',md.fd_gradient_step_size)); 34 disp(sprintf(' evaluation_concurrency: %i (evaluation concurrency level)',md.evaluation_concurrency)); 35 disp(sprintf(' npart: %i (number of partitions for semi-descrete qmu)',md.npart)); 36 disp(sprintf(' analysis_driver : ''%s'' (''matlab'' or name of driver for Dakota analysis)',md.analysis_driver)); 37 disp(sprintf(' analysis_components: ''%s'' (Matlab script file for Matlab driver)',md.analysis_components)); 54 disp(sprintf(' npart : %i (number of partitions for semi-descrete qmu)',md.npart)); 55 disp(sprintf(' numrifts: %i (number of rifts for semi-descrete qmu)',md.numrifts)); -
issm/trunk/src/m/classes/public/extrude.m
r1 r27 152 152 md.segmentonneumann_diag=segmentonneumann_diag; 153 153 md.gridondirichlet_prog=project3d(md,md.gridondirichlet_prog,'node'); 154 md.dirichletvalues_prog=project3d(md,md.dirichletvalues_prog,'node' ,1);154 md.dirichletvalues_prog=project3d(md,md.dirichletvalues_prog,'node'); 155 155 %md.segmentonneumann_prog=[tproj(md.segmentonneumann_prog(:,1)) tproj(md.segmentonneumann_prog(:,2)) tproj2d_el(md.segmentonneumann_prog(:,3))]; 156 156 %md.segmentonneumann_prog2=[tproj(md.segmentonneumann_prog2(:,1)) tproj(md.segmentonneumann_prog2(:,2)) tproj2d_el(md.segmentonneumann_prog2(:,3))]; -
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r1 r27 5 5 % bool=ismodelselfconsistent(md,solutiontype,package), 6 6 7 if strcmpi(solutiontype,'mesh'),8 %this solution is a little special. It should come right after the md=model; operation. So a lot less checks!9 10 bool=1;11 return;12 end13 14 7 %tolerance we use in litmus tests for the consistency of the model 15 8 tolerance=10^-12; 16 9 if (nargin~=3 ) 17 IsModelSelfConsistentUsage(); 18 error(' '); 19 end 20 10 help ismodelselfconsistent 11 error('ismodelselfconsistent error message: wrong usage'); 12 end 13 14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMON CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 16 %COUNTER 17 if md.counter<3, 18 disp(['model ' md.name ' is not correctly configured. You forgot one step in the following sequence (mesh, geography, parameterize)!']); 19 bool=0;return; 20 end 21 22 %NAME 23 if isempty(md.name), 24 disp(['model is not correctly configured: missing name!']); 25 bool=0;return; 26 end 27 28 %MESH 29 if md.numberofelements<=0, 30 disp(['model ' md.name ' does not have any elements!']); 31 bool=0; return; 32 end 33 if md.numberofgrids<=0, 34 disp(['model ' md.name ' does not have any grids!']); 35 bool=0; return; 36 end 37 38 %ELEMENTSTYPE 39 if size(md.elements_type,1)~=md.numberofelements | size(md.elements_type,2)~=2, 40 disp(['Types of elements have not been set properly, run setelementstype first']) 41 bool=0;return; 42 end 43 if any(ones(md.numberofelements,1)-((md.elements_type(:,1)==hutterenum) + (md.elements_type(:,1)==macayealenum) + (md.elements_type(:,1)==pattynenum))) 44 disp(['Types of elements have not been set properly, run setelementstype first']) 45 bool=0;return; 46 end 47 if any(ones(md.numberofelements,1)-((md.elements_type(:,2)==stokesenum) + (md.elements_type(:,2)==noneenum))) 48 disp(['Types of elements have not been set properly, run setelementstype first']) 49 bool=0;return; 50 end 51 if strcmpi(md.type,'2d'), 52 if (ismember(pattynenum,md.elements_type(:,1)) | ismember(stokesenum,md.elements_type(:,2))), 53 disp(['For a 2d model, only MacAyeal''s and Hutter''s elements are allowed']); 54 bool=0;return; 55 end 56 end 57 58 %NO NAN 59 fields={'numberofelements','numberofgrids','x','y','z','segmentonneumann_diag','drag','drag_type','p','q','gridondirichlet_diag',... 60 'rho_ice','rho_water','B','elementoniceshelf','surface','thickness','bed','g','lowmem','sparsity','nsteps','maxiter',... 61 'tolx','np','eps_rel','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 62 for i=1:length(fields), 63 if ~isempty(eval(['md.' char(fields(i))])), 64 if find(isnan(eval(['md.' char(fields(i))]))), 65 disp(['model ' md.name ' has an NaN value in field ' char(fields(i)) '!']); 66 bool=0; return; 67 end 68 end 69 end 70 71 %FIELDS > 0 72 fields={'numberofelements','numberofgrids','elements','segmentonneumann_diag','drag','drag_type','p','q','gridondirichlet_diag',... 73 'rho_ice','rho_water','B','elementoniceshelf','thickness','g','eps_rel','eps_abs','nsteps','maxiter','tolx','exclusive',... 74 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 75 for i=1:length(fields), 76 if ~isempty(eval(['md.' char(fields(i))])), 77 if find((eval(['md.' char(fields(i))]))<0), 78 disp(['model ' md.name ' has a <0 value in field ' char(fields(i)) '!']); 79 bool=0; return; 80 end 81 end 82 end 83 if any(md.p<=0), 84 disp(['model ' md.name ' has some p<0 friction coefficientsin sliding law']); 85 bool=0; return; 86 end 87 88 %FIELDS ~=0 89 fields={'numberofelements','numberofgrids','elements','segmentonneumann_diag','drag_type',... 90 'rho_ice','rho_water','B','thickness','g','eps_rel','eps_abs','maxiter','tolx',... 91 'sparsity','deltaH','DeltaH','timeacc','timedec'}; 92 for i=1:length(fields), 93 if ~isempty(eval(['md.' char(fields(i))])), 94 if find((eval(['md.' char(fields(i))]))==0), 95 disp(['model ' md.name ' has a =0 value in field ' char(fields(i)) '!']); 96 bool=0; return; 97 end 98 end 99 end 100 101 %SIZE NUMBEROFELEMENTS 102 fields={'elements','p','q','elementoniceshelf','n','elementonbed'}; 103 for i=1:size(fields,2), 104 if (size(eval(['md.' char(fields(i))]),1)~=md.numberofelements), 105 disp(['model ' md.name ' field ' char(fields(i)) ' should be of size ' num2str(md.numberofelements) '!']); 106 bool=0; return; 107 end 108 end 109 110 %SIZE NUMBEROFGRIDS 111 fields={'x','y','z','B','drag','gridondirichlet_diag','melting','accumulation','surface','thickness','bed','gridonbed','gridonsurface'}; 112 for i=1:length(fields), 113 if find(length(eval(['md.' char(fields(i))]))~=md.numberofgrids), 114 disp(['model ' md.name ' field ' char(fields(i)) ' should be of size ' num2str(md.numberofgrids) '!']); 115 bool=0; return; 116 end 117 end 118 119 %THICKNESS = SURFACE - BED 120 if find((md.thickness-md.surface+md.bed)>tolerance), 121 disp(['model ' md.name ' violates the equality thickness=surface-bed!']); 122 bool=0; return; 123 end 124 125 %RIFTS 126 if md.numrifts, 127 if ~strcmpi(md.type,'2d'), 128 disp(['Models with rifts are only supported in 2d for now!']); 129 bool=0;return; 130 end 131 end 132 if ~isstruct(md.rifts), 133 if ~isempty(find(md.segmentmarkers>=2)), 134 %We have segments with rift markers, but no rift structure! 135 disp(['model ' md.name ' should be processed for rifts (run meshprocessrifts)!']); 136 bool=0; return; 137 end 138 end 139 140 %ARTIFICIAL DIFFUSIVITY 141 if ~isscalar(md.artificial_diffusivity), 142 disp('artificial_diffusivity should be a scalar (1 or 0)'); 143 bool=0;return; 144 end 145 146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SOLUTION CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 147 148 %DIAGNOSTIC 149 if strcmpi(solutiontype,'diagnostic') 150 151 %HUTTER ON ICESHELF WARNING 152 if any(md.elements_type(:,1)==hutterenum & md.elementoniceshelf), 153 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 154 end 155 156 %SINGULAR 157 if ~any(md.gridondirichlet_diag), 158 disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!']) 159 bool=0;return; 160 end 161 162 %DIRICHLET VALUES 163 if isempty(md.gridondirichlet_diag) | isempty(md.dirichletvalues_diag), 164 disp(['model ' md.name ' is not well posed. Missing dirichlet values for diagnostic run']); 165 bool=0;return; 166 end 167 168 %DIRICHLET IF THICKNESS <= 0 169 if ~isempty(find(md.thickness<=0)), 170 pos=find(md.thickness<=0); 171 if ~isempty(find(md.gridondirichlet_diag(pos)==0)), 172 disp(['model ' md.name ' has some grids with 0 thickness']); 173 bool=0; return; 174 end 175 end 176 end 177 178 %PROGNOSTIC 179 if strcmp(solutiontype,'prognostic'), 180 %old testing 181 % if isempty(find(md.gridondirichlet_diag)), 182 % disp(['model ' md.name ' diagnostic is not well posed (singular). You need at least one grid with fixed velocity!']) 183 % bool=0;return; 184 % end 185 % if isempty(find(md.gridondirichlet_prog)), 186 % disp(['model ' md.name ' prognostic is not well posed (singular). You need at least one grid with fixed thickness!']) 187 % bool=0;return; 188 % end 189 190 %VELOCITIES 191 if (size(md.vx,1)~=md.numberofgrids | size(md.vy,1)~=md.numberofgrids), 192 disp(['a 3d velocity is required. Run ''diagnostic'' solution first!']) 193 bool=0; return; 194 end 195 end 196 197 %THERMAL TRANSIENT 198 if strcmp(solutiontype,'thermaltransient') 199 200 %INITIAL TEMPERATURE, MELTING AND ACCUMULATION 201 if isempty(md.temperature), 202 disp(['An initial temperature is needed for a transient thermal computation']) 203 bool=0;return; 204 end 205 if isstruct(md.temperature) | isstruct(md.melting) | isstruct(md.accumulation), 206 disp(['The initial temperature, melting or accumulation should be a list and not a structure']) 207 bool=0;return; 208 end 209 end 210 211 %THERMAL STEADY AND THERMAL TRANSIENT 212 if strcmpi(solutiontype,'thermalsteady') | strcmp(solutiontype,'thermaltransient'), 213 214 %EXTRUSION 215 if strcmp(md.type,'2d'), 216 disp(['For a ' solutiontype ' computation, the model must be 3d, extrude it first!']) 217 bool=0;return; 218 end 219 220 %VELOCITIES AND PRESSURE 221 if (isempty(md.vx) | isnan(md.vx) | isempty(md.vy) | isnan(md.vy) | isempty(md.vz) | isnan(md.vz)), 222 disp(['a 3d velocity is required. Run ''diagnostic'' solution first!']) 223 bool=0;return; 224 end 225 if (isempty(md.pressure) | isnan(md.pressure)), 226 disp(['pressure is required. Run ''diagnostic'' solution first!']) 227 bool=0;return; 228 end 229 end 230 231 %THERMAL TRANSIENT AND TRANSIENT 232 if strcmp(solutiontype,'thermaltransient') | strcmp(solutiontype,'transient'), 233 234 %DT and NDT 235 fields={'dt','ndt'}; 236 for i=1:length(fields), 237 if find((eval(['md.' char(fields(i))]))<0), 238 disp(['model ' md.name ' has a <0 value in field ' char(fields(i)) '!']); 239 bool=0; return; 240 end 241 end 242 243 %INITIAL TEMPERATURE 244 if isstruct(md.temperature), 245 disp(['The initial temperature should be empty or a list but not a structure']) 246 bool=0;return; 247 end 248 end 249 250 %PARAMETERS 251 if strcmp(solutiontype,'parameters') 252 253 %OUTPUT 254 if ~iscell(md.parameteroutput) 255 disp(['parameteroutput field must be a cell, example {''strainrate'',''stress'',''deviatoricstress'',''viscousheating''}']); 256 bool=0; return; 257 end 258 for i=1:length(md.parameteroutput) 259 if ~strcmpi(md.parameteroutput(i),'strainrate') & ~strcmpi(md.parameteroutput(i),'stress') & ~strcmpi(md.parameteroutput(i),'deviatoricstress') & ~strcmpi(md.parameteroutput(i),'viscousheating') ... 260 & ~strcmpi(md.parameteroutput(i),'pressure_elem') & ~strcmpi(md.parameteroutput(i),'stress_bed') & ~strcmpi(md.parameteroutput(i),'stress_surface') 261 disp(['one of the parameteroutput is not supported yet']); 262 bool=0; return; 263 end 264 end 265 %VELOCITY 266 if ~(size(md.vx,1)==md.numberofgrids & size(md.vy,1)==md.numberofgrids & (size(md.vz,1)==md.numberofgrids | strcmpi(md.type,'2d'))) 267 disp(['velocities are required!']); 268 bool=0;return; 269 end 270 271 %ACCELERATION 272 if strcmpi(md.type,'2d') & md.acceleration 273 disp(['solution requires acceleration=0']); 274 bool=0;return; 275 end 276 277 %HUTTER 278 if any(md.elements_type(:,1)==hutterenum); 279 disp(['The model has Hutter''s elements. Impossible to compute parameters']); 280 bool=0;return; 281 end 282 end 283 284 %CONTROL 285 if strcmpi(solutiontype,'control'), 286 287 %CONTROL TYPE 288 if ~iscell(md.control_type), 289 disp('control_type should be a cell array of strings'); 290 bool=0;return; 291 end 292 293 %LENGTH CONTROL FIELDS 294 if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps) 295 disp('maxiter, optscal and fit must have the length specified by nsteps') 296 bool=0;return; 297 end 298 299 %FIT 300 if sum((double(md.fit==1) + double(md.fit==0) + double(md.fit==2))==1)~=md.nsteps 301 disp('wrong fits: fit should be a vector of size nsteps holding 0, 1 and 2 only') 302 bool=0;return; 303 end 304 305 %OBSERVED VELOCITIES 306 fields={'vx_obs','vy_obs'}; 307 for i=1:length(fields), 308 if find(length(eval(['md.' char(fields(i))]))~=md.numberofgrids), 309 disp(['model ' md.name ' field ' char(fields(i)) ' should be of size ' num2str(md.numberofgrids) '!']); 310 bool=0; return; 311 end 312 end 313 end 314 315 %QMU 21 316 if strcmpi(solutiontype,'qmu'), 22 317 if ~strcmpi(md.cluster,'none'), … … 28 323 end 29 324 30 if isempty(md.name), 31 disp(['model is not correctly configured: missing name!']); 32 bool=0;return; 33 end 34 35 if md.counter<3, 36 disp(['model ' md.name ' is not correctly configured. You forgot one step in the following sequence (mesh, geography, parameterize)!']); 37 bool=0;return; 38 end 39 40 if md.numberofelements<=0, 41 disp(['model ' md.name ' does not have any elements!']); 42 bool=0; return; 43 end 44 45 if md.numberofgrids<=0, 46 disp(['model ' md.name ' does not have any grids!']); 47 bool=0; return; 48 end 49 50 %check elementstype 51 if size(md.elements_type,1)~=md.numberofelements | size(md.elements_type,2)~=2, 52 disp(['Types of elements have not been set properly, run setelementstype first']) 53 bool=0;return; 54 end 55 if any(ones(md.numberofelements,1)-((md.elements_type(:,1)==hutterenum) + (md.elements_type(:,1)==macayealenum) + (md.elements_type(:,1)==pattynenum))) 56 disp(['Types of elements have not been set properly, run setelementstype first']) 57 bool=0;return; 58 end 59 if any(ones(md.numberofelements,1)-((md.elements_type(:,2)==stokesenum) + (md.elements_type(:,2)==noneenum))) 60 disp(['Types of elements have not been set properly, run setelementstype first']) 61 bool=0;return; 62 end 63 if strcmpi(md.type,'2d'), 64 if (ismember(pattynenum,md.elements_type(:,1)) | ismember(stokesenum,md.elements_type(:,2))), 65 disp(['For a 2d model, only MacAyeal''s and Hutter''s elements are allowed']); 66 bool=0;return; 67 end 68 end 69 %check that if there are rifts, model is 2d 70 if md.numrifts, 71 if ~strcmpi(md.type,'2d'), 72 disp(['Models with rifts are only supported in 2d for now!']); 73 bool=0;return; 74 end 75 end 76 77 %If there are rifts, check that the solver is set to mumps in parallel 78 if md.numrifts, 79 if ~strcmpi(md.cluster,'none') 80 if isempty(findstr('aijmumps',md.solverstring)), 81 disp(['For a 2d model with rifts, running on a cluster, you should use a direct solver like MUMPS!']); 325 %MESH 326 if strcmpi(solutiontype,'mesh'), 327 %this solution is a little special. It should come right after the md=model; operation. So a lot less checks! 328 329 bool=1; 330 return; 331 end 332 333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PACKAGE CHECKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 334 335 %CIELO 336 if strcmpi(package,'cielo'), 337 338 %NAN VALUES 339 fields={'time','sparsity'}; 340 for i=1:length(fields), 341 if ~isempty(eval(['md.' char(fields(i))])), 342 if find(isnan(eval(['md.' char(fields(i))]))), 343 disp(['model ' md.name ' has an NaN value in field ' char(fields(i)) '!']); 344 bool=0; return; 345 end 346 end 347 end 348 349 %FIELD > 0 350 fields={'time','sparsity'}; 351 for i=1:length(fields), 352 if ~isempty(eval(['md.' char(fields(i))])), 353 if find((eval(['md.' char(fields(i))]))<0), 354 disp(['model ' md.name ' has a <0 value in field ' char(fields(i)) '!']); 355 bool=0; return; 356 end 357 end 358 end 359 360 %FIELD ~= 0 361 fields={'time','sparsity'}; 362 for i=1:length(fields), 363 if ~isempty(eval(['md.' char(fields(i))])), 364 if find((eval(['md.' char(fields(i))]))==0), 365 disp(['model ' md.name ' has a =0 value in field ' char(fields(i)) '!']); 366 bool=0; return; 367 end 368 end 369 end 370 371 %SPARSITY BETWEEN 0 AND 1 372 if ( (md.sparsity<=0) | (md.sparsity>1)), 373 disp(['model ' md.name ' sparsity should be inside the ]0 1] range']); 374 bool=0; return; 375 end 376 377 %RIFTS 378 if md.numrifts, 379 if ~strcmpi(md.cluster,'none') 380 if isempty(findstr('aijmumps',md.solverstring)), 381 disp(['For a 2d model with rifts, running on a cluster, you should use a direct solver like MUMPS!']); 382 bool=0;return; 383 end 384 end 385 end 386 387 %CONNECTIVITY 388 if strcmpi(md.type,'2d'), 389 if md.connectivity<9, 390 disp('connectivity should be at least 9 for 2d models'); 82 391 bool=0;return; 83 392 end 84 393 end 85 end 86 87 %check elementstype in diagnostic 88 if strcmpi(solutiontype,'diagnostic') 89 if any(md.elements_type(:,1)==hutterenum & md.elementoniceshelf), 90 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 91 end 92 end 93 94 %Check that mesh is 3d 95 if strcmpi(solutiontype,'thermalsteady') | strcmp(solutiontype,'thermaltransient'), 96 if strcmp(md.type,'2d'), 97 disp(['For a ' solutiontype ' computation, the model must be 3d, extrude it first!']) 98 bool=0;return; 99 end 100 end 101 102 %check artificial_diffusivity is an integer 103 if ~isscalar(md.artificial_diffusivity), 104 disp('artificial_diffusivity should be a scalar (1 or 0)'); 105 bool=0;return; 106 end 107 108 %check on connectivity 109 if strcmpi(md.type,'2d'), 110 if md.connectivity<9, 111 disp('connectivity should be at least 9 for 2d models'); 112 bool=0;return; 113 end 114 end 115 116 if strcmpi(md.type,'3d'), 117 if md.connectivity<24, 118 disp('connectivity should be at least 24 for 3d models'); 119 bool=0;return; 120 end 121 end 122 123 124 125 126 127 %Check previous computation 128 if strcmp(solutiontype,'thermaltransient') | strcmp(solutiontype,'thermalsteady') 129 if (isempty(md.vx) | isempty(md.vy) | isempty(md.vz)), 130 disp(['a 3d velocity is required. Run ''diagnostic'' solution first!']) 131 bool=0;return; 132 end 133 end 134 135 if strcmp(solutiontype,'thermaltransient') | strcmp(solutiontype,'thermalsteady') 136 if (isempty(md.pressure) | isnan(md.pressure)), 137 disp(['pressure is required. Run ''diagnostic'' solution first!']) 138 bool=0;return; 139 end 140 141 if (isempty(md.vx) | isnan(md.vx) | isempty(md.vy) | isnan(md.vy) | isempty(md.vz) | isnan(md.vz)), 142 disp(['velocities are required!']); 143 bool=0;return; 144 end 145 end 146 147 if strcmp(solutiontype,'thermaltransient') 148 if isempty(md.temperature), 149 disp(['An initial temperature is needed for a transient thermal computation']) 150 bool=0;return; 151 end 152 if isstruct(md.temperature) | isstruct(md.melting), 153 disp(['The initial temperature or melting should be a list and not a structure']) 154 bool=0;return; 155 end 156 157 end 158 159 if strcmp(solutiontype,'transient') 160 if isstruct(md.temperature), 161 disp(['The initial temperature should be empty or a list but not a structure']) 162 bool=0;return; 163 end 164 165 end 166 167 if strcmp(solutiontype,'parameters') 168 if ~(size(md.vx,1)==md.numberofgrids & size(md.vy,1)==md.numberofgrids & (size(md.vz,1)==md.numberofgrids | strcmpi(md.type,'2d'))) 169 disp(['velocities are required!']); 170 bool=0;return; 171 end 172 if strcmpi(md.type,'2d') & md.acceleration 173 disp(['solution requires acceleration=0']); 174 bool=0;return; 175 end 176 if any(md.elements_type(:,1)==hutterenum); 177 disp(['The model has Hutter''s elements. Impossible to compute parameters']); 178 bool=0;return; 179 end 180 end 181 182 183 %Check that problem is not singular 184 if strcmp(solutiontype,'diagnostic'), 185 if isempty(find(md.gridondirichlet_diag)), 186 disp(['model ' md.name ' is not well posed (singular). You need at least one grid with fixed velocity!']) 187 bool=0;return; 188 end 189 end 190 191 %Check we have values for dirichletvalues_diag 192 if strcmp(solutiontype,'diagnostic'), 193 if isempty(md.gridondirichlet_diag) | isempty(md.dirichletvalues_diag), 194 disp(['model ' md.name ' is not well posed. Missing dirichlet values for diagnostic run']); 195 bool=0;return; 196 end 197 end 198 199 200 201 if strcmp(solutiontype,'prognostic'), 202 %old testing 203 % if isempty(find(md.gridondirichlet_diag)), 204 % disp(['model ' md.name ' diagnostic is not well posed (singular). You need at least one grid with fixed velocity!']) 205 % bool=0;return; 206 % end 207 % if isempty(find(md.gridondirichlet_prog)), 208 % disp(['model ' md.name ' prognostic is not well posed (singular). You need at least one grid with fixed thickness!']) 209 % bool=0;return; 210 % end 211 if (size(md.vx,1)~=md.numberofgrids | size(md.vy,1)~=md.numberofgrids), 212 disp(['a 3d velocity is required. Run ''diagnostic'' solution first!']) 213 bool=0; return; 214 end 215 end 216 %some checks for control methods 217 if strcmp(solutiontype,'control') 218 %check fields used by control 219 if (length(md.maxiter)~=md.nsteps | length(md.optscal)~=md.nsteps | length(md.fit)~=md.nsteps) 220 disp('maxiter, optscal and fit must have the length specified by nsteps') 221 bool=0;return; 222 end 223 if sum((double(md.fit==1) + double(md.fit==0) + double(md.fit==2))==1)~=md.nsteps 224 disp('wrong fits: fit should be a vector of size nsteps holding 0, 1 and 2 only') 225 bool=0;return; 226 end 227 end 228 229 230 %Check that no NaN values popped up: 231 fields={'numberofelements','numberofgrids','x','y','z','segmentonneumann_diag','drag','drag_type','p','q','gridondirichlet_diag',... 232 'rho_ice','rho_water','B','elementoniceshelf','surface','thickness','bed','g','lowmem','sparsity','nsteps','maxiter',... 233 'tolx','np','time','eps_rel','exclusive','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 234 for i=1:length(fields), 235 if ~isempty(eval(['md.' char(fields(i))])), 236 if find(isnan(eval(['md.' char(fields(i))]))), 237 disp(['model ' md.name ' has an NaN value in field ' char(fields(i)) '!']); 238 bool=0; return; 239 end 240 end 241 end 242 243 %Check that these fields are > 0 244 fields={'numberofelements','numberofgrids','elements','segmentonneumann_diag','drag','drag_type','p','q','gridondirichlet_diag',... 245 'rho_ice','rho_water','B','elementoniceshelf','thickness','g','eps_rel','eps_abs','nsteps','maxiter','tolx','np','time','exclusive',... 246 'sparsity','lowmem','n','gridonbed','gridonsurface','elementonbed','elementonsurface','deltaH','DeltaH','timeacc','timedec'}; 247 for i=1:length(fields), 248 if ~isempty(eval(['md.' char(fields(i))])), 249 if find((eval(['md.' char(fields(i))]))<0), 250 disp(['model ' md.name ' has a <0 value in field ' char(fields(i)) '!']); 251 bool=0; return; 252 end 253 end 254 end 255 256 %Check that these fields are ~=0 257 fields={'numberofelements','numberofgrids','elements','segmentonneumann_diag','drag_type',... 258 'rho_ice','rho_water','B','thickness','g','eps_rel','eps_abs','maxiter','tolx','np','time',... 259 'sparsity','deltaH','DeltaH','timeacc','timedec'}; 260 for i=1:length(fields), 261 if ~isempty(eval(['md.' char(fields(i))])), 262 if find((eval(['md.' char(fields(i))]))==0), 263 disp(['model ' md.name ' has a =0 value in field ' char(fields(i)) '!']); 264 bool=0; return; 265 end 266 end 267 end 268 269 %Check that these fields are of size md.numberofelements 270 fields={'elements','p','q','elementoniceshelf','n','elementonbed'}; 271 for i=1:size(fields,2), 272 if (size(eval(['md.' char(fields(i))]),1)~=md.numberofelements), 273 disp(['model ' md.name ' field ' char(fields(i)) ' should be of size ' num2str(md.numberofelements) '!']); 274 bool=0; return; 275 end 276 end 277 278 %Check that these fields are of size md.numberofgrids 279 fields={'melting','x','y','z','B','drag','gridondirichlet_diag','vx_obs','vy_obs','surface','thickness','bed','gridonbed','gridonsurface'}; 280 for i=1:length(fields), 281 if find(length(eval(['md.' char(fields(i))]))~=md.numberofgrids), 282 disp(['model ' md.name ' field ' char(fields(i)) ' should be of size ' num2str(md.numberofgrids) '!']); 283 bool=0; return; 284 end 285 end 286 287 %Make sure lowmem is either 0 or 1 288 if ((md.lowmem ~= 1) & (md.lowmem~=0)), 289 disp(['model ' md.name ' lowmem field should be 0 or 1']); 290 bool=0; return; 291 end 292 293 %Make sure sparsity is between 0 and 1: 294 if ( (md.sparsity<=0) | (md.sparsity>1)), 295 disp(['model ' md.name ' sparsity should be inside the ]0 1] range']); 296 bool=0; return; 297 end 298 299 %Make sure thickness=surface-bed; 300 if find((md.thickness-md.surface+md.bed)>tolerance), 301 disp(['model ' md.name ' violates the equality thickness=surface-bed!']); 302 bool=0; return; 303 end 304 305 %Check that rifts were processed correctly: 306 if ~isstruct(md.rifts), 307 if ~isempty(find(md.segmentmarkers>=2)), 308 %We have segments with rift markers, but no rift structure! 309 disp(['model ' md.name ' should be processed for rifts (run meshprocessrifts)!']); 310 bool=0; return; 311 end 312 end 313 314 315 %Check that thickness is not null. If is it, then the corresponding grids should be spc'd. 316 if ~isempty(find(md.thickness<=0)), 317 pos=find(md.thickness<=0); 318 if ~isempty(find(md.gridondirichlet_diag(pos)==0)), 319 disp(['model ' md.name ' has some grids with 0 thickness']); 320 bool=0; return; 321 end 322 end 323 324 %Check that p>0 in the sliding law u = k * sigma ^ p * Neff ^ q : 325 if ~isempty(find(md.p<=0)), 326 disp(['model ' md.name ' has some p<0 friction coefficientsin sliding law']); 327 bool=0; return; 328 end 329 330 331 %Check parameteroutput 332 if ~iscell(md.parameteroutput) 333 disp(['parameteroutput field must be a cell, example {''strainrate'',''stress'',''deviatoricstress'',''viscousheating''}']); 334 bool=0; return; 335 end 336 337 338 for i=1:length(md.parameteroutput) 339 if ~strcmpi(md.parameteroutput(i),'strainrate') & ~strcmpi(md.parameteroutput(i),'stress') & ~strcmpi(md.parameteroutput(i),'deviatoricstress') & ~strcmpi(md.parameteroutput(i),'viscousheating') ... 340 & ~strcmpi(md.parameteroutput(i),'pressure_elem') & ~strcmpi(md.parameteroutput(i),'stress_bed') & ~strcmpi(md.parameteroutput(i),'stress_surface') 341 disp(['one of the parameteroutput is not supported yet']); 342 bool=0; return; 343 end 344 end 345 346 %check parallel settings 347 if ~strcmpi(md.cluster,'none'), 348 if ~strcmpi(package,'cielo'), 349 disp(['parallel runs only allowed for ''cielo'' package']); 350 bool=0; return; 351 end 352 end 353 354 %Put as many checks as you want here: 355 394 if strcmpi(md.type,'3d'), 395 if md.connectivity<24, 396 disp('connectivity should be at least 24 for 3d models'); 397 bool=0;return; 398 end 399 end 400 401 %NP 402 if md.np==0, 403 disp(['model ' md.name ' has a =0 value in field ' md.np ' !']); 404 elseif md.np<0, 405 disp(['model ' md.name ' has a negative value in field ' md.np ' !']); 406 end 407 408 %LOWMEM = 0 or 1 409 if ((md.lowmem ~= 1) & (md.lowmem~=0)), 410 disp(['model ' md.name ' lowmem field should be 0 or 1']); 411 bool=0; return; 412 end 413 end 356 414 357 415 %No problems, just return 1; 358 416 bool=1; 359 417 return; 360 361 function IsModelSelfConsistentUsage()362 disp(' ');363 disp(' IsModelSelfConsistent usage: flag=IsModelSelfConsistent(model)');364 disp(' where model is an instance of the @model class, and flag a boolean');365 366 367 368 -
issm/trunk/src/m/classes/public/isresultconsistent.m
r1 r27 21 21 if ~isnan(md.penalties), 22 22 for i=1:size(md.penalties,1) 23 for n=2: md.numlayers23 for n=2:size(md.penalties,2) 24 24 relativex=(md.vx(md.penalties(i,1))-md.vx(md.penalties(i,n)))./(md.vx(md.penalties(i,1))); 25 25 if md.vx(md.penalties(i,1))==md.vx(md.penalties(i,n)), relativex=0; end … … 74 74 if ~isnan(md.penalties), 75 75 for i=1:size(md.penalties,1) 76 for n=2: md.numlayers76 for n=2:size(md.penalties,2) 77 77 relativex=(md.transient_results(iter).vx(md.penalties(i,1))-md.transient_results(iter).vx(md.penalties(i,n)))./(md.transient_results(iter).vx(md.penalties(i,1))); 78 78 if md.transient_results(iter).vx(md.penalties(i,1))==md.transient_results(iter).vx(md.penalties(i,n)), relativex=0; end -
issm/trunk/src/m/classes/public/parameterize.m
r1 r27 27 27 end 28 28 29 %Try and run parameter file. We try to capture the error message, but this is not allowed for30 %lower versions of matlab. 29 %Try and run parameter file. 30 eval(['system( '' cp ' parametername ' TemporaryParameterFile.m'');']); 31 31 32 stringfile=readfile(parametername); 33 stringlines=strsplit(stringfile,char(10)); %split into lines 34 35 for i=1:length(stringlines),36 a=stringlines{i};37 try,38 eval(stringlines{i});39 catch me,40 disp(' ');41 disp(['Error in ==> ' parametername ' at ' num2str(i)]);42 disp(me.message);43 disp(stringlines{i});44 e rror(' ');32 try, 33 TemporaryParameterFile 34 system('rm TemporaryParameterFile.m'); 35 catch me, 36 system('rm TemporaryParameterFile.m'); 37 me2=struct('message',me.message,'stack',me.stack); 38 for i=1:length(me2.stack) 39 if (length(me2.stack(i).file)>=24 & strcmp(me2.stack(i).file(end-23:end),'TemporaryParameterFile.m')) 40 me2.stack(i).file=[me2.stack(i).file(1:end-24) parametername]; 41 end 42 if strcmp(me2.stack(i).name,'TemporaryParameterFile'), 43 me2.stack(i).name=parametername; 44 end 45 45 end 46 rethrow(me2); 46 47 end 47 48 -
issm/trunk/src/m/classes/public/plot/applyoptions.m
r1 r27 44 44 if ~isnan(options_structure.view), 45 45 view(options_structure.view); 46 else 47 if strcmpi(md.type,'3d') & isnan(options_structure.layer), 48 view(3); 49 else 50 view(2); 51 end 46 52 end 47 53 … … 162 168 end 163 169 170 %streamliness 171 if iscell(options_structure.streamlines) | ~isnan(options_structure.streamlines), 172 plot_streamlines(md,options_structure); 173 end 174 164 175 %contours 165 176 if iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels), -
issm/trunk/src/m/classes/public/plot/imagescnan.m
r1 r27 80 80 81 81 % Copyright 2008 Carlos Adrian Vargas Aguilera 82 % $Revision: 1.1 $ $Date: 2009/0 3/24 21:05:20$82 % $Revision: 1.1 $ $Date: 2009/04/03 22:56:05 $ 83 83 84 84 % Written by -
issm/trunk/src/m/classes/public/plot/parse_options.m
r1 r27 17 17 end 18 18 19 %density 20 densityvalues=findarg(optionstring,'density'); 21 if ~isempty(densityvalues), 22 options_struct.density=abs(ceil(densityvalues(1).value)); 23 else 24 options_struct.density=NaN; 25 end 26 19 27 %Section profile 20 28 sectionvalues=findarg(optionstring,'sectionvalue'); … … 38 46 39 47 %Show section 40 showsection s=findarg(optionstring,'showsection');41 if ~isempty(showsection s),42 if ischar(showsection s(1).value),43 options_struct.showsection= showsections(1).value;44 else 45 options_struct.showsection= 0;48 showsection=findarg(optionstring,'showsection'); 49 if ~isempty(showsection), 50 if ischar(showsection(1).value) & strcmpi(showsection(1).value,'on'), 51 options_struct.showsection=4; 52 else 53 options_struct.showsection=showsection(1).value; 46 54 end 47 55 else … … 115 123 else 116 124 options_struct.smooth=NaN; 125 end 126 127 %streamlines 128 streamlines_values=findarg(optionstring,'streamlines'); 129 if ~isempty(streamlines_values), 130 options_struct.streamlines=streamlines_values.value; 131 else 132 options_struct.streamlines=NaN; 117 133 end 118 134 … … 226 242 options_struct.view=viewvalues.value; 227 243 else 228 if strcmpi(md.type,'3d') & isnan(options_struct.layer), 229 options_struct.view=3; 230 else 231 options_struct.view=2; 232 end 244 options_struct.view=NaN; 233 245 end 234 246 -
issm/trunk/src/m/classes/public/plot/plot_basaldrag.m
r1 r27 1 function plot_basaldrag(md,options_structure,width,i );1 function plot_basaldrag(md,options_structure,width,i,type); 2 2 %PLOT_BASALDRAG - plot basal drag 3 3 % 4 4 % Usage: 5 % plot_basaldrag(md,options_structure,width,i );5 % plot_basaldrag(md,options_structure,width,i,type); 6 6 % 7 7 % See also: PLOTMODEL … … 20 20 21 21 %compute horizontal velocity 22 ub=sqrt(md.vx.^2+md.vy.^2)/md.yts; 22 if strcmpi(type,'basal_drag') 23 ub=sqrt(md.vx.^2+md.vy.^2)/md.yts; 24 elseif strcmpi(type,'basal_dragx') 25 ub=md.vx/md.yts; 26 elseif strcmpi(type,'basal_dragy') 27 ub=md.vy/md.yts; 28 end 23 29 24 30 %compute basal drag 25 31 drag=(md.g*(md.rho_ice*md.thickness+md.rho_water*md.bed)).^r.*(md.drag).^2.*ub.^s/1000; 26 32 27 %process data and model 28 [x y z elements is2d]=processmesh(md,options_structure); 29 [basal_drag isongrid]=processdata(md,drag,options_structure); 33 %Figure out if this is a Section plot 34 if ~isnan(options_structure.sectionvalue) 35 plot_section(md,drag,options_structure,width,i); 36 return; 37 else 30 38 31 %plot mesh quivervel 32 subplot(width,width,i); 39 %process data and model 40 [x y z elements is2d]=processmesh(md,options_structure); 41 [basal_drag isongrid]=processdata(md,drag,options_structure); 33 42 34 %edgecolor? 35 if ~isnan(options_structure.edgecolor), 36 edgecolor=options_structure.edgecolor; 37 else 38 edgecolor='none'; 43 %plot basaldrag 44 subplot(width,width,i); 45 plot_unit(x,y,z,elements,basal_drag,isongrid,is2d,options_structure); 46 47 %apply options 48 if isnan(options_structure.title) 49 options_structure.title='Basal drag [kPa]'; 50 end 51 if isnan(options_structure.view) 52 options_structure.view=2; 53 end 54 applyoptions(md,basal_drag,options_structure); 55 39 56 end 40 41 %plot basal basal drag42 A=elements(:,1); B=elements(:,2); C=elements(:,3);43 44 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData',basal_drag,'FaceColor','interp','EdgeColor',edgecolor);45 46 %apply options47 if isnan(options_structure.title)48 options_structure.title='Basal drag [kPa]';49 end50 options_structure.view=2;51 applyoptions(md,basal_drag,options_structure); -
issm/trunk/src/m/classes/public/plot/plot_boundaries.m
r1 r27 41 41 options_structure.colorbar=0; 42 42 end 43 if isnan(options_structure.view) 44 options_structure.view=2; 45 end 43 46 applyoptions(md,[],options_structure); -
issm/trunk/src/m/classes/public/plot/plot_contour.m
r1 r27 46 46 47 47 %initialization of some variables 48 numberofelements= md.numberofelements;48 numberofelements=size(index,1); 49 49 elementslist=1:numberofelements; 50 50 c=[]; … … 231 231 232 232 %labels? 233 if ~strcmpi(options_structure.contourticks,'off')233 if (~strcmpi(options_structure.contourticks,'off') & ~isempty(c) & ~isempty(h)) 234 234 if ~isnan(options_structure.contourcolor) 235 235 clabel(c,h,'color',color); -
issm/trunk/src/m/classes/public/plot/plot_drivingstress.m
r1 r27 5 5 % plot_drivingstress(md,options_structure,width,i); 6 6 % 7 % See also: PLOTMODEL 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 8 8 9 9 %get driving stress … … 17 17 %plot mesh quivervel 18 18 subplot(width,width,i); 19 20 %edgecolor? 21 if ~isnan(options_structure.edgecolor), 22 edgecolor=options_structure.edgecolor; 23 else 24 edgecolor='none'; 25 end 26 27 %element data 28 if ~isongrid 29 if is2d 30 A=elements(:,1); B=elements(:,2); C=elements(:,3); 31 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 32 else 33 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6); 34 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 35 patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 36 patch( 'Faces', [A B E D], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 37 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 38 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', dstress,'FaceColor','flat','EdgeColor',edgecolor); 39 end 40 %grid data 41 elseif isongrid 42 if is2d 43 A=elements(:,1); B=elements(:,2); C=elements(:,3); 44 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 45 else 46 if options_structure.layer>=1, 47 A=elements(:,1); B=elements(:,2); C=elements(:,3); 48 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 49 else 50 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6); 51 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 52 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 53 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 54 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 55 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', dstress,'FaceColor','interp','EdgeColor',edgecolor); 56 end 57 end 58 end 19 plot_unit(x,y,z,elements,dstress,isongrid,is2d,options_structure) 59 20 60 21 %apply options … … 62 23 options_structure.title='Driving stress [kPa]'; 63 24 end 25 if isnan(options_structure.view) 26 options_structure.view=2; 27 end 64 28 applyoptions(md,dstress,options_structure); -
issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m
r1 r27 5 5 % plot_elementnumbering(md,options_structure,width,i); 6 6 % 7 % See also: PLOTMODEL 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 8 8 9 9 subplot(width,width,i); -
issm/trunk/src/m/classes/public/plot/plot_elementstype.m
r1 r27 76 76 if ~isempty(posS) 77 77 A=elements(posS,1); B=elements(posS,2); C=elements(posS,3); D=elements(posS,4); E=elements(posS,5); F=elements(posS,6); 78 % p4=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', stokesenum,'FaceColor','flat','EdgeColor',edgecolor,'EdgeAlpha',alpha,'FaceAlpha',alpha);79 % patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', stokesenum,'FaceColor','flat','EdgeColor',edgecolor,'EdgeAlpha',alpha,'FaceAlpha',alpha);80 % patch( 'Faces', [A B E D], 'Vertices', [x y z],'CData', stokesenum,'FaceColor','flat','EdgeColor',edgecolor,'EdgeAlpha',alpha,'FaceAlpha',alpha);81 % patch( 'Faces', [B E F C ], 'Vertices', [x y z],'CData', stokesenum,'FaceColor','flat','EdgeColor',edgecolor,'EdgeAlpha',alpha,'FaceAlpha',alpha);82 % patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', stokesenum,'FaceColor','flat','EdgeColor',edgecolor,'EdgeAlpha',alpha,'FaceAlpha',alpha);83 %legend([p1 p2 p3 p4],'Hutter''s elements','MacAyeal''s elements','Pattyn''s elements','Stokes''s elements');78 p4=patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceColor','none','EdgeColor','black'); 79 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceColor','none','EdgeColor','black'); 80 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceColor','none','EdgeColor','black'); 81 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceColor','none','EdgeColor','black'); 82 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceColor','none','EdgeColor','black'); 83 legend([p1 p2 p3 p4],'Hutter''s elements','MacAyeal''s elements','Pattyn''s elements','Stokes''s elements'); 84 84 else 85 85 legend([p1 p2 p3],'Hutter''s elements','MacAyeal''s elements','Pattyn''s elements'); -
issm/trunk/src/m/classes/public/plot/plot_penalties.m
r1 r27 22 22 if ~strcmpi(md.type,'3d'), 23 23 error('no penalties to plot for ''2d'' model'); 24 elseif is nan(md.penalties) | isempty(md.penalties)24 elseif isempty(md.penalties), 25 25 disp('no penalty applied in this model'); 26 26 return; -
issm/trunk/src/m/classes/public/plot/plot_quiver.m
r1 r27 16 16 17 17 %quiver 2d 18 if ~isnan(options_structure.density) 19 x=x(1:options_structure.density:end); 20 y=y(1:options_structure.density:end); 21 vx=vx(1:options_structure.density:end); 22 vy=vy(1:options_structure.density:end); 23 end 18 24 quiver(x,y,vx,vy); 19 25 -
issm/trunk/src/m/classes/public/plot/plot_quiver3.m
r1 r27 17 17 18 18 %quiver 3d 19 if ~isnan(options_structure.density) 20 x=x(1:options_structure.density:end); 21 y=y(1:options_structure.density:end); 22 z=z(1:options_structure.density:end); 23 vx=vx(1:options_structure.density:end); 24 vy=vy(1:options_structure.density:end); 25 vz=vz(1:options_structure.density:end); 26 end 19 27 quiver3(x,y,z,vx,vy,vz); 20 28 -
issm/trunk/src/m/classes/public/plot/plot_quivervel.m
r1 r27 5 5 % plot_quivervel(md,options_structure,width,i); 6 6 % 7 % See also: PLOTMODEL 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 8 8 9 9 %process data and model … … 15 15 end 16 16 17 %edgecolor? 18 if ~isnan(options_structure.edgecolor), 19 edgecolor=options_structure.edgecolor; 20 else 21 edgecolor='none'; 17 %density 18 if ~isnan(options_structure.density) 19 x=x(1:options_structure.density:end); 20 y=y(1:options_structure.density:end); 21 z=z(1:options_structure.density:end); 22 vx=vx(1:options_structure.density:end); 23 vy=vy(1:options_structure.density:end); 24 vz=vz(1:options_structure.density:end); 22 25 end 23 26 24 27 %plot 25 28 subplot(width,width,i); 29 colormap('default') 30 plot_unit(x,y,z,elements,sqrt(vx.^2+vy.^2),isongrid,is2d,options_structure) 26 31 27 32 if is2d 28 33 hold on 29 colormap('default')30 A=elements(:,1); B=elements(:,2); C=elements(:,3);31 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);32 34 colorbar; 33 35 quiver(x,y,vx,vy,'k') … … 35 37 else 36 38 hold on 37 colormap('default')38 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);39 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);40 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);41 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);42 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);43 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);44 39 colorbar; 45 40 quiver3(x,y,z,vx,vy,vz); -
issm/trunk/src/m/classes/public/plot/plot_section.m
r1 r27 8 8 9 9 %How many subplots? 10 if strcmpi(options_structure.showsection,'yes')10 if ~isnan(options_structure.showsection) 11 11 12 12 %Compute the indexes of the 2 plots (one for the sectionvalue and one for showsection … … 20 20 end 21 21 22 %check on arguments23 if (iscell(data) | isempty(data)),24 error('plot error message: data provided is empty');25 end26 if md.numberofgrids==size(md.elements,1),27 error('plot error message: the number of elements is the same as the number of grids! cannot plot anything with model/plot, use matlab/plot instead')28 end29 22 30 %smoothing? 31 if strcmpi(options_structure.smooth,'yes') & length(data)==md.numberofelements 32 data=elementstogrids(md,data); 33 end 23 %process data and model 24 [x_m y_m z_m elements_m is2d]=processmesh(md,options_structure); 25 [data isongrid]=processdata(md,data,options_structure); 34 26 35 %layer projection? 36 if ~isnan(options_structure.layer) & options_structure.layer>=1, 37 data=project2d(md,data,options_structure.layer); %project onto 2d mesh 38 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 39 md.x=md.x2d; 40 md.y=md.y2d; 41 md.z=md.z2d; 42 md.elements=md.elements2d; 43 md.elements_type=md.elements_type2d; 44 md.type='2d'; 45 end 46 47 %units 48 if ~isnan(options_structure.unitmultiplier), 49 md.x=md.x*options_structure.unitmultiplier; 50 md.y=md.y*options_structure.unitmultiplier; 51 md.z=md.z*options_structure.unitmultiplier; 27 %replug x and y onto model so that SectionValue treats the problem correctly 28 if ~isnan(options_structure.layer) 29 md.x=md.x2d; md.y=md.y2d; md.elements=md.elements2d; md.type='2d'; 52 30 end 53 31 … … 61 39 62 40 %Compute section value 63 [elements,x,y,z,s,data ]=SectionValues(md,data,options_structure.sectionvalue,resolution);41 [elements,x,y,z,s,data_s]=SectionValues(md,data,options_structure.sectionvalue,resolution); 64 42 65 if strcmpi(md.type,'2d')43 if is2d 66 44 %plot section value 67 45 subplot(width,width,index1) 68 plot(s,data) 46 plot(s,data_s) 47 48 %Show Section if requested by user 49 if ~isnan(options_structure.showsection) 50 51 %compute number of labels 52 numlabels=min(options_structure.showsection,length(s)); 53 shift=fix(length(s)/numlabels); 54 55 %plot labels on current graph 56 hold on 57 text(s(1),data_s(1),'1','backgroundcolor',[0.8 0.9 0.8]) 58 for i=2:numlabels-1 59 text(s(1+(i-1)*shift),data_s(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 60 end 61 text(s(end),data_s(end),'end','backgroundcolor',[0.8 0.9 0.8]) 62 63 %plot section only with labels 64 subplot(width,width,index2) 65 plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,options_structure) 66 hold on 67 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) 68 for i=2:numlabels-1 69 text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 70 end 71 text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8]) 72 plot(x,y,'-r') 73 axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1]) 74 view(2) 75 end 69 76 else 70 77 %plot section value … … 73 80 subplot(width,width,index1) 74 81 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); 75 patch( 'Faces', [A B C D], 'Vertices', [s z zeros(length(s),1)],'FaceVertexCData',data,'FaceColor','interp','EdgeColor','none'); 82 patch( 'Faces', [A B C D], 'Vertices', [s z zeros(length(s),1)],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none'); 83 84 %Show Section if requested by user 85 if ~isnan(options_structure.showsection) 86 87 %compute number of labels 88 numlabels=min(options_structure.showsection,length(s)); 89 shift=fix(length(s)/numlabels); 90 91 %plot labels on current graph 92 hold on 93 text(s(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8]) 94 for i=2:numlabels-1 95 text(s(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 96 end 97 text(s(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8]) 98 99 %plot section only with labels 100 subplot(width,width,index2) 101 plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,options_structure) 102 hold on 103 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) 104 for i=2:numlabels-1 105 text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 106 end 107 text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8]) 108 plot(x,y,'-r') 109 axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1]) 110 view(2) 111 end 76 112 else 77 113 subplot(width,width,index1) 78 114 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); 79 patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',data ,'FaceColor','interp','EdgeColor','none');115 patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none'); 80 116 view(3) 117 118 %Show Section if requested by user 119 if ~isnan(options_structure.showsection) 120 121 %compute number of labels 122 numlabels=min(options_structure.showsection,length(s)); 123 shift=fix(length(x)/numlabels); 124 125 %plot labels on current graph 126 hold on 127 text(x(1),y(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8]) 128 for i=2:numlabels-1 129 text(x(1+(i-1)*shift),y(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 130 end 131 text(x(end),y(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8]) 132 133 %plot section only with labels 134 subplot(width,width,index2) 135 plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,options_structure) 136 hold on 137 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) 138 for i=2:numlabels-1 139 text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8]) 140 end 141 text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8]) 142 plot(x,y,'-r') 143 axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1]) 144 view(2) 145 end 81 146 end 82 147 end … … 96 161 end 97 162 applyoptions(md,[],options_structure); 98 99 %plot section if requested by user100 if strcmpi(options_structure.showsection,'yes')101 subplot(width,width,index2)102 hold on103 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])104 text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8])105 plot(x,y)106 axis([min(md.x) max(md.x) min(md.y) max(md.y)])107 view(2)108 end -
issm/trunk/src/m/classes/public/plot/plot_tensor_components.m
r1 r27 5 5 % plot_tensor_components(md,options_structure,width,i,tensor,type,plot_option); 6 6 % 7 % See also: PLOTMODEL 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 8 8 9 %Compute the indexes of the components plots 10 upperplots=fix((i-1)/width); 11 if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end 12 if strcmpi(md.type,'2d')%3 components -> 3 indexes 13 index1=4*width*upperplots+2*leftplots+1; 14 index2=index1+1; 15 index3=index1+width*2; 16 elseif strcmpi(md.type,'3d')%6 components -> 6 indexes 17 index1=3*3*width*upperplots+3*leftplots+1; 18 index2=index1+1; 19 index3=index1+2; 20 index4=index1+width*3; 21 index5=index4+1; 22 index6=index4+2; 23 end 24 25 %smoothing? 26 if strcmpi(options_structure.smooth,'yes') & length(tensor.xx)==md.numberofelements 27 tensor.xx=elementstogrids(md,tensor.xx); 28 tensor.yy=elementstogrids(md,tensor.yy); 29 tensor.xy=elementstogrids(md,tensor.xy); 30 if strcmpi(md.type,'3d') 31 tensor.zz=elementstogrids(md,tensor.zz); 32 tensor.yz=elementstogrids(md,tensor.yz); 33 tensor.xz=elementstogrids(md,tensor.xz); 34 end 35 end 36 37 38 %layer projection? 39 if ~isnan(options_structure.layer) & options_structure.layer>=1, 40 tensor.xx=project2d(md,tensor.xx,options_structure.layer); %project onto 2d mesh 41 tensor.yy=project2d(md,tensor.yy,options_structure.layer); %project onto 2d mesh 42 tensor.zz=project2d(md,tensor.zz,options_structure.layer); %project onto 2d mesh 43 tensor.xy=project2d(md,tensor.xy,options_structure.layer); %project onto 2d mesh 44 tensor.xz=project2d(md,tensor.xz,options_structure.layer); %project onto 2d mesh 45 tensor.yz=project2d(md,tensor.yz,options_structure.layer); %project onto 2d mesh 46 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 47 md.x=md.x2d; 48 md.y=md.y2d; 49 md.z=md.z2d; 50 md.elements=md.elements2d; 51 md.elements_type=md.elements_type2d; 52 end 53 54 %units 55 if ~isnan(options_structure.unitmultiplier), 56 md.x=md.x*options_structure.unitmultiplier; 57 md.y=md.y*options_structure.unitmultiplier; 58 md.z=md.z*options_structure.unitmultiplier; 59 end 60 61 if length(tensor.xx)==length(md.elements), 62 63 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 64 tensor.xx(find(md.elementoniceshelf))=NaN; 65 tensor.yy(find(md.elementoniceshelf))=NaN; 66 tensor.xy(find(md.elementoniceshelf))=NaN; 67 if strcmpi(md.type,'3d') 68 tensor.zz(find(md.elementoniceshelf))=NaN; 69 tensor.yz(find(md.elementoniceshelf))=NaN; 70 tensor.xz(find(md.elementoniceshelf))=NaN; 71 end 72 end 73 if ~isnan(options_structure.noicesheet) & options_structure.noicesheet, 74 tensor.xx(find(~md.elementoniceshelf))=NaN; 75 tensor.yy(find(~md.elementoniceshelf))=NaN; 76 tensor.xy(find(~md.elementoniceshelf))=NaN; 77 if strcmpi(md.type,'3d') 78 tensor.zz(find(~md.elementoniceshelf))=NaN; 79 tensor.yz(find(~md.elementoniceshelf))=NaN; 80 tensor.xz(find(~md.elementoniceshelf))=NaN; 81 end 82 end 83 84 if (strcmpi(md.type,'2d')), 85 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 86 87 subplot(2*width,2*width,index1) 88 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 89 Apply_options_tensor(options_structure,type,'xx') 90 91 subplot(2*width,2*width,index2) 92 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 93 Apply_options_tensor(options_structure,type,'yy') 94 95 subplot(2*width,2*width,index3) 96 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 97 Apply_options_tensor(options_structure,type,'xy') 98 else 99 if options_structure.layer>=1, 100 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 101 102 subplot(3*width,3*width,index1) 103 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.xx ,'FaceColor','flat','EdgeColor','black'); 104 Apply_options_tensor(options_structure,type,'xx') 105 106 subplot(3*width,3*width,index2) 107 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.yy ,'FaceColor','flat','EdgeColor','black'); 108 Apply_options_tensor(options_structure,type,'yy') 109 110 subplot(3*width,3*width,index3) 111 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.zz ,'FaceColor','flat','EdgeColor','black'); 112 Apply_options_tensor(options_structure,type,'zz') 113 114 subplot(3*width,3*width,index4) 115 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.xy ,'FaceColor','flat','EdgeColor','black'); 116 Apply_options_tensor(options_structure,type,'xy') 117 118 subplot(3*width,3*width,index5) 119 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.xz ,'FaceColor','flat','EdgeColor','black'); 120 Apply_options_tensor(options_structure,type,'xz') 121 122 subplot(3*width,3*width,index6) 123 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData',tensor.yz ,'FaceColor','flat','EdgeColor','black'); 124 Apply_options_tensor(options_structure,type,'yz') 125 126 else 127 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); D=md.elements(:,4); E=md.elements(:,5); F=md.elements(:,6); 128 129 subplot(3*width,3*width,index1) 130 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 131 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 132 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 133 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 134 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.xx,'FaceColor','flat','EdgeColor','black'); 135 Apply_options_tensor(options_structure,type,'xx') 136 137 subplot(3*width,3*width,index2) 138 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 139 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 140 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 141 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 142 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.yy,'FaceColor','flat','EdgeColor','black'); 143 Apply_options_tensor(options_structure,type,'yy') 144 145 subplot(3*width,3*width,index3) 146 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.zz,'FaceColor','flat','EdgeColor','black'); 147 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.zz,'FaceColor','flat','EdgeColor','black'); 148 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.zz,'FaceColor','flat','EdgeColor','black'); 149 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.zz,'FaceColor','flat','EdgeColor','black'); 150 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.zz,'FaceColor','flat','EdgeColor','black'); 151 Apply_options_tensor(options_structure,type,'zz') 152 153 subplot(3*width,3*width,index4) 154 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 155 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 156 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 157 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 158 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.xy,'FaceColor','flat','EdgeColor','black'); 159 Apply_options_tensor(options_structure,type,'xy') 160 161 subplot(3*width,3*width,index5) 162 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.xz,'FaceColor','flat','EdgeColor','black'); 163 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.xz,'FaceColor','flat','EdgeColor','black'); 164 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.xz,'FaceColor','flat','EdgeColor','black'); 165 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.xz,'FaceColor','flat','EdgeColor','black'); 166 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.xz,'FaceColor','flat','EdgeColor','black'); 167 Apply_options_tensor(options_structure,type,'xz') 168 169 subplot(3*width,3*width,index6) 170 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.yz,'FaceColor','flat','EdgeColor','black'); 171 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.yz,'FaceColor','flat','EdgeColor','black'); 172 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.yz,'FaceColor','flat','EdgeColor','black'); 173 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.yz,'FaceColor','flat','EdgeColor','black'); 174 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.yz,'FaceColor','flat','EdgeColor','black'); 175 Apply_options_tensor(options_structure,type,'yz') 176 end 177 end 178 elseif length(tensor.xx)==md.numberofgrids | length(tensor.xx)==md.numberofgrids2d, 179 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 180 pos=find(md.gridoniceshelf); 181 tensor.xx(pos)=NaN; 182 tensor.yy(pos)=NaN; 183 tensor.xy(pos)=NaN; 184 if strcmpi(md.type,'3d') 185 tensor.zz(pos)=NaN; 186 tensor.xz(pos)=NaN; 187 tensor.yz(pos)=NaN; 188 end 189 end 190 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet, 191 pos=find(md.gridonicesheet); 192 tensor.xx(pos)=NaN; 193 tensor.yy(pos)=NaN; 194 tensor.xy(pos)=NaN; 195 if strcmpi(md.type,'3d') 196 tensor.zz(pos)=NaN; 197 tensor.xz(pos)=NaN; 198 tensor.yz(pos)=NaN; 199 end 200 end 201 202 if strcmpi(md.type,'2d'), 203 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 204 205 subplot(2*width,2*width,index1) 206 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.xx ,'FaceColor','flat','EdgeColor','none'); 207 Apply_options_tensor(options_structure,type,'xx') 208 209 subplot(2*width,2*width,index2) 210 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.yy ,'FaceColor','flat','EdgeColor','none'); 211 Apply_options_tensor(options_structure,type,'yy') 212 213 subplot(2*width,2*width,index3) 214 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.xy ,'FaceColor','flat','EdgeColor','none'); 215 Apply_options_tensor(options_structure,type,'xy') 216 217 else 218 if options_structure.layer>=1, 219 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 220 subplot(3*width,3*width,index1) 221 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.xx ,'FaceColor','flat','EdgeColor','none'); 222 Apply_options_tensor(options_structure,type,'xx') 223 224 subplot(3*width,3*width,index2) 225 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.yy ,'FaceColor','flat','EdgeColor','none'); 226 Apply_options_tensor(options_structure,type,'yy') 227 228 subplot(3*width,3*width,index3) 229 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.zz ,'FaceColor','flat','EdgeColor','none'); 230 Apply_options_tensor(options_structure,type,'zz') 231 232 subplot(3*width,3*width,index4) 233 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.xy ,'FaceColor','flat','EdgeColor','none'); 234 Apply_options_tensor(options_structure,type,'xy') 235 236 subplot(3*width,3*width,index5) 237 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.xz ,'FaceColor','flat','EdgeColor','none'); 238 Apply_options_tensor(options_structure,type,'xz') 239 240 subplot(3*width,3*width,index6) 241 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.yz ,'FaceColor','flat','EdgeColor','none'); 242 Apply_options_tensor(options_structure,type,'yz') 243 244 else 245 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); D=md.elements(:,4); E=md.elements(:,5); F=md.elements(:,6); 246 247 subplot(3*width,3*width,index1) 248 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xx,'FaceColor','flat','EdgeColor','none'); 249 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xx,'FaceColor','flat','EdgeColor','none'); 250 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xx,'FaceColor','flat','EdgeColor','none'); 251 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xx,'FaceColor','flat','EdgeColor','none'); 252 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xx,'FaceColor','flat','EdgeColor','none'); 253 Apply_options_tensor(options_structure,type,'xx') 254 255 subplot(3*width,3*width,index2) 256 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yy,'FaceColor','flat','EdgeColor','none'); 257 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yy,'FaceColor','flat','EdgeColor','none'); 258 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yy,'FaceColor','flat','EdgeColor','none'); 259 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yy,'FaceColor','flat','EdgeColor','none'); 260 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yy,'FaceColor','flat','EdgeColor','none'); 261 Apply_options_tensor(options_structure,type,'yy') 262 263 subplot(3*width,3*width,index3) 264 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.zz,'FaceColor','flat','EdgeColor','none'); 265 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.zz,'FaceColor','flat','EdgeColor','none'); 266 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.zz,'FaceColor','flat','EdgeColor','none'); 267 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.zz,'FaceColor','flat','EdgeColor','none'); 268 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.zz,'FaceColor','flat','EdgeColor','none'); 269 Apply_options_tensor(options_structure,type,'zz') 270 271 subplot(3*width,3*width,index4) 272 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xy,'FaceColor','flat','EdgeColor','none'); 273 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xy,'FaceColor','flat','EdgeColor','none'); 274 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xy,'FaceColor','flat','EdgeColor','none'); 275 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xy,'FaceColor','flat','EdgeColor','none'); 276 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xy,'FaceColor','flat','EdgeColor','none'); 277 Apply_options_tensor(options_structure,type,'xy') 278 279 subplot(3*width,3*width,index5) 280 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xz,'FaceColor','flat','EdgeColor','none'); 281 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xz,'FaceColor','flat','EdgeColor','none'); 282 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xz,'FaceColor','flat','EdgeColor','none'); 283 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xz,'FaceColor','flat','EdgeColor','none'); 284 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.xz,'FaceColor','flat','EdgeColor','none'); 285 Apply_options_tensor(options_structure,type,'xz') 286 287 subplot(3*width,3*width,index6) 288 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yz,'FaceColor','flat','EdgeColor','none'); 289 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yz,'FaceColor','flat','EdgeColor','none'); 290 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yz,'FaceColor','flat','EdgeColor','none'); 291 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yz,'FaceColor','flat','EdgeColor','none'); 292 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.yz,'FaceColor','flat','EdgeColor','none'); 293 Apply_options_tensor(options_structure,type,'yz') 294 end 295 end 296 end 9 %Compute the indexes of the components plots 10 upperplots=fix((i-1)/width); 11 if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end 12 if strcmpi(md.type,'2d')%3 components -> 3 indexes 13 index1=4*width*upperplots+2*leftplots+1; 14 index2=index1+1; 15 index3=index1+width*2; 16 elseif strcmpi(md.type,'3d')%6 components -> 6 indexes 17 index1=3*3*width*upperplots+3*leftplots+1; 18 index2=index1+1; 19 index3=index1+2; 20 index4=index1+width*3; 21 index5=index4+1; 22 index6=index4+2; 297 23 end 298 24 299 function Apply_options_tensor(options_structure,type,component) 300 %apply options 25 %process data and model 26 [x y z elements is2d]=processmesh(md,options_structure); 27 [tensor.xx isongrid]=processdata(md,tensor.xx,options_structure); 28 [tensor.yy isongrid]=processdata(md,tensor.yy,options_structure); 29 [tensor.xy isongrid]=processdata(md,tensor.xy,options_structure); 30 if strcmpi(md.type,'3d') 31 [tensor.xz isongrid]=processdata(md,tensor.xz,options_structure); 32 [tensor.yz isongrid]=processdata(md,tensor.yz,options_structure); 33 [tensor.zz isongrid]=processdata(md,tensor.zz,options_structure); 34 end 35 36 if (strcmpi(md.type,'2d')), 37 subplot(2*width,2*width,index1), 38 plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,options_structure) 39 Apply_options_tensor(md,options_structure,type,'xx') 40 subplot(2*width,2*width,index2), 41 plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,options_structure) 42 Apply_options_tensor(md,options_structure,type,'yy') 43 subplot(2*width,2*width,index3), 44 plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,options_structure) 45 Apply_options_tensor(md,options_structure,type,'xy') 46 else 47 subplot(3*width,3*width,index1), 48 plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,options_structure) 49 Apply_options_tensor(md,options_structure,type,'xx') 50 subplot(3*width,3*width,index2), 51 plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,options_structure) 52 Apply_options_tensor(md,options_structure,type,'yy') 53 subplot(3*width,3*width,index3), 54 plot_unit(x,y,z,elements,tensor.zz,isongrid,is2d,options_structure) 55 Apply_options_tensor(md,options_structure,type,'zz') 56 subplot(3*width,3*width,index4), 57 plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,options_structure) 58 Apply_options_tensor(md,options_structure,type,'xy') 59 subplot(3*width,3*width,index5), 60 plot_unit(x,y,z,elements,tensor.xz,isongrid,is2d,options_structure) 61 Apply_options_tensor(md,options_structure,type,'xz') 62 subplot(3*width,3*width,index6), 63 plot_unit(x,y,z,elements,tensor.yz,isongrid,is2d,options_structure) 64 Apply_options_tensor(md,options_structure,type,'yz') 65 end 66 end 67 68 function Apply_options_tensor(md,options_structure,type,component) 69 %apply options 301 70 if isnan(options_structure.title) 302 71 if ismember('_',type) %user plotet stress_tensor -
issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m
r1 r27 5 5 % plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options); 6 6 % 7 % See also: PLOTMODEL 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 8 8 9 %Compute the indexes of the components plots 10 upperplots=fix((i-1)/width); 11 if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end 12 if strcmpi(md.type,'2d')%3 components -> 3 indexes 13 index1=4*width*upperplots+2*leftplots+1; 14 index2=index1+1; 15 index3=index1+width*2; 16 index4=index3+1; 17 newwidth=2*width; 18 elseif strcmpi(md.type,'3d')%6 components -> 6 indexes 19 index1=3*3*width*upperplots+3*leftplots+1; 20 index2=index1+1; 21 index3=index1+2; 22 index4=index1+width*3; 23 index5=index4+1; 24 index6=index4+2; 25 newwidth=3*width; 26 end 27 28 %plot principal axis 29 type1=[type 'axis1']; 30 plot_tensor_principalaxis(md,options_structure,newwidth,index1,tensor,type1,plot_options); 31 type2=[type 'axis2']; 32 plot_tensor_principalaxis(md,options_structure,newwidth,index2,tensor,type2,plot_options); 33 if strcmpi(md.type,'3d') 34 type3=[type 'axis3']; 35 plot_tensor_principalaxis(md,options_structure,newwidth,index3,tensor,type3,plot_options); 36 end 37 38 %smoothing? 39 if strcmpi(options_structure.smooth,'yes') & length(tensor.principalvalue1)==md.numberofelements 40 tensor.principalvalue1=elementstogrids(md,tensor.principalvalue1); 41 tensor.principalvalue2=elementstogrids(md,tensor.principalvalue2); 42 if strcmpi(md.type,'3d'), tensor.principalvalue3=elementstogrids(md,tensor.principalvalue3); end 43 end 44 45 46 %layer projection? 47 if ~isnan(options_structure.layer) & options_structure.layer>=1, 48 tensor.principalvalue1=project2d(md,tensor.principalvalue1,options_structure.layer); %project onto 2d mesh 49 tensor.principalvalue2=project2d(md,tensor.principalvalue2,options_structure.layer); 50 tensor.principalvalue3=project2d(md,tensor.principalvalue3,options_structure.layer); 51 52 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 53 md.x=md.x2d; 54 md.y=md.y2d; 55 md.z=md.z2d; 56 md.elements=md.elements2d; 57 md.elements_type=md.elements_type2d; 58 end 59 60 %units 61 if ~isnan(options_structure.unitmultiplier), 62 md.x=md.x*options_structure.unitmultiplier; 63 md.y=md.y*options_structure.unitmultiplier; 64 md.z=md.z*options_structure.unitmultiplier; 65 end 66 67 if length(tensor.principalvalue1)==length(md.elements), 68 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 69 tensor.principalvalue1(find(md.elementoniceshelf))=NaN; 70 tensor.principalvalue2(find(md.elementoniceshelf))=NaN; 71 if strcmpi(md.type,'3d') 72 tensor.principalvalue3(find(md.elementoniceshelf))=NaN; 73 end 74 end 75 if ~isnan(options_structure.noicesheet) & options_structure.noicesheet, 76 tensor.principalvalue1(find(~md.elementoniceshelf))=NaN; 77 tensor.principalvalue2(find(~md.elementoniceshelf))=NaN; 78 if strcmpi(md.type,'3d') 79 tensor.principalvalue3(find(~md.elementoniceshelf))=NaN; 80 end 81 end 82 83 if (strcmpi(md.type,'2d')), 84 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 85 86 subplot(2*width,2*width,index3) 87 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 88 Apply_options_tensor(options_structure,type,'principal value 1') 89 90 subplot(2*width,2*width,index4) 91 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 92 Apply_options_tensor(options_structure,type,'principal value 2') 93 else 94 if options_structure.layer>=1, 95 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 96 97 subplot(3*width,3*width,index4) 98 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 99 Apply_options_tensor(options_structure,type,'principal value 1') 100 101 subplot(3*width,3*width,index5) 102 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 103 Apply_options_tensor(options_structure,type,'principal value 2') 104 105 subplot(3*width,3*width,index6) 106 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 107 Apply_options_tensor(options_structure,type,'principal value 3') 108 109 else 110 111 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); D=md.elements(:,4); E=md.elements(:,5); F=md.elements(:,6); 112 113 subplot(3*width,3*width,index4) 114 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 115 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 116 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 117 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 118 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','black'); 119 Apply_options_tensor(options_structure,type,'principal value 1') 120 121 subplot(3*width,3*width,index5) 122 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 123 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 124 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 125 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 126 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','black'); 127 Apply_options_tensor(options_structure,type,'principal value 2') 128 129 subplot(3*width,3*width,index6) 130 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 131 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 132 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 133 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 134 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'CData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','black'); 135 Apply_options_tensor(options_structure,type,'principal value 3') 136 end 137 end 138 139 elseif length(tensor.principalvalue1)==md.numberofgrids | length(tensor.principalvalue1)==md.numberofgrids2d, 140 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 141 pos=find(md.gridoniceshelf); 142 tensor.principalvalue1(pos)=NaN; 143 tensor.principalvalue2(pos)=NaN; 144 if strcmpi(md.type,'3d') 145 tensor.principalvalue3(pos)=NaN; 146 end 147 end 148 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet, 149 pos=find(md.gridonicesheet); 150 tensor.principalvalue1(pos)=NaN; 151 tensor.principalvalue2(pos)=NaN; 152 if strcmpi(md.type,'3d') 153 tensor.principalvalue3(pos)=NaN; 154 end 155 end 156 157 if strcmpi(md.type,'2d'), 158 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 159 160 subplot(2*width,2*width,index3) 161 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.principalvalue1 ,'FaceColor','flat','EdgeColor','none'); 162 Apply_options_tensor(options_structure,type,'principal value 1') 163 164 subplot(2*width,2*width,index4) 165 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.principalvalue2 ,'FaceColor','flat','EdgeColor','none'); 166 Apply_options_tensor(options_structure,type,'principal value 2') 167 else 168 if options_structure.layer>=1, 169 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); 170 171 subplot(3*width,3*width,index4) 172 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.principalvalue1 ,'FaceColor','flat','EdgeColor','none'); 173 Apply_options_tensor(options_structure,type,'principal value 1') 174 175 subplot(3*width,3*width,index5) 176 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.principalvalue2 ,'FaceColor','flat','EdgeColor','none'); 177 Apply_options_tensor(options_structure,type,'principal value 2') 178 179 subplot(3*width,3*width,index6) 180 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData',tensor.principalvalue3 ,'FaceColor','flat','EdgeColor','none'); 181 Apply_options_tensor(options_structure,type,'principal value 3') 182 else 183 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); D=md.elements(:,4); E=md.elements(:,5); F=md.elements(:,6); 184 185 subplot(3*width,3*width,index4) 186 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','none'); 187 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','none'); 188 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','none'); 189 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','none'); 190 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue1,'FaceColor','flat','EdgeColor','none'); 191 Apply_options_tensor(options_structure,type,'principal value 1') 192 193 subplot(3*width,3*width,index5) 194 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','none'); 195 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','none'); 196 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','none'); 197 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','none'); 198 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue2,'FaceColor','flat','EdgeColor','none'); 199 Apply_options_tensor(options_structure,type,'principal value 2') 200 201 subplot(3*width,3*width,index6) 202 patch( 'Faces', [A B C], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','none'); 203 patch( 'Faces', [D E F], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','none'); 204 patch( 'Faces', [A B E D], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','none'); 205 patch( 'Faces', [B E F C ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','none'); 206 patch( 'Faces', [C A D F ], 'Vertices', [md.x md.y md.z],'FaceVertexCData', tensor.principalvalue3,'FaceColor','flat','EdgeColor','none'); 207 Apply_options_tensor(options_structure,type,'principal value 3') 208 end 209 end 210 end 9 %Compute the indexes of the components plots 10 upperplots=fix((i-1)/width); 11 if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end 12 if strcmpi(md.type,'2d')%3 components -> 3 indexes 13 index1=4*width*upperplots+2*leftplots+1; 14 index2=index1+1; 15 index3=index1+width*2; 16 index4=index3+1; 17 newwidth=2*width; 18 elseif strcmpi(md.type,'3d')%6 components -> 6 indexes 19 index1=3*3*width*upperplots+3*leftplots+1; 20 index2=index1+1; 21 index3=index1+2; 22 index4=index1+width*3; 23 index5=index4+1; 24 index6=index4+2; 25 newwidth=3*width; 211 26 end 212 27 213 function Apply_options_tensor(options_structure,type,component) 28 %plot principal axis 29 type1=[type 'axis1']; 30 plot_tensor_principalaxis(md,options_structure,newwidth,index1,tensor,type1,plot_options); 31 type2=[type 'axis2']; 32 plot_tensor_principalaxis(md,options_structure,newwidth,index2,tensor,type2,plot_options); 33 if strcmpi(md.type,'3d') 34 type3=[type 'axis3']; 35 plot_tensor_principalaxis(md,options_structure,newwidth,index3,tensor,type3,plot_options); 36 end 37 38 %now plot principal values 39 [x y z elements is2d]=processmesh(md,options_structure); 40 [tensor.principalvalue1 isongrid]=processdata(md,tensor.principalvalue1,options_structure); 41 [tensor.principalvalue2 isongrid]=processdata(md,tensor.principalvalue2,options_structure); 42 if strcmpi(md.type,'3d') 43 [tensor.principalvalue3 isongrid]=processdata(md,tensor.principalvalue3,options_structure); 44 end 45 46 if (strcmpi(md.type,'2d')), 47 subplot(2*width,2*width,index3) 48 plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,options_structure) 49 Apply_options_tensor(md,options_structure,type,'principal value 1') 50 subplot(2*width,2*width,index4) 51 plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,options_structure) 52 Apply_options_tensor(md,options_structure,type,'principal value 2') 53 else 54 subplot(3*width,3*width,index4) 55 plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,options_structure) 56 Apply_options_tensor(md,options_structure,type,'principal value 1') 57 subplot(3*width,3*width,index5) 58 plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,options_structure) 59 Apply_options_tensor(md,options_structure,type,'principal value 2') 60 subplot(3*width,3*width,index6) 61 plot_unit(x,y,z,elements,tensor.principalvalue3,isongrid,is2d,options_structure) 62 Apply_options_tensor(md,options_structure,type,'principal value 3') 63 end 64 end 65 66 function Apply_options_tensor(md,options_structure,type,component) 214 67 %apply options 215 68 if isnan(options_structure.title) -
issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m
r1 r27 7 7 % See also: PLOTMODEL 8 8 9 %p lot mesh boundaries9 %prepare subplot 10 10 subplot(width,width,i); 11 11 12 %process data and model 13 [x y z elements is2d]=processmesh(md,options_structure); 12 14 13 15 if (strcmpi(md.type,'2d')), 14 16 eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);']) 17 eval(['value=tensor.principalvalue' type(end) ';']); 18 [Vx isongrid]=processdata(md,Vx,options_structure); 19 [Vy isongrid]=processdata(md,Vy,options_structure); 20 [value isongrid]=processdata(md,value,options_structure); 15 21 else 16 22 eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2); Vz=tensor.principalaxis' type(end) '(:,3);']) 23 [Vx isongrid]=processdata(md,Vx,options_structure); 24 [Vy isongrid]=processdata(md,Vy,options_structure); 25 [Vz isongrid]=processdata(md,Vz,options_structure); 26 [value isongrid]=processdata(md,value,options_structure); 17 27 end 18 28 19 %smoothing? 20 if strcmpi(options_structure.smooth,'yes') & length(Vx)==md.numberofelements 21 Vx=elementstogrids(md,Vx); 22 Vy=elementstogrids(md,Vy); 23 if (strcmpi(md.type,'3d')), 24 Vz=elementstogrids(md,Vz); 25 end 26 end 27 28 %layer projection? 29 if ~isnan(options_structure.layer) & options_structure.layer>=1, 30 Vx=project2d(md,Vx,options_structure.layer); %project onto 2d mesh 31 Vy=project2d(md,Vy,options_structure.layer); %project onto 2d mesh 32 if (strcmpi(md.type,'3d')), 33 Vz=project2d(md,Vz,options_structure.layer); %project onto 2d mesh 34 end 35 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 36 md.x=md.x2d; 37 md.y=md.y2d; 38 md.z=md.z2d; 39 md.elements=md.elements2d; 40 md.elements_type=md.elements_type2d; 41 md.type='2d'; 29 %take the center of each element if ~isongrid 30 if ~isongrid 31 x=mean(md.x(md.elements'))'; y=mean(md.y(md.elements'))'; z=mean(md.z(md.elements'))'; 42 32 end 43 33 44 %units 45 if ~isnan(options_structure.unitmultiplier), 46 md.x=md.x*options_structure.unitmultiplier; 47 md.y=md.y*options_structure.unitmultiplier; 48 md.z=md.z*options_structure.unitmultiplier; 49 end 50 if length(Vx)==length(md.elements), 51 52 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 53 Vx(find(md.elementoniceshelf))=NaN; 54 Vy(find(md.elementoniceshelf))=NaN; 55 Vz(find(md.elementoniceshelf))=NaN; 56 end 57 if ~isnan(options_structure.noicesheet) & options_structure.noicesheet, 58 Vx(find(~md.elementoniceshelf))=NaN; 59 Vy(find(~md.elementoniceshelf))=NaN; 60 Vz(find(~md.elementoniceshelf))=NaN; 34 %plot quivers 35 if strcmpi(md.type,'2d'), 36 37 %density 38 if ~isnan(options_structure.density) 39 x=x(1:options_structure.density:end); 40 y=y(1:options_structure.density:end); 41 Vx=Vx(1:options_structure.density:end); 42 Vy=Vy(1:options_structure.density:end); 43 value=value(1:options_structure.density:end); 61 44 end 62 45 63 if (strcmpi(md.type,'2d')),64 x=mean(md.x(md.elements'))'; y=mean(md.y(md.elements'))';65 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3);66 quiver(x,y,Vx,Vy)46 %scaling: 47 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 48 scale=0.5/max(sqrt((Vx.^2+Vy.^2)/delta)); 49 Vx=scale*Vx; Vy=scale*Vy; 67 50 68 else 69 x=mean(md.x(md.elements'))'; y=mean(md.y(md.elements'))'; z=mean(md.z(md.elements'))'; 70 A=md.elements(:,1); B=md.elements(:,2); C=md.elements(:,3); D=md.elements(:,4); E=md.elements(:,5); F=md.elements(:,6); 71 quiver3(x,y,z,Vx,Vy,Vz) 72 end 73 elseif length(Vx)==md.numberofgrids | length(Vx)==md.numberofgrids2d, 74 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf, 75 pos=find(md.gridoniceshelf); 76 Vx(pos)=NaN; 77 Vy(pos)=NaN; 78 Vz(pos)=NaN; 79 end 80 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet, 81 pos=find(md.gridonicesheet); 82 Vx(pos)=NaN; 83 Vy(pos)=NaN; 84 Vz(pos)=NaN; 51 pos=find(value>=0); 52 q1=quiver(x(pos),y(pos),Vx(pos),Vy(pos),'Color','r','ShowArrowHead','off','AutoScale','off'); 53 hold on 54 pos=find(value<0); 55 q2=quiver(x(pos),y(pos),Vx(pos),Vy(pos),'Color','b','ShowArrowHead','off','AutoScale','off'); 56 57 else 58 %density 59 if ~isnan(options_structure.density) 60 x=x(1:options_structure.density:end); 61 y=y(1:options_structure.density:end); 62 z=z(1:options_structure.density:end); 63 Vx=Vx(1:options_structure.density:end); 64 Vy=Vy(1:options_structure.density:end); 65 Vz=Vz(1:options_structure.density:end); 66 value=value(1:options_structure.density:end); 85 67 end 86 68 87 if strcmpi(md.type,'2d'), 88 quiver(md.x,md.y,Vx,Vy) 89 else 90 quiver3(md.x,md.y,md.z,Vx,Vy,Vz) 91 end 69 %scaling: 70 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 71 scale=0.5/max(sqrt((Vx.^2+Vy.^2)/delta)); 72 Vx=scale*Vx; Vy=scale*Vy; Vz=scale*Vz; 73 74 pos=find(value>=0); 75 q1=quiver3(x(pos),y(pos),z(pos),Vx(pos),Vy(pos),Vz(pos),'Color','r','ShowArrowHead','off','AutoScale','off'); 76 hold on 77 pos=find(value<0); 78 q2=quiver3(x(pos),y(pos),z(pos),Vx(pos),Vy(pos),Vz(pos),'Color','b','ShowArrowHead','off','AutoScale','off'); 79 end 80 81 %legend 82 if strcmpi(type(1:6),'strain') 83 legend([q1 q2],'extension','compression') 84 elseif strcmpi(type(1:6),'stress') 85 legend([q1 q2],'compression','traction') 92 86 end 93 87 -
issm/trunk/src/m/classes/public/plot/plot_transient_movie.m
r1 r27 4 4 % plot_transient_movie(md,options_structure,width,i); 5 5 % 6 % See also: PLOTMODEL 6 % See also: PLOTMODEL, PLOT_UNIT, PLOT_DEALER 7 7 8 %p lot mesh boundaries8 %prepare subplot 9 9 subplot(width,width,i); 10 11 %first load x,y, etc ... to speed up plot12 x=md.x;13 x2d=md.x2d;14 y=md.y;15 y2d=md.y2d;16 z=md.z;17 z2d=md.z2d;18 elements2d=md.elements2d;19 elements=md.elements;20 elements_type2d=md.elements_type2d;21 22 %units23 if ~isnan(options_structure.unitmultiplier),24 md.x=md.x*options_structure.unitmultiplier;25 md.y=md.y*options_structure.unitmultiplier;26 md.z=md.z*options_structure.unitmultiplier;27 end28 29 %edgecolor?30 if ~isnan(options_structure.edgecolor),31 edgecolor=options_structure.edgecolor;32 else33 edgecolor='none';34 end35 10 36 11 if strcmpi(md.type,'2d') 37 12 choice=input('Which field do you want to plot? (vel/vx/vy/thickness/surface/bed)','s'); 38 39 13 if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface') 40 14 disp('plot_transient_movie error message: input not supported yet, exiting...') 41 15 return 42 16 end 43 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,44 pos=find(md.gridoniceshelf);45 data(pos)=NaN;46 end47 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,48 pos=find(md.gridonicesheet);49 data(pos)=NaN;50 end51 for i=1:length(md.transient_results)52 eval(['data=md.transient_results(' num2str(i) ').' num2str(choice) ';']);53 titlestring=[choice ' at time ' num2str(md.transient_results(i).time) ' year'];54 A=elements(:,1); B=elements(:,2); C=elements(:,3);55 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);56 apply_options_movie(options_structure,titlestring);57 pause(0.5)58 end59 60 17 else 61 18 choice=input('Which field do you want to plot? (vel/vx/vy/vz/thickness/surface/bed/temperature)','s'); 62 63 19 if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'vz') & ~strcmp(choice,'temperature') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface') 64 20 disp('plot_transient_movie error message: input not supported yet, exiting...') 65 21 return 66 22 end 67 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,68 pos=find(md.gridoniceshelf);69 data(pos)=NaN;70 end71 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,72 pos=find(md.gridonicesheet);73 data(pos)=NaN;74 end75 for i=1:length(md.transient_results)76 eval(['data=md.transient_results(' num2str(i) ').' num2str(choice) ';']);77 titlestring=[choice 'at time ' num2str(md.transient_results(i).time) ' a'];78 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);79 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);80 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);81 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);82 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);83 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);84 apply_options_movie(options_structure,titlestring);85 pause(0.5)86 end87 23 end 88 24 25 %process model 26 [x y z elements is2d]=processmesh(md,options_structure); 27 28 %loop over the time steps 29 for i=1:length(md.transient_results) 30 eval(['data=md.transient_results(' num2str(i) ').' num2str(choice) ';']); 31 32 %process data 33 [data isongrid]=processdata(md,data,options_structure); 34 titlestring=[choice ' at time ' num2str(md.transient_results(i).time) ' year']; 35 plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure) 36 apply_options_movie(md,options_structure,titlestring); 37 pause(0.5) 38 end 89 39 end %function 90 40 91 function apply_options_movie( options_structure,titlestring)41 function apply_options_movie(md,options_structure,titlestring) 92 42 %apply options 93 43 if isnan(options_structure.title) -
issm/trunk/src/m/classes/public/plot/plot_unit.m
r1 r27 1 function plot_unit( md,optionstring,width,i);2 %PLOT_UNIT - unit plot called by plotmodel1 function plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure) 2 %PLOT_UNIT - unit plot, display data 3 3 % 4 4 % Usage: 5 % plot_unit( md,optionstring,width,i);5 % plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure); 6 6 % 7 % See also: PLOTMODEL 8 9 %parse options and get a structure of options. 10 options_structure=parse_options(md,optionstring); 11 12 %figure out if this is a special plot 13 data=findarg(optionstring,'data');data=data.value; 14 15 %Figure out if this is a semi-transparent plot. 16 if ~isnan(options_structure.overlay), 17 plot_overlay(md,data,options_structure,width,i); 18 return; 19 end 20 21 if ischar(data), 22 switch data, 23 case 'boundaries', 24 plot_boundaries(md,options_structure,width,i); 25 return; 26 case 'elementnumbering', 27 plot_elementnumbering(md,options_structure,width,i); 28 return; 29 case 'highlightelements', 30 plot_highlightelements(md,options_structure,width,i); 31 case 'segmentnumbering', 32 plot_segmentnumbering(md,options_structure,width,i); 33 return; 34 case 'importancefactors', 35 plot_importancefactors(md,options_structure,width,i); 36 return; 37 case 'elements_type', 38 plot_elementstype(md,options_structure,width,i); 39 return; 40 case 'gridnumbering', 41 plot_gridnumbering(md,options_structure,width,i); 42 return; 43 case 'highlightgrids', 44 plot_highlightgrids(md,options_structure,width,i); 45 return; 46 case 'basal_drag', 47 plot_basaldrag(md,options_structure,width,i); 48 return; 49 case 'driving_stress', 50 plot_drivingstress(md,options_structure,width,i); 51 return; 52 case 'mesh', 53 plot_mesh(md,options_structure,width,i); 54 return; 55 case 'penalties', 56 plot_penalties(md,options_structure,width,i); 57 return; 58 case 'quiver', 59 plot_quiver(md,options_structure,width,i); 60 return; 61 case 'quiver3', 62 plot_quiver3(md,options_structure,width,i); 63 return; 64 case 'quivervel', 65 plot_quivervel(md,options_structure,width,i); 66 return; 67 case 'riftvel', 68 plot_riftvel(md,options_structure,width,i); 69 return; 70 case 'riftrelvel', 71 plot_riftrelvel(md,options_structure,width,i); 72 return; 73 case 'riftpenetration', 74 plot_riftpenetration(md,options_structure,width,i); 75 return; 76 case 'sarpwr', 77 plot_sarpwr(md,options_structure,width,i) 78 return 79 case {'segmentonneumann_diag','segmentonneumann_prog'} 80 plot_segmentonneumann(md,options_structure,width,i,data) 81 return 82 case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',... 83 'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',... 84 'deviatoricstress_tensor','deviatoricstress','deviatoricstress_principal','deviatoricstress_principalaxis1','deviatoricstress_principalaxis2','deviatoricstress_principalaxis3'}, 85 plot_tensor(md,options_structure,width,i,data); 86 return; 87 case 'thermaltransient_results', 88 plot_thermaltransient_results(md,options_structure,width,i); 89 return; 90 case 'transient_movie', 91 plot_transient_movie(md,options_structure,width,i); 92 return; 93 case 'transient_results', 94 plot_transient_results(md,options_structure,width,i); 95 return; 96 otherwise, 97 if isfield(struct(md),data) 98 data=eval(['md.' data ';']); 99 else 100 error('plot error message: data provided not supported yet. Type plotdoc for help'); 101 end 102 end 103 end 104 105 %Figure out if this is a Section plot 106 if ~isnan(options_structure.sectionvalue) 107 plot_section(md,data,options_structure,width,i); 108 return; 109 end 110 111 %check on arguments 112 if (iscell(data) | isempty(data)), 113 error('plot error message: data provided is empty'); 114 end 115 116 %process data and model 117 [x y z elements is2d]=processmesh(md,options_structure); 118 [data isongrid]=processdata(md,data,options_structure); 7 % See also: PLOTMODEL, PLOT_DEALER 119 8 120 9 %edgecolor? … … 124 13 edgecolor='none'; 125 14 end 126 127 %standard plot:128 subplot(width,width,i);129 15 130 16 %element data … … 145 31 if is2d 146 32 A=elements(:,1); B=elements(:,2); C=elements(:,3); 147 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);33 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 148 34 else 149 35 if options_structure.layer>=1, 150 36 A=elements(:,1); B=elements(:,2); C=elements(:,3); 151 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);37 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 152 38 else 153 39 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6); 154 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);155 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);156 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);157 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);158 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data ,'FaceColor','interp','EdgeColor',edgecolor);40 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 41 patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 42 patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 43 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 44 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 159 45 end 160 46 end 161 47 end 162 163 %apply all options164 if isnan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data,1)==md.numberofgrids,165 options_structure.shading='interp';166 end167 168 applyoptions(md,data,options_structure); -
issm/trunk/src/m/classes/public/plot/plotdoc.m
r1 r27 30 30 disp(' - ''riftpenetration'': penetration levels for a fault'); 31 31 disp(' - ''basal_drag'': plot the basal drag on the bed (in kPa)'); 32 disp(' - ''basal_dragx'' or ''basal_dragy'' : plot a component of the basal drag on the bed (in kPa)'); 32 33 disp(' - ''driving_stress'': plot the driving stress (in kPa)'); 33 34 disp(' - ''strainrate_tensor'': plot the components of the strainrate tensor (exx,eyy,ezz,exy,exz,eyz) if computed'); … … 53 54 disp(' ''contourticks'': ''on'' or ''off'' to display the ticks of the contours'); 54 55 disp(' ''contouronly'': ''on'' or ''off'' to display the contours on a white background'); 55 disp(' ''contourcolors'': ticks and contour color'); 56 disp(' ''contourcolor'': ticks and contour color'); 57 disp(' ''density'': density of quivers (one arrow every N nodes, N integer)'); 58 disp(' ''streamlines'': N (number of stream lines) or {[x1 y1],...} (coordinates of seed points) add streanlines on current figure'); 56 59 disp(' ''wrapping'': repeat ''n'' times the colormap (''n'' must be an integer)'); 57 60 disp(' ''edgecolor'': same as standard matlab option EdgeColor (color name: ''black'' or RGB array: [0.5 0.2 0.8])'); … … 61 64 disp(' ''resolution'': resolution used by section value (array of type [horizontal_resolution vertical_resolution])'); 62 65 disp(' horizontal_resolution must be in meter, and vertical_resolution a number of layers'); 63 disp(' ''showsection'': show section used by ''sectionvalue'' (string '' yes'')');66 disp(' ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)'); 64 67 disp(' ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')'); 65 68 disp(' ''smooth'': smooth element data (string ''yes'' or integer)'); -
issm/trunk/src/m/classes/public/plot/plotmodel.m
r1 r27 1 1 function plotmodel(md,varargin) 2 2 %At command prompt, type plotdoc for help on documentation. 3 3 4 global ISSM_DIR 4 5 if isempty(ISSM_DIR), … … 28 29 %recover options for all subplots. 29 30 options=recover_plot_options(md,varargin,numberofplots); 31 32 %Create figure 33 figure(figurenumber),clf; 30 34 31 %Create figure32 figure(figurenumber); clf;33 34 35 %Go through all data plottable 35 36 for i=1:numberofplots, 36 37 37 38 %call unit plot 38 plot_ unit(md,options{i},subplotwidth,i);39 39 plot_dealer(md,options{i},subplotwidth,i); 40 40 41 end 41 42 else -
issm/trunk/src/m/classes/public/plot/processdata.m
r1 r27 7 7 % See also: PLOTMODEL, PROCESSMESH 8 8 9 %some checks 10 if length(data)~=md.numberofgrids & length(data)~=md.numberofelements & length(data)~=md.numberofgrids*6 9 %check format 10 if (iscell(data) | isempty(data)), 11 error('plotmodel error message: data provided is empty'); 12 end 13 14 %check length 15 if length(data)~=md.numberofgrids & length(data)~=md.numberofelements & length(data)~=md.numberofgrids*6 & (strcmpi(md.type,'2d') | length(data)~=md.numberofgrids2d) 11 16 error('plotmodel error message: data not supproted yet') 12 17 end 13 18 14 % 6*grid data19 %treat the case length(data)=6*grids 15 20 if length(data)==6*md.numberofgrids 16 21 %keep the only norm of data … … 18 23 data2=data(2:6:md.numberofgrids*6); 19 24 data=sqrt(data1.^2+data2.^2); 25 %---> go to grid data 26 end 27 28 %treat the case length(data)=grids2d 29 if (strcmpi(md.type,'3d') & length(data)==md.numberofgrids2d), 30 data=project3d(md,data,'node'); 20 31 %---> go to grid data 21 32 end … … 60 71 data=project2d(md,data,options_structure.layer); %project onto 2d mesh 61 72 end 62 63 -
issm/trunk/src/m/classes/public/solve.m
r1 r27 14 14 %some checks on list of arguments 15 15 16 solutions={'mesh2grid','mesh','thermaltransient','thermalsteady','qmu','diagnostic','diagnostic_horiz','prognostic','transient','param ters','control'};16 solutions={'mesh2grid','mesh','thermaltransient','thermalsteady','qmu','diagnostic','diagnostic_horiz','prognostic','transient','parameters','control'}; 17 17 found=0; 18 18 for i=1:length(solutions), … … 24 24 25 25 if found==0, 26 error(['solve error messa e: solution type ' solutiontype ' not supported yet!']);26 error(['solve error message: solution type ' solutiontype ' not supported yet!']); 27 27 end 28 28 -
issm/trunk/src/m/classes/public/thicknessevolution.m
r1 r27 4 4 % This routine compute the new thickness of a model after a time step 5 5 % according to the following formula: 6 % dh/dt=div(Hu) +Ms-Mb6 % dh/dt=div(Hu) 7 7 % 8 8 % Usage: … … 13 13 end 14 14 15 %load some variables (it is much faster if the variab;es are loaded from md once for all) 16 numberofelements=md.numberofelements; 17 H=md.thickness; 18 vx=md.vx; 19 vy=md.vy; 20 index=md.elements; 21 x=md.x; y=md.y; 22 23 %initialization 15 24 alpha=zeros(md.numberofelements,3); 16 25 beta=zeros(md.numberofelements,3); 26 gradx=zeros(md.numberofgrids,1); 27 grady=zeros(md.numberofgrids,1); 17 28 18 for n=1:md.numberofelements19 X=inv([md.x(md.elements(n,:)) md.y(md.elements(n,:)) ones(3,1)]);20 alpha(n,:)=X(1,:);21 beta(n,:)=X(2,:);22 end 29 %build some usefull variables 30 line=index(:); 31 summation=1/3*ones(3,1); 32 linesize=3*numberofelements; 33 x1=x(index(:,1)); x2=x(index(:,2)); x3=x(index(:,3)); y1=y(index(:,1)); y2=y(index(:,2)); y3=y(index(:,3)); 23 34 24 summation=[1;1;1]; 25 dHu=(md.vx(md.elements).*md.thickness(md.elements).*alpha)*summation; 26 dHv=(md.vy(md.elements).*md.thickness(md.elements).*beta)*summation; 35 %compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma 36 invdet=1./(x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2)); 37 alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)]; 38 beta=[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)]; 27 39 28 dHu=averaging(md,dHu,0); 29 dHv=averaging(md,dHv,0); 30 31 dhdt=dHu+dHv+md.accumulation-md.melting; 40 %compute dhdt=div(Hu) 41 Hvx=H.*vx; Hvy=H.*vy; 42 dhdt=sum(Hvx(index).*alpha,2)+sum(Hvy(index).*beta,2);
Note:
See TracChangeset
for help on using the changeset viewer.