source: issm/trunk-jpl/src/m/classes/SMBsemic.m@ 27647

Last change on this file since 27647 was 27647, checked in by inwoo, 2 years ago

CHG: update SMBsemic.m class.

File size: 17.6 KB
RevLine 
[23540]1%SMBsemic Class definition
2%
3% Usage:
4% SMBsemic=SMBsemic();
5
6classdef SMBsemic
[24240]7 properties (SetAccess=public)
[23540]8 dailysnowfall = NaN;
9 dailyrainfall = NaN;
10 dailydsradiation = NaN;
11 dailydlradiation = NaN;
12 dailywindspeed = NaN;
13 dailypressure = NaN;
[27453]14 dailyairdensity = NaN;
[23540]15 dailyairhumidity = NaN;
16 dailytemperature = NaN;
[27498]17 Tamp = NaN;
18 mask = NaN;
19 hice = NaN;
20 hsnow = NaN;
[27647]21 qmr = NaN;
[23540]22 desfac = 0;
[27498]23 desfacElevation = 0;
[27453]24 rlaps = 0;
[23540]25 rdl = 0;
[27453]26 s0gcm = NaN;
27 steps_per_step = 1;
28 averaging = 0;
29 requested_outputs = {};
[27498]30
31 hcrit = 0;
32 rcrit = 0;
33
34 % albedo
[27513]35 albedo = 0; % required for first energy balance calculation of SEMIC
36 albedo_snow = 0; % required for ISBA method
[27511]37 albedo_scheme = 0;
[27498]38 alb_smax = NaN;
39 alb_smin = NaN;
40 albi = NaN;
41 albl = NaN;
42
[27511]43 % albedo parameters depending on albedo_scheme
44 % for slater
45 tmin = NaN;
46 tmax = NaN;
47
48 % for isba & denby method
49 mcrit = NaN;
50
51 % for isba
52 tau_a = NaN;
53 tau_f = NaN;
54 wcrit = NaN;
55
56 % for alex
57 tmid = NaN;
58 afac = NaN;
59
[27498]60 % method
[27511]61 ismethod = 0;
[23540]62 end
63 methods
64 function self = SMBsemic(varargin) % {{{
65 switch nargin
66 case 0
67 self=setdefaultparameters(self);
68 otherwise
69 error('constructor not supported');
70 end
71 end % }}}
72 function self = extrude(self,md) % {{{
73 self.dailysnowfall=project3d(md,'vector',self.dailysnowfall,'type','node');
74 self.dailyrainfall=project3d(md,'vector',self.dailyrainfall,'type','node');
75 self.dailydsradiation=project3d(md,'vector',self.dailydsradiation,'type','node');
76 self.dailydlradiation=project3d(md,'vector',self.dailydlradiation,'type','node');
77 self.dailywindspeed=project3d(md,'vector',self.dailywindspeed,'type','node');
78 self.dailypressure=project3d(md,'vector',self.dailypressure,'type','node');
79 self.dailyairdensity=project3d(md,'vector',self.dailyairdensity,'type','node');
80 self.dailyairhumidity=project3d(md,'vector',self.dailyairhumidity,'type','node');
81 self.dailytemperature=project3d(md,'vector',self.dailytemperature,'type','node');
82 self.s0gcm=project3d(md,'vector',self.s0gcm,'type','node');
83
84 end % }}}
85 function list = defaultoutputs(self,md) % {{{
[27403]86 list = {'SmbMassBalance'};
[23540]87 end % }}}
[27511]88 function list = outputlists(self,md) % {{{
89 if self.ismethod == 1
90 list = {'SmbMassBalance','SmbMassBalanceSnow','SmbMelt','SmbAccumulation',...
91 'SmbHIce','SmbHSnow','SmbAlbedo','SmbAlbedoSnow','TemperatureSEMIC'};
92 else
93 list = {'SmbMassBalance'};
94 end
95 end % }}}
[23540]96 function self = initialize(self,md) % {{{
[27583]97 % Explain
98 % initialize SEMIC smb values, such as s0gcm(surface elevation), albedo,
99 % albedo_snow, hice, hsnow, Tamp... values.
100 %
101 %
102 % Usage
103 % md.smb = initialize(md.smb,md);
[23540]104
105 if isnan(self.s0gcm),
[27583]106 if ~isnan(md.geometry.surface) & (numel(md.geometry.surface) == md.mesh.numberofvertices)
107 self.s0gcm=md.geometry.surface;
108 disp(' no SMBsemic.s0gcm specified: values from md.geometry.surface');
109 else
110 self.s0gcm=zeros(md.mesh.numberofvertices,1);
111 disp(' no SMBsemic.s0gcm specified: values set as zero');
112 end
[23540]113 end
[27583]114 if isnan(self.mask),
115 self.mask = 2*ones(md.mesh.numberofvertices,1);
116 disp(' no SMBsemic.mask specified: values set as 2 for ice');
117 end
118
119 % update each values.
120 if isnan(self.Tamp)
121 self.Tamp= 3*ones(md.mesh.numberofvertices,1);
122 disp(' no SMBsemic.Tamp specified: values set as 3.0');
123 end
124 self.albedo = 0.8*ones(md.mesh.numberofvertices,1);
125 self.albedo_snow= 0.5*ones(md.mesh.numberofvertices,1);
126 self.hice = 10*ones(md.mesh.numberofvertices,1);
[27498]127 self.hsnow = 5*ones(md.mesh.numberofvertices,1);
[27647]128 self.qmr = zeros(md.mesh.numberofvertices,1);
[23540]129 end % }}}
130 function self = setdefaultparameters(self) % {{{
131
[27511]132 % albedo parameters
[27498]133 self.albedo_scheme = 0;
134 self.alb_smax = 0.79;
135 self.alb_smin = 0.6;
136 self.albi = 0.41;
137 self.albl = 0.07;
138
[27511]139 % albedo parameters for?
140 % for slater
141 self.tmin = 263.15;
142 self.tmax = 273.15;
143 % for isba & denby
144 self.mcrit = 6e-8;
145 % for isba
146 self.tau_a = 0.008;
147 self.tau_f = 0.24;
148 self.wcrit = 15.0;
149 % for alex
150 self.tmid = 273.35;
151 self.afac = -0.18;
152
[27498]153 self.hcrit = 0.028;% from Krapp et al. (2017)
154 self.rcrit = 0.85; % from Krapp et al. (2017)
155
156 self.desfac = -log(2.0)/1000;
157 self.desfacElevation = 2000;
158 self.rlaps = 7.4;
159 self.rdl = 0.29;
160
161 self.ismethod = 0;
[27409]162 self.requested_outputs={'default'};
[27513]163 end % }}}
[23540]164 function md = checkconsistency(self,md,solution,analyses) % {{{
165
166 if ismember('MasstransportAnalysis',analyses),
167 md = checkfield(md,'fieldname','smb.desfac','<=',1,'numel',1);
168 md = checkfield(md,'fieldname','smb.s0gcm','>=',0,'NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]);
169 md = checkfield(md,'fieldname','smb.rlaps','>=',0,'numel',1);
170 md = checkfield(md,'fieldname','smb.rdl','>=',0,'numel',1);
171 md = checkfield(md,'fieldname','smb.dailysnowfall','timeseries',1,'NaN',1,'Inf',1);
172 md = checkfield(md,'fieldname','smb.dailyrainfall','timeseries',1,'NaN',1,'Inf',1);
173 md = checkfield(md,'fieldname','smb.dailydsradiation','timeseries',1,'NaN',1,'Inf',1);
174 md = checkfield(md,'fieldname','smb.dailydlradiation','timeseries',1,'NaN',1,'Inf',1);
175 md = checkfield(md,'fieldname','smb.dailywindspeed','timeseries',1,'NaN',1,'Inf',1);
176 md = checkfield(md,'fieldname','smb.dailypressure','timeseries',1,'NaN',1,'Inf',1);
177 md = checkfield(md,'fieldname','smb.dailyairdensity','timeseries',1,'NaN',1,'Inf',1);
178 md = checkfield(md,'fieldname','smb.dailyairhumidity','timeseries',1,'NaN',1,'Inf',1);
179 md = checkfield(md,'fieldname','smb.dailytemperature','timeseries',1,'NaN',1,'Inf',1);
[27498]180
181 % TODO: transient model should be merged with SEMIC developed by Ruckamp et al. (2018)
182
183 md = checkfield(md,'fieldname','smb.ismethod','numel',1,'values',[0,1]);
[27513]184 if self.ismethod == 1 % transient mode
[27498]185 md = checkfield(md,'fieldname','smb.desfacElevation','>=',0,'numel',1);
186
187 md = checkfield(md,'fieldname','smb.albedo_scheme','NaN',1,'Inf',1,'numel',1,'values',[0,1,2,3,4]);
188 md = checkfield(md,'fieldname','smb.alb_smax','>=',0,'NaN',1,'Inf',1,'numel',1);
189 md = checkfield(md,'fieldname','smb.mask','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1],'values',[0,1,2]);
190
191 % initial values
192 md = checkfield(md,'fieldname','smb.albedo','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
193 md = checkfield(md,'fieldname','smb.albedo_snow','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
194 md = checkfield(md,'fieldname','smb.alb_smax','>=',0,'<=',1,'NaN',1,'Inf',1,'numel',1);
[27647]195 md = checkfield(md,'fieldname','smb.alb_smin','<=',1,'NaN',1,'Inf',1,'numel',1);
[27498]196 md = checkfield(md,'fieldname','smb.albi','>=',0,'<=',1,'NaN',1,'Inf',1,'numel',1);
197 md = checkfield(md,'fieldname','smb.albl','>=',0,'<=',1,'NaN',1,'Inf',1,'numel',1);
198 md = checkfield(md,'fieldname','smb.hice','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
199 md = checkfield(md,'fieldname','smb.hsnow','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
[27647]200 md = checkfield(md,'fieldname','smb.qmr','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices, 1]);
[27498]201 end
[23540]202 end
[24240]203 md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);
[24800]204 md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);
[23540]205 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
206
207 end % }}}
208 function disp(self) % {{{
209 disp(sprintf(' surface forcings parameters:'));
[24240]210
[23540]211 disp(sprintf(' Interface for coupling GCM data to the energy balance model SEMIC (Krapp et al (2017) https://doi.org/10.5194/tc-11-1519-2017).'));
[24240]212 disp(sprintf(' The implemented coupling uses daily mean GCM input to calculate yearly mean smb, accumulation, ablation, and surface temperature.'));
[23540]213 disp(sprintf(' smb and temperatures are updated every year'));
214 disp(sprintf('\n SEMIC parameters:'));
[24240]215 fielddisplay(self,'dailysnowfall','daily surface dailysnowfall [m/s]');
[23540]216 fielddisplay(self,'dailyrainfall','daily surface dailyrainfall [m/s]');
217 fielddisplay(self,'dailydsradiation','daily downwelling shortwave radiation [W/m2]');
218 fielddisplay(self,'dailydlradiation','daily downwelling longwave radiation [W/m2]');
[24240]219 fielddisplay(self,'dailywindspeed','daily surface wind speed [m/s]');
[23540]220 fielddisplay(self,'dailypressure','daily surface pressure [Pa]');
[24240]221 fielddisplay(self,'dailyairdensity','daily air density [kg/m3]');
[23540]222 fielddisplay(self,'dailyairhumidity','daily air specific humidity [kg/kg]');
223 fielddisplay(self,'dailytemperature','daily surface air temperature [K]');
[27454]224 fielddisplay(self,'rlaps','present day lapse rate (default is 7.4 [degree/km]; Erokhina et al. 2017)');
[23540]225 fielddisplay(self,'desfac','desertification elevation factor (default is -log(2.0)/1000 [1/km]; Vizcaino et al. 2010)');
226 fielddisplay(self,'rdl','longwave downward radiation decrease (default is 0.29 [W/m^2/km]; Marty et al. 2002)');
227 fielddisplay(self,'s0gcm','GCM reference elevation; (default is 0) [m]');
[27498]228
229 fielddisplay(self,'ismethod','method for calculating SMB with SEMIC. Default version of SEMIC is really slow. 0: steady, 1: transient (default: 0)');
[27513]230 if self.ismethod == 1 % transient mode
[27498]231 fielddisplay(self,'desfacElevation','desertification elevation (default is 2000 m; Vizcaino et al. 2010)');
232 fielddisplay(self,'Tamp','amplitude of diurnal cycle [K]');
233 fielddisplay(self,'albedo','initial albedo [no unit]');
234 fielddisplay(self,'albedo_snow','initial albedo for snow [no unit]');
235 fielddisplay(self,'hice','initial thickness of ice [unit: m]');
236 fielddisplay(self,'hsnow','initial thickness of snow [unit: m]');
237 fielddisplay(self,'mask','masking for albedo. 0: ocean, 1: land, 2: ice (default: 2)');
238 fielddisplay(self,'hcrit','critical snow height for albedo [unit: m]');
239 fielddisplay(self,'rcrit','critical refreezing height for albedo [no unit]');
240
241 disp(sprintf('\nSEMIC albedo parameters.'));
242 fielddisplay(self,'albedo_scheme','albedo scheme for SEMIC. 0: none, 1: slater, 2: isba, 3: denby, 4: alex (default is 0)');
[27504]243 fielddisplay(self,'alb_smax','maximum snow albedo (default: 0.79)');
244 fielddisplay(self,'alb_smin','minimum snow albedo (default: 0.6)');
[27513]245 fielddisplay(self,'albi','background albedo for bare ice (default: 0.41)');
246 fielddisplay(self,'albl','background albedo for bare land (default: 0.07)');
[27498]247 end
[27513]248 % albedo_scheme - 0: none, 1: slater, 2: isba, 3: denby, 4: alex.
[27511]249 if self.albedo_scheme == 1
250 disp(sprintf('\n\tSEMIC snow albedo parameters for Slater et al, (1998).'));
251 disp(sprintf('\t alb = alb_smax - (alb_smax - alb_smin)*tm^(3.0)'))
252 disp(sprintf('\t tm = 1 (tsurf > 273.15 K)'));
253 disp(sprintf('\t tm = f*(tsurf-tmin) (tmin <= tsurf < 273.15)'));
254 disp(sprintf('\t 0 (tsurf < tmin)'));
255 disp(sprintf('\t f = 1/(273.15-tmin)'));
256 fielddisplay(self,'tmin','minimum temperature for which albedo decline become effective. (default: 263.15 K)[unit: K])');
257 fielddisplay(self,'tmax','maxmium temperature for which albedo decline become effective. This value should be fixed. (default: 273.15 K)[unit: K])');
258 elseif self.albedo_scheme == 2,
259 disp(sprintf('\n\tSEMIC snow albedo parameters for ISBA.? where is citation?'));
[27513]260 fielddisplay(self,'mcrit','critical melt rate (default: 6e-8) [unit: m/sec]');
261 fielddisplay(self,'wcrit','critical liquid water content (default: 15) [unit: kg/m2]');
[27511]262 fielddisplay(self,'tau_a','dry albedo decline [unit: 1/day]');
263 fielddisplay(self,'tau_f','wet albedo decline [unit: 1/day]');
264 elseif self.albedo_scheme == 3,
265 disp(sprintf('\n\tSEMIC snow albedo parameters for Denby et al. (2002 Tellus)'));
[27513]266 fielddisplay(self,'mcrit','critical melt rate (default: 6e-8) [unit: m/sec]');
[27511]267 elseif self.albedo_scheme == 4,
268 disp(sprintf('\n\tSEMIC snow albedo parameters for Alex.?'));
269 fielddisplay(self,'afac','[unit: ?]');
270 fielddisplay(self,'tmid','[unit: ?]');
271 else
272 error(sprintf('ERROR: %d is not supported albedom scheme.',self.albedo_scheme))
273 end
[27498]274
[24240]275 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');
[24793]276 fielddisplay(self, 'averaging', 'averaging methods from short to long steps');
[24806]277 disp(sprintf('%51s 0: Arithmetic (default)',' '));
278 disp(sprintf('%51s 1: Geometric',' '));
279 disp(sprintf('%51s 2: Harmonic',' '));
[23540]280 fielddisplay(self,'requested_outputs','additional outputs requested');
281 end % }}}
282 function marshall(self,prefix,md,fid) % {{{
[24240]283
[27453]284 yts=md.constants.yts;
285
[23540]286 WriteData(fid,prefix,'name','md.smb.model','data',12,'format','Integer');
287
[27498]288 WriteData(fid,prefix,'object',self,'class','smb','fieldname','ismethod','format','Integer','values',[0, 1]);
[23540]289 WriteData(fid,prefix,'object',self,'class','smb','fieldname','desfac','format','Double');
[27498]290 WriteData(fid,prefix,'object',self,'class','smb','fieldname','desfacElevation','format','Double');
[23540]291 WriteData(fid,prefix,'object',self,'class','smb','fieldname','s0gcm','format','DoubleMat','mattype',1);
292 WriteData(fid,prefix,'object',self,'class','smb','fieldname','rlaps','format','Double');
293 WriteData(fid,prefix,'object',self,'class','smb','fieldname','rdl','format','Double');
[27453]294 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailysnowfall','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
295 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailyrainfall','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
296 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailydsradiation','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
297 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailydlradiation','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
298 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailywindspeed','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
299 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailypressure','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
300 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailyairdensity','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
301 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailyairhumidity','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
302 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dailytemperature','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts);
[27498]303 % TODO: transient mode should be merged with SEMIC developed by Ruckamp et al. (2018).
[27513]304 if self.ismethod == 1% transient mode
[27498]305 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tamp','format','DoubleMat','mattype',1);
306 WriteData(fid,prefix,'object',self,'class','smb','fieldname','mask','format','DoubleMat','mattype',1);
307 WriteData(fid,prefix,'object',self,'class','smb','fieldname','hice','format','DoubleMat','mattype',1);
308 WriteData(fid,prefix,'object',self,'class','smb','fieldname','hsnow','format','DoubleMat','mattype',1);
[27647]309 WriteData(fid,prefix,'object',self,'class','smb','fieldname','qmr','format','DoubleMat','mattype',1);
[27498]310
311 WriteData(fid,prefix,'object',self,'class','smb','fieldname','hcrit','format','Double');
312 WriteData(fid,prefix,'object',self,'class','smb','fieldname','rcrit','format','Double');
313
[27513]314 %albedo
[27498]315 WriteData(fid,prefix,'object',self,'class','smb','fieldname','albedo','format','DoubleMat','mattype',1);
316 WriteData(fid,prefix,'object',self,'class','smb','fieldname','albedo_snow','format','DoubleMat','mattype',1);
317 WriteData(fid,prefix,'object',self,'class','smb','fieldname','albedo_scheme','format','Integer');
318 WriteData(fid,prefix,'object',self,'class','smb','fieldname','albi','format','Double');
319 WriteData(fid,prefix,'object',self,'class','smb','fieldname','albl','format','Double');
320 WriteData(fid,prefix,'object',self,'class','smb','fieldname','alb_smin','format','Double');
321 WriteData(fid,prefix,'object',self,'class','smb','fieldname','alb_smax','format','Double');
[27511]322
[27513]323 %albedo parameters for ?
[27511]324 %for slater
325 WriteData(fid,prefix,'object',self,'class','smb','fieldname','tmin','format','Double');
326 WriteData(fid,prefix,'object',self,'class','smb','fieldname','tmax','format','Double');
327 %for isba & denby
328 WriteData(fid,prefix,'object',self,'class','smb','fieldname','mcrit','format','Double');
329 %for isba
330 WriteData(fid,prefix,'object',self,'class','smb','fieldname','wcrit','format','Double');
331 WriteData(fid,prefix,'object',self,'class','smb','fieldname','tau_a','format','Double');
332 WriteData(fid,prefix,'object',self,'class','smb','fieldname','tau_f','format','Double');
333 %for alex
334 WriteData(fid,prefix,'object',self,'class','smb','fieldname','tmid','format','Double');
335 WriteData(fid,prefix,'object',self,'class','smb','fieldname','afac','format','Double');
[27498]336 end
337
[27453]338 WriteData(fid,prefix,'object',self,'fieldname','steps_per_step','format','Integer');
339 WriteData(fid,prefix,'object',self,'fieldname','averaging','format','Integer');
[27498]340
[23540]341 %process requested outputs
342 outputs = self.requested_outputs;
343 pos = find(ismember(outputs,'default'));
344 if ~isempty(pos),
345 outputs(pos) = []; %remove 'default' from outputs
346 outputs = [outputs defaultoutputs(self,md)]; %add defaults
347 end
348 WriteData(fid,prefix,'data',outputs,'name','md.smb.requested_outputs','format','StringArray');
349
350 end % }}}
351 end
352end
Note: See TracBrowser for help on using the repository browser.