6 #include "../../shared/shared.h"
7 #include "../../toolkits/toolkits.h"
8 #include "../modules.h"
9 #include "../../classes/Inputs2/TransientInput2.h"
28 if(time<=starttime+dt){
45 if(time>time0 && timeend>time0){
46 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
60 IssmDouble* smb = xNew<IssmDouble>(numvertices);
65 xDelete<IssmDouble>(smb);
87 IssmDouble* Href = xNew<IssmDouble>(numvertices);
88 IssmDouble* Smbref = xNew<IssmDouble>(numvertices);
89 IssmDouble* b_pos = xNew<IssmDouble>(numvertices);
90 IssmDouble* b_neg = xNew<IssmDouble>(numvertices);
92 IssmDouble* smb = xNew<IssmDouble>(numvertices);
111 for(v=0;v<numvertices;v++){
113 smb[v]=Smbref[v]+b_pos[v]*(s[v]-Href[v]);
116 smb[v]=Smbref[v]+b_neg[v]*(s[v]-Href[v]);
119 smb[v]=smb[v]/1000*rho_water/rho_ice;
124 xDelete<IssmDouble>(Href);
125 xDelete<IssmDouble>(Smbref);
126 xDelete<IssmDouble>(b_pos);
127 xDelete<IssmDouble>(b_neg);
128 xDelete<IssmDouble>(s);
129 xDelete<IssmDouble>(smb);
147 IssmDouble* ela = xNew<IssmDouble>(numvertices);
148 IssmDouble* b_pos = xNew<IssmDouble>(numvertices);
149 IssmDouble* b_neg = xNew<IssmDouble>(numvertices);
150 IssmDouble* b_max = xNew<IssmDouble>(numvertices);
151 IssmDouble* b_min = xNew<IssmDouble>(numvertices);
152 IssmDouble* s = xNew<IssmDouble>(numvertices);
153 IssmDouble* smb = xNew<IssmDouble>(numvertices);
166 for(v=0;v<numvertices;v++){
169 smb[v]=b_pos[v]*(s[v]-ela[v]);
173 smb[v]=b_neg[v]*(s[v]-ela[v]);
188 xDelete<IssmDouble>(ela);
189 xDelete<IssmDouble>(b_pos);
190 xDelete<IssmDouble>(b_neg);
191 xDelete<IssmDouble>(b_max);
192 xDelete<IssmDouble>(b_min);
193 xDelete<IssmDouble>(s);
194 xDelete<IssmDouble>(smb);
242 int NPDMAX = 1504, NPDCMAX = 1454;
256 pdds=xNew<IssmDouble>(NPDMAX+1);
257 pds=xNew<IssmDouble>(NPDCMAX+1);
268 sigfac = -1.0/(2.0*pow(signorm,2));
269 snormfac = 1.0/(signorm*sqrt(2.0*acos(-1.0)));
270 siglim = 2.5*signorm;
271 siglimc = 2.5*signormc;
272 siglim0 = siglim/DT + 0.5;
273 siglim0c = siglimc/DT + 0.5;
274 PDup = siglimc+PDCUT;
276 itm = reCast<int,IssmDouble>((2*siglim/DT + 1.5));
278 if(itm >= NPDMAX)
_error_(
"increase NPDMAX in massBalance.cpp");
279 for(it = 0; it < itm; it++){
281 tstar = it*DT-siglim;
284 for ( jj = 0; jj < 600; jj++){
285 if (tint > (tstar+siglim)){
break;}
286 pddt = pddt + tint*exp(sigfac*(pow((tint-tstar),2)))*tstep;
289 pdds[it] = pddt*snormfac;
291 pdds[itm+1] = siglim + DT;
295 tsint = PDCUT-tstepc*0.5;
296 signormc = signorm - 0.5;
297 sigfac = -1.0/(2.0*pow(signormc,2));
298 snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0)));
299 siglimc = 2.5*signormc ;
300 itm = reCast<int,IssmDouble>((PDCUT+2.*siglimc)/DT + 1.5);
301 if(itm >= NPDCMAX)
_error_(
"increase NPDCMAX in p35com");
302 for(it = 0; it < itm; it++ ){
303 tstar = it*DT-siglimc;
307 for (jj = 0; jj < 600; jj++){
308 if (tint<(tstar-siglimc)) {
break;}
309 pd = pd + exp(sigfac*(pow((tint-tstar),2)))*tstepc;
312 pds[it] = pd*snormfac;
322 xDelete<IssmDouble>(pdds);
323 xDelete<IssmDouble>(pds);
362 IssmDouble* surfacelist = xNew<IssmDouble>(numvertices);
363 IssmDouble* smblistref = xNew<IssmDouble>(numvertices);
364 IssmDouble* smblist = xNew<IssmDouble>(numvertices);
369 for(
int v=0;v<numvertices;v++){
373 anomaly = smblistref[v];
377 z_critical = z_critical + dz;
384 smb = (a + b*z)*(f + g*(z-z_critical) + h*(z-z_critical)*(z-z_critical)) + c;
389 smb = smb/yts + anomaly;
398 xDelete<IssmDouble>(surfacelist);
399 xDelete<IssmDouble>(smblistref);
400 xDelete<IssmDouble>(smblist);
421 IssmDouble* acc = xNew<IssmDouble>(numvertices);
422 IssmDouble* evap = xNew<IssmDouble>(numvertices);
423 IssmDouble* runoff = xNew<IssmDouble>(numvertices);
424 IssmDouble* smb = xNew<IssmDouble>(numvertices);
448 if(time>time0 & timeend>time0){
449 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
453 timeclim=time0+delta;
462 if(time>time0 & timeend>time0){
463 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
467 timeclim=time0+delta;
476 if(time>time0 & timeend>time0){
477 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
481 timeclim=time0+delta;
492 for(
int v=0;v<numvertices;v++) smb[v]=acc[v]-evap[v]-runoff[v];
496 xDelete<IssmDouble>(acc);
497 xDelete<IssmDouble>(evap);
498 xDelete<IssmDouble>(runoff);
499 xDelete<IssmDouble>(smb);
521 IssmDouble* acc = xNew<IssmDouble>(numvertices);
522 IssmDouble* evap = xNew<IssmDouble>(numvertices);
524 IssmDouble* refreeze = xNew<IssmDouble>(numvertices);
525 IssmDouble* smb = xNew<IssmDouble>(numvertices);
549 if(time>time0 & timeend>time0){
550 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
554 timeclim=time0+delta;
563 if(time>time0 & timeend>time0){
564 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
568 timeclim=time0+delta;
577 if(time>time0 & timeend>time0){
578 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
582 timeclim=time0+delta;
591 if(time>time0 & timeend>time0){
592 IssmDouble delta=(time-time0) - (timeend-time0)*(reCast<int,IssmDouble>((time-time0)/(timeend-time0)));
596 timeclim=time0+delta;
608 for(
int v=0;v<numvertices;v++) smb[v]=acc[v]-evap[v]-
melt[v]+refreeze[v];
612 xDelete<IssmDouble>(acc);
613 xDelete<IssmDouble>(evap);
614 xDelete<IssmDouble>(
melt);
615 xDelete<IssmDouble>(refreeze);
616 xDelete<IssmDouble>(smb);
639 #endif //_HAVE_SEMIC_