Changeset 25997
- Timestamp:
- 02/17/21 18:10:09 (4 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SmbAnalysis.cpp
r25539 r25997 46 46 iomodel->FetchDataToInput(inputs,elements,"md.smb.V",SmbVEnum); 47 47 iomodel->FetchDataToInput(inputs,elements,"md.smb.dswrf",SmbDswrfEnum); 48 iomodel->FetchDataToInput(inputs,elements,"md.smb.dswdiffrf",SmbDswdiffrfEnum); 48 49 iomodel->FetchDataToInput(inputs,elements,"md.smb.dlwrf",SmbDlwrfEnum); 49 50 iomodel->FetchDataToInput(inputs,elements,"md.smb.P",SmbPEnum); … … 70 71 iomodel->FetchDataToInput(inputs,elements,"md.smb.Wini",SmbWiniEnum); 71 72 iomodel->FetchDataToInput(inputs,elements,"md.smb.Aini",SmbAiniEnum); 73 iomodel->FetchDataToInput(inputs,elements,"md.smb.Adiffini",SmbAdiffiniEnum); 72 74 iomodel->FetchDataToInput(inputs,elements,"md.smb.Tini",SmbTiniEnum); 73 75 iomodel->FetchDataToInput(inputs,elements,"md.smb.Sizeini",SmbSizeiniEnum); 74 76 iomodel->FetchDataToInput(inputs,elements,"md.smb.aValue",SmbAValueEnum); 75 77 iomodel->FetchDataToInput(inputs,elements,"md.smb.teValue",SmbTeValueEnum); 78 iomodel->FetchDataToInput(inputs,elements,"md.smb.szaValue",SmbSzaValueEnum); 79 iomodel->FetchDataToInput(inputs,elements,"md.smb.cotValue",SmbCotValueEnum); 80 iomodel->FetchDataToInput(inputs,elements,"md.smb.ccsnowValue",SmbCcsnowValueEnum); 81 iomodel->FetchDataToInput(inputs,elements,"md.smb.cciceValue",SmbCciceValueEnum); 76 82 break; 77 83 case SMBpddEnum: -
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r25993 r25997 3546 3546 IssmDouble dlw=0.0; 3547 3547 IssmDouble dsw=0.0; 3548 IssmDouble dswdiff=0.0; 3548 3549 IssmDouble P=0.0; 3549 3550 IssmDouble eAir=0.0; … … 3602 3603 IssmDouble* W = NULL; 3603 3604 IssmDouble* a = NULL; 3605 IssmDouble* adiff = NULL; 3604 3606 IssmDouble* swf=NULL; 3605 3607 IssmDouble* T = NULL; … … 3617 3619 IssmDouble* Wini = NULL; 3618 3620 IssmDouble* aini = NULL; 3621 IssmDouble* adiffini = NULL; 3619 3622 IssmDouble* Tini = NULL; 3620 3623 int m=0; … … 3695 3698 this->inputs->GetArray(SmbWiniEnum,this->lid,&Wini,&m); 3696 3699 this->inputs->GetArray(SmbAiniEnum,this->lid,&aini,&m); 3700 this->inputs->GetArray(SmbAdiffiniEnum,this->lid,&adiffini,&m); 3697 3701 this->inputs->GetArray(SmbTiniEnum,this->lid,&Tini,&m); 3698 3702 EC_input = this->GetInput(SmbECiniEnum); _assert_(EC_input); … … 3714 3718 W = xNew<IssmDouble>(m); for(int i=0;i<m;i++)W[i]=Wini[0]; //set water content to zero [kg m-2] 3715 3719 a = xNew<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aini[0]; //set albedo equal to fresh snow [fraction] 3720 adiff = xNew<IssmDouble>(m); for(int i=0;i<m;i++)adiff[i]=adiffini[0]; //set diffusive albedo equal to 1 [fraction] 3716 3721 T = xNew<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean; //set initial grid cell temperature to the annual mean temperature [K] 3717 3722 /*/!\ Default value of T can not be retrived from SMBgemb.m (like other snow properties) … … 3732 3737 W = xNew<IssmDouble>(m);for(int i=0;i<m;i++)W[i]=Wini[i]; 3733 3738 a = xNew<IssmDouble>(m);for(int i=0;i<m;i++)a[i]=aini[i]; 3739 adiff = xNew<IssmDouble>(m);for(int i=0;i<m;i++)adiff[i]=adiffini[i]; 3734 3740 T = xNew<IssmDouble>(m);for(int i=0;i<m;i++)T[i]=Tini[i]; 3735 3741 … … 3757 3763 this->inputs->GetArray(SmbWEnum,this->lid,&W,&m); 3758 3764 this->inputs->GetArray(SmbAEnum,this->lid,&a,&m); 3765 this->inputs->GetArray(SmbAdiffEnum,this->lid,&adiff,&m); 3759 3766 this->inputs->GetArray(SmbTEnum,this->lid,&T,&m); 3760 3767 EC_input = this->GetInput(SmbECDtEnum); _assert_(EC_input); … … 3821 3828 Input *Dlwr_input= this->GetInput(SmbDlwrfEnum,timeinputs); _assert_(Dlwr_input); 3822 3829 Input *Dswr_input= this->GetInput(SmbDswrfEnum,timeinputs); _assert_(Dswr_input); 3830 Input *Dswrdiff_input= this->GetInput(SmbDswdiffrfEnum,timeinputs); _assert_(Dswrdiff_input); 3823 3831 Input *P_input = this->GetInput(SmbPEnum,timeinputs); _assert_(P_input); 3824 3832 Input *eAir_input= this->GetInput(SmbEAirEnum,timeinputs); _assert_(eAir_input); … … 3826 3834 Input *teValue_input= this->GetInput(SmbTeValueEnum,timeinputs); _assert_(teValue_input); 3827 3835 Input *aValue_input= this->GetInput(SmbAValueEnum,timeinputs); _assert_(aValue_input); 3836 Input *szaValue_input= this->GetInput(SmbSzaValueEnum,timeinputs); _assert_(szaValue_input); 3837 Input *cotValue_input= this->GetInput(SmbCotValueEnum,timeinputs); _assert_(cotValue_input); 3838 Input *ccsnowValue_input= this->GetInput(SmbCcsnowValueEnum,timeinputs); _assert_(ccsnowValue_input); 3839 Input *cciceValue_input= this->GetInput(SmbCciceValueEnum,timeinputs); _assert_(cciceValue_input); 3828 3840 3829 3841 /*extract daily data:{{{*/ … … 3832 3844 Dlwr_input->GetInputValue(&dlw,gauss); //downward longwave radiation flux [W m-2] 3833 3845 Dswr_input->GetInputValue(&dsw,gauss); //downward shortwave radiation flux [W m-2] 3846 Dswrdiff_input->GetInputValue(&dswdiff,gauss); //downward shortwave diffuse radiation flux [W m-2] 3834 3847 P_input->GetInputValue(&P,gauss); //precipitation [kg m-2] 3835 3848 eAir_input->GetInputValue(&eAir,gauss); //screen level vapor pressure [Pa] … … 3837 3850 teValue_input->GetInputValue(&teValue,gauss); // Emissivity [0-1] 3838 3851 aValue_input->GetInputValue(&aValue,gauss); // Albedo [0 1] 3839 //Not implemented as input 3840 //szaValue; // Solar Zenith Angle [degree] 3841 //cotValue; // Cloud Optical Thickness 3842 //ccsnowValue;//concentration of light absorbing carbon for snow [ppm1] 3843 //cciceValue;//concentration of light absorbing carbon for ice [ppm1] 3852 szaValue_input->GetInputValue(&szaValue,gauss); // Solar Zenith Angle [degree] 3853 cotValue_input->GetInputValue(&cotValue,gauss); // Cloud Optical Thickness 3854 ccsnowValue_input->GetInputValue(&ccsnowValue,gauss); //concentration of light absorbing carbon for snow [ppm1] 3855 cciceValue_input->GetInputValue(&cciceValue,gauss); //concentration of light absorbing carbon for ice [ppm1] 3844 3856 //_printf_("Time: " << t << " Ta: " << Ta << " V: " << V << " dlw: " << dlw << " dsw: " << dsw << " P: " << P << " eAir: " << eAir << " pAir: " << pAir << "\n"); 3845 3857 /*}}}*/ … … 3849 3861 3850 3862 /*Snow, firn and ice albedo:*/ 3851 if(isalbedo)albedo(&a, aIdx,re,dz,d,cldFrac,aIce,aSnow,aValue,adThresh,T,W,P,EC,Msurf,ccsnowValue,cciceValue,szaValue,cotValue,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid());3863 if(isalbedo)albedo(&a,&adiff,aIdx,re,dz,d,cldFrac,aIce,aSnow,aValue,adThresh,T,W,P,EC,Msurf,ccsnowValue,cciceValue,szaValue,cotValue,t0wet,t0dry,K,smb_dt,rho_ice,m,this->Sid()); 3852 3864 3853 3865 /*Distribution of absorbed short wave radation with depth:*/ 3854 if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, a[0], d, dz, re,rho_ice,m,this->Sid());3866 if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, dswdiff, a[0], adiff[0], d, dz, re,rho_ice,m,this->Sid()); 3855 3867 3856 3868 /*Calculate net shortwave [W m-2]*/ … … 3869 3881 3870 3882 /*Add snow/rain to top grid cell adjusting cell depth, temperature and density*/ 3871 if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, & re, &gdn, &gsp, &m, aIdx, dsnowIdx, Tmean, Ta, P, dzMin, aSnow, C, V, Vmean, rho_ice,this->Sid());3883 if(isaccumulation)accumulation(&T, &dz, &d, &W, &a, &adiff, &re, &gdn, &gsp, &m, aIdx, dsnowIdx, Tmean, Ta, P, dzMin, aSnow, C, V, Vmean, rho_ice,this->Sid()); 3872 3884 3873 3885 /*Calculate water production, M [kg m-2] resulting from snow/ice temperature exceeding 273.15 deg K 3874 3886 * (> 0 deg C), runoff R [kg m-2] and resulting changes in density and determine wet compaction [m]*/ 3875 if(ismelt)melt(&M, &Msurf, &R, &mAdd, &dz_add, &T, &d, &dz, &W, &a, & re, &gdn, &gsp, &m, dzMin, zMax, zMin, zTop, zY, rho_ice,this->Sid());3887 if(ismelt)melt(&M, &Msurf, &R, &mAdd, &dz_add, &T, &d, &dz, &W, &a, &adiff, &re, &gdn, &gsp, &m, dzMin, zMax, zMin, zTop, zY, rho_ice,this->Sid()); 3876 3888 3877 3889 /*Allow non-melt densification and determine compaction [m]*/ … … 3903 3915 << "lwf[" << netLW << "] " 3904 3916 << "a[" << a << "] " 3917 << "adiff[" << adiff << "] " 3905 3918 << "te[" << teValue << "] " 3906 3919 << "\n"); … … 3975 3988 this->inputs->SetArrayInput(SmbWEnum,this->lid,W,m); 3976 3989 this->inputs->SetArrayInput(SmbAEnum,this->lid,a,m); 3990 this->inputs->SetArrayInput(SmbAdiffEnum,this->lid,adiff,m); 3977 3991 this->SetElementInput(SmbECEnum,sumEC/dt/rho_ice); 3978 3992 this->SetElementInput(SmbMassBalanceEnum,(sumP + sumEC -sumR)/dt/rho_ice); … … 4001 4015 if(W) xDelete<IssmDouble>(W); 4002 4016 if(a) xDelete<IssmDouble>(a); 4017 if(adiff) xDelete<IssmDouble>(adiff); 4003 4018 if(T) xDelete<IssmDouble>(T); 4004 4019 if(dzini) xDelete<IssmDouble>(dzini); … … 4009 4024 if(Wini) xDelete<IssmDouble>(Wini); 4010 4025 if(aini) xDelete<IssmDouble>(aini); 4026 if(adiffini) xDelete<IssmDouble>(adiffini); 4011 4027 if(Tini) xDelete<IssmDouble>(Tini); 4012 4028 if(swf) xDelete<IssmDouble>(swf); -
issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/Gembx.cpp
r25993 r25997 197 197 198 198 } /*}}}*/ 199 IssmDouble gardnerAlb(IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble dPHC, int m){ /*{{{*/ 200 //gardnerAlb(S1, c1, SZA, t, z1, S2, c2) 201 //This is an implementation of the snow and ice broadband albedo 202 // parameterization developed by Alex Gardner. 203 //Created By: Alex S. Gardner, Jet Propulsion Laboratory [alex.s.gardner@jpl.nasa.gov] 204 // Last Modified: June, 2014 205 //Full Reference: Gardner, A. S., and Sharp, M. J.: A review of snow and 206 // ice albedo and the development of a new physically based broadband albedo 207 // parameterization, J. Geophys. Res., 115, F01009, 10.1029/2009jf001444, 208 // 2010. 209 210 //INPUTS 211 // ONE LAYER 212 // - S1 : specific surface area of the snow or ice [cm^2 g-1] 213 // - c1 : concentration of light absorbing carbon [ppm1] 214 // - SZA : solar zenith angle of the incident radiation [deg] 215 // - t : cloud optical thickness 216 // TWO LAYER 217 // - z1 : depth of snow suface layer [mm w.e.] 218 // - S2 : specific surface area of bottom ice layer [cm^2 g-1] 219 // - c2 : concentration of light absorbing carbon of bottom ice 220 // layer [ppm1] 221 IssmDouble c1=clabSnow; 222 IssmDouble c2=clabIce; 223 IssmDouble t=COT; 224 IssmDouble a=0.0; 225 226 //Single layer albedo parameterization 227 //convert effective radius to specific surface area [cm2 g-1] 228 IssmDouble S1 = 3.0 / (0.091 * re[0]); 229 230 //effective solar zenith angle 231 IssmDouble x = min(pow(t/(3*cos(Pi*SZA/180.0)),0.5), 1.0); 232 IssmDouble u = 0.64*x + (1-x)*cos(Pi*SZA/180.0); 233 234 // pure snow albedo 235 IssmDouble as = 1.48 - pow(S1,-0.07); 236 237 //change in pure snow albedo due to soot loading 238 IssmDouble dac = max(0.04 - as, pow(-c1,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c1,0.6))*pow(S1,-0.25))); 239 240 //Two layer albedo parameterization 241 // do two layer calculation if there is more than 1 layer 242 IssmDouble z1=0.0; 243 int lice=0; 244 for(int l=0;(l<m & d[l]<dPHC-Dtol);l++){ 245 z1=z1+dz[l]*d[l]; //mm 246 lice=l+1; 247 } 248 if (m>0 & lice<m & z1 > Dtol){ 249 // determine albedo values for bottom layer 250 IssmDouble S2 = 3.0 / (0.091 * re[lice]); 251 252 // pure snow albedo 253 IssmDouble as2 = 1.48 - pow(S2,-0.07); 254 255 // change in pure snow albedo due to soot loading 256 IssmDouble dac2 = max(0.04 - as2, pow(-c2,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c2,0.6))*pow(S2,-0.25))); 257 258 // determine the effective change due to finite depth and soot loading 259 IssmDouble A = min(1.0, (2.1 * pow(z1,1.35*(1-as) - 0.1*c1 - 0.13))); 260 261 dac = (as2 + dac2 - as) + A*((as + dac) - (as2 + dac2)); 262 } 263 264 // change in albedo due to solar zenith angle 265 IssmDouble dasz = 0.53*as*(1 - (as + dac))*pow(1 - u,1.2); 266 267 // change in albedo due to cloud (apart from change in diffuse fraction) 268 IssmDouble dat = (0.1*t*pow(as + dac,1.3)) / (pow(1 + 1.5*t,as)); 269 270 // Broadband albedo 271 a = as + dac + dasz + dat; 272 273 return a; 274 } /*}}}*/ 199 275 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){ /*{{{*/ 200 276 … … 410 486 411 487 } /*}}}*/ 412 void albedo(IssmDouble** pa, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/488 void albedo(IssmDouble** pa, IssmDouble** padiff, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* TK, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m,int sid) { /*{{{*/ 413 489 414 490 //// Calculates Snow, firn and ice albedo as a function of: … … 471 547 /*output: */ 472 548 IssmDouble* a=NULL; 549 IssmDouble* adiff=NULL; 473 550 474 551 if(VerboseSmb() && sid==0 && IssmComm::GetRank()==0)_printf0_(" albedo module\n"); … … 476 553 /*Recover pointers: */ 477 554 a=*pa; 555 adiff=*padiff; 478 556 479 557 //some constants: … … 490 568 if(aIdx==1){ 491 569 //function of effective grain radius 492 493 //gardnerAlb(S1, c1, SZA, t, z1, S2, c2) 494 //This is an implementation of the snow and ice broadband albedo 495 // parameterization developed by Alex Gardner. 496 //Created By: Alex S. Gardner, Jet Propulsion Laboratory [alex.s.gardner@jpl.nasa.gov] 497 // Last Modified: June, 2014 498 //Full Reference: Gardner, A. S., and Sharp, M. J.: A review of snow and 499 // ice albedo and the development of a new physically based broadband albedo 500 // parameterization, J. Geophys. Res., 115, F01009, 10.1029/2009jf001444, 501 // 2010. 502 503 //INPUTS 504 // ONE LAYER 505 // - S1 : specific surface area of the snow or ice [cm^2 g-1] 506 // - c1 : concentration of light absorbing carbon [ppm1] 507 // - SZA : solar zenith angle of the incident radiation [deg] 508 // - t : cloud optical thickness 509 // TWO LAYER 510 // - z1 : depth of snow suface layer [mm w.e.] 511 // - S2 : specific surface area of bottom ice layer [cm^2 g-1] 512 // - c2 : concentration of light absorbing carbon of bottom ice 513 // layer [ppm1] 514 IssmDouble c1=clabSnow; 515 IssmDouble c2=clabIce; 516 IssmDouble t=COT; 517 518 //Single layer albedo parameterization 519 //convert effective radius to specific surface area [cm2 g-1] 520 IssmDouble S1 = 3.0 / (0.091 * re[0]); 521 522 //effective solar zenith angle 523 IssmDouble x = min(pow(t/(3*cos(Pi*SZA/180.0)),0.5), 1.0); 524 IssmDouble u = 0.64*x + (1-x)*cos(Pi*SZA/180.0); 525 526 // pure snow albedo 527 IssmDouble as = 1.48 - pow(S1,-0.07); 528 529 //change in pure snow albedo due to soot loading 530 IssmDouble dac = max(0.04 - as, pow(-c1,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c1,0.6))*pow(S1,-0.25))); 531 532 //Two layer albedo parameterization 533 // do two layer calculation if there is more than 1 layer 534 IssmDouble z1=0.0; 535 int lice=0; 536 for(int l=0;(l<m & d[l]<dPHC-Dtol);l++){ 537 z1=z1+dz[l]*d[l]; //mm 538 lice=l+1; 539 } 540 if (m>0 & lice<m & z1 > Dtol){ 541 // determine albedo values for bottom layer 542 IssmDouble S2 = 3.0 / (0.091 * re[lice]); 543 544 // pure snow albedo 545 IssmDouble as2 = 1.48 - pow(S2,-0.07); 546 547 // change in pure snow albedo due to soot loading 548 IssmDouble dac2 = max(0.04 - as2, pow(-c2,0.55)/(0.16 + 0.6*pow(S1,0.5) + (1.8*pow(c2,0.6))*pow(S2,-0.25))); 549 550 // determine the effective change due to finite depth and soot loading 551 IssmDouble A = min(1.0, (2.1 * pow(z1,1.35*(1-as) - 0.1*c1 - 0.13))); 552 553 dac = (as2 + dac2 - as) + A*((as + dac) - (as2 + dac2)); 554 } 555 556 // change in albedo due to solar zenith angle 557 IssmDouble dasz = 0.53*as*(1 - (as + dac))*pow(1 - u,1.2); 558 559 // change in albedo due to cloud (apart from change in diffuse fraction) 560 IssmDouble dat = (0.1*t*pow(as + dac,1.3)) / (pow(1 + 1.5*t,as)); 561 562 // Broadband albedo 563 a[0] = as + dac + dasz + dat; 570 // clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, int m 571 a[0]=gardnerAlb(re, dz, d, clabSnow, clabIce, SZA, COT, dPHC, m); 572 adiff[0]=gardnerAlb(re, dz, d, clabSnow, clabIce, 50, COT, dPHC, m); 564 573 } 565 574 else if(aIdx==2){ … … 698 707 /*Assign output pointers:*/ 699 708 *pa=a; 709 *padiff=adiff; 700 710 701 711 } /*}}}*/ … … 1078 1088 1079 1089 } /*}}}*/ 1080 void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid){ /*{{{*/1090 void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble dswdiff, IssmDouble as, IssmDouble asdiff, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid){ /*{{{*/ 1081 1091 1082 1092 // DISTRIBUTES ABSORBED SHORTWAVE RADIATION WITHIN SNOW/ICE … … 1092 1102 // aIdx = method for calculating albedo (1-4) 1093 1103 // dsw = downward shortwave radiative flux [w m-2] 1104 // dswdir = downward shortwave direct radiative flux [w m-2] 1094 1105 // as = surface albedo 1106 // asdiff = surface albedo for diffuse radiation 1095 1107 // d = grid cell density [kg m-3] 1096 1108 // dz = grid cell depth [m] … … 1113 1125 1114 1126 // calculate surface shortwave radiation fluxes [W m-2] 1115 swf[0] = (1.0 - as) * dsw; 1127 if (aIdx == 1){ 1128 swf[0] = (1.0 - as) * dsw + (1.0 - asdiff) * dswdiff; 1129 } 1130 else{ 1131 swf[0] = (1.0 - as) * dsw; 1132 } 1116 1133 } 1117 1134 else{ // sw radation is absorbed at depth within the glacier … … 1277 1294 1278 1295 } /*}}}*/ 1279 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** p re, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid){ /*{{{*/1296 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble T_air, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid){ /*{{{*/ 1280 1297 1281 1298 // Adds precipitation and deposition to the model grid … … 1318 1335 IssmDouble* W=NULL; 1319 1336 IssmDouble* a=NULL; 1337 IssmDouble* adiff=NULL; 1320 1338 IssmDouble* re=NULL; 1321 1339 IssmDouble* gdn=NULL; … … 1331 1349 W=*pW; 1332 1350 a=*pa; 1351 adiff=*padiff; 1333 1352 re=*pre; 1334 1353 gdn=*pgdn; … … 1389 1408 newcell(&W,0.0,top,m); //new cell W 1390 1409 newcell(&a,aSnow,top,m); //new cell a 1410 newcell(&adiff,aSnow,top,m); //new cell a 1391 1411 newcell(&re,refall,top,m); //new cell grain size 1392 1412 newcell(&gdn,dfall,top,m); //new cell grain dendricity … … 1457 1477 *pW=W; 1458 1478 *pa=a; 1479 *padiff=adiff; 1459 1480 *pre=re; 1460 1481 *pgdn=gdn; … … 1462 1483 *pm=m; 1463 1484 } /*}}}*/ 1464 void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** p re, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid){ /*{{{*/1485 void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid){ /*{{{*/ 1465 1486 1466 1487 //// MELT ROUTINE … … 1504 1525 IssmDouble W_bot=0.0; 1505 1526 IssmDouble a_bot=0.0; 1527 IssmDouble adiff_bot=0.0; 1506 1528 IssmDouble re_bot=0.0; 1507 1529 IssmDouble gdn_bot=0.0; … … 1533 1555 IssmDouble* W=*pW; 1534 1556 IssmDouble* a=*pa; 1557 IssmDouble* adiff=*padiff; 1535 1558 IssmDouble* re=*pre; 1536 1559 IssmDouble* gdn=*pgdn; … … 1783 1806 celldelete(&T,n,D,D_size); 1784 1807 celldelete(&a,n,D,D_size); 1808 celldelete(&adiff,n,D,D_size); 1785 1809 celldelete(&re,n,D,D_size); 1786 1810 celldelete(&gdn,n,D,D_size); … … 1845 1869 T[X1] = (T[X2]*m[X2] + T[X1]*m[X1]) / m_new; 1846 1870 a[X1] = (a[X2]*m[X2] + a[X1]*m[X1]) / m_new; 1871 adiff[X1] = (adiff[X2]*m[X2] + adiff[X1]*m[X1]) / m_new; 1847 1872 re[X1] = (re[X2]*m[X2] + re[X1]*m[X1]) / m_new; 1848 1873 gdn[X1] = (gdn[X2]*m[X2] + gdn[X1]*m[X1]) / m_new; … … 1871 1896 celldelete(&T,n,D,D_size); 1872 1897 celldelete(&a,n,D,D_size); 1898 celldelete(&adiff,n,D,D_size); 1873 1899 celldelete(&re,n,D,D_size); 1874 1900 celldelete(&gdn,n,D,D_size); … … 1908 1934 cellsplit(&d, n, j,1.0); 1909 1935 cellsplit(&a, n, j,1.0); 1936 cellsplit(&adiff, n, j,1.0); 1910 1937 cellsplit(&EI, n, j,.5); 1911 1938 cellsplit(&EW, n, j,.5); … … 1936 1963 d_bot=d[n-1]; 1937 1964 a_bot=a[n-1]; 1965 adiff_bot=adiff[n-1]; 1938 1966 re_bot=re[n-1]; 1939 1967 gdn_bot=gdn[n-1]; … … 1950 1978 newcell(&d,d_bot,top,n); 1951 1979 newcell(&a,a_bot,top,n); 1980 newcell(&adiff,adiff_bot,top,n); 1952 1981 newcell(&re,re_bot,top,n); 1953 1982 newcell(&gdn,gdn_bot,top,n); … … 1975 2004 celldelete(&d,n,D,D_size); 1976 2005 celldelete(&a,n,D,D_size); 2006 celldelete(&adiff,n,D,D_size); 1977 2007 celldelete(&re,n,D,D_size); 1978 2008 celldelete(&gdn,n,D,D_size); … … 2034 2064 *pW=W; 2035 2065 *pa=a; 2066 *padiff=adiff; 2036 2067 *pre=re; 2037 2068 *pgdn=gdn; -
issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
r25993 r25997 28 28 void GembgridInitialize(IssmDouble** pdz, int* psize, IssmDouble zTop, IssmDouble dzTop, IssmDouble zMax, IssmDouble zY); 29 29 IssmDouble Marbouty(IssmDouble T, IssmDouble d, IssmDouble dT); 30 IssmDouble gardnerAlb(IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble dPHC, int m); 30 31 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); 31 void albedo(IssmDouble** a, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid);32 void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble as, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid);32 void albedo(IssmDouble** a, IssmDouble** adiff, int aIdx, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble cldFrac, IssmDouble aIce, IssmDouble aSnow, IssmDouble aValue, IssmDouble adThresh, IssmDouble* T, IssmDouble* W, IssmDouble P, IssmDouble EC, IssmDouble Msurf, IssmDouble clabSnow, IssmDouble clabIce, IssmDouble SZA, IssmDouble COT, IssmDouble t0wet, IssmDouble t0dry, IssmDouble K, IssmDouble dt, IssmDouble dIce, int m, int sid); 33 void shortwave(IssmDouble** pswf, int swIdx, int aIdx, IssmDouble dsw, IssmDouble dswdiff, IssmDouble as, IssmDouble asdiff, IssmDouble* d, IssmDouble* dz, IssmDouble* re, IssmDouble dIce, int m, int sid); 33 34 void thermo(IssmDouble* pEC, IssmDouble** T, IssmDouble* pulwrf, 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 thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT); 34 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** p re, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid);35 void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** p re, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid);35 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pm, int aIdx, int dsnowIdx, IssmDouble Tmean, IssmDouble Ta, IssmDouble P, IssmDouble dzMin, IssmDouble aSnow, IssmDouble C, IssmDouble V, IssmDouble Vmean, IssmDouble dIce, int sid); 36 void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pmAdd, IssmDouble* pdz_add, IssmDouble** pT, IssmDouble** pd, IssmDouble** pdz, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, int* pn, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid); 36 37 void densification(IssmDouble** pd,IssmDouble** pdz, IssmDouble* T, IssmDouble* re, int denIdx, int aIdx, int swIdx, IssmDouble adThresh, IssmDouble C, IssmDouble dt, IssmDouble Tmean, IssmDouble dIce, int m, int sid); 37 38 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); -
issm/trunk-jpl/src/c/shared/Enum/Enum.vim
r25958 r25997 757 757 syn keyword cConstant SmbAccumulatedRunoffEnum 758 758 syn keyword cConstant SmbAEnum 759 syn keyword cConstant SmbAdiffEnum 759 760 syn keyword cConstant SmbAValueEnum 760 761 syn keyword cConstant SmbAccumulationEnum 762 syn keyword cConstant SmbAdiffiniEnum 761 763 syn keyword cConstant SmbAiniEnum 762 764 syn keyword cConstant SmbBMaxEnum … … 765 767 syn keyword cConstant SmbBPosEnum 766 768 syn keyword cConstant SmbCEnum 769 syn keyword cConstant SmbCcsnowValueEnum 770 syn keyword cConstant SmbCciceValueEnum 771 syn keyword cConstant SmbCotValueEnum 767 772 syn keyword cConstant SmbDEnum 768 773 syn keyword cConstant SmbDailyairdensityEnum … … 778 783 syn keyword cConstant SmbDlwrfEnum 779 784 syn keyword cConstant SmbDswrfEnum 785 syn keyword cConstant SmbDswdiffrfEnum 780 786 syn keyword cConstant SmbDzAddEnum 781 787 syn keyword cConstant SmbDzEnum … … 830 836 syn keyword cConstant SmbSmbCorrEnum 831 837 syn keyword cConstant SmbSmbrefEnum 838 syn keyword cConstant SmbSzaValueEnum 832 839 syn keyword cConstant SmbTEnum 833 840 syn keyword cConstant SmbTaEnum -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r25958 r25997 753 753 SmbAccumulatedRunoffEnum, 754 754 SmbAEnum, 755 SmbAdiffEnum, 755 756 SmbAValueEnum, 756 757 SmbAccumulationEnum, 758 SmbAdiffiniEnum, 757 759 SmbAiniEnum, 758 760 SmbBMaxEnum, … … 761 763 SmbBPosEnum, 762 764 SmbCEnum, 765 SmbCcsnowValueEnum, 766 SmbCciceValueEnum, 767 SmbCotValueEnum, 763 768 SmbDEnum, 764 769 SmbDailyairdensityEnum, … … 774 779 SmbDlwrfEnum, 775 780 SmbDswrfEnum, 781 SmbDswdiffrfEnum, 776 782 SmbDzAddEnum, 777 783 SmbDzEnum, … … 827 833 SmbSmbCorrEnum, 828 834 SmbSmbrefEnum, 835 SmbSzaValueEnum, 829 836 SmbTEnum, 830 837 SmbTaEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r25958 r25997 759 759 case SmbAccumulatedRunoffEnum : return "SmbAccumulatedRunoff"; 760 760 case SmbAEnum : return "SmbA"; 761 case SmbAdiffEnum : return "SmbAdiff"; 761 762 case SmbAValueEnum : return "SmbAValue"; 762 763 case SmbAccumulationEnum : return "SmbAccumulation"; 764 case SmbAdiffiniEnum : return "SmbAdiffini"; 763 765 case SmbAiniEnum : return "SmbAini"; 764 766 case SmbBMaxEnum : return "SmbBMax"; … … 767 769 case SmbBPosEnum : return "SmbBPos"; 768 770 case SmbCEnum : return "SmbC"; 771 case SmbCcsnowValueEnum : return "SmbCcsnowValue"; 772 case SmbCciceValueEnum : return "SmbCciceValue"; 773 case SmbCotValueEnum : return "SmbCotValue"; 769 774 case SmbDEnum : return "SmbD"; 770 775 case SmbDailyairdensityEnum : return "SmbDailyairdensity"; … … 780 785 case SmbDlwrfEnum : return "SmbDlwrf"; 781 786 case SmbDswrfEnum : return "SmbDswrf"; 787 case SmbDswdiffrfEnum : return "SmbDswdiffrf"; 782 788 case SmbDzAddEnum : return "SmbDzAdd"; 783 789 case SmbDzEnum : return "SmbDz"; … … 832 838 case SmbSmbCorrEnum : return "SmbSmbCorr"; 833 839 case SmbSmbrefEnum : return "SmbSmbref"; 840 case SmbSzaValueEnum : return "SmbSzaValue"; 834 841 case SmbTEnum : return "SmbT"; 835 842 case SmbTaEnum : return "SmbTa"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r25958 r25997 777 777 else if (strcmp(name,"SmbAccumulatedRunoff")==0) return SmbAccumulatedRunoffEnum; 778 778 else if (strcmp(name,"SmbA")==0) return SmbAEnum; 779 else if (strcmp(name,"SmbAdiff")==0) return SmbAdiffEnum; 779 780 else if (strcmp(name,"SmbAValue")==0) return SmbAValueEnum; 780 781 else if (strcmp(name,"SmbAccumulation")==0) return SmbAccumulationEnum; 782 else if (strcmp(name,"SmbAdiffini")==0) return SmbAdiffiniEnum; 781 783 else if (strcmp(name,"SmbAini")==0) return SmbAiniEnum; 782 784 else if (strcmp(name,"SmbBMax")==0) return SmbBMaxEnum; … … 785 787 else if (strcmp(name,"SmbBPos")==0) return SmbBPosEnum; 786 788 else if (strcmp(name,"SmbC")==0) return SmbCEnum; 789 else if (strcmp(name,"SmbCcsnowValue")==0) return SmbCcsnowValueEnum; 790 else if (strcmp(name,"SmbCciceValue")==0) return SmbCciceValueEnum; 791 else if (strcmp(name,"SmbCotValue")==0) return SmbCotValueEnum; 787 792 else if (strcmp(name,"SmbD")==0) return SmbDEnum; 788 793 else if (strcmp(name,"SmbDailyairdensity")==0) return SmbDailyairdensityEnum; … … 798 803 else if (strcmp(name,"SmbDlwrf")==0) return SmbDlwrfEnum; 799 804 else if (strcmp(name,"SmbDswrf")==0) return SmbDswrfEnum; 805 else if (strcmp(name,"SmbDswdiffrf")==0) return SmbDswdiffrfEnum; 800 806 else if (strcmp(name,"SmbDzAdd")==0) return SmbDzAddEnum; 801 807 else if (strcmp(name,"SmbDz")==0) return SmbDzEnum; … … 850 856 else if (strcmp(name,"SmbSmbCorr")==0) return SmbSmbCorrEnum; 851 857 else if (strcmp(name,"SmbSmbref")==0) return SmbSmbrefEnum; 858 else if (strcmp(name,"SmbSzaValue")==0) return SmbSzaValueEnum; 852 859 else if (strcmp(name,"SmbT")==0) return SmbTEnum; 853 860 else if (strcmp(name,"SmbTa")==0) return SmbTaEnum; … … 868 875 else if (strcmp(name,"SmbZMax")==0) return SmbZMaxEnum; 869 876 else if (strcmp(name,"SmbZMin")==0) return SmbZMinEnum; 870 else if (strcmp(name,"SmbZTop")==0) return SmbZTopEnum; 877 else stage=8; 878 } 879 if(stage==8){ 880 if (strcmp(name,"SmbZTop")==0) return SmbZTopEnum; 871 881 else if (strcmp(name,"SmbZY")==0) return SmbZYEnum; 872 882 else if (strcmp(name,"SolidearthExternalDisplacementEastRate")==0) return SolidearthExternalDisplacementEastRateEnum; … … 875 885 else if (strcmp(name,"SolidearthExternalGeoidRate")==0) return SolidearthExternalGeoidRateEnum; 876 886 else if (strcmp(name,"SolidearthExternalBarystaticSeaLevelRate")==0) return SolidearthExternalBarystaticSeaLevelRateEnum; 877 else stage=8; 878 } 879 if(stage==8){ 880 if (strcmp(name,"StrainRateeffective")==0) return StrainRateeffectiveEnum; 887 else if (strcmp(name,"StrainRateeffective")==0) return StrainRateeffectiveEnum; 881 888 else if (strcmp(name,"StrainRateparallel")==0) return StrainRateparallelEnum; 882 889 else if (strcmp(name,"StrainRateperpendicular")==0) return StrainRateperpendicularEnum; … … 991 998 else if (strcmp(name,"Outputdefinition52")==0) return Outputdefinition52Enum; 992 999 else if (strcmp(name,"Outputdefinition53")==0) return Outputdefinition53Enum; 993 else if (strcmp(name,"Outputdefinition54")==0) return Outputdefinition54Enum; 1000 else stage=9; 1001 } 1002 if(stage==9){ 1003 if (strcmp(name,"Outputdefinition54")==0) return Outputdefinition54Enum; 994 1004 else if (strcmp(name,"Outputdefinition55")==0) return Outputdefinition55Enum; 995 1005 else if (strcmp(name,"Outputdefinition56")==0) return Outputdefinition56Enum; … … 998 1008 else if (strcmp(name,"Outputdefinition59")==0) return Outputdefinition59Enum; 999 1009 else if (strcmp(name,"Outputdefinition5")==0) return Outputdefinition5Enum; 1000 else stage=9; 1001 } 1002 if(stage==9){ 1003 if (strcmp(name,"Outputdefinition60")==0) return Outputdefinition60Enum; 1010 else if (strcmp(name,"Outputdefinition60")==0) return Outputdefinition60Enum; 1004 1011 else if (strcmp(name,"Outputdefinition61")==0) return Outputdefinition61Enum; 1005 1012 else if (strcmp(name,"Outputdefinition62")==0) return Outputdefinition62Enum; … … 1114 1121 else if (strcmp(name,"DepthAverageAnalysis")==0) return DepthAverageAnalysisEnum; 1115 1122 else if (strcmp(name,"DeviatoricStressErrorEstimator")==0) return DeviatoricStressErrorEstimatorEnum; 1116 else if (strcmp(name,"Divergence")==0) return DivergenceEnum; 1123 else stage=10; 1124 } 1125 if(stage==10){ 1126 if (strcmp(name,"Divergence")==0) return DivergenceEnum; 1117 1127 else if (strcmp(name,"Domain3Dsurface")==0) return Domain3DsurfaceEnum; 1118 1128 else if (strcmp(name,"DoubleArrayInput")==0) return DoubleArrayInputEnum; … … 1121 1131 else if (strcmp(name,"DoubleMatArrayParam")==0) return DoubleMatArrayParamEnum; 1122 1132 else if (strcmp(name,"DoubleMatExternalResult")==0) return DoubleMatExternalResultEnum; 1123 else stage=10; 1124 } 1125 if(stage==10){ 1126 if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum; 1133 else if (strcmp(name,"DoubleMatParam")==0) return DoubleMatParamEnum; 1127 1134 else if (strcmp(name,"DoubleParam")==0) return DoubleParamEnum; 1128 1135 else if (strcmp(name,"DoubleVecParam")==0) return DoubleVecParamEnum; … … 1237 1244 else if (strcmp(name,"MantlePlumeGeothermalFlux")==0) return MantlePlumeGeothermalFluxEnum; 1238 1245 else if (strcmp(name,"MassFlux")==0) return MassFluxEnum; 1239 else if (strcmp(name,"Masscon")==0) return MassconEnum; 1246 else stage=11; 1247 } 1248 if(stage==11){ 1249 if (strcmp(name,"Masscon")==0) return MassconEnum; 1240 1250 else if (strcmp(name,"Massconaxpby")==0) return MassconaxpbyEnum; 1241 1251 else if (strcmp(name,"Massfluxatgate")==0) return MassfluxatgateEnum; … … 1244 1254 else if (strcmp(name,"Matdamageice")==0) return MatdamageiceEnum; 1245 1255 else if (strcmp(name,"Matenhancedice")==0) return MatenhancediceEnum; 1246 else stage=11; 1247 } 1248 if(stage==11){ 1249 if (strcmp(name,"Materials")==0) return MaterialsEnum; 1256 else if (strcmp(name,"Materials")==0) return MaterialsEnum; 1250 1257 else if (strcmp(name,"Matestar")==0) return MatestarEnum; 1251 1258 else if (strcmp(name,"Matice")==0) return MaticeEnum; … … 1360 1367 else if (strcmp(name,"SpatialLinearFloatingMeltRate")==0) return SpatialLinearFloatingMeltRateEnum; 1361 1368 else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum; 1362 else if (strcmp(name,"SpcStatic")==0) return SpcStaticEnum; 1369 else stage=12; 1370 } 1371 if(stage==12){ 1372 if (strcmp(name,"SpcStatic")==0) return SpcStaticEnum; 1363 1373 else if (strcmp(name,"SpcTransient")==0) return SpcTransientEnum; 1364 1374 else if (strcmp(name,"Sset")==0) return SsetEnum; … … 1367 1377 else if (strcmp(name,"StressIntensityFactor")==0) return StressIntensityFactorEnum; 1368 1378 else if (strcmp(name,"StressbalanceAnalysis")==0) return StressbalanceAnalysisEnum; 1369 else stage=12; 1370 } 1371 if(stage==12){ 1372 if (strcmp(name,"StressbalanceConvergenceNumSteps")==0) return StressbalanceConvergenceNumStepsEnum; 1379 else if (strcmp(name,"StressbalanceConvergenceNumSteps")==0) return StressbalanceConvergenceNumStepsEnum; 1373 1380 else if (strcmp(name,"StressbalanceSIAAnalysis")==0) return StressbalanceSIAAnalysisEnum; 1374 1381 else if (strcmp(name,"StressbalanceSolution")==0) return StressbalanceSolutionEnum; -
issm/trunk-jpl/src/m/classes/SMBgemb.m
r25933 r25997 41 41 42 42 %optional inputs: 43 aValue = NaN; %Albedo forcing at every element. Used only if aIdx == 0 .43 aValue = NaN; %Albedo forcing at every element. Used only if aIdx == 0, or density exceeds adThresh 44 44 teValue = NaN; %Outward longwave radiation thermal emissivity forcing at every element (default in code is 1) 45 45 … … 53 53 Wini = NaN; %Water content (kg m-2) 54 54 Aini = NaN; %albedo (0-1) 55 Adiffini = NaN; %albedo, diffusive radiation (0-1) 55 56 Tini = NaN; %snow temperature (K) 56 57 Sizeini = NaN; %Number of layers … … 58 59 %settings: 59 60 aIdx = NaN; %method for calculating albedo and subsurface absorption (default is 1) 60 61 62 63 64 61 % 0: direct input from aValue parameter 62 % 1: effective grain radius [Gardner & Sharp, 2009] 63 % 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003]], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992) 64 % 3: density and cloud amount [Greuell & Konzelmann, 1994] 65 % 4: exponential time decay & wetness [Bougamont & Bamber, 2005] 65 66 66 67 swIdx = NaN; % apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, with snow density (taken from Bassford, 2004)) 67 68 68 69 denIdx = NaN; %densification model to use (default is 2): 69 70 71 72 73 74 75 70 % 1 = emperical model of Herron and Langway (1980) 71 % 2 = semi-emperical model of Anthern et al. (2010) 72 % 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010) 73 % 4 = DO NOT USE: emperical model of Li and Zwally (2004) 74 % 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008) 75 % 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011) 76 % 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015) 76 77 77 78 dsnowIdx = NaN; %model for fresh snow accumulation density (default is 1): 78 79 80 81 82 79 % 0 = Original GEMB value, 150 kg/m^3 80 % 1 = Antarctica value of fresh snow density, 350 kg/m^3 81 % 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008) 82 % 3 = Antarctica model of Kaspers et al. (2004) 83 % 4 = Greenland model of Kuipers Munneke et al. (2015) 83 84 84 85 zTop = NaN; % depth over which grid length is constant at the top of the snopack (default 10) [m] … … 92 93 93 94 %specific albedo parameters: 95 %Method 1 96 dswdiffrf = NaN; %downward diffusive shortwave radiation flux [W/m^2] 97 szaValue = NaN; %Solar Zenith Angle [degree] 98 cotValue = NaN; %Cloud Optical Thickness 99 ccsnowValue = NaN; %concentration of light absorbing carbon for snow [ppm1] 100 cciceValue = NaN; %concentration of light absorbing carbon for ice [ppm1] 94 101 %Method 1 and 2: 95 102 aSnow = NaN; % new snow albedo (0.64 - 0.89) 96 103 aIce = NaN; % range 0.27-0.58 for old snow 97 104 %Method 3: Radiation Correction Factors -> only used for met station data and Greuell & Konzelmann, 1994 albedo 98 105 cldFrac = NaN; % average cloud amount 99 106 %Method 4: additonal tuning parameters albedo as a funtion of age and water content (Bougamont et al., 2005) 100 107 t0wet = NaN; % time scale for wet snow (15-21.9) 101 108 t0dry = NaN; % warm snow timescale (30) 102 109 K = NaN; % time scale temperature coef. (7) 103 110 adThresh = NaN; %Apply aIdx method to all areas with densities below this value, 104 105 111 %or else apply direct input value from aValue, allowing albedo to be altered. 112 %Default value is rho water (1023 kg m-3). 106 113 107 114 %densities: … … 134 141 function self = extrude(self,md) % {{{ 135 142 136 self.Ta=project3d(md,'vector',self.Ta,'type','node'); 137 self.V=project3d(md,'vector',self.V,'type','node'); 138 self.dswrf=project3d(md,'vector',self.dswrf,'type','node'); 139 self.dswrf=project3d(md,'vector',self.dswrf,'type','node'); 140 self.P=project3d(md,'vector',self.P,'type','node'); 141 self.eAir=project3d(md,'vector',self.eAir,'type','node'); 142 self.pAir=project3d(md,'vector',self.pAir,'type','node'); 143 143 self.Ta=project3d(md,'vector',self.Ta,'type','element'); 144 self.V=project3d(md,'vector',self.V,'type','element'); 145 self.dswrf=project3d(md,'vector',self.dswrf,'type','element'); 146 self.dslrf=project3d(md,'vector',self.dslrf,'type','element'); 147 self.P=project3d(md,'vector',self.P,'type','element'); 148 self.eAir=project3d(md,'vector',self.eAir,'type','element'); 149 self.pAir=project3d(md,'vector',self.pAir,'type','element'); 150 151 if ~isnan(self.Dzini) 152 self.Dzini=project3d(md,'vector',self.Dzini,'type','element'); 153 end 154 if ~isnan(self.Dini) 155 self.Dini=project3d(md,'vector',self.Dini,'type','element'); 156 end 157 if ~isnan(self.Reini) 158 self.Reini=project3d(md,'vector',self.Reini,'type','element'); 159 end 160 if ~isnan(self.Gdnini) 161 self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element'); 162 end 163 if ~isnan(self.Gspini) 164 self.Gspini=project3d(md,'vector',self.Gspini,'type','element'); 165 end 166 if ~isnan(self.ECini) 167 self.ECini=project3d(md,'vector',self.ECini,'type','element'); 168 end 169 if ~isnan(self.Wini) 170 self.Wini=project3d(md,'vector',self.Wini,'type','element'); 171 end 172 if ~isnan(self.Aini) 173 self.Aini=project3d(md,'vector',self.Aini,'type','element'); 174 end 175 if ~isnan(self.Adiffini) 176 self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element'); 177 end 178 if ~isnan(self.Tini) 179 self.Tini=project3d(md,'vector',self.Tini,'type','element'); 180 end 181 182 if ~isnan(self.dswdiffrf) 183 self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element'); 184 end 185 if ~isnan(self.szaValue) 186 self.szaValue=project3d(md,'vector',self.szaValue,'type','element'); 187 end 188 if ~isnan(self.cotValue) 189 self.cotValue=project3d(md,'vector',self.cotValue,'type','element'); 190 end 191 if ~isnan(self.ccsnowValue) 192 self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element'); 193 end 194 if ~isnan(self.cciceValue) 195 self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element'); 196 end 144 197 if (aIdx == 0) & ~isnan(self.aValue) 145 self.aValue=project3d(md,'vector',self.aValue,'type',' node');198 self.aValue=project3d(md,'vector',self.aValue,'type','element'); 146 199 end 147 200 if ~isnan(self.teValue) 148 self.teValue=project3d(md,'vector',self.teValue,'type',' node');201 self.teValue=project3d(md,'vector',self.teValue,'type','element'); 149 202 end 150 203 … … 152 205 end % }}} 153 206 function list = defaultoutputs(self,md) % {{{ 154 list = {'SmbMassBalance' };207 list = {'SmbMassBalance','SmbAccumulatedMassBalance'}; 155 208 end % }}} 156 209 function self = setdefaultparameters(self,mesh,geometry) % {{{ … … 196 249 self.aValue = self.aSnow*ones(mesh.numberofelements,1); 197 250 251 self.dswdiffrf=0.0*ones(mesh.numberofelements,1); 252 self.szaValue=0.0*ones(mesh.numberofelements,1); 253 self.cotValue=0.0*ones(mesh.numberofelements,1); 254 self.ccsnowValue=0.0*ones(mesh.numberofelements,1); 255 self.cciceValue=0.0*ones(mesh.numberofelements,1); 256 198 257 self.Dzini=0.05*ones(mesh.numberofelements,2); 199 258 self.Dini=910.0*ones(mesh.numberofelements,2); … … 204 263 self.Wini=0.0*ones(mesh.numberofelements,2); 205 264 self.Aini=self.aSnow*ones(mesh.numberofelements,2); 265 self.Adiffini=ones(mesh.numberofelements,2); 206 266 self.Tini=273.15*ones(mesh.numberofelements,2); 207 267 % /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh). … … 226 286 md = checkfield(md,'fieldname','smb.V','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<',45,'size',size(self.Ta)); %max 500 km/h 227 287 md = checkfield(md,'fieldname','smb.dswrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400,'size',size(self.Ta)); 288 md = checkfield(md,'fieldname','smb.dswdiffrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400); 228 289 md = checkfield(md,'fieldname','smb.dlwrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'size',size(self.Ta)); 229 290 md = checkfield(md,'fieldname','smb.P','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',200,'size',size(self.Ta)); … … 232 293 if (self.isclimatology) 233 294 md = checkfield(md,'fieldname', 'smb.Ta', 'size',[md.mesh.numberofelements+1],... 234 295 'message',['Ta must have md.mesh.numberofelements+1 rows in order to force a climatology']); 235 296 md = checkfield(md,'fieldname', 'smb.V', 'size',[md.mesh.numberofelements+1],... 236 297 'message',['V must have md.mesh.numberofelements+1 rows in order to force a climatology']); 237 298 md = checkfield(md,'fieldname', 'smb.dswrf', 'size',[md.mesh.numberofelements+1],... 238 299 'message',['dswrf must have md.mesh.numberofelements+1 rows in order to force a climatology']); 239 300 md = checkfield(md,'fieldname', 'smb.dlwrf', 'size',[md.mesh.numberofelements+1],... 240 301 'message',['dlwrf must have md.mesh.numberofelements+1 rows in order to force a climatology']); 241 302 md = checkfield(md,'fieldname', 'smb.P', 'size',[md.mesh.numberofelements+1],... 242 303 'message',['P must have md.mesh.numberofelements+1 rows in order to force a climatology']); 243 304 md = checkfield(md,'fieldname', 'smb.eAir', 'size',[md.mesh.numberofelements+1],... 244 305 'message',['eAir must have md.mesh.numberofelements+1 rows in order to force a climatology']); 245 306 end 246 307 … … 273 334 md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89); 274 335 md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58); 336 if self.aIdx==1 337 md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90); 338 md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 339 md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 340 md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 341 end 275 342 case 3 276 343 md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'>=',0,'<=',1); … … 307 374 fielddisplay(self,'Ta','2 m air temperature, in Kelvin'); 308 375 fielddisplay(self,'V','wind speed (m s-1)'); 309 fielddisplay(self,'dlwrf','downward shortwave radiation flux [W/m^2]'); 310 fielddisplay(self,'dswrf','downward longwave radiation flux [W/m^2]'); 376 fielddisplay(self,'dswrf','downward shortwave radiation flux [W/m^2]'); 377 fielddisplay(self,'dswdiffrf','downward diffusive portion of shortwave radiation flux (default to 0) [W/m^2]'); 378 fielddisplay(self,'dlwrf','downward longwave radiation flux [W/m^2]'); 311 379 fielddisplay(self,'P','precipitation [mm w.e. / m^2]'); 312 380 fielddisplay(self,'eAir','screen level vapor pressure [Pa]'); … … 328 396 fielddisplay(self,'adThresh',{'Apply aIdx method to all areas with densities below this value,','or else apply direct input value from aValue, allowing albedo to be altered.'}); 329 397 fielddisplay(self,'aIdx',{'method for calculating albedo and subsurface absorption (default is 1)',... 330 331 332 333 334 398 '0: direct input from aValue parameter',... 399 '1: effective grain radius [Gardner & Sharp, 2009]',... 400 '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',... 401 '3: density and cloud amount [Greuell & Konzelmann, 1994]',... 402 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'}) 335 403 336 404 fielddisplay(self,'teValue','Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)'); … … 345 413 fielddisplay(self,'Wini','Initial snow water content when restart [kg m-2]'); 346 414 fielddisplay(self,'Aini','Initial albedo when restart [-]'); 415 fielddisplay(self,'Adiffini','Initial diffusive radiation albedo when restart (default to 1) [-]'); 347 416 fielddisplay(self,'Tini','Initial snow temperature when restart [K]'); 348 417 fielddisplay(self,'Sizeini','Initial number of layers when restart [-]'); 349 418 350 419 %additional albedo parameters: 351 fielddisplay(self,'aValue','Albedo forcing at every element .');420 fielddisplay(self,'aValue','Albedo forcing at every element'); 352 421 switch self.aIdx 353 422 case {1 2} 354 423 fielddisplay(self,'aSnow','new snow albedo (0.64 - 0.89)'); 355 424 fielddisplay(self,'aIce','albedo of ice (0.27-0.58)'); 425 if self.aIdx==1 426 fielddisplay(self,'szaValue','Solar Zenith Angle [degree]'); 427 fielddisplay(self,'cotValue','Cloud Optical Thickness'); 428 fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]'); 429 fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]'); 430 end 356 431 case 3 357 432 fielddisplay(self,'cldFrac','average cloud amount'); … … 364 439 fielddisplay(self,'swIdx','apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, with snow density (taken from Bassford, 2004)]'); 365 440 fielddisplay(self,'denIdx',{'densification model to use (default is 2):',... 366 367 368 369 370 371 372 441 '1 = emperical model of Herron and Langway (1980)',... 442 '2 = semi-emperical model of Anthern et al. (2010)',... 443 '3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010)',... 444 '4 = DO NOT USE: emperical model of Li and Zwally (2004)',... 445 '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)',... 446 '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)',... 447 '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'}); 373 448 fielddisplay(self,'dsnowIdx',{'model for fresh snow accumulation density (default is 1):',... 374 375 376 377 378 449 '0 = Original GEMB value, 150 kg/m^3',... 450 '1 = Antarctica value of fresh snow density, 350 kg/m^3',... 451 '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2008)',... 452 '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately',... 453 '4 = Greenland model of Kuipers Munneke et al. (2015)'}); 379 454 380 455 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'); … … 407 482 WriteData(fid,prefix,'object',self,'class','smb','fieldname','V','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 408 483 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dswrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 484 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dswdiffrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 409 485 WriteData(fid,prefix,'object',self,'class','smb','fieldname','dlwrf','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 410 486 WriteData(fid,prefix,'object',self,'class','smb','fieldname','P','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); … … 441 517 WriteData(fid,prefix,'object',self,'class','smb','fieldname','aValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 442 518 WriteData(fid,prefix,'object',self,'class','smb','fieldname','teValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 519 WriteData(fid,prefix,'object',self,'class','smb','fieldname','szaValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 520 WriteData(fid,prefix,'object',self,'class','smb','fieldname','cotValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 521 WriteData(fid,prefix,'object',self,'class','smb','fieldname','ccsnowValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 522 WriteData(fid,prefix,'object',self,'class','smb','fieldname','cciceValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts); 443 523 444 524 %snow properties init … … 451 531 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Wini','format','DoubleMat','mattype',3); 452 532 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Aini','format','DoubleMat','mattype',3); 533 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Adiffini','format','DoubleMat','mattype',3); 453 534 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Tini','format','DoubleMat','mattype',3); 454 535 WriteData(fid,prefix,'object',self,'class','smb','fieldname','Sizeini','format','IntMat','mattype',2); … … 464 545 error('All GEMB forcings (Ta, P, V, dswrf, dlwrf, eAir, pAir) must have the same time steps in the final row!'); 465 546 end 547 if size(md.smb.teValue,2)>1 & any(md.smb.teValue(end,:) - md.smb.Ta(end,:) ~= 0) 548 error('If GEMB forcing teValue is transient, it must have the same time steps as input Ta in the final row!'); 549 end 550 if size(md.smb.dswdiffrf,2)>1 & any(md.smb.dswdiffrf(end,:) - md.smb.Ta(end,:) ~= 0) 551 error('If GEMB forcing dswdiffrf is transient, it must have the same time steps as input Ta in the final row!'); 552 end 553 if size(md.smb.aValue,2)>1 & any(md.smb.aValue(end,:) - md.smb.Ta(end,:) ~= 0) 554 error('If GEMB forcing aValue is transient, it must have the same time steps as input Ta in the final row!'); 555 end 556 if size(md.smb.szaValue,2)>1 & any(md.smb.szaValue(end,:) - md.smb.Ta(end,:) ~= 0) 557 error('If GEMB forcing szaValue is transient, it must have the same time steps as input Ta in the final row!'); 558 end 559 if size(md.smb.cotValue,2)>1 & any(md.smb.cotValue(end,:) - md.smb.Ta(end,:) ~= 0) 560 error('If GEMB forcing cotValue is transient, it must have the same time steps as input Ta in the final row!'); 561 end 562 if size(md.smb.ccsnowValue,2)>1 & any(md.smb.ccsnowValue(end,:) - md.smb.Ta(end,:) ~= 0) 563 error('If GEMB forcing ccsnowValue is transient, it must have the same time steps as input Ta in the final row!'); 564 end 565 if size(md.smb.cciceValue,2)>1 & any(md.smb.cciceValue(end,:) - md.smb.Ta(end,:) ~= 0) 566 error('If GEMB forcing cciceValue is transient, it must have the same time steps as input Ta in the final row!'); 567 end 466 568 time=self.Ta(end,:); %assume all forcings are on the same time step 467 569 dtime=diff(time,1); -
issm/trunk-jpl/src/m/classes/SMBgemb.py
r25933 r25997 47 47 48 48 #optional inputs: 49 self.aValue = np.nan # Albedo forcing at every element. Used only if aIdx == 0 .49 self.aValue = np.nan # Albedo forcing at every element. Used only if aIdx == 0, or density exceeds adThresh 50 50 self.teValue = np.nan # Outward longwave radiation thermal emissivity forcing at every element (default in code is 1) 51 51 … … 59 59 self.Wini = np.nan # Water content (kg m-2) 60 60 self.Aini = np.nan # albedo (0-1) 61 self.Adiffini = np.nan # albedo, diffusive radiation (0-1) 61 62 self.Tini = np.nan # snow temperature (K) 62 63 self.Sizeini = np.nan # Number of layers … … 96 97 97 98 #specific albedo parameters: 99 #Method 1 100 dswdiffrf = np.nan #downward diffusive shortwave radiation flux [W/m^2] 101 szaValue = np.nan #Solar Zenith Angle [degree] 102 cotValue = np.nan #Cloud Optical Thickness 103 ccsnowValue = np.nan #concentration of light absorbing carbon for snow [ppm1] 104 cciceValue = np.nan #concentration of light absorbing carbon for ice [ppm1] 98 105 #Method 1 and 2: 99 106 self.aSnow = np.nan # new snow albedo (0.64 - 0.89) … … 152 159 string = "%s\n%s" % (string, fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin')) 153 160 string = "%s\n%s" % (string, fielddisplay(self, 'V', 'wind speed (m s-1)')) 154 string = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward shortwave radiation flux [W/m^2]')) 155 string = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward longwave radiation flux [W/m^2]')) 161 string = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward shortwave radiation flux [W/m^2]')) 162 string = "%s\n%s" % (string, fielddisplay(self, 'dswdiffrf', 'downward diffusive portion of shortwave radiation flux (default to 0) [W/m^2]')) 163 string = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward longwave radiation flux [W/m^2]')) 156 164 string = "%s\n%s" % (string, fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]')) 157 165 string = "%s\n%s" % (string, fielddisplay(self, 'eAir', 'screen level vapor pressure [Pa]')) … … 188 196 string = "%s\n%s" % (string, fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]')) 189 197 string = "%s\n%s" % (string, fielddisplay(self, 'Aini', 'Initial albedo when restart [-]')) 198 string = "%s\n%s" % (string, fielddisplay(self, 'Adiffini', 'Initial diffusive radiation albedo when restart (default to 1) [-]')) 190 199 string = "%s\n%s" % (string, fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]')) 191 200 string = "%s\n%s" % (string, fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [-]')) 192 201 193 202 #additional albedo parameters: 194 string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element .'))203 string = "%s\n%s" % (string, fielddisplay(self, 'aValue', 'Albedo forcing at every element')) 195 204 if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)): 196 205 string = "%s\n%s" % (string, fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)')) 197 206 string = "%s\n%s" % (string, fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)')) 207 if self.aIdx == 1: 208 string = "%s\n%s" % (string, fielddisplay(self,'szaValue','Solar Zenith Angle [degree]')) 209 string = "%s\n%s" % (string, fielddisplay(self,'cotValue','Cloud Optical Thickness')) 210 string = "%s\n%s" % (string, fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]')) 211 string = "%s\n%s" % (string, fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]')) 212 198 213 elif self.aIdx == 3: 199 214 string = "%s\n%s" % (string, fielddisplay(self, 'cldFrac', 'average cloud amount')) … … 228 243 229 244 def extrude(self, md): # {{{ 230 self.Ta = project3d(md, 'vector', self.Ta, 'type', 'node') 231 self.V = project3d(md, 'vector', self.V, 'type', 'node') 232 self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'node') 233 self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'node') 234 self.P = project3d(md, 'vector', self.P, 'type', 'node') 235 self.eAir = project3d(md, 'vector', self.eAir, 'type', 'node') 236 self.pAir = project3d(md, 'vector', self.pAir, 'type', 'node') 237 238 if (self.aIdx == 0) and np.isnan(self.aValue): 239 self.aValue = project3d(md, 'vector', self.aValue, 'type', 'node') 240 if np.isnan(self.teValue): 241 self.teValue = project3d(md, 'vector', self.teValue, 'type', 'node') 245 self.Ta = project3d(md, 'vector', self.Ta, 'type', 'element') 246 self.V = project3d(md, 'vector', self.V, 'type', 'element') 247 self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'element') 248 self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'element') 249 self.P = project3d(md, 'vector', self.P, 'type', 'element') 250 self.eAir = project3d(md, 'vector', self.eAir, 'type', 'element') 251 self.pAir = project3d(md, 'vector', self.pAir, 'type', 'element') 252 253 if not np.isnan(self.Dzini): 254 self.self.Dzini=project3d(md,'vector',self.self.Dzini,'type','element'); 255 if not np.isnan(self.Dini): 256 self.self.Dini=project3d(md,'vector',self.Dini,'type','element'); 257 if not np.isnan(self.Reini): 258 self.self.Reini=project3d(md,'vector',self.Reini,'type','element'); 259 if not np.isnan(self.Gdnini): 260 self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element'); 261 if not np.isnan(self.Gspini): 262 self.Gspini=project3d(md,'vector',self.Gspini,'type','element'); 263 if not np.isnan(self.ECini): 264 self.ECini=project3d(md,'vector',self.ECini,'type','element'); 265 if not np.isnan(self.Wini): 266 self.Wini=project3d(md,'vector',self.Wini,'type','element'); 267 if not np.isnan(self.Aini): 268 self.Aini=project3d(md,'vector',self.Aini,'type','element'); 269 if not np.isnan(self.Adiffini): 270 self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element'); 271 if not np.isnan(self.Tini): 272 self.Tini=project3d(md,'vector',self.Tini,'type','element'); 273 if not np.isnan(self.dswdiffrf): 274 self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element'); 275 if not np.isnan(self.szaValue): 276 self.szaValue=project3d(md,'vector',self.szaValue,'type','element'); 277 if not np.isnan(self.cotValue): 278 self.cotValue=project3d(md,'vector',self.cotValue,'type','element'); 279 if not np.isnan(self.ccsnowValue): 280 self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element'); 281 if not np.isnan(self.cciceValue): 282 self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element'); 283 284 if (self.aIdx == 0) and (not np.isnan(self.aValue)): 285 self.aValue = project3d(md, 'vector', self.aValue, 'type', 'element') 286 if not np.isnan(self.teValue): 287 self.teValue = project3d(md, 'vector', self.teValue, 'type', 'element') 242 288 243 289 return self … … 245 291 246 292 def defaultoutputs(self, md): # {{{ 247 return ['SmbMassBalance' ]293 return ['SmbMassBalance','SmbAccumulatedMassBalance'] 248 294 #}}} 249 295 … … 290 336 self.aValue = self.aSnow * np.ones(mesh.numberofelements,) 291 337 338 self.dswdiffrf = 0.0 * np.ones(mesh.numberofelements,) 339 self.szaValue = 0.0 * np.ones(mesh.numberofelements,) 340 self.cotValue = 0.0 * np.ones(mesh.numberofelements,) 341 self.ccsnowValue = 0.0 * np.ones(mesh.numberofelements,) 342 self.cciceValue = 0.0 * np.ones(mesh.numberofelements,) 343 292 344 self.Dzini = 0.05 * np.ones((mesh.numberofelements, 2)) 293 345 self.Dini = 910.0 * np.ones((mesh.numberofelements, 2)) … … 298 350 self.Wini = 0.0 * np.ones((mesh.numberofelements, 2)) 299 351 self.Aini = self.aSnow * np.ones((mesh.numberofelements, 2)) 352 self.Adiffini = np.ones((mesh.numberofelements, 2)) 300 353 self.Tini = 273.15 * np.ones((mesh.numberofelements, 2)) 301 354 # /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh). … … 321 374 md = checkfield(md, 'fieldname', 'smb.V', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '<', 45, 'size', np.shape(self.Ta)) #max 500 km/h 322 375 md = checkfield(md, 'fieldname', 'smb.dswrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1400, 'size', np.shape(self.Ta)) 376 md = checkfield(md, 'fieldname', 'smb.dswdiffrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1400) 323 377 md = checkfield(md, 'fieldname', 'smb.dlwrf', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, 'size', np.shape(self.Ta)) 324 378 md = checkfield(md, 'fieldname', 'smb.P', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 200, 'size', np.shape(self.Ta)) … … 358 412 md = checkfield(md, 'fieldname', 'smb.aSnow', 'NaN', 1, 'Inf', 1, '> = ', .64, '< = ', .89) 359 413 md = checkfield(md, 'fieldname', 'smb.aIce', 'NaN', 1, 'Inf', 1, '> = ', .27, '< = ', .58) 414 if self.aIdx == 1: 415 md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90) 416 md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0) 417 md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0) 418 md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0) 419 360 420 elif self.aIdx == 0: 361 421 md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1) … … 396 456 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'V', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 397 457 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dswrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 458 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dswdiffrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 398 459 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'dlwrf', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 399 460 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'P', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) … … 430 491 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'aValue', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 431 492 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'teValue', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 493 WriteData(fid,prefix,'object',self,'class','smb','fieldname','szaValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts) 494 WriteData(fid,prefix,'object',self,'class','smb','fieldname','cotValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts) 495 WriteData(fid,prefix,'object',self,'class','smb','fieldname','ccsnowValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts) 496 WriteData(fid,prefix,'object',self,'class','smb','fieldname','cciceValue','format','DoubleMat','mattype',2,'timeserieslength',md.mesh.numberofelements+1,'yts',md.constants.yts) 432 497 433 498 #snow properties init … … 440 505 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Wini', 'format', 'DoubleMat', 'mattype', 3) 441 506 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Aini', 'format', 'DoubleMat', 'mattype', 3) 507 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Adiffini', 'format', 'DoubleMat', 'mattype', 3) 442 508 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Tini', 'format', 'DoubleMat', 'mattype', 3) 443 509 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Sizeini', 'format', 'IntMat', 'mattype', 2) … … 448 514 raise IOError('All GEMB forcings (Ta, P, V, dswrf, dlwrf, eAir, pAir) must have the same time steps in the final row!') 449 515 516 if ((np.ndim(self.teValue)>1) & np.any(self.teValue[-1] - self.Ta[-1] != 0)): 517 raise IOError('If GEMB forcing teValue is transient, it must have the same time steps as input Ta in the final row!') 518 if ((np.ndim(self.dswdiffrf)>1) & np.any(self.dswdiffrf[-1] - self.Ta[-1] != 0)): 519 raise IOError('If GEMB forcing dswdiffrf is transient, it must have the same time steps as input Ta in the final row!') 520 if ((np.ndim(self.aValue)>1) & np.any(self.aValue[-1] - self.Ta[-1] != 0)): 521 raise IOError('If GEMB forcing aValue is transient, it must have the same time steps as input Ta in the final row!') 522 if ((np.ndim(self.szaValue)>1) & np.any(self.szaValue[-1] - self.Ta[-1] != 0)): 523 raise IOError('If GEMB forcing szaValue is transient, it must have the same time steps as input Ta in the final row!') 524 if ((np.ndim(self.cotValue)>1) & np.any(self.cotValue[-1] - self.Ta[-1] != 0)): 525 raise IOError('If GEMB forcing cotValue is transient, it must have the same time steps as input Ta in the final row!') 526 if ((np.ndim(self.ccsnowValue)>1) & np.any(self.ccsnowValue[-1] - self.Ta[-1] != 0)): 527 raise IOError('If GEMB forcing ccsnowValue is transient, it must have the same time steps as input Ta in the final row!') 528 if ((np.ndim(self.cciceValue)>1) & np.any(self.cciceValue[-1] - self.Ta[-1] != 0)): 529 raise IOError('If GEMB forcing cciceValue is transient, it must have the same time steps as input Ta in the final row!') 530 450 531 time = self.Ta[-1] #assume all forcings are on the same time step 451 532 dtime = np.diff(time, n=1, axis=0)
Note:
See TracChangeset
for help on using the changeset viewer.