8 #include "../Numerics/numerics.h"
61 int ismon[12]={11,0,1,2,3,4,5,6,7,8,9,10};
67 IssmDouble dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm;
74 sconv=(rho_water/rho_ice)/12.;
78 siglimc = 2.5*signormc;
79 siglim0 = siglim/DT + 0.5;
80 siglim0c = siglimc/DT + 0.5;
84 for (iqj = 0; iqj < 12; iqj++){
89 rtlaps=TdiffTime*rlapslgm + (1.-TdiffTime)*rlaps;
92 monthlytemperatures[imonth]=monthlytemperatures[imonth] - rtlaps *
max(st,sealevTime*0.001);
93 tstar = monthlytemperatures[imonth];
94 Tsurf = tstar*deltm+Tsurf;
99 if (tstar >= -siglimc){ pd = pds[reCast<int,IssmDouble>(tstar/DT + siglim0c)];}}
104 sp=(s-s0p)/1000.-deselcut;
105 if (sp>0.0){q = exp(-desfac*sp);}
108 qmt= qmt + monthlyprec[imonth]*sconv;
109 qmpt= q*monthlyprec[imonth]*sconv;
116 if (iqj>5 && iqj<9){ Tsum=Tsum+tstar;}
118 if (tstar >= siglim) {pdd = pdd + tstar*deltm;}
119 else if (tstar> -siglim){
120 pddsig=pdds[reCast<int,IssmDouble>(tstar/DT + siglim0)];
121 pdd = pdd + pddsig*deltm;
122 frzndd = frzndd - (tstar-pddsig)*deltm;}
123 else{frzndd = frzndd - tstar*deltm; }
126 *(monthlytemperatures+imonth) = monthlytemperatures[imonth];
127 *(monthlyprec+imonth) = monthlyprec[imonth];
138 if (pddsnowfac<1.65) {
139 _printf0_(
"WARNING: Pdd snow factor input, " << pddsnowfac <<
", results in a negative value. It will be ignored. \n");
146 if (pddicefac>17.22) {
147 _printf0_(
"WARNING: Pdd ice factor input, " << pddicefac <<
", results in a negative value. It will be ignored. \n");
156 snwmf=(2.65+snowfac-pddsnowfac0)*0.001;
160 snwmf = (0.15*(Tsum+1) + (2.65+snowfac-pddsnowfac0))*0.001;
161 smf = (((17.22-icefac)/(pow(11,3)))*pow((10.-Tsum),3) + pddicefac0)*0.001;
177 water=prect-saccu + snwm;
194 supice=
min(hmx2*CovrLm*frzndd+2.2*(saccu-snwm), water);
195 supcap=
min(2.2*(saccu-snwm),water);
196 runoff=snwm - supice;
199 supice=
min(hmx2*CovrLm*frzndd, prect );
200 runoff= saccu + smf*(pddt-saccu/snwmf) - supice;
223 diffndd=fsupndd*
min((supice-supcap)/dCovrLm ,frzndd);
224 frzndd=frzndd-diffndd;
227 saccu= saccu -runoff;
229 precrunoff=prect-saccu;
231 Tsurf=
max(Tsurf,-frzndd);
235 precrunoff=prect-
max(0.,supice)-saccu;}
240 Tsurf=
min(Tsurf+fsupT*diffndd , 0.);}