source:
issm/oecreview/Archive/21724-22754/ISSM-22449-22450.diff@
22755
Last change on this file since 22755 was 22755, checked in by , 7 years ago | |
---|---|
File size: 34.0 KB |
-
TabularUnified ../trunk-jpl/src/m/classes/SMBgemb.m
35 35 C = NaN; %mean annual snow accumulation [kg m-2 yr-1] 36 36 Tz = NaN; %height above ground at which temperature (T) was sampled [m] 37 37 Vz = NaN; %height above ground at which wind (V) eas sampled [m] 38 39 %optional inputs: 40 aValue = NaN; %Albedo forcing at every element. Used only if aIdx == 0. 41 teValue = NaN; %Outward longwave radiation thermal emissivity forcing at every element (default in code is 1) 38 42 39 43 % Initialization of snow properties 40 44 Dzini = NaN; %cell depth (m) … … 50 54 51 55 %settings: 52 56 aIdx = NaN; %method for calculating albedo and subsurface absorption (default is 1) 53 % 1: effective grain radius [Gardner & Sharp, 2009] 57 % 0: direct input from aValue parameter 58 % 1: effective grain radius [Gardner & Sharp, 2009] 54 59 % 2: effective grain radius [Brun et al., 2009] 55 60 % 3: density and cloud amount [Greuell & Konzelmann, 1994] 56 61 % 4: exponential time decay & wetness [Bougamont & Bamber, 2005] … … 114 119 self.eAir=project3d(md,'vector',self.eAir,'type','node'); 115 120 self.pAir=project3d(md,'vector',self.pAir,'type','node'); 116 121 122 if aIdx == 0 & ~isnan(self.aValue) 123 self.aValue=project3d(md,'vector',self.aValue,'type','node'); 124 end 125 if ~isnan(self.teValue) 126 self.teValue=project3d(md,'vector',self.teValue,'type','node'); 127 end 128 129 117 130 end % }}} 118 131 function list = defaultoutputs(self,md) % {{{ 119 132 list = {'SmbMassBalance'}; … … 149 162 self.t0wet = 15; 150 163 self.t0dry = 30; 151 164 self.K = 7; 165 166 self.teValue = ones(mesh.numberofelements,1); 167 self.aValue = self.aSnow*ones(mesh.numberofelements,1); 152 168 153 169 self.Dzini=0.05*ones(mesh.numberofelements,2); 154 170 self.Dini=910.0*ones(mesh.numberofelements,2); … … 166 182 end % }}} 167 183 function md = checkconsistency(self,md,solution,analyses) % {{{ 168 184 169 170 185 md = checkfield(md,'fieldname','smb.isgraingrowth','values',[0 1]); 171 186 md = checkfield(md,'fieldname','smb.isalbedo','values',[0 1]); 172 187 md = checkfield(md,'fieldname','smb.isshortwave','values',[0 1]); … … 188 203 md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 189 204 md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 190 205 191 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[1,2,3,4]); 206 md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 207 208 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]); 192 209 md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]); 193 210 md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5]); 194 211 … … 200 217 md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1); 201 218 202 219 switch self.aIdx, 220 case 0 221 md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 203 222 case {1 2} 204 223 md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89); 205 224 md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58); … … 251 270 fielddisplay(self,'InitDensityScaling',{'initial scaling factor multiplying the density of ice','which describes the density of the snowpack.'}); 252 271 fielddisplay(self,'outputFreq','output frequency in days (default is monthly, 30)'); 253 272 fielddisplay(self,'aIdx',{'method for calculating albedo and subsurface absorption (default is 1)',... 273 '0: direct input from aValue parameter',... 254 274 '1: effective grain radius [Gardner & Sharp, 2009]',... 255 275 '2: effective grain radius [Brun et al., 2009]',... 256 276 '3: density and cloud amount [Greuell & Konzelmann, 1994]',... 257 277 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'}); 278 279 fielddisplay(self,'teValue','Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)'); 258 280 259 281 %snow properties init 260 fielddisplay(self,'Dzini','Initial cel depth when restart [m]');282 fielddisplay(self,'Dzini','Initial cell depth when restart [m]'); 261 283 fielddisplay(self,'Dini','Initial snow density when restart [kg m-3]'); 262 284 fielddisplay(self,'Reini','Initial grain size when restart [mm]'); 263 285 fielddisplay(self,'Gdnini','Initial grain dendricity when restart [-]'); … … 271 293 272 294 %additional albedo parameters: 273 295 switch self.aIdx 296 case 0 297 fielddisplay(self,'aValue','Albedo forcing at every element. Used only if aIdx == 0.'); 274 298 case {1 2} 275 299 fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)'); 276 300 fielddisplay(self,'aIce','albedo of ice (0.27-0.58)'); … … 338 362 WriteData(fid,prefix,'object',self,'class','smb','fieldname','t0wet','format','Double'); 339 363 WriteData(fid,prefix,'object',self,'class','smb','fieldname','t0dry','format','Double'); 340 364 WriteData(fid,prefix,'object',self,'class','smb','fieldname','K','format','Double'); 365 366 WriteData(fid,prefix,'object',self,'class','smb','fieldname','aValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 367 WriteData(fid,prefix,'object',self,'class','smb','fieldname','teValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 341 368 342 369 %snow properties init 343 370 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Dzini','format','DoubleMat','mattype',3); -
TabularUnified ../trunk-jpl/src/m/classes/SMBgemb.py
41 41 C = float('NaN') #mean annual snow accumulation [kg m-2 yr-1] 42 42 Tz = float('NaN') #height above ground at which temperature (T) was sampled [m] 43 43 Vz = float('NaN') #height above ground at which wind (V) eas sampled [m] 44 45 #optional inputs: 46 aValue = float('NaN') #Albedo forcing at every element. Used only if aIdx == 0. 47 teValue = float('NaN') #Outward longwave radiation thermal emissivity forcing at every element (default in code is 1) 44 48 45 49 # Initialization of snow properties 46 50 Dzini = float('NaN') #cell depth (m) … … 56 60 57 61 #settings: 58 62 aIdx = float('NaN') #method for calculating albedo and subsurface absorption (default is 1) 59 # 1: effective grain radius [Gardner & Sharp, 2009] 63 # 0: direct input from aValue parameter 64 # 1: effective grain radius [Gardner & Sharp, 2009] 60 65 # 2: effective grain radius [Brun et al., 2009] 61 66 # 3: density and cloud amount [Greuell & Konzelmann, 1994] 62 67 # 4: exponential time decay & wetness [Bougamont & Bamber, 2005] … … 134 139 string = "%s\n%s"%(string,fielddisplay(self,'InitDensityScaling',['initial scaling factor multiplying the density of ice','which describes the density of the snowpack.'])) 135 140 string = "%s\n%s"%(string,fielddisplay(self,'outputFreq','output frequency in days (default is monthly, 30)')) 136 141 string = "%s\n%s"%(string,fielddisplay(self,'aIdx',['method for calculating albedo and subsurface absorption (default is 1)', 142 '0: direct input from aValue parameter', 137 143 '1: effective grain radius [Gardner & Sharp, 2009]', 138 144 '2: effective grain radius [Brun et al., 2009]', 139 145 '3: density and cloud amount [Greuell & Konzelmann, 1994]', 140 146 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'])) 147 148 string = "%s\n%s"%(string,fielddisplay(self,'teValue','Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)')) 141 149 142 150 #snow properties init 143 string = "%s\n%s"%(string,fielddisplay(self,'Dzini','Initial cel depth when restart [m]'))151 string = "%s\n%s"%(string,fielddisplay(self,'Dzini','Initial cell depth when restart [m]')) 144 152 string = "%s\n%s"%(string,fielddisplay(self,'Dini','Initial snow density when restart [kg m-3]')) 145 153 string = "%s\n%s"%(string,fielddisplay(self,'Reini','Initial grain size when restart [mm]')) 146 154 string = "%s\n%s"%(string,fielddisplay(self,'Gdnini','Initial grain dricity when restart [-]')) … … 155 163 if type(self.aIdx) == list or type(self.aIdx) == type(np.array([1,2])) and (self.aIdx == [1,2] or (1 in self.aIdx and 2 in self.aIdx)): 156 164 string = "%s\n%s"%(string,fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)')) 157 165 string = "%s\n%s"%(string,fielddisplay(self,'aIce','albedo of ice (0.27-0.58)')) 166 elif self.aIdx == 0: 167 string = "%s\n%s"%(string,fielddisplay(self,'aValue','Albedo forcing at every element. Used only if aIdx == 0.')) 158 168 elif self.aIdx == 3: 159 169 string = "%s\n%s"%(string,fielddisplay(self,'cldFrac','average cloud amount')) 160 170 elif self.aIdx == 4: … … 182 192 self.P = project3d(md,'vector',self.P,'type','node') 183 193 self.eAir = project3d(md,'vector',self.eAir,'type','node') 184 194 self.pAir = project3d(md,'vector',self.pAir,'type','node') 195 196 if aIdx == 0 and np.isnan(self.aValue): 197 self.aValue=project3d(md,'vector',self.aValue,'type','node'); 198 if np.isnan(self.teValue): 199 self.teValue=project3d(md,'vector',self.teValue,'type','node'); 200 185 201 return self 186 202 #}}} 187 203 def defaultoutputs(self,md): # {{{ … … 210 226 self.zMin = 130*np.ones((mesh.numberofelements,)) 211 227 self.zY = 1.10*np.ones((mesh.numberofelements,)) 212 228 self.outputFreq = 30 213 229 214 230 #additional albedo parameters 215 231 self.aSnow = 0.85 216 232 self.aIce = 0.48 … … 218 234 self.t0wet = 15 219 235 self.t0dry = 30 220 236 self.K = 7 237 238 self.teValue = np.ones((mesh.numberofelements,)); 239 self.aValue = self.aSnow*np.ones(mesh.numberofelements,); 221 240 222 241 self.Dzini = 0.05*np.ones((mesh.numberofelements,2)) 223 242 self.Dini = 910.0*np.ones((mesh.numberofelements,2)) … … 256 275 md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements],'NaN',1,'Inf',1,'> = ',0,'< = ',5000) 257 276 md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements],'NaN',1,'Inf',1,'> = ',0,'< = ',5000) 258 277 259 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[1,2,3,4]) 278 md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 279 280 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]) 260 281 md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]) 261 282 md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5]) 262 283 … … 270 291 if type(self.aIdx) == list or type(self.aIdx) == type(np.array([1,2])) and (self.aIdx == [1,2] or (1 in self.aIdx and 2 in self.aIdx)): 271 292 md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'> = ',.64,'< = ',.89) 272 293 md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'> = ',.27,'< = ',.58) 294 elif self.aIdx == 0: 295 md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 273 296 elif self.aIdx == 3: 274 297 md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'> = ',0,'< = ',1) 275 298 elif self.aIdx == 4: … … 332 355 WriteData(fid,prefix,'object',self,'class','smb','fieldname','t0wet','format','Double') 333 356 WriteData(fid,prefix,'object',self,'class','smb','fieldname','t0dry','format','Double') 334 357 WriteData(fid,prefix,'object',self,'class','smb','fieldname','K','format','Double') 358 359 WriteData(fid,prefix,'object',self,'class','smb','fieldname','aValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 360 WriteData(fid,prefix,'object',self,'class','smb','fieldname','teValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 335 361 336 362 #snow properties init 337 363 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Dzini','format','DoubleMat','mattype',3) -
TabularUnified ../trunk-jpl/src/c/analyses/SmbAnalysis.cpp
68 68 iomodel->FetchDataToInput(elements,"md.smb.Aini",SmbAiniEnum); 69 69 iomodel->FetchDataToInput(elements,"md.smb.Tini",SmbTiniEnum); 70 70 iomodel->FetchDataToInput(elements,"md.smb.Sizeini",SmbSizeiniEnum); 71 iomodel->FetchDataToInput(elements,"md.smb.aValue",SmbAValueEnum); 72 iomodel->FetchDataToInput(elements,"md.smb.teValue",SmbTeValueEnum); 71 73 break; 72 74 case SMBpddEnum: 73 75 iomodel->FindConstant(&isdelta18o,"md.smb.isdelta18o"); -
TabularUnified ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
24 24 void GembgridInitialize(IssmDouble** pdz, int* psize, IssmDouble zTop, IssmDouble dzTop, IssmDouble zMax, IssmDouble zY); 25 25 IssmDouble Marbouty(IssmDouble T, IssmDouble d, IssmDouble dT); 26 26 void grainGrowth(IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* T,IssmDouble* dz,IssmDouble* d, IssmDouble* W,IssmDouble smb_dt,int m,int aIdx, int sid); 27 void albedo(IssmDouble** a,int aIdx, IssmDouble* re, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble * T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid);27 void albedo(IssmDouble** a,int aIdx, IssmDouble* re, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid); 28 28 void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid); 29 void thermo(IssmDouble* pEC, IssmDouble** T, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid);30 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble dIce, int sid);29 void thermo(IssmDouble* pEC, IssmDouble** T, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble teValue, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid); 30 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx,IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble dIce, int sid); 31 31 void melt(IssmDouble* pM, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble dIce, int sid); 32 32 void densification(IssmDouble** pd,IssmDouble** pdz, IssmDouble* T, IssmDouble* re, int denIdx, IssmDouble C, IssmDouble dt, IssmDouble Tmean, IssmDouble dIce, int m, int sid); 33 33 void turbulentFlux(IssmDouble* pshf, IssmDouble* plhf, IssmDouble* pEC, IssmDouble Ta, IssmDouble Ts, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble ds, IssmDouble Ws, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid); -
TabularUnified ../trunk-jpl/src/c/modules/SurfaceMassBalancex/Gembx.cpp
336 336 *pgsp=gsp; 337 337 338 338 } /*}}}*/ 339 void albedo(IssmDouble** pa, int aIdx, IssmDouble* re, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble * TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/339 void albedo(IssmDouble** pa, int aIdx, IssmDouble* re, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble* TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/ 340 340 341 341 //// Calculates Snow, firn and ice albedo as a function of: 342 // 0 : direct input from aValue parameter 342 343 // 1 : effective grain radius (Gardner & Sharp, 2009) 343 344 // 2 : effective grain radius (Brun et al., 2009) 344 345 // 3 : density and cloud amount (Greuell & Konzelmann, 1994) … … 347 348 //// Inputs 348 349 // aIdx = albedo method to use 349 350 351 // Method 0 352 // aValue = direct input value for albedo 353 350 354 // Methods 1 & 2 351 355 // re = surface effective grain radius [mm] 352 356 … … 391 395 //some constants: 392 396 const IssmDouble dSnow = 300; // density of fresh snow [kg m-3] 393 397 394 if(aIdx==1){ 398 if (aIdx==0){ 399 for(int i=0;i<m;i++)a[i] = aValue; 400 } 401 else if(aIdx==1){ 395 402 //function of effective grain radius 396 403 397 404 //convert effective radius to specific surface area [cm2 g-1] … … 399 406 400 407 //determine broadband albedo 401 408 a[0]= 1.48 - pow(S,-0.07); 409 for(int i=1;i<m;i++)a[i]=a[0]; 402 410 } 403 411 else if(aIdx==2){ 404 412 … … 420 428 421 429 // broadband surface albedo 422 430 a[0] = sF[0]*a0 + sF[1]*a1 + sF[2]*a2; 423 431 for(int i=1;i<m;i++)a[i]=a[0]; 424 432 } 425 433 else if(aIdx==3){ 426 434 … … 428 436 429 437 // calculate albedo 430 438 a[0] = aIce + (d[0] - dIce)*(aSnow - aIce) / (dSnow - dIce) + (0.05 * (cldFrac - 0.5)); 439 for(int i=1;i<m;i++)a[i]=a[0]; 431 440 } 432 441 else if(aIdx==4){ 433 442 … … 485 494 xDelete<IssmDouble>(d_a); 486 495 487 496 } 488 else _error_("albedo method switch should range from 1to 4!");497 else _error_("albedo method switch should range from 0 to 4!"); 489 498 490 499 // Check for erroneous values 491 500 if (a[0] > 1) _printf_("albedo > 1.0\n"); … … 496 505 *pa=a; 497 506 498 507 } /*}}}*/ 499 void thermo(IssmDouble* pEC, IssmDouble** pT, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlwrf, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid) { /*{{{*/508 void thermo(IssmDouble* pEC, IssmDouble** pT, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlwrf, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, IssmDouble teValue, IssmDouble Ws, IssmDouble dt0, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble dIce, int sid) { /*{{{*/ 500 509 501 510 /* ENGLACIAL THERMODYNAMICS*/ 502 511 … … 807 816 dT_turb = turb / TCs; 808 817 809 818 // upward longwave contribution 810 ulw = - SB * pow(Ts,4.0) * dt;819 ulw = - SB * pow(Ts,4.0)* teValue * dt; 811 820 dT_ulw = ulw / TCs; 812 821 813 822 // new grid point temperature … … 1068 1077 *pswf=swf; 1069 1078 1070 1079 } /*}}}*/ 1071 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble dIce, int sid){ /*{{{*/1080 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble dIce, int sid){ /*{{{*/ 1072 1081 1073 1082 // Adds precipitation and deposition to the model grid 1074 1083 … … 1161 1170 T[0] = (T_air * P + T[0] * mInit[0])/mass; 1162 1171 1163 1172 // adjust a, re, gdn & gsp 1164 a[0] = (aSnow * P + a[0] * mInit[0])/mass;1173 if(aIdx>0)a[0] = (aSnow * P + a[0] * mInit[0])/mass; 1165 1174 re[0] = (reNew * P + re[0] * mInit[0])/mass; 1166 1175 gdn[0] = (gdnNew * P + gdn[0] * mInit[0])/mass; 1167 1176 gsp[0] = (gspNew * P + gsp[0] * mInit[0])/mass; … … 1786 1795 } /*}}}*/ 1787 1796 void densification(IssmDouble** pd,IssmDouble** pdz, IssmDouble* T, IssmDouble* re, int denIdx, IssmDouble C, IssmDouble dt, IssmDouble Tmean, IssmDouble dIce, int m, int sid){ /*{{{*/ 1788 1797 1789 //// THIS NEEDS TO BE DOUBLE CHECKED AS THERE SEAMS TO BE LITTLE DENSIFICATION IN THE MODEL OUTOUT [MAYBE COMPA TION IS COMPNSATED FOR BY TRACES OF SNOW???]1798 //// THIS NEEDS TO BE DOUBLE CHECKED AS THERE SEAMS TO BE LITTLE DENSIFICATION IN THE MODEL OUTOUT [MAYBE COMPACTION IS COMPENSATED FOR BY TRACES OF SNOW???] 1790 1799 1791 1800 //// FUNCTION INFO 1792 1801 -
TabularUnified ../trunk-jpl/src/c/classes/Elements/Element.cpp
2555 2555 IssmDouble P=0.0; 2556 2556 IssmDouble eAir=0.0; 2557 2557 IssmDouble pAir=0.0; 2558 IssmDouble teValue=1.0; 2559 IssmDouble aValue=0.0; 2558 2560 int aIdx=0; 2559 2561 int denIdx=0; 2560 2562 int swIdx=0; … … 2658 2660 Input* P_input=this->GetInput(SmbPEnum); _assert_(P_input); 2659 2661 Input* eAir_input=this->GetInput(SmbEAirEnum); _assert_(eAir_input); 2660 2662 Input* pAir_input=this->GetInput(SmbPAirEnum); _assert_(pAir_input); 2663 Input* teValue_input=this->GetInput(SmbTeValueEnum); _assert_(teValue_input); 2664 Input* aValue_input=this->GetInput(SmbAValueEnum); _assert_(aValue_input); 2661 2665 Input* isinitialized_input=this->GetInput(SmbIsInitializedEnum); _assert_(isinitialized_input); 2662 2666 /*Retrieve input values:*/ 2663 2667 Gauss* gauss=this->NewGauss(1); gauss->GaussPoint(0); 2664 2668 2669 if (aIdx == 0) aValue_input->GetInputValue(&aValue,gauss); 2670 2665 2671 zTop_input->GetInputValue(&zTop,gauss); 2666 2672 dzTop_input->GetInputValue(&dzTop,gauss); 2667 2673 dzMin_input->GetInputValue(&dzMin,gauss); … … 2672 2678 C_input->GetInputValue(&C,gauss); 2673 2679 Tz_input->GetInputValue(&Tz,gauss); 2674 2680 Vz_input->GetInputValue(&Vz,gauss); 2681 teValue_input->GetInputValue(&teValue,gauss); 2675 2682 isinitialized_input->GetInputValue(&isinitialized); 2676 2683 /*}}}*/ 2677 2684 … … 2718 2725 W = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)W[i]=Wini[0]; //set water content to zero [kg m-2] 2719 2726 a = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aini[0]; //set albedo equal to fresh snow [fraction] 2720 2727 T = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean; //set initial grid cell temperature to the annual mean temperature [K] 2721 /* /!\ Default value of T can not be retrived from SMBgemb.m (like other snow properties) because don't know Tmean yet when set default values. 2722 Default value of 0C given in SMBgemb.m is overwritten here with value of Tmean*/ 2728 /*/!\ Default value of T can not be retrived from SMBgemb.m (like other snow properties) 2729 * because don't know Tmean yet when set default values. 2730 * Default value of 0C given in SMBgemb.m is overwritten here with value of Tmean*/ 2723 2731 2724 2732 //fixed lower temperature bounday condition - T is fixed 2725 2733 T_bottom=T[m-1]; … … 2796 2804 P_input->GetInputValue(&P,gauss,t); //precipitation [kg m-2] 2797 2805 eAir_input->GetInputValue(&eAir,gauss,t); //screen level vapor pressure [Pa] 2798 2806 pAir_input->GetInputValue(&pAir,gauss,t); // screen level air pressure [Pa] 2807 teValue_input->GetInputValue(&teValue,gauss); // screen level air pressure [Pa] 2808 if(aIdx == 0) aValue_input->GetInputValue(&aValue,gauss); // screen level air pressure [Pa] 2799 2809 //_printf_("Time: " << t << " Ta: " << Ta << " V: " << V << " dlw: " << dlw << " dsw: " << dsw << " P: " << P << " eAir: " << eAir << " pAir: " << pAir << "\n"); 2800 2810 /*}}}*/ 2801 2811 … … 2803 2813 if(isgraingrowth)grainGrowth(&re, &gdn, &gsp, T, dz, d, W, smb_dt, m, aIdx,this->Sid()); 2804 2814 2805 2815 /*Snow, firn and ice albedo:*/ 2806 if(isalbedo)albedo(&a,aIdx,re,d,cldFrac,aIce, aSnow, T,W,P,EC,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid());2816 if(isalbedo)albedo(&a,aIdx,re,d,cldFrac,aIce, aSnow,aValue,T,W,P,EC,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid()); 2807 2817 2808 2818 2809 2819 /*Distribution of absorbed short wave radation with depth:*/ … … 2813 2823 netSW = cellsum(swf,m); 2814 2824 2815 2825 /*Thermal profile computation:*/ 2816 if(isthermal)thermo(&EC, &T, dz, d, swf, dlw, Ta, V, eAir, pAir, W[0], smb_dt, m, Vz, Tz,rho_ice,this->Sid());2826 if(isthermal)thermo(&EC, &T, dz, d, swf, dlw, Ta, V, eAir, pAir, teValue, W[0], smb_dt, m, Vz, Tz,rho_ice,this->Sid()); 2817 2827 2818 2828 /*Change in thickness of top cell due to evaporation/condensation assuming same density as top cell. 2819 2829 * need to fix this in case all or more of cell evaporates */ … … 2820 2830 dz[0] = dz[0] + EC / d[0]; 2821 2831 2822 2832 /*Add snow/rain to top grid cell adjusting cell depth, temperature and density*/ 2823 if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, &re, &gdn, &gsp, &m, Ta, P, dzMin, aSnow,rho_ice,this->Sid());2833 if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, &re, &gdn, &gsp, &m, aIdx, Ta, P, dzMin, aSnow,rho_ice,this->Sid()); 2824 2834 2825 2835 /*Calculate water production, M [kg m-2] resulting from snow/ice temperature exceeding 273.15 deg K 2826 2836 * (> 0 deg C), runoff R [kg m-2] and resulting changes in density and determine wet compaction [m]*/ … … 2831 2841 2832 2842 /*Calculate upward longwave radiation flux [W m-2] not used in energy balance. Calculated for every 2833 2843 * sub-time step in thermo equations*/ 2834 ulw = 5.67E-8 * pow(T[0],4.0) ;2844 ulw = 5.67E-8 * pow(T[0],4.0) * teValue; 2835 2845 2836 2846 /*Calculate net longwave [W m-2]*/ 2837 2847 netLW = dlw - ulw; … … 2839 2849 /*Calculate turbulent heat fluxes [W m-2]*/ 2840 2850 if(isturbulentflux)turbulentFlux(&shf, &lhf, &dayEC, Ta, T[0], V, eAir, pAir, d[0], W[0], Vz, Tz,rho_ice,this->Sid()); 2841 2851 2842 /*Verbose some resul s in debug mode: {{{*/2852 /*Verbose some results in debug mode: {{{*/ 2843 2853 if(VerboseSmb() && 0){ 2844 2854 _printf_("smb log: count[" << count << "] m[" << m << "] " 2845 2855 << setprecision(16) << "T[" << cellsum(T,m) << "] " … … 2851 2861 << "gdn[" << cellsum(gdn,m) << "] " 2852 2862 << "gsp[" << cellsum(gsp,m) << "] " 2853 2863 << "swf[" << netSW << "] " 2864 << "a[" << a << "] " 2865 << "te[" << teValue << "] " 2854 2866 << "\n"); 2855 2867 } /*}}}*/ 2856 2868 -
TabularUnified ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
458 458 SmbWEnum, 459 459 SmbAEnum, 460 460 SmbTEnum, 461 SmbAValueEnum, 462 SmbTeValueEnum, 461 463 SmbIsgraingrowthEnum, 462 464 SmbIsalbedoEnum, 463 465 SmbIsshortwaveEnum, -
TabularUnified ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
460 460 case SmbWEnum : return "SmbW"; 461 461 case SmbAEnum : return "SmbA"; 462 462 case SmbTEnum : return "SmbT"; 463 case SmbAValueEnum : return "SmbAValue"; 464 case SmbTeValueEnum : return "SmbTeValue"; 463 465 case SmbIsgraingrowthEnum : return "SmbIsgraingrowth"; 464 466 case SmbIsalbedoEnum : return "SmbIsalbedo"; 465 467 case SmbIsshortwaveEnum : return "SmbIsshortwave"; -
TabularUnified ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
469 469 else if (strcmp(name,"SmbW")==0) return SmbWEnum; 470 470 else if (strcmp(name,"SmbA")==0) return SmbAEnum; 471 471 else if (strcmp(name,"SmbT")==0) return SmbTEnum; 472 else if (strcmp(name,"SmbAValue")==0) return SmbAValueEnum; 473 else if (strcmp(name,"SmbTeValue")==0) return SmbTeValueEnum; 472 474 else if (strcmp(name,"SmbIsgraingrowth")==0) return SmbIsgraingrowthEnum; 473 475 else if (strcmp(name,"SmbIsalbedo")==0) return SmbIsalbedoEnum; 474 476 else if (strcmp(name,"SmbIsshortwave")==0) return SmbIsshortwaveEnum; … … 503 505 else if (strcmp(name,"SmbSealev")==0) return SmbSealevEnum; 504 506 else if (strcmp(name,"SMBd18opdd")==0) return SMBd18opddEnum; 505 507 else if (strcmp(name,"SmbDpermil")==0) return SmbDpermilEnum; 506 else if (strcmp(name,"SmbF")==0) return SmbFEnum;507 else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum;508 508 else stage=5; 509 509 } 510 510 if(stage==5){ 511 if (strcmp(name,"SmbMonthlytemperatures")==0) return SmbMonthlytemperaturesEnum; 511 if (strcmp(name,"SmbF")==0) return SmbFEnum; 512 else if (strcmp(name,"SMBgradients")==0) return SMBgradientsEnum; 513 else if (strcmp(name,"SmbMonthlytemperatures")==0) return SmbMonthlytemperaturesEnum; 512 514 else if (strcmp(name,"SmbHref")==0) return SmbHrefEnum; 513 515 else if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum; 514 516 else if (strcmp(name,"SmbBPos")==0) return SmbBPosEnum; … … 626 628 else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum; 627 629 else if (strcmp(name,"GiaW")==0) return GiaWEnum; 628 630 else if (strcmp(name,"SaveResults")==0) return SaveResultsEnum; 629 else if (strcmp(name,"BoolExternalResult")==0) return BoolExternalResultEnum;630 else if (strcmp(name,"DoubleExternalResult")==0) return DoubleExternalResultEnum;631 631 else stage=6; 632 632 } 633 633 if(stage==6){ 634 if (strcmp(name,"DoubleMatExternalResult")==0) return DoubleMatExternalResultEnum; 634 if (strcmp(name,"BoolExternalResult")==0) return BoolExternalResultEnum; 635 else if (strcmp(name,"DoubleExternalResult")==0) return DoubleExternalResultEnum; 636 else if (strcmp(name,"DoubleMatExternalResult")==0) return DoubleMatExternalResultEnum; 635 637 else if (strcmp(name,"IntExternalResult")==0) return IntExternalResultEnum; 636 638 else if (strcmp(name,"IntMatExternalResult")==0) return IntMatExternalResultEnum; 637 639 else if (strcmp(name,"J")==0) return JEnum; … … 749 751 else if (strcmp(name,"VxObs")==0) return VxObsEnum; 750 752 else if (strcmp(name,"VyObs")==0) return VyObsEnum; 751 753 else if (strcmp(name,"Numberedcostfunction")==0) return NumberedcostfunctionEnum; 752 else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;753 else if (strcmp(name,"Incremental")==0) return IncrementalEnum;754 754 else stage=7; 755 755 } 756 756 if(stage==7){ 757 if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum; 757 if (strcmp(name,"Absolute")==0) return AbsoluteEnum; 758 else if (strcmp(name,"Incremental")==0) return IncrementalEnum; 759 else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum; 758 760 else if (strcmp(name,"AugmentedLagrangianRhop")==0) return AugmentedLagrangianRhopEnum; 759 761 else if (strcmp(name,"AugmentedLagrangianRlambda")==0) return AugmentedLagrangianRlambdaEnum; 760 762 else if (strcmp(name,"AugmentedLagrangianRholambda")==0) return AugmentedLagrangianRholambdaEnum; … … 872 874 else if (strcmp(name,"LoveKernelsReal")==0) return LoveKernelsRealEnum; 873 875 else if (strcmp(name,"LoveKernelsImag")==0) return LoveKernelsImagEnum; 874 876 else if (strcmp(name,"EsaUmotion")==0) return EsaUmotionEnum; 875 else if (strcmp(name,"EsaNmotion")==0) return EsaNmotionEnum;876 else if (strcmp(name,"EsaEmotion")==0) return EsaEmotionEnum;877 877 else stage=8; 878 878 } 879 879 if(stage==8){ 880 if (strcmp(name,"EsaXmotion")==0) return EsaXmotionEnum; 880 if (strcmp(name,"EsaNmotion")==0) return EsaNmotionEnum; 881 else if (strcmp(name,"EsaEmotion")==0) return EsaEmotionEnum; 882 else if (strcmp(name,"EsaXmotion")==0) return EsaXmotionEnum; 881 883 else if (strcmp(name,"EsaYmotion")==0) return EsaYmotionEnum; 882 884 else if (strcmp(name,"EsaHemisphere")==0) return EsaHemisphereEnum; 883 885 else if (strcmp(name,"EsaStrainratexx")==0) return EsaStrainratexxEnum; … … 995 997 else if (strcmp(name,"BalancethicknessSoftAnalysis")==0) return BalancethicknessSoftAnalysisEnum; 996 998 else if (strcmp(name,"BalancethicknessSoftSolution")==0) return BalancethicknessSoftSolutionEnum; 997 999 else if (strcmp(name,"BalancevelocityAnalysis")==0) return BalancevelocityAnalysisEnum; 998 else if (strcmp(name,"BalancevelocitySolution")==0) return BalancevelocitySolutionEnum;999 else if (strcmp(name,"L2ProjectionEPLAnalysis")==0) return L2ProjectionEPLAnalysisEnum;1000 1000 else stage=9; 1001 1001 } 1002 1002 if(stage==9){ 1003 if (strcmp(name,"L2ProjectionBaseAnalysis")==0) return L2ProjectionBaseAnalysisEnum; 1003 if (strcmp(name,"BalancevelocitySolution")==0) return BalancevelocitySolutionEnum; 1004 else if (strcmp(name,"L2ProjectionEPLAnalysis")==0) return L2ProjectionEPLAnalysisEnum; 1005 else if (strcmp(name,"L2ProjectionBaseAnalysis")==0) return L2ProjectionBaseAnalysisEnum; 1004 1006 else if (strcmp(name,"BedSlopeSolution")==0) return BedSlopeSolutionEnum; 1005 1007 else if (strcmp(name,"DamageEvolutionSolution")==0) return DamageEvolutionSolutionEnum; 1006 1008 else if (strcmp(name,"DamageEvolutionAnalysis")==0) return DamageEvolutionAnalysisEnum; … … 1118 1120 else if (strcmp(name,"Water")==0) return WaterEnum; 1119 1121 else if (strcmp(name,"DataSet")==0) return DataSetEnum; 1120 1122 else if (strcmp(name,"Constraints")==0) return ConstraintsEnum; 1121 else if (strcmp(name,"Loads")==0) return LoadsEnum;1122 else if (strcmp(name,"Materials")==0) return MaterialsEnum;1123 1123 else stage=10; 1124 1124 } 1125 1125 if(stage==10){ 1126 if (strcmp(name,"Nodes")==0) return NodesEnum; 1126 if (strcmp(name,"Loads")==0) return LoadsEnum; 1127 else if (strcmp(name,"Materials")==0) return MaterialsEnum; 1128 else if (strcmp(name,"Nodes")==0) return NodesEnum; 1127 1129 else if (strcmp(name,"Contours")==0) return ContoursEnum; 1128 1130 else if (strcmp(name,"Parameters")==0) return ParametersEnum; 1129 1131 else if (strcmp(name,"Vertices")==0) return VerticesEnum;
Note:
See TracBrowser
for help on using the repository browser.