Changeset 22539
- Timestamp:
- 03/14/18 18:46:50 (7 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r22515 r22539 2816 2816 IssmDouble sumMassAdd=0.0; 2817 2817 IssmDouble sumdz_add=0.0; 2818 IssmDouble fac=0.0; 2818 2819 IssmDouble sumMass=0.0; 2819 2820 IssmDouble dMass=0.0; … … 3117 3118 sumP = P + sumP; 3118 3119 sumEC = sumEC + EC; // evap (-)/cond(+) 3119 sumdz_add=dz_add+sumdz_add;3120 3120 3121 3121 /*Calculate total system mass:*/ 3122 sumMass=0; for(int i=0;i<m;i++) sumMass += dz[i]*d[i]; 3122 sumMass=0; 3123 fac=0; 3124 for(int i=0;i<m;i++){ 3125 sumMass += dz[i]*d[i]; 3126 fac += dz[i]*(rho_ice - fmin(d[i],rho_ice)); 3127 } 3123 3128 3124 3129 #ifndef _HAVE_ADOLC_ //we want to avoid the round operation at all cost. Not differentiable. … … 3154 3159 this->AddInput(new DoubleInput(SmbRunoffEnum,sumR/dt/rho_ice)); 3155 3160 this->AddInput(new DoubleInput(SmbPrecipitationEnum,sumP/dt/rho_ice)); 3156 this->AddInput(new DoubleInput(SmbDz_addEnum,sumdz_add/yts)); 3157 this->AddInput(new DoubleInput(SmbM_addEnum,sumMassAdd/dt)); 3161 this->AddInput(new DoubleInput(SmbDzAddEnum,sumdz_add)); 3162 this->AddInput(new DoubleInput(SmbMAddEnum,sumMassAdd/dt)); 3163 this->AddInput(new DoubleInput(SmbFACEnum,fac/1000)); // output in meters 3158 3164 3159 3165 /*Free allocations:{{{*/ -
issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/Gembx.cpp
r22497 r22539 583 583 /*outputs:*/ 584 584 IssmDouble EC=0.0; 585 IssmDouble* T= NULL;585 IssmDouble* T=*pT; 586 586 587 587 if(VerboseSmb() && sid==0 && IssmComm::GetRank()==0)_printf0_(" thermal module\n"); 588 589 /*Recover pointers: */590 T=*pT;591 588 592 589 ds = d[0]; // density of top grid cell … … 686 683 } 687 684 dt=max_fdt; 688 685 689 686 // determine mean (harmonic mean) of K/dz for u, d, & p 690 687 Au = xNew<IssmDouble>(m); … … 783 780 784 781 // calculate heat/wind 'coef_H' stability factor 785 if (Ri < -0.03-Ttol) coefH = 1.3 * coefM;782 if (Ri <= -0.03+Ttol) coefH = coefM/1.3; 786 783 else coefH = coefM; 787 784 … … 790 787 shf = C * CA * (Ta - Ts); 791 788 792 // adjust using Monin Obukhov stability theory789 // adjust using Monin-Obukhov stability theory 793 790 shf = shf / (coefM * coefH); 794 791 … … 796 793 // determine if snow pack is melting & calcualte surface vapour pressure over ice or liquid water 797 794 if (Ts >= CtoK-Ttol){ 798 L = LV; 799 795 L = LV; //for liquid water at 273.15 k to vapor 796 797 //for liquid surface (assume liquid on surface when Ts == 0 deg C) 798 // Wright (1997), US Meteorological Handbook from Murphy and Koop, 2005 Appendix A 799 eS = 611.21 * exp(17.502 * (Ts - CtoK) / (240.97 + Ts - CtoK)); 800 } 801 else{ 802 L = LS; // latent heat of sublimation 803 800 804 // for an ice surface Murphy and Koop, 2005 [Equation 7] 801 805 eS = exp(9.550426 - 5723.265/Ts + 3.53068 * log(Ts) - 0.00728332 * Ts); 802 806 } 803 else{ 804 L = LS; // latent heat of sublimation for liquid surface (assume liquid on surface when Ts == 0 deg C) 805 // Wright (1997), US Meteorological Handbook from Murphy and Koop, 2005 Appendix A 806 eS = 611.21 * exp(17.502 * (Ts - CtoK) / (240.97 + Ts - CtoK)); 807 } 808 807 809 808 // Latent heat flux [W m-2] 810 809 lhf = C * L * (eAir - eS) * 0.622 / pAir; 811 810 812 811 // adjust using Monin-Obukhov stability theory (if lhf '+' then there is energy and mass gained at the surface, 813 812 // if '-' then there is mass and energy loss at the surface. … … 832 831 833 832 // temperature diffusion 834 for(int j=0;j<m;j++) T0[1+j]=T[j];833 for(int j=0;j<m;j++) T0[1+j]=T[j]; 835 834 for(int j=0;j<m;j++) Tu[j] = T0[j]; 836 835 for(int j=0;j<m;j++) Td[j] = T0[2+j]; … … 839 838 // calculate cumulative evaporation (+)/condensation(-) 840 839 EC = EC + (EC_day/dts)*dt; 841 840 842 841 /* CHECK FOR ENERGY (E) CONSERVATION [UNITS: J] 843 842 //energy flux across lower boundary (energy supplied by underling ice) … … 854 853 */ 855 854 } 856 855 857 856 /*Free ressources:*/ 858 857 xDelete<IssmDouble>(K); … … 1680 1679 // WORKS FINE BUT HAS BEEN DISABLED FOR CONVIENCE OF MODEL OUTPUT 1681 1680 // INTERPRETATION 1682 // //calculate total model depth1681 // calculate total model depth 1683 1682 Ztot = cellsum(dz,n); 1684 1683 … … 1993 1992 1994 1993 // if V = 0 goes to infinity therfore if V = 0 change 1995 if(V < 0.01)V=0.01;1994 if(V<0.01-Dtol)V=0.01; 1996 1995 1997 1996 // calculate the Bulk Richardson Number (Ri) … … 1999 1998 2000 1999 // calculate Monin-Obukhov stability factors 'coef_M' and 'coef_H' 2001 2000 2002 2001 // do not allow Ri to exceed 0.19 2003 if(Ri>0.19-Ttol)Ri= 0.19; 2004 2005 // calculate momentum 'coef_M' stability factor 2006 if (Ri > 0.0) coef_M = pow(1.0-5.2*Ri,-1.0); // if stable 2007 else coef_M = pow(1.0-18*Ri,-0.25); 2002 Ri = fmin(Ri, 0.19); 2003 2004 // calculate momentum 'coefM' stability factor 2005 if (Ri > 0.0+Ttol){ 2006 // if stable 2007 coef_M = 1.0/(1.0-5.2*Ri); 2008 } 2009 else { 2010 coef_M =pow (1.0-18*Ri,-0.25); 2011 } 2008 2012 2009 2013 // calculate heat/wind 'coef_H' stability factor 2010 if (Ri < -0.03) coef_H = 1.3 * coef_M;2014 if (Ri <= -0.03+Ttol) coef_H = coef_M/1.3; 2011 2015 else coef_H = coef_M; 2012 2016 2013 2017 //// Bulk-transfer coefficient 2014 2018 An = pow(0.4,2) / pow(log(Tz/z0),2); // Bulk-transfer coefficient … … 2022 2026 shf = shf / (coef_M * coef_H); 2023 2027 2024 //// Latent Heat 2025 // determine if snow pack is melting & calcualte surface vapour pressure 2026 // over ice or liquid water 2028 // Latent Heat 2029 // determine if snow pack is melting & calcualte surface vapour pressure over ice or liquid water 2027 2030 if (Ts >= CtoK-Ttol){ 2028 L = LV; 2029 2030 // for an ice surface Murphy and Koop, 2005 [Equation 7] 2031 eS = exp(9.550426 - 5723.265/Ts + 3.53068 * log(Ts)- 0.00728332 * Ts); 2031 L = LV; //for liquid water at 273.15 k to vapor 2032 2033 //for liquid surface (assume liquid on surface when Ts == 0 deg C) 2034 // Wright (1997), US Meteorological Handbook from Murphy and Koop, 2005 Appendix A 2035 eS = 611.21 * exp(17.502 * (Ts - CtoK) / (240.97 + Ts - CtoK)); 2032 2036 } 2033 2037 else{ 2034 2038 L = LS; // latent heat of sublimation 2035 // for liquid surface (assume liquid on surface when Ts == 0 deg C) 2036 // Wright (1997), US Meteorological Handbook from Murphy and Koop,2037 // 2005 Apendix A2038 eS = 611.21 * exp(17.502 * (Ts - CtoK) / (240.97 + Ts - CtoK));2039 } 2039 2040 // for an ice surface Murphy and Koop, 2005 [Equation 7] 2041 eS = exp(9.550426 - 5723.265/Ts + 3.53068 * log(Ts) - 0.00728332 * Ts); 2042 } 2043 2040 2044 2041 2045 // Latent heat flux [W m-2] -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r22507 r22539 484 484 SmbIsdensificationEnum, 485 485 SmbIsturbulentfluxEnum, 486 SmbDz_addEnum, 487 SmbM_addEnum, 486 SmbDzAddEnum, 487 SmbMAddEnum, 488 SmbFACEnum, 488 489 /*SMBpdd*/ 489 490 SMBpddEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r22507 r22539 486 486 case SmbIsdensificationEnum : return "SmbIsdensification"; 487 487 case SmbIsturbulentfluxEnum : return "SmbIsturbulentflux"; 488 case SmbDz_addEnum : return "SmbDz_add"; 489 case SmbM_addEnum : return "SmbM_add"; 488 case SmbDzAddEnum : return "SmbDzAdd"; 489 case SmbMAddEnum : return "SmbMAdd"; 490 case SmbFACEnum : return "SmbFAC"; 490 491 case SMBpddEnum : return "SMBpdd"; 491 492 case SmbDelta18oEnum : return "SmbDelta18o"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r22507 r22539 495 495 else if (strcmp(name,"SmbIsdensification")==0) return SmbIsdensificationEnum; 496 496 else if (strcmp(name,"SmbIsturbulentflux")==0) return SmbIsturbulentfluxEnum; 497 else if (strcmp(name,"SmbDz_add")==0) return SmbDz_addEnum; 498 else if (strcmp(name,"SmbM_add")==0) return SmbM_addEnum; 497 else if (strcmp(name,"SmbDzAdd")==0) return SmbDzAddEnum; 498 else if (strcmp(name,"SmbMAdd")==0) return SmbMAddEnum; 499 else if (strcmp(name,"SmbFAC")==0) return SmbFACEnum; 499 500 else if (strcmp(name,"SMBpdd")==0) return SMBpddEnum; 500 501 else if (strcmp(name,"SmbDelta18o")==0) return SmbDelta18oEnum; … … 505 506 else if (strcmp(name,"SmbIsd18opd")==0) return SmbIsd18opdEnum; 506 507 else if (strcmp(name,"SmbIstemperaturescaled")==0) return SmbIstemperaturescaledEnum; 507 else if (strcmp(name,"SmbPrecipitationsPresentday")==0) return SmbPrecipitationsPresentdayEnum;508 508 else stage=5; 509 509 } 510 510 if(stage==5){ 511 if (strcmp(name,"SmbPrecipitationsLgm")==0) return SmbPrecipitationsLgmEnum; 511 if (strcmp(name,"SmbPrecipitationsPresentday")==0) return SmbPrecipitationsPresentdayEnum; 512 else if (strcmp(name,"SmbPrecipitationsLgm")==0) return SmbPrecipitationsLgmEnum; 512 513 else if (strcmp(name,"SmbTemperaturesPresentday")==0) return SmbTemperaturesPresentdayEnum; 513 514 else if (strcmp(name,"SmbTemperaturesLgm")==0) return SmbTemperaturesLgmEnum; … … 628 629 else if (strcmp(name,"DeviatoricStressxz")==0) return DeviatoricStressxzEnum; 629 630 else if (strcmp(name,"DeviatoricStressyy")==0) return DeviatoricStressyyEnum; 630 else if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum;631 631 else stage=6; 632 632 } 633 633 if(stage==6){ 634 if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum; 634 if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum; 635 else if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum; 635 636 else if (strcmp(name,"DeviatoricStresseffective")==0) return DeviatoricStresseffectiveEnum; 636 637 else if (strcmp(name,"LambdaS")==0) return LambdaSEnum; … … 751 752 else if (strcmp(name,"Outputdefinition89")==0) return Outputdefinition89Enum; 752 753 else if (strcmp(name,"Outputdefinition90")==0) return Outputdefinition90Enum; 753 else if (strcmp(name,"Outputdefinition91")==0) return Outputdefinition91Enum;754 754 else stage=7; 755 755 } 756 756 if(stage==7){ 757 if (strcmp(name,"Outputdefinition92")==0) return Outputdefinition92Enum; 757 if (strcmp(name,"Outputdefinition91")==0) return Outputdefinition91Enum; 758 else if (strcmp(name,"Outputdefinition92")==0) return Outputdefinition92Enum; 758 759 else if (strcmp(name,"Outputdefinition93")==0) return Outputdefinition93Enum; 759 760 else if (strcmp(name,"Outputdefinition94")==0) return Outputdefinition94Enum; … … 874 875 else if (strcmp(name,"SealevelriseRequestedOutputs")==0) return SealevelriseRequestedOutputsEnum; 875 876 else if (strcmp(name,"SealevelriseNumRequestedOutputs")==0) return SealevelriseNumRequestedOutputsEnum; 876 else if (strcmp(name,"LoveNfreq")==0) return LoveNfreqEnum;877 877 else stage=8; 878 878 } 879 879 if(stage==8){ 880 if (strcmp(name,"LoveFrequencies")==0) return LoveFrequenciesEnum; 880 if (strcmp(name,"LoveNfreq")==0) return LoveNfreqEnum; 881 else if (strcmp(name,"LoveFrequencies")==0) return LoveFrequenciesEnum; 881 882 else if (strcmp(name,"LoveShNmax")==0) return LoveShNmaxEnum; 882 883 else if (strcmp(name,"LoveShNmin")==0) return LoveShNminEnum; … … 997 998 else if (strcmp(name,"Tria")==0) return TriaEnum; 998 999 else if (strcmp(name,"TriaInput")==0) return TriaInputEnum; 999 else if (strcmp(name,"Tetra")==0) return TetraEnum;1000 1000 else stage=9; 1001 1001 } 1002 1002 if(stage==9){ 1003 if (strcmp(name,"TetraInput")==0) return TetraInputEnum; 1003 if (strcmp(name,"Tetra")==0) return TetraEnum; 1004 else if (strcmp(name,"TetraInput")==0) return TetraInputEnum; 1004 1005 else if (strcmp(name,"Penta")==0) return PentaEnum; 1005 1006 else if (strcmp(name,"PentaInput")==0) return PentaInputEnum; … … 1120 1121 else if (strcmp(name,"P1xP3")==0) return P1xP3Enum; 1121 1122 else if (strcmp(name,"P1xP4")==0) return P1xP4Enum; 1122 else if (strcmp(name,"P2xP4")==0) return P2xP4Enum;1123 1123 else stage=10; 1124 1124 } 1125 1125 if(stage==10){ 1126 if (strcmp(name,"P1P1")==0) return P1P1Enum; 1126 if (strcmp(name,"P2xP4")==0) return P2xP4Enum; 1127 else if (strcmp(name,"P1P1")==0) return P1P1Enum; 1127 1128 else if (strcmp(name,"P1P1GLS")==0) return P1P1GLSEnum; 1128 1129 else if (strcmp(name,"MINI")==0) return MINIEnum; -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.m
r22383 r22539 199 199 elseif strcmp(fieldname,'SmbRunoff'), 200 200 field = field*yts; 201 elseif strcmp(fieldname,'SmbEvaporation'), 202 field = field*yts; 203 elseif strcmp(fieldname,'SmbRefreeze'), 204 field = field*yts; 201 205 elseif strcmp(fieldname,'SmbEC'), 202 206 field = field*yts; … … 205 209 elseif strcmp(fieldname,'SmbMelt'), 206 210 field = field*yts; 207 elseif strcmp(fieldname,'SmbDz_add'), 208 field = field*yts; 209 elseif strcmp(fieldname,'SmbM_add'), 210 field = field*yts; 211 elseif strcmp(fieldname,'SmbMAdd'), 212 field = field*yts; 211 213 elseif strcmp(fieldname,'CalvingCalvingrate'), 212 214 field = field*yts; -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py
r22399 r22539 209 209 elif fieldname=='SmbRunoff': 210 210 field = field*yts 211 elif fieldname=='SmbEvaporation': 212 field = field*yts; 213 elif fieldname=='SmbRefreeze': 214 field = field*yts; 211 215 elif fieldname=='SmbEC': 212 216 field = field*yts … … 215 219 elif fieldname=='SmbMelt': 216 220 field = field*yts 217 elif fieldname=='SmbDz_add': 218 field = field*yts 219 elif fieldname=='SmbM_add': 221 elif fieldname=='SmbMAdd': 220 222 field = field*yts 221 223 elif fieldname=='CalvingCalvingrate': -
issm/trunk-jpl/test/NightlyRun/test243.m
r22432 r22539 27 27 28 28 %smb settings 29 md.smb.requested_outputs={'SmbDz','SmbT','SmbD','SmbRe','SmbGdn','SmbGsp','SmbEC','SmbA','SmbMassBalance' };29 md.smb.requested_outputs={'SmbDz','SmbT','SmbD','SmbRe','SmbGdn','SmbGsp','SmbEC','SmbA','SmbMassBalance','SmbMAdd','SmbDzAdd','SmbFAC'}; 30 30 31 31 %only run smb core: … … 44 44 45 45 %Fields and tolerances to track changes 46 field_names ={'SmbDz','SmbT' ,'SmbD' ,'SmbRe','SmbGdn','SmbGsp','SmbA' ,'SmbEC','SmbMassBalance' };47 field_tolerances ={1e-11,1e-12,1e-11,1e-11,1e-11,1e-11,1e-12,1e-12,1e-12 };46 field_names ={'SmbDz','SmbT' ,'SmbD' ,'SmbRe','SmbGdn','SmbGsp','SmbA' ,'SmbEC','SmbMassBalance','SmbMAdd','SmbDzAdd','SmbFAC'}; 47 field_tolerances ={1e-11,1e-12,1e-11,1e-11,1e-11,1e-11,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12}; 48 48 49 49 field_values={... … … 57 57 (md.results.TransientSolution(end).SmbEC(1)),... 58 58 (md.results.TransientSolution(end).SmbMassBalance(1)),... 59 (md.results.TransientSolution(end).SmbMAdd(1)),... 60 (md.results.TransientSolution(end).SmbDzAdd(1)),... 61 (md.results.TransientSolution(end).SmbFAC(1)) 59 62 }; -
issm/trunk-jpl/test/NightlyRun/test243.py
r22432 r22539 40 40 41 41 #smb settings 42 md.smb.requested_outputs = ['SmbDz','SmbT','SmbD','SmbRe','SmbGdn','SmbGsp','SmbEC','SmbA','SmbMassBalance' ]42 md.smb.requested_outputs = ['SmbDz','SmbT','SmbD','SmbRe','SmbGdn','SmbGsp','SmbEC','SmbA','SmbMassBalance','SmbMAdd','SmbDzAdd','SmbFAC'] 43 43 44 44 #only run smb core: … … 57 57 58 58 #Fields and tolerances to track changes 59 field_names = ['SmbDz','SmbT' ,'SmbD' ,'SmbRe','SmbGdn','SmbGsp','SmbA' ,'SmbEC','SmbMassBalance' ]60 field_tolerances = [1e-11,1e-12,1e-11,1e-11,1e-11,1e-11,1e-12,1e-12,1e-12 ]59 field_names = ['SmbDz','SmbT' ,'SmbD' ,'SmbRe','SmbGdn','SmbGsp','SmbA' ,'SmbEC','SmbMassBalance','SmbMAdd','SmbDzAdd','SmbFAC'] 60 field_tolerances = [1e-11,1e-12,1e-11,1e-11,1e-11,1e-11,1e-12,1e-12,1e-12,1e-12,1e-12,1e-12] 61 61 #shape is different in python solution (fixed using reshape) which can cause test failure: 62 62 field_values = [ … … 70 70 md.results.TransientSolution[-1].SmbEC[0], 71 71 md.results.TransientSolution[-1].SmbMassBalance[0], 72 md.results.TransientSolution[-1].SmbMAdd[0], 73 md.results.TransientSolution[-1].SmbDzAdd[0], 74 md.results.TransientSolution[-1].SmbFAC[0], 72 75 ]
Note:
See TracChangeset
for help on using the changeset viewer.