Changeset 27240
- Timestamp:
- 08/26/22 12:16:57 (3 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/Gembx.cpp
r27238 r27240 160 160 T = T - CtoK; 161 161 // convert dT from degC/m to degC/cm 162 dT = dT/100 ;162 dT = dT/100.0; 163 163 164 164 // temperature coefficient F … … 410 410 411 411 // determine new grain size (mm) 412 gsz[i] = 1e-1*(gdn[i]/.99+(1-1*gdn[i]/.99)*(gsp[i]/.99*3+(1-gsp[i]/.99)*4));412 gsz[i] = max(1e-1*(gdn[i]/.99+(1.0-1.0*gdn[i]/.99)*(gsp[i]/.99*3.0+(1.0-gsp[i]/.99)*4.0)),Gdntol*2.0); 413 413 414 414 } … … 756 756 IssmDouble zT=0.0; 757 757 IssmDouble zQ=0.0; 758 IssmDouble zratio=1 ;758 IssmDouble zratio=1.0; 759 759 IssmDouble dt=0.0; 760 760 IssmDouble max_fdt=0.0; … … 815 815 816 816 //zT and zQ are percentage of z0 (Foken 2008) 817 zratio=10 ;817 zratio=10.0; 818 818 zT=z0/zratio; 819 819 zQ=z0/zratio; … … 886 886 // NS: 2.16.18 divided dt by scaling factor, default set to 1/11 for stability 887 887 dt=1e12; 888 for(int i=0;i<m;i++) dt = min(dt,CI * pow(dz[i],2) * d[i] / (3 * K[i]) * thermo_scaling);888 for(int i=0;i<m;i++) dt = min(dt,CI * pow(dz[i],2) * d[i] / (3. * K[i]) * thermo_scaling); 889 889 890 890 // smallest possible even integer of 60 min where diffusion number > 1/2 … … 977 977 978 978 // calculate the Bulk Richardson Number (Ri) 979 Ri = pow(100000 /pAir,0.286)*(2.0*9.81*(Ta - Ts)) / (Tz*(Ta + Ts)* pow(V/(Vz),2.0));979 Ri = pow(100000./pAir,0.286)*(2.0*9.81*(Ta - Ts)) / (Tz*(Ta + Ts)* pow(V/(Vz),2.0)); 980 980 981 981 IssmDouble PhiM; … … 993 993 } 994 994 else { 995 coefM =pow (1.0-18 *Ri,-0.25);995 coefM =pow (1.0-18.0*Ri,-0.25); 996 996 } 997 997 … … 1013 1013 // if stable 1014 1014 //coefM = pow(1.0-5.0*Ri,2.0); //Fitzpatrick et al., 2017, from Brock et al., 2010 1015 coefM=1 +5.3*min((Ri/(1-5*Ri)),0.5);1016 coefH=1 +8*min((Ri/(1-5*Ri)),0.5);1015 coefM=1.0+5.3*min((Ri/(1.0-5.0*Ri)),0.5); 1016 coefH=1.0+8.0*min((Ri/(1.0-5.0*Ri)),0.5); 1017 1017 } 1018 1018 else { 1019 1019 //coefM =pow(1.0-16.0*max(Ri,-1.0),0.75); //Fitzpatrick et al., 2017, from Brock et al., 2010 1020 coefM=pow(1 -19*max(Ri/1.5,-2.0),-0.25);1021 coefH=0.95*pow(1 -11.6*max(Ri/1.5,-2.0),-0.5);1020 coefM=pow(1.0-19.0*max(Ri/1.5,-2.0),-0.25); 1021 coefH=0.95*pow(1.0-11.6*max(Ri/1.5,-2.0),-0.5); 1022 1022 } 1023 1023 … … 1032 1032 if (Ri > 0.0+Ttol){ 1033 1033 // if stable 1034 coefM=1 +15*Ri*pow(1+Ri,1/2);1035 coefH=1 ;1034 coefM=1.0+15.0*Ri*pow(1.0+Ri,1./2.); 1035 coefH=1.0; 1036 1036 } 1037 1037 else { 1038 coefM=pow(1 -15*Ri/(1+75*pow(0.4/log(Tz/zT),2)*pow(Tz/zT*fabs(Ri),1/2)),-1);1039 coefH=1 ;1038 coefM=pow(1.0-15.0*Ri/(1.0+75.0*pow(0.4/log(Tz/zT),2)*pow(Tz/zT*fabs(Ri),1./2.)),-1); 1039 coefH=1.0; 1040 1040 } 1041 1041 … … 1046 1046 else { 1047 1047 IssmDouble a1=1.0; 1048 IssmDouble b1=2 /3;1048 IssmDouble b1=2.0/3.0; 1049 1049 IssmDouble c1=5.0; 1050 1050 IssmDouble d1=0.35; 1051 IssmDouble PhiMz ;1052 IssmDouble PhiHz ;1051 IssmDouble PhiMz=0.0; 1052 IssmDouble PhiHz=0.0; 1053 1053 IssmDouble PhiMz0=0.0; 1054 1054 IssmDouble PhiHzT=0.0; 1055 1055 IssmDouble PhiHzQ=0.0; 1056 IssmDouble zL ;1057 IssmDouble zLT ;1058 IssmDouble zLM ;1056 IssmDouble zL=0.0; 1057 IssmDouble zLT=0.0; 1058 IssmDouble zLM=0.0; 1059 1059 1060 1060 if (Ri > 0.0+Ttol){ … … 1062 1062 1063 1063 if(Ri < 0.2-Ttol){ 1064 zL = Ri/(1 -5*Ri);1064 zL = Ri/(1.0-5.0*Ri); 1065 1065 } 1066 1066 else{ … … 1068 1068 } 1069 1069 //zL = min(zL, 0.5); //Sjoblom, 2014 1070 zLM=max(zL/Vz*z0,1 e-3);1071 zLT=max(zL/Tz*zT,1 e-3);1070 zLM=max(zL/Vz*z0,1.e-3); 1071 zLT=max(zL/Tz*zT,1.e-3); 1072 1072 1073 1073 //Ding et al. 2020, from Beljaars and Holtslag (1991) 1074 PhiMz=-1 *(a1*zL + b1*(zL-c1/d1)*exp(-1*d1*zL) + b1*c1/d1);1075 PhiHz=-1 *(pow(1+2*a1*zL/3,1.5) + b1*(zL-c1/d1)*exp(-1*d1*zL) + b1*c1/d1 - 1);1076 PhiMz0=-1 *(a1*zLM + b1*(zLM-c1/d1)*exp(-1*d1*zLM) + b1*c1/d1);1077 PhiHzT=-1 *(pow(1+2*a1*zLT/3,1.5) + b1*(zLT-c1/d1)*exp(-1*d1*zLT) + b1*c1/d1 - 1);1074 PhiMz=-1.*(a1*zL + b1*(zL-c1/d1)*exp(-1.*d1*zL) + b1*c1/d1); 1075 PhiHz=-1.*(pow(1.+2.*a1*zL/3.,1.5) + b1*(zL-c1/d1)*exp(-1.*d1*zL) + b1*c1/d1 - 1.0); 1076 PhiMz0=-1.*(a1*zLM + b1*(zLM-c1/d1)*exp(-1.*d1*zLM) + b1*c1/d1); 1077 PhiHzT=-1.*(pow(1.+2.*a1*zLT/3.,1.5) + b1*(zLT-c1/d1)*exp(-1.*d1*zLT) + b1*c1/d1 - 1.0); 1078 1078 1079 1079 PhiHzQ=PhiHzT; … … 1091 1091 1092 1092 if (true){ //Sjoblom, 2014 1093 xm=pow(1.0-19 *zL,-0.25);1094 PhiMz=2 *log((1+xm)/2.0) + log((1+pow(xm,2))/2.0) - 2*atan(xm) + Pi/2;1093 xm=pow(1.0-19.0*zL,-0.25); 1094 PhiMz=2.0*log((1.+xm)/2.0) + log((1.+pow(xm,2))/2.0) - 2.*atan(xm) + Pi/2.; 1095 1095 1096 1096 xh=0.95*pow(1.0-11.6*zL,-0.5); 1097 PhiHz=2 *log((1+pow(xh,2))/2.0);1097 PhiHz=2.0*log((1.0+pow(xh,2))/2.0); 1098 1098 } 1099 1099 else{ //Ding et al., 2020 … … 1101 1101 xmM=pow(1.0-16*zLM,0.25); 1102 1102 xmT=pow(1.0-16*zLT,0.25); 1103 PhiMz=2 *log((1+xm)/2.0) + log((1+pow(xm,2))/2.0) - 2*atan(xm) + Pi/2;1104 PhiMz0=2 *log((1+xmM)/2.0) + log((1+pow(xmM,2))/2.0) - 2*atan(xmM) + Pi/2;1105 1106 PhiHz=2 *log((1+pow(xm,2))/2.0);1107 PhiHzT=2 *log((1+pow(xmT,2))/2.0);1103 PhiMz=2.0*log((1.+xm)/2.0) + log((1.+pow(xm,2))/2.0) - 2.0*atan(xm) + Pi/2.0; 1104 PhiMz0=2.0*log((1.+xmM)/2.0) + log((1.+pow(xmM,2))/2.0) - 2.0*atan(xmM) + Pi/2.0; 1105 1106 PhiHz=2.0*log((1.+pow(xm,2))/2.0); 1107 PhiHzT=2.0*log((1.+pow(xmT,2))/2.0); 1108 1108 1109 1109 PhiHzQ=PhiHzT; … … 1121 1121 //// Sensible Heat 1122 1122 // calculate the sensible heat flux [W m-2](Patterson, 1998) 1123 shf = dAir * C * CA * (Ta - Ts) * pow(100000 /pAir,0.286);1123 shf = dAir * C * CA * (Ta - Ts) * pow(100000./pAir,0.286); 1124 1124 1125 1125 // adjust using Monin-Obukhov stability theory … … 1147 1147 1148 1148 // Latent heat flux [W m-2] 1149 lhf = C * L * (eAir - eS) / (461.9*(Ta+Ts)/2 );1149 lhf = C * L * (eAir - eS) / (461.9*(Ta+Ts)/2.0); 1150 1150 1151 1151 // adjust using Monin-Obukhov stability theory (if lhf '+' then there is energy and mass gained at the surface, … … 1521 1521 gdnNew = min(max(1.29 - 0.17*V,0.20),1.0); 1522 1522 gspNew = min(max(0.08*V + 0.38,0.5),0.9); 1523 reNew=max(1e-1*(gdnNew/.99+(1 -1*gdnNew/.99)*(gspNew/.99*3+(1-gspNew/.99)*4))/2,Gdntol);1523 reNew=max(1e-1*(gdnNew/.99+(1.0-1.0*gdnNew/.99)*(gspNew/.99*3.0+(1.0-gspNew/.99)*4.0))/2.0,Gdntol); 1524 1524 break; 1525 1525 … … 1579 1579 gdn[0] = dfall; 1580 1580 gsp[0] = sfall; 1581 re[0] = max(1e-1*(gdn[0]/.99+(1 -1*gdn[0]/.99)*(gsp[0]/.99*3+(1-gsp[0]/.99)*4))/2,Gdntol);1581 re[0] = max(1e-1*(gdn[0]/.99+(1.0-1.0*gdn[0]/.99)*(gsp[0]/.99*3.0+(1.0-gsp[0]/.99)*4.0))/2.0,Gdntol); 1582 1582 } 1583 1583 } -
issm/trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h
r27237 r27240 34 34 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); 35 35 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); 36 void thermo(IssmDouble* pshf, IssmDouble* plhf, IssmDouble* pEC, IssmDouble** T, IssmDouble* pulwrf, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, int tcIdx, int eIdx, IssmDouble teValue, IssmDouble dulwrfValue, IssmDouble teThresh, IssmDouble Ws, IssmDouble dt0, IssmDouble dzMin, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT, bool isdeltaLWup);36 void thermo(IssmDouble* pshf, IssmDouble* plhf, IssmDouble* pEC, IssmDouble** pT, IssmDouble* pulwrf, IssmDouble* re, IssmDouble* dz, IssmDouble* d, IssmDouble* swf, IssmDouble dlw, IssmDouble Ta, IssmDouble V, IssmDouble eAir, IssmDouble pAir, int tcIdx, int eIdx, IssmDouble teValue, IssmDouble dulwrfValue, IssmDouble teThresh, IssmDouble Ws, IssmDouble dt0, IssmDouble dzMin, int m, IssmDouble Vz, IssmDouble Tz, IssmDouble thermo_scaling, IssmDouble dIce, int sid, bool isconstrainsurfaceT, bool isdeltaLWup); 37 37 void accumulation(IssmDouble** pT, IssmDouble** pdz, IssmDouble** pd, IssmDouble** pW, IssmDouble** pa, IssmDouble** padiff, IssmDouble** pre, IssmDouble** pgdn, IssmDouble** pgsp, IssmDouble* pRa, 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); 38 38 void melt(IssmDouble* pM, IssmDouble* pMs, IssmDouble* pR, IssmDouble* pF, 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 Ra, IssmDouble dzMin, IssmDouble zMax, IssmDouble zMin, IssmDouble zTop, IssmDouble zY, IssmDouble dIce, int sid);
Note:
See TracChangeset
for help on using the changeset viewer.