Ignore:
Timestamp:
10/17/19 06:03:43 (5 years ago)
Author:
bdef
Message:

Adding a substeping framework in hydro and part of smb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/SMBcomponents.m

    r23814 r24240  
    55
    66classdef SMBcomponents
    7         properties (SetAccess=public) 
     7        properties (SetAccess=public)
    88                isclimatology = 0;
    99                accumulation = NaN;
    1010                runoff = NaN;
    1111                evaporation = NaN;
    12                 requested_outputs      = {};
     12                steps_per_step = 1;
     13                requested_outputs     = {};
    1314        end
    1415        methods
     
    3637                        if isnan(self.accumulation)
    3738                                self.accumulation=zeros(md.mesh.numberofvertices,1);
    38                                 disp('      no smb.accumulation specified: values set as zero');
     39                                disp('  no smb.accumulation specified: values set as zero');
    3940                        end
    4041                        if isnan(self.evaporation)
    4142                                self.evaporation=zeros(md.mesh.numberofvertices,1);
    42                                 disp('      no smb.evaporation specified: values set as zero');
     43                                disp('  no smb.evaporation specified: values set as zero');
    4344                        end
    4445                        if isnan(self.runoff)
    4546                                self.runoff=zeros(md.mesh.numberofvertices,1);
    46                                 disp('      no smb.runoff specified: values set as zero');
     47                                disp('  no smb.runoff specified: values set as zero');
    4748                        end
    4849
     
    5253                        if ismember('MasstransportAnalysis',analyses),
    5354                                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);
    5457                        end
    5558                        if ismember('BalancethicknessAnalysis',analyses),
    5659                                md = checkfield(md,'fieldname','smb.accumulation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    57                         end
    58                         if ismember('MasstransportAnalysis',analyses),
    59                                 md = checkfield(md,'fieldname','smb.runoff','timeseries',1,'NaN',1,'Inf',1);
    60                         end
    61                         if ismember('BalancethicknessAnalysis',analyses),
    6260                                md = checkfield(md,'fieldname','smb.runoff','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    63                         end
    64                         if ismember('MasstransportAnalysis',analyses),
    65                                 md = checkfield(md,'fieldname','smb.evaporation','timeseries',1,'NaN',1,'Inf',1);
    66                         end
    67                         if ismember('BalancethicknessAnalysis',analyses),
    6861                                md = checkfield(md,'fieldname','smb.evaporation','size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1);
    6962                        end
     63                        md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
    7064                        md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
    7165                        md = checkfield(md,'fieldname','smb.isclimatology','values',[0 1]);
    7266                        if (self.isclimatology)
    7367                                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']);
    7569                                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']);
    7771                                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']);
    7973                        end
    8074                end % }}}
    8175                function disp(self) % {{{
    82                         disp(sprintf('   surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
     76                        disp(sprintf('    surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));
    8377                        fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');
    8478                        fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]');
    8579                        fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');
    8680                        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');
    8782                        fielddisplay(self,'requested_outputs','additional outputs requested');
    8883                end % }}}
     
    9590                        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);
    9691                        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');
    9893                        %process requested outputs
    9994                        outputs = self.requested_outputs;
    10095                        pos  = find(ismember(outputs,'default'));
    10196                        if ~isempty(pos),
    102                                 outputs(pos) = [];                         %remove 'default' from outputs
    103                                 outputs      = [outputs defaultoutputs(self,md)]; %add defaults
     97                                outputs(pos) = [];                             %remove 'default' from outputs
     98                                outputs  = [outputs defaultoutputs(self,md)]; %add defaults
    10499                        end
    105100                        WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
Note: See TracChangeset for help on using the changeset viewer.