Changeset 24240 for issm/trunk-jpl/src/m/classes/SMBcomponents.m
- Timestamp:
- 10/17/19 06:03:43 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/SMBcomponents.m
r23814 r24240 5 5 6 6 classdef SMBcomponents 7 properties (SetAccess=public) 7 properties (SetAccess=public) 8 8 isclimatology = 0; 9 9 accumulation = NaN; 10 10 runoff = NaN; 11 11 evaporation = NaN; 12 requested_outputs = {}; 12 steps_per_step = 1; 13 requested_outputs = {}; 13 14 end 14 15 methods … … 36 37 if isnan(self.accumulation) 37 38 self.accumulation=zeros(md.mesh.numberofvertices,1); 38 disp(' 39 disp(' no smb.accumulation specified: values set as zero'); 39 40 end 40 41 if isnan(self.evaporation) 41 42 self.evaporation=zeros(md.mesh.numberofvertices,1); 42 disp(' 43 disp(' no smb.evaporation specified: values set as zero'); 43 44 end 44 45 if isnan(self.runoff) 45 46 self.runoff=zeros(md.mesh.numberofvertices,1); 46 disp(' 47 disp(' no smb.runoff specified: values set as zero'); 47 48 end 48 49 … … 52 53 if ismember('MasstransportAnalysis',analyses), 53 54 md = checkfield(md,'fieldname','smb.accumulation','timeseries',1,'NaN',1,'Inf',1); 55 md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1); 56 md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1); 54 57 end 55 58 if ismember('BalancethicknessAnalysis',analyses), 56 59 md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1); 57 end58 if ismember('MasstransportAnalysis',analyses),59 md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1);60 end61 if ismember('BalancethicknessAnalysis',analyses),62 60 md = checkfield(md,'fieldname','smb.runoff','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1); 63 end64 if ismember('MasstransportAnalysis',analyses),65 md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);66 end67 if ismember('BalancethicknessAnalysis',analyses),68 61 md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1); 69 62 end 63 md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]); 70 64 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1); 71 65 md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]); 72 66 if (self.isclimatology) 73 67 md = checkfield(md,'fieldname', 'smb.accumulation', 'size',[md.mesh.numberofvertices+1],... 74 'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);68 'message',['accumulation must have md.mesh.numberofvertices+1 rows in order to force a climatology']); 75 69 md = checkfield(md,'fieldname', 'smb.runoff', 'size',[md.mesh.numberofvertices+1],... 76 'message',['runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology']);70 'message',['runoff must have md.mesh.numberofvertices+1 rows in order to force a climatology']); 77 71 md = checkfield(md,'fieldname', 'smb.evaporation', 'size',[md.mesh.numberofvertices+1],... 78 'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']);72 'message',['evaporation must have md.mesh.numberofvertices+1 rows in order to force a climatology']); 79 73 end 80 74 end % }}} 81 75 function disp(self) % {{{ 82 disp(sprintf(' 76 disp(sprintf(' surface forcings parameters (SMB=accumulation-runoff-evaporation) :')); 83 77 fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]'); 84 78 fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]'); 85 79 fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]'); 86 80 fielddisplay(self,'isclimatology','repeat all forcings when past last forcing time (default false)'); 81 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'); 87 82 fielddisplay(self,'requested_outputs','additional outputs requested'); 88 83 end % }}} … … 95 90 WriteData(fid,prefix,'object',self,'class','smb','fieldname','runoff','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 96 91 WriteData(fid,prefix,'object',self,'class','smb','fieldname','evaporation','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 97 92 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer'); 98 93 %process requested outputs 99 94 outputs = self.requested_outputs; 100 95 pos = find(ismember(outputs,'default')); 101 96 if ~isempty(pos), 102 outputs(pos) = []; 103 outputs 97 outputs(pos) = []; %remove 'default' from outputs 98 outputs = [outputs defaultoutputs(self,md)]; %add defaults 104 99 end 105 100 WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
Note:
See TracChangeset
for help on using the changeset viewer.