Changeset 9860
- Timestamp:
- 09/20/11 16:12:30 (14 years ago)
- Location:
- issm/trunk/src/m
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/balancethickness.m
r9854 r9860 43 43 if solution~=BalancethicknessSolutionEnum, return; end 44 44 45 if ~ismember(md.balancethickness.stabilization,[0 1 3]), 46 checkmessage('model not consistent: balancethickness.stabilization should be a scalar (0 or 1 or 3)'); 47 end 48 45 checkfield(md,'balancethickness.spcthickness','forcing',1); 46 checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1); 47 checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 3]); 49 48 end % }}} 50 49 function disp(obj) % {{{ -
issm/trunk/src/m/classes/basalforcings.m
r9854 r9860 37 37 function checkconsistency(obj,md,solution,analyses) % {{{ 38 38 39 fields={'geothermalflux'};40 %checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]);41 39 if ismember(PrognosticAnalysisEnum,analyses), 42 fields={'melting_rate'}; 43 checkforcing(md,'basalforcings',fields); 40 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1); 44 41 end 45 42 if ismember(BalancethicknessAnalysisEnum,analyses), 46 fields={'melting_rate'}; 47 checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]); 48 checknan(md, 'basalforcings',fields); 43 checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]); 49 44 end 50 45 if ismember(ThermalAnalysisEnum,analyses), 51 fields={'geothermalflux'}; 52 checksize(md,'basalforcings',fields,[md.mesh.numberofvertices 1]); 53 checknan(md, 'basalforcings',fields); 46 checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1); 47 checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0); 54 48 end 55 49 end % }}} -
issm/trunk/src/m/classes/constants.m
r9853 r9860 47 47 function flag = checkconsistency(obj,md,solution,analyses) % {{{ 48 48 49 fields={'g'};50 check nan(md,'constants',fields);51 check greaterstrict(md,'constants',fields,0);49 checkfield(md,'constants.g','>',0,'size',[1 1]); 50 checkfield(md,'constants.yts','>',0,'size',[1 1]); 51 checkfield(md,'constants.referencetemperature','size',[1 1]); 52 52 53 53 end % }}} -
issm/trunk/src/m/classes/diagnostic.m
r9854 r9860 79 79 function checkconsistency(obj,md,solution,analyses) % {{{ 80 80 81 fields={'restol','maxiter'};82 checknan(md,'diagnostic',fields);81 %Early return 82 if ~ismember(DiagnosticHorizAnalysisEnum,analyses), return; end 83 83 84 fields={'abstol','restol','reltol'}; 85 checkgreaterstrict(md,'diagnostic',fields,0); 84 checkfield(md,'diagnostic.spcvx','forcing',1); 85 checkfield(md,'diagnostic.spcvy','forcing',1); 86 if md.mesh.dimension==3, checkfield(md,'diagnostic.spcvz','forcing',1); end 87 checkfield(md,'diagnostic.restol','size',[1 1],'>',0); 88 checkfield(md,'diagnostic.reltol','size',[1 1]); 89 checkfield(md,'diagnostic.abstol','size',[1 1]); 90 checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1); 91 checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1); 92 if md.mesh.dimension==2, 93 checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1); 94 else 95 checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1); 96 end 97 checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]); 98 checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1); 99 checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]); 100 if ~isempty(md.diagnostic.requested_outputs), 101 checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]); 102 end 86 103 87 fields={'icefront'}; 88 if (md.mesh.dimension==2), 89 checksize(md,'diagnostic',fields,[NaN 4]); 90 elseif md.mesh.dimension==3, 91 checksize(md,'diagnostic',fields,[NaN 6]); 104 %singular solution 105 if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2), 106 checkmessage(['model ' md.miscellaneous.name ' is not well posed (singular). You need at least one node with fixed velocity!']) 92 107 end 93 fields={'icefront(:,end)'}; 94 checkvalues(md,'diagnostic',fields,[0 1 2]); 95 96 fields={'referential'}; 97 checksize(md,'diagnostic',fields,[md.mesh.numberofvertices 6]); 98 99 if ~isempty(md.diagnostic.requested_outputs), 100 if(size(md.diagnostic.requested_outputs,2)~=1), 101 checkmessage(['model ' md.miscellaneous.name ' requested outputs should be a column vector']); 108 %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES 109 if any(sum(isnan(md.diagnostic.referential),2)~=0 & sum(isnan(md.diagnostic.referential),2)~=6), 110 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Each line of diagnostic.referential should contain either only NaN values or no NaN values']); 111 end 112 %CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL 113 if any(sum(isnan(md.diagnostic.referential),2)==0), 114 pos=find(sum(isnan(md.diagnostic.referential),2)==0); 115 if any(dot(md.diagnostic.referential(pos,1:3),md.diagnostic.referential(pos,4:6))), 116 dot(md.diagnostic.referential(pos,1:3),md.diagnostic.referential(pos,4:6)) 117 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']); 102 118 end 103 119 end 104 105 if ismember(DiagnosticHorizAnalysisEnum,analyses),106 %singular solution107 if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2),108 checkmessage(['model ' md.miscellaneous.name ' is not well posed (singular). You need at least one node with fixed velocity!'])120 %CHECK THAT ROTATION IS IN THE (X,Y) PLANE FOR 2D MODELS 121 if md.mesh.dimension==2, 122 pos=find(sum(isnan(md.diagnostic.referential),2)==0 & md.flowequation.vertex_equation==2); 123 if any(md.diagnostic.referential(pos,3:5)~=0); 124 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. The rotation should be in the (x,y) plane for 2D diagnostic models (nodeonmacayeal)']); 109 125 end 110 %ROTATED SPC111 %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES112 if any(sum(isnan(md.diagnostic.referential),2)~=0 & sum(isnan(md.diagnostic.referential),2)~=6),113 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Each line of diagnostic.referential should contain either only NaN values or no NaN values']);114 end115 %CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL116 if any(sum(isnan(md.diagnostic.referential),2)==0),117 pos=find(sum(isnan(md.diagnostic.referential),2)==0);118 if any(dot(md.diagnostic.referential(pos,1:3),md.diagnostic.referential(pos,4:6))),119 dot(md.diagnostic.referential(pos,1:3),md.diagnostic.referential(pos,4:6))120 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);121 end122 123 end124 %CHECK THAT ROTATION IS IN THE (X,Y) PLANE FOR 2D MODELS125 if md.mesh.dimension==2,126 pos=find(sum(isnan(md.diagnostic.referential),2)==0 & md.flowequation.vertex_equation==2);127 if any(md.diagnostic.referential(pos,3:5)~=0);128 checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. The rotation should be in the (x,y) plane for 2D diagnostic models (nodeonmacayeal)']);129 end130 end131 132 126 end 133 134 127 end % }}} 135 128 function disp(obj) % {{{ -
issm/trunk/src/m/classes/flaim.m
r9853 r9860 43 43 function checkconsistency(obj,md,solution,analyses) % {{{ 44 44 45 if solution~=FlaimSolutionEnum, 46 return; 47 end 45 %Early return 46 if solution~=FlaimSolutionEnum, return; end 48 47 49 if ~exist(obj.tracks,'file') 50 checkmessage(['flaim.tracks file ''' md.flaim.tracks ''' does not exist.']); 51 end 52 % probably going to need some checks on flaim.flightreqs here 53 if (numel(obj.criterion)~=md.mesh.numberofvertices) & (numel(obj.criterion)~=md.mesh.numberofelements), 54 checkmessage(['flaim.criterion vector must have number of nodes (' ... 55 int2str(md.mesh.numberofvertices) ') or elements (' int2str(md.mesh.numberofelements)... 56 ') values, not ' int2str(numel(md.flaim.criterion)) ' values.']); 57 end 48 checkfield(md,'flaim.tracks','file',1); 49 checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]); 58 50 59 51 end % }}} -
issm/trunk/src/m/classes/flowequation.m
r9854 r9860 44 44 45 45 if ismember(DiagnosticHorizAnalysisEnum,analyses), 46 %Check the size of flowequation.element_equation 47 fields={'element_equation'}; 48 checksize(md,'flowequation',fields,[md.mesh.numberofelements 1]); 49 %Check the values of flowequation.element_equation 50 checkvalues(md,'flowequation',fields,[0:7]); 46 47 checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]); 48 checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]); 49 checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]); 51 50 if (md.mesh.dimension==2), 52 checkvalues(md,'flowequation',fields,[1 2]); 53 end 54 if (md.flowequation.ismacayealpattyn==0 && md.flowequation.ishutter==0 && md.flowequation.isstokes==0), 55 checkmessage(['no elements type set for this model. at least one of ismacayealpattyn, ishutter and isstokes need to be =1']); 56 end 57 58 %VERTICESTYPE 59 %Check the size of verticess_type 60 fields={'vertex_equation'}; 61 checksize(md,'flowequation',fields,[md.mesh.numberofvertices 1]); 62 %Check the values of flowequation.vertex_equation 63 checkvalues(md,'flowequation',fields,[0:7]); 64 if (md.mesh.dimension==2), 65 checkvalues(md,'flowequation',fields,[1 2]); 51 checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]); 52 checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]); 53 else 54 checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]); 55 checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]); 66 56 end 67 57 if (md.flowequation.ismacayealpattyn==0 && md.flowequation.ishutter==0 && md.flowequation.isstokes==0), -
issm/trunk/src/m/classes/friction.m
r9853 r9860 38 38 function checkconsistency(obj,md,solution,analyses) % {{{ 39 39 40 fields={'coefficient','p','q'}; 41 checknan(md,'friction',fields); 42 checkgreater(md,'friction',fields,0); 40 %Early return 41 if ~ismember(DiagnosticHorizAnalysisEnum,analyses) & ~ismember(ThermalAnalysisEnum,analyses), return; end 43 42 44 fields={'p','q'}; 45 checksize(md,'friction',fields,[md.mesh.numberofelements 1]); 46 47 fields={'coefficient'}; 48 checksize(md,'friction',fields,[md.mesh.numberofvertices 1]); 43 checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]); 44 checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]); 45 checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]); 49 46 end % }}} 50 47 function disp(obj) % {{{ -
issm/trunk/src/m/classes/geometry.m
r9854 r9860 39 39 end % }}} 40 40 function checkconsistency(obj,md,solution,analyses) % {{{ 41 fields={'surface','thickness','bed'};42 checknan(md,'geometry',fields);43 checksize(md,'geometry',fields,[md.mesh.numberofvertices 1]);44 41 45 fields={'thickness'};46 check greater(md,'geometry',fields,0);47 42 checkfield(md,'geometry.surface' ,'NaN',1,'size',[md.mesh.numberofvertices 1]); 43 checkfield(md,'geometry.bed' ,'NaN',1,'size',[md.mesh.numberofvertices 1]); 44 checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0); 48 45 if any((obj.thickness-obj.surface+obj.bed)>10^-9), 49 46 checkmessage(['equality thickness=surface-bed violated']); 50 47 end 51 52 if ismember(PrognosticAnalysisEnum,analyses),53 fields={'thickness'};54 checkgreaterstrict(md,'geometry',fields,0);55 end56 48 end % }}} 57 49 function disp(obj) % {{{ -
issm/trunk/src/m/classes/groundingline.m
r9853 r9860 44 44 function checkconsistency(obj,md,solution,analyses) % {{{ 45 45 46 if ~ismember({obj.migration},{'None' 'AgressiveMigration' 'SoftMigration'}), 47 checkmessage(['groundingline.migration field should be ''None'' ''AgressiveMigration'' or ''SoftMigration''']); 48 end 46 checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'}); 47 49 48 if ~strcmp(obj.migration,'None'), 50 49 if (md.mesh.dimension==3 | strcmpi(md.cluster.name,'none')), -
issm/trunk/src/m/classes/mesh.m
r9854 r9860 80 80 function checkconsistency(obj,md,solution,analyses) % {{{ 81 81 82 fields={'x','y','z','elements','elementonbed','elementonsurface','vertexonbed','vertexonsurface','elementconnectivity'}; 83 checknan(md,'mesh',fields); 84 85 fields={'elements','elementonbed','elementonsurface','vertexonbed','vertexonsurface','elementconnectivity'}; 86 checkgreater(md,'mesh',fields,0); 87 88 fields={'dimension','elements','numberofelements','numberofvertices'}; 89 checkgreaterstrict(md,'mesh',fields,0); 90 91 fields={'vertexonbed','vertexonsurface','x','y','z'}; 92 checksize(md,'mesh',fields,[md.mesh.numberofvertices 1]); 93 94 fields={'elementonbed','elementonsurface'}; 95 checksize(md,'mesh',fields,[md.mesh.numberofelements 1]); 96 97 fields={'elements'}; 82 checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]); 83 checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]); 84 checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]); 85 checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices); 98 86 if(md.mesh.dimension==2), 99 check size(md,'mesh',fields,[md.mesh.numberofelements 3]);87 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]); 100 88 else 101 check size(md,'mesh',fields,[md.mesh.numberofelements 6]);89 checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]); 102 90 end 103 91 if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:))))); 104 checkmessage('orphan nodes have been found. Check the mesh ');92 checkmessage('orphan nodes have been found. Check the mesh outline'); 105 93 end 106 107 94 checkfield(md,'mesh.dimension','values',[2 3]); 95 checkfield(md,'mesh.numberoflayers','>=',0); 96 checkfield(md,'mesh.numberofelements','>',0); 97 checkfield(md,'mesh.numberofvertices','>',0); 98 %no checks for numberofedges lat long and hemisphere 99 checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]); 100 checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]); 101 checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]); 102 checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]); 108 103 if (md.mesh.dimension==2), 109 if md.mesh.average_vertex_connectivity<9, 110 checkmessage('model not consistent: connectivity should be at least 9 for 2d models'); 111 end 112 end 113 if md.mesh.dimension==3, 114 if md.mesh.average_vertex_connectivity<24, 115 checkmessage('model not consistent: connectivity should be at least 24 for 3d models'); 116 end 104 checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d'); 105 else 106 checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d'); 117 107 end 118 108 … … 121 111 case PrognosticSolutionEnum, 122 112 if md.prognostic.stabilization==3, 123 if md.mesh.dimension~=2, checkmessage('Discontinuous Galerkin only supported for 2d meshes'); end 124 fields={'edges'}; 125 checksize(md,'mesh',fields,[NaN 4]); 126 fields={'edges(:,1:3)'}; 127 checknan(md,'mesh',fields); 128 checkgreaterstrict(md,'mesh',fields,0); 113 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 114 checkfield(md,'mesh.edges','size',[NaN 4]); 115 checkfield(md,'mesh.edges(:,1:3)','>',0); 129 116 end 130 117 case BalancethicknessSolutionEnum, 131 118 if md.balancethickness.stabilization==3, 132 if md.mesh.dimension~=2, checkmessage('Discontinuous Galerkin only supported for 2d meshes'); end 133 fields={'edges'}; 134 checksize(md,'mesh',fields,[NaN 4]); 135 fields={'edges(:,1:3)'}; 136 checknan(md,'mesh',fields); 137 checkgreaterstrict(md,'mesh',fields,0); 119 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 120 checkfield(md,'mesh.edges','size',[NaN 4]); 121 checkfield(md,'mesh.edges(:,1:3)','>',0); 138 122 end 139 123 case TransientSolutionEnum, 140 124 if md.transient.isprognostic & md.prognostic.stabilization==3, 141 if md.mesh.dimension~=2, checkmessage('Discontinuous Galerkin only supported for 2d meshes'); end 142 fields={'edges'}; 143 checksize(md,'mesh',fields,[NaN 4]); 144 fields={'edges(:,1:3)'}; 145 checknan(md,'mesh',fields); 146 checkgreaterstrict(md,'mesh',fields,0); 125 checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes'); 126 checkfield(md,'mesh.edges','size',[NaN 4]); 127 checkfield(md,'mesh.edges(:,1:3)','>',0); 147 128 end 148 129 case ThermalSolutionEnum, 149 if md.mesh.dimension~=3, checkmessage('thermal solution only supported on 3d meshes'); end130 checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes'); 150 131 end 151 132 end % }}}
Note:
See TracChangeset
for help on using the changeset viewer.