Changeset 11778


Ignore:
Timestamp:
03/22/12 14:45:29 (13 years ago)
Author:
lemorzad
Message:

ton message

Location:
issm/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/PositiveDegreeDayx/PositiveDegreeDayx.cpp

    r11527 r11778  
    1111
    1212void PositiveDegreeDayx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters){
    13        
    14         Element* element = NULL;
    1513
    16         for(int i=0;i<elements->Size();i++){
    17                 element=(Element*)elements->GetObjectByOffset(i);
    18                 element->PositiveDegreeDay();
    19         }
     14// void PositiveDegreeDayx(hd,vTempsea,vPrec,agd,Tsurf,ni){
     15//    note "v" prefix means 12 monthly means, ie time dimension
     16//    INPUT parameters: ni: working size of arrays
     17//    INPUT: surface elevation (m): hd(NA)
     18//    monthly mean surface sealevel temperature (degrees C): vTempsea(NA
     19//    ,NTIME)
     20//    monthly mean precip rate (m/yr water equivalent): vPrec(NA,NTIME)
     21//    OUTPUT: mass-balance (m/yr ice): agd(NA)
     22//    mean annual surface temperature (degrees C): Tsurf(NA)
    2023
     24  int    i, it, jj, itm;
     25  double DT = 0.02, sigfac, snormfac;
     26  double signorm = 5.5;      // signorm : sigma of the temperature distribution for a normal day
     27  double siglim;       // sigma limit for the integration which is equal to 2.5 sigmanorm
     28  double signormc;     // sigma of the temperature distribution for cloudy day
     29  double siglimc=0, siglim0, siglim0c;
     30  double tstep, tsint, tint, tstepc;
     31  int    NPDMAX = 1504, NPDCMAX = 1454;
     32  //double pdds[NPDMAX]={0};
     33  //double pds[NPDCMAX]={0};
     34  double pddt, pd ; // pd : snow/precip fraction, precipitation falling as snow
     35  double PDup, PDCUT = 2.0;    // PDcut: rain/snow cutoff temperature (C)
     36  double tstar; // monthly mean surface temp
     37 
     38  double* pdds=NULL;
     39  double* pds=NULL;
     40  Element* element = NULL;
     41 
     42  pdds=(double*)xmalloc(NPDMAX*sizeof(double)+1);
     43  pds=(double*)xmalloc(NPDCMAX*sizeof(double)+1);
     44 
     45 
     46  // PDD constant
     47  siglim = 2.5*signorm;
     48 
     49  // initialize PDD (creation of a lookup table)
     50  tstep = 0.1;
     51  tsint = tstep*0.5;
     52  sigfac = -1.0/(2.0*pow(signorm,2));
     53  snormfac = 1.0/(signorm*sqrt(2.0*acos(-1.0)));
     54  siglim = 2.5*signorm;
     55  itm = (int)(2*siglim/DT + 1.5);
     56 
     57  if (itm >= NPDMAX){
     58    printf("increase NPDMAX in massBalance.cpp\n");
     59    exit (1);
     60      }
     61  for (it = 0; it < itm; it++){ 
     62    //    tstar = REAL(it)*DT-siglim;
     63    tstar = it*DT-siglim;
     64    tint = tsint;
     65    pddt = 0;
     66    for ( jj = 0; jj < 600; jj++){
     67      if (tint > (tstar+siglim)){break;}
     68      pddt = pddt + tint*exp(sigfac*(pow((tint-tstar),2)))*tstep;
     69      tint = tint+tstep;
     70    }
     71    pdds[it] = pddt*snormfac;
     72  }
     73  pdds[itm+1] = siglim + DT;
     74 
     75  //*********compute PD(T) : snow/precip fraction. precipitation falling as snow
     76  tstepc = 0.1;
     77  tsint = PDCUT-tstepc*0.5;
     78  signormc = signorm - 0.5;
     79  sigfac = -1.0/(2.0*pow(signormc,2));
     80  snormfac = 1.0/(signormc*sqrt(2.0*acos(-1.0)));
     81  siglimc = 2.5*signormc ;
     82  itm = (int)((PDCUT+2.*siglimc)/DT + 1.5);
     83  if (itm >= NPDCMAX){
     84    printf("'increase NPDCMAX in p35com'\n");
     85    exit (1);
     86      }
     87  for (it = 0; it < itm; it++ ){
     88    tstar = it*DT-siglimc;
     89    //    tstar = REAL(it)*DT-siglimc;
     90    tint = tsint;          // start against upper bound
     91    pd = 0;
     92    for (jj = 0; jj < 600; jj++){
     93      if (tint<(tstar-siglimc)) {break;}
     94      pd = pd + exp(sigfac*(pow((tint-tstar),2)))*tstepc;
     95      tint = tint-tstepc;
     96    }
     97    pds[it] = pd*snormfac;  // gaussian integral lookup table for snow fraction
     98  }
     99  pds[itm+1] = 0;
     100  //     *******END initialize PDD
     101 
     102  for(i=0;i<elements->Size();i++){
     103    element=(Element*)elements->GetObjectByOffset(i);
     104    element->PositiveDegreeDay(pdds,pds,signorm);
     105  }
     106  /*free ressouces: */
     107  xfree((void**)&pdds);
     108  xfree((void**)&pds);
     109 
    21110}
  • issm/trunk/src/c/objects/Elements/Element.h

    r11527 r11778  
    6868                virtual void   MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding)=0;
    6969                virtual void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0;
    70                 virtual void   PositiveDegreeDay(void)=0;
     70                virtual void   PositiveDegreeDay(double* pdds,double* pds,double signorm)=0;
    7171                virtual int    UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0;
    7272                virtual void   ResetCoordinateSystem()=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r11527 r11778  
    23792379/*}}}*/
    23802380/*FUNCTION Penta::PositiveDegreeDay{{{1*/
    2381 void  Penta::PositiveDegreeDay(){
    2382 
    2383         _error_("Not implemented yet");
     2381void  Penta::PositiveDegreeDay(double* pdds,double* pds,double signorm){
     2382
     2383
     2384   int    i,iqj,imonth;
     2385   double agd[NUMVERTICES];  // surface and basal
     2386   double saccu[NUMVERTICES] = {0};     // yearly surface accumulation
     2387   double smelt[NUMVERTICES] = {0};     // yearly melt
     2388   double precrunoff[NUMVERTICES];      // yearly runoff
     2389   double prect; // total precipitation during 1 year taking into account des. ef.
     2390   double water; //water=rain + snowmelt
     2391   double runoff; //meltwater only, does not include rain
     2392   double sconv; //rhow_rain/rhoi / 12 months
     2393
     2394   double  rho_water,rho_ice,density;
     2395   double lapser=6.5/1000, sealev=0;    // lapse rate. degrees per meter.
     2396   double desfac = 0.5;                 //desert elevation factor
     2397   double s0p[NUMVERTICES]={0};         //should be set to elevation from precip source
     2398   double s0t[NUMVERTICES]={0};         //should be set to elevation from temperature source
     2399   double st;             // elevation between altitude of the temp record and current altitude
     2400   double sp;             // elevation between altitude of the prec record and current altitude
     2401
     2402
     2403   // PDD and PD constants and variables
     2404   double siglim;          // sigma limit for the integration which is equal to 2.5 sigmanorm
     2405   double siglimc=0, siglim0, siglim0c;
     2406   double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
     2407   double DT = 0.02;
     2408   double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
     2409   
     2410   double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
     2411   double qm[NUMVERTICES] = {0};        // snow part of the precipitation
     2412   double qmt[NUMVERTICES] = {0};       // precipitation without desertification effect adjustment
     2413   double qmp[NUMVERTICES] = {0};       // desertification taken into account
     2414   double pdd[NUMVERTICES] = {0};     
     2415   double frzndd[NUMVERTICES] = {0}; 
     2416
     2417   double tstar;                        // monthly mean surface temp
     2418   double Tsum[NUMVERTICES]= {0};       // average summer (JJA) temperature
     2419   double Tsurf[NUMVERTICES] = {0};     // average annual temperature   
     2420   
     2421   double h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
     2422   double t[NUMVERTICES][12],prec[NUMVERTICES][12];
     2423   double deltm=1/12;
     2424   int    ismon[12]={12,1,2,3,4,5,6,7,8,9,10,11};
     2425
     2426   double snwm;  // snow that could have been melted in a year.
     2427   double snwmf; //  ablation factor for snow per positive degree day.
     2428   double smf;   //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
     2429
     2430   double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
     2431   double supice,supcap,diffndd;
     2432   double fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
     2433   double pddtj[NUMVERTICES], hmx2;
     2434
     2435   /*Recover info at the vertices: */
     2436   GetInputListOnVertices(&h[0],ThicknessEnum);
     2437   GetInputListOnVertices(&s[0],SurfaceEnum);
     2438   GetInputListOnVertices(&ttmp[0],ThermalSpctemperatureEnum);
     2439   GetInputListOnVertices(&prectmp[0],SurfaceforcingsPrecipitationEnum);
     2440
     2441   for(i=0;i<NUMVERTICES;i++) ttmp[i]=ttmp[i]-273.15; // convertion from Kelvin to celcius
     2442
     2443   for(i=0;i<NUMVERTICES;i++)
     2444     for(imonth=0;imonth<12;imonth++){
     2445       t[i][imonth]=ttmp[i];
     2446       prec[i][imonth]=prectmp[i];
     2447   }
     2448
     2449   /*Get material parameters :*/
     2450   rho_ice=matpar->GetRhoIce();
     2451   rho_water=matpar->GetRhoWater();
     2452   density=rho_ice/rho_water;
     2453   
     2454   sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
     2455     
     2456     /*PDD constant*/
     2457   siglim = 2.5*signorm;
     2458   siglim0 =  siglim/DT + 0.5;
     2459   siglim0c =  siglimc/DT + 0.5;
     2460   PDup = siglimc+PDCUT;
     2461   
     2462   // seasonal loop
     2463   for (iqj = 0; iqj < 12; iqj++){
     2464     imonth =  ismon[iqj];
     2465     for (i = 0; i < NUMVERTICES; i++){
     2466       st=(s[i]-s0t[i])/1000;
     2467       tstar = t[i][imonth] - lapser *max(st,sealev);
     2468       Tsurf[i] = tstar*deltm+Tsurf[i];       
     2469       
     2470       /*********compute PD ****************/
     2471       if (tstar < PDup){
     2472         pd = 1;
     2473         if (tstar >= -siglimc){ pd = pds[int(tstar/DT + siglim0c)];}}
     2474       else {
     2475         pd = 0;}
     2476       
     2477       /******exp des/elev precip reduction*******/
     2478       sp=(s[i]-s0p[i])/1000; // deselev effect is wrt chng in topo
     2479       if (sp>0.0){q = exp(-desfac*sp);}
     2480       else {q = 1.0;}
     2481       
     2482       qmt[i]= qmt[i] + prec[i][imonth]*sconv;  //*sconv to convert in m of ice equivalent
     2483       qmpt= q*prec[i][imonth]*sconv;           
     2484       qmp[i]= qmp[i] + qmpt;
     2485       qm[i]= qm[i] + qmpt*pd;
     2486       
     2487       /*********compute PDD************/
     2488       // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
     2489       // gaussian=T_m, so ndd=-(Tsurf-pdd)
     2490       if (iqj>6 &&  iqj<10){ Tsum[i]=Tsum[i]+tstar;}
     2491       if (tstar >= siglim) {pdd[i] = pdd[i] + tstar*deltm;}
     2492       else if (tstar> -siglim){
     2493         pddsig=pdds[int(tstar/DT + siglim0)];
     2494         pdd[i] = pdd[i] + pddsig*deltm;
     2495         frzndd[i] = frzndd[i] - (tstar-pddsig)*deltm;}
     2496       else{frzndd[i] = frzndd[i] - tstar*deltm; }
     2497     }
     2498   } // end of seasonal loop
     2499   
     2500   //******************************************************************
     2501   for(i=0;i<NUMVERTICES;i++){
     2502     saccu[i] = qm[i];
     2503     prect = qmp[i];     // total precipitation during 1 year taking into account des. ef.
     2504     Tsum[i]=Tsum[i]/3;
     2505     
     2506     /***** determine PDD factors *****/
     2507     if(Tsum[i]< -1.) {
     2508       snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
     2509       smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
     2510     }
     2511     else if(Tsum[i]< 10){
     2512       snwmf = (0.15*Tsum[i] + 2.8)*0.001;
     2513       smf = (0.0067*pow((10.-Tsum[i]),3) + 8.3)*0.001;
     2514     }
     2515     else{
     2516       snwmf=4.3*0.001;
     2517       smf=8.3*0.001;
     2518     }
     2519     snwmf=0.95*snwmf;
     2520     smf=0.95*smf;
     2521     
     2522     /*****  compute PDD ablation and refreezing *****/
     2523     pddt = pdd[i] *365;
     2524     snwm = snwmf*pddt;       // snow that could have been melted in a year
     2525     hmx2 = min(h[i],dfrz);   // refreeze active layer max depth: dfrz
     2526     
     2527     if(snwm < saccu[i]) {
     2528       water=prect-saccu[i] + snwm; //water=rain + snowmelt
     2529       //     l 2.2= capillary factor
     2530       //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
     2531       //     dCovrLm concept is of warming of active layer (thickness =d@=1-
     2532       //     >2m)
     2533       //     problem with water seepage into ice: should be sealed after
     2534       //     refreezing
     2535       //     so everything needs to be predicated on 1 year scale, except for
     2536       //     thermal
     2537       //     conductivity through ice
     2538       //     also, need to account that melt season has low accum, so what's
     2539       //     going to
     2540       //     hold the meltwater around for refreezing? And melt-time will have
     2541       //     low seasonal frzndd
     2542       
     2543       //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
     2544       
     2545       supice= min(hmx2*CovrLm*frzndd[i]+2.2*(saccu[i]-snwm), water); // superimposed ice
     2546       supcap=min(2.2*(saccu[i]-snwm),water);
     2547       runoff=snwm - supice;  //meltwater only, does not include rain
     2548     }
     2549     else {  //all snow melted
     2550       supice= min(hmx2*CovrLm*frzndd[i], prect );
     2551       runoff= saccu[i] + smf*(pddt-saccu[i]/snwmf) - supice;
     2552       supcap=0;
     2553     }
     2554     //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
     2555     //     except pdd melt heat source is atmosphere, while refreeze is
     2556     //     ground/ice stored interim
     2557     //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
     2558     //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
     2559     //     <0
     2560     //     assume ndd>pdd, little melt => little supice
     2561     //     bottom line: compare for Tsurf<0 : supice and no supice case,
     2562     //     expect Tsurf difference
     2563     //     except some of cooling flux comes from atmosphere//
     2564     //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
     2565     //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
     2566     //     < 0.1
     2567     
     2568     //     make more sense to just use residual pdd-ndd except that pdd
     2569     //     residual not clear yet
     2570     //     frzndd should not be used up by refreezing in snow, so stick in
     2571     //     supcap.
     2572     diffndd=0;
     2573     if (frzndd[i]>0) {
     2574       diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd[i]);
     2575       frzndd[i]=frzndd[i]-diffndd;
     2576     }
     2577     if(runoff<0){
     2578       saccu[i]= saccu[i] -runoff;
     2579       smelt[i] = 0;
     2580       precrunoff[i]=prect-saccu[i];
     2581       //here assume pdd residual is 0, =>
     2582       Tsurf[i]= max(Tsurf[i],-frzndd[i]);
     2583     }
     2584     else {
     2585       smelt[i] = runoff;
     2586       precrunoff[i]=prect-max(0.,supice)-saccu[i];}
     2587     //here really need pdd balance, try 0.5 fudge factor?
     2588     //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
     2589     //yet from site plots, can be ice free with Tsurf=-5.5C
     2590     if(Tsurf[i]<0) {
     2591       Tsurf[i]= min(Tsurf[i]+fsupT*diffndd , 0.);}
     2592     
     2593     agd[i] = -smelt[i]+saccu[i];
     2594     pddtj[i]=pddt;
     2595     
     2596     /*Update inputs*/   
     2597     this->inputs->AddInput(new PentaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0])); ////////verifier le nom
     2598     // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
     2599     this->inputs->AddInput(new PentaP1Input(ThermalSpctemperatureEnum,&Tsurf[0]));
     2600     
     2601   }       //end of the for loop over the vertices
    23842602}
    23852603/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r11527 r11778  
    112112                void   PatchFill(int* pcount, Patch* patch);
    113113                void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
    114                 void   PositiveDegreeDay(void);
     114                void   PositiveDegreeDay(double* pdds,double* pds,double signorm);
    115115                void   ProcessResultsUnits(void);
    116116                void   ResetCoordinateSystem(void);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r11527 r11778  
    22042204/*}}}*/
    22052205/*FUNCTION Tria::PositiveDegreeDay{{{1*/
    2206 void  Tria::PositiveDegreeDay(){
    2207 
    2208         _error_("Not implemented yet");
     2206void  Tria::PositiveDegreeDay(double* pdds,double* pds,double signorm){
     2207
     2208   int    i,iqj,imonth;
     2209   double agd[NUMVERTICES];  // surface and basal
     2210   double saccu[NUMVERTICES] = {0};     // yearly surface accumulation
     2211   double smelt[NUMVERTICES] = {0};     // yearly melt
     2212   double precrunoff[NUMVERTICES];      // yearly runoff
     2213   double prect; // total precipitation during 1 year taking into account des. ef.
     2214   double water; //water=rain + snowmelt
     2215   double runoff; //meltwater only, does not include rain
     2216   double sconv; //rhow_rain/rhoi / 12 months
     2217
     2218   double  rho_water,rho_ice,density;
     2219   double lapser=6.5/1000, sealev=0;    // lapse rate. degrees per meter.
     2220   double desfac = 0.5;                 //desert elevation factor
     2221   double s0p[NUMVERTICES]={0};         //should be set to elevation from precip source
     2222   double s0t[NUMVERTICES]={0};         //should be set to elevation from temperature source
     2223   double st;             // elevation between altitude of the temp record and current altitude
     2224   double sp;             // elevation between altitude of the prec record and current altitude
     2225
     2226
     2227   // PDD and PD constants and variables
     2228   double siglim;          // sigma limit for the integration which is equal to 2.5 sigmanorm
     2229   double siglimc=0, siglim0, siglim0c;
     2230   double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
     2231   double DT = 0.02;
     2232   double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
     2233   
     2234   double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
     2235   double qm[NUMVERTICES] = {0};        // snow part of the precipitation
     2236   double qmt[NUMVERTICES] = {0};       // precipitation without desertification effect adjustment
     2237   double qmp[NUMVERTICES] = {0};       // desertification taken into account
     2238   double pdd[NUMVERTICES] = {0};     
     2239   double frzndd[NUMVERTICES] = {0}; 
     2240
     2241   double tstar;                        // monthly mean surface temp
     2242   double Tsum[NUMVERTICES]= {0};       // average summer (JJA) temperature
     2243   double Tsurf[NUMVERTICES] = {0};     // average annual temperature   
     2244   
     2245   double h[NUMVERTICES],s[NUMVERTICES],ttmp[NUMVERTICES],prectmp[NUMVERTICES]; // ,b[NUMVERTICES]
     2246   double t[NUMVERTICES][12],prec[NUMVERTICES][12];
     2247   double deltm=1/12;
     2248   int    ismon[12]={12,1,2,3,4,5,6,7,8,9,10,11};
     2249
     2250   double snwm;  // snow that could have been melted in a year.
     2251   double snwmf; //  ablation factor for snow per positive degree day.
     2252   double smf;   //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
     2253
     2254   double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
     2255   double supice,supcap,diffndd;
     2256   double fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
     2257   double pddtj[NUMVERTICES], hmx2;
     2258
     2259   /*Recover info at the vertices: */
     2260   GetInputListOnVertices(&h[0],ThicknessEnum);
     2261   GetInputListOnVertices(&s[0],SurfaceEnum);
     2262   GetInputListOnVertices(&ttmp[0],ThermalSpctemperatureEnum);
     2263   GetInputListOnVertices(&prectmp[0],SurfaceforcingsPrecipitationEnum);
     2264
     2265   for(i=0;i<NUMVERTICES;i++) ttmp[i]=ttmp[i]-273.15; // convertion from Kelvin to celcius
     2266
     2267   for(i=0;i<NUMVERTICES;i++)
     2268     for(imonth=0;imonth<12;imonth++){
     2269       t[i][imonth]=ttmp[i];
     2270       prec[i][imonth]=prectmp[i];
     2271   }
     2272
     2273   /*Get material parameters :*/
     2274   rho_ice=matpar->GetRhoIce();
     2275   rho_water=matpar->GetRhoWater();
     2276   density=rho_ice/rho_water;
     2277   
     2278   sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
     2279     
     2280     /*PDD constant*/
     2281   siglim = 2.5*signorm;
     2282   siglim0 =  siglim/DT + 0.5;
     2283   siglim0c =  siglimc/DT + 0.5;
     2284   PDup = siglimc+PDCUT;
     2285   
     2286   // seasonal loop
     2287   for (iqj = 0; iqj < 12; iqj++){
     2288     imonth =  ismon[iqj];
     2289     for (i = 0; i < NUMVERTICES; i++){
     2290       st=(s[i]-s0t[i])/1000;
     2291       tstar = t[i][imonth] - lapser *max(st,sealev);
     2292       Tsurf[i] = tstar*deltm+Tsurf[i];       
     2293       
     2294       /*********compute PD ****************/
     2295       if (tstar < PDup){
     2296         pd = 1;
     2297         if (tstar >= -siglimc){ pd = pds[int(tstar/DT + siglim0c)];}}
     2298       else {
     2299         pd = 0;}
     2300       
     2301       /******exp des/elev precip reduction*******/
     2302       sp=(s[i]-s0p[i])/1000; // deselev effect is wrt chng in topo
     2303       if (sp>0.0){q = exp(-desfac*sp);}
     2304       else {q = 1.0;}
     2305       
     2306       qmt[i]= qmt[i] + prec[i][imonth]*sconv;  //*sconv to convert in m of ice equivalent
     2307       qmpt= q*prec[i][imonth]*sconv;           
     2308       qmp[i]= qmp[i] + qmpt;
     2309       qm[i]= qm[i] + qmpt*pd;
     2310       
     2311       /*********compute PDD************/
     2312       // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
     2313       // gaussian=T_m, so ndd=-(Tsurf-pdd)
     2314       if (iqj>6 &&  iqj<10){ Tsum[i]=Tsum[i]+tstar;}
     2315       if (tstar >= siglim) {pdd[i] = pdd[i] + tstar*deltm;}
     2316       else if (tstar> -siglim){
     2317         pddsig=pdds[int(tstar/DT + siglim0)];
     2318         pdd[i] = pdd[i] + pddsig*deltm;
     2319         frzndd[i] = frzndd[i] - (tstar-pddsig)*deltm;}
     2320       else{frzndd[i] = frzndd[i] - tstar*deltm; }
     2321     }
     2322   } // end of seasonal loop
     2323   
     2324   //******************************************************************
     2325   for(i=0;i<NUMVERTICES;i++){
     2326     saccu[i] = qm[i];
     2327     prect = qmp[i];     // total precipitation during 1 year taking into account des. ef.
     2328     Tsum[i]=Tsum[i]/3;
     2329     
     2330     /***** determine PDD factors *****/
     2331     if(Tsum[i]< -1.) {
     2332       snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
     2333       smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
     2334     }
     2335     else if(Tsum[i]< 10){
     2336       snwmf = (0.15*Tsum[i] + 2.8)*0.001;
     2337       smf = (0.0067*pow((10.-Tsum[i]),3) + 8.3)*0.001;
     2338     }
     2339     else{
     2340       snwmf=4.3*0.001;
     2341       smf=8.3*0.001;
     2342     }
     2343     snwmf=0.95*snwmf;
     2344     smf=0.95*smf;
     2345     
     2346     /*****  compute PDD ablation and refreezing *****/
     2347     pddt = pdd[i] *365;
     2348     snwm = snwmf*pddt;       // snow that could have been melted in a year
     2349     hmx2 = min(h[i],dfrz);   // refreeze active layer max depth: dfrz
     2350     
     2351     if(snwm < saccu[i]) {
     2352       water=prect-saccu[i] + snwm; //water=rain + snowmelt
     2353       //     l 2.2= capillary factor
     2354       //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
     2355       //     dCovrLm concept is of warming of active layer (thickness =d@=1-
     2356       //     >2m)
     2357       //     problem with water seepage into ice: should be sealed after
     2358       //     refreezing
     2359       //     so everything needs to be predicated on 1 year scale, except for
     2360       //     thermal
     2361       //     conductivity through ice
     2362       //     also, need to account that melt season has low accum, so what's
     2363       //     going to
     2364       //     hold the meltwater around for refreezing? And melt-time will have
     2365       //     low seasonal frzndd
     2366       
     2367       //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
     2368       
     2369       supice= min(hmx2*CovrLm*frzndd[i]+2.2*(saccu[i]-snwm), water); // superimposed ice
     2370       supcap=min(2.2*(saccu[i]-snwm),water);
     2371       runoff=snwm - supice;  //meltwater only, does not include rain
     2372     }
     2373     else {  //all snow melted
     2374       supice= min(hmx2*CovrLm*frzndd[i], prect );
     2375       runoff= saccu[i] + smf*(pddt-saccu[i]/snwmf) - supice;
     2376       supcap=0;
     2377     }
     2378     //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
     2379     //     except pdd melt heat source is atmosphere, while refreeze is
     2380     //     ground/ice stored interim
     2381     //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
     2382     //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
     2383     //     <0
     2384     //     assume ndd>pdd, little melt => little supice
     2385     //     bottom line: compare for Tsurf<0 : supice and no supice case,
     2386     //     expect Tsurf difference
     2387     //     except some of cooling flux comes from atmosphere//
     2388     //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
     2389     //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
     2390     //     < 0.1
     2391     
     2392     //     make more sense to just use residual pdd-ndd except that pdd
     2393     //     residual not clear yet
     2394     //     frzndd should not be used up by refreezing in snow, so stick in
     2395     //     supcap.
     2396     diffndd=0;
     2397     if (frzndd[i]>0) {
     2398       diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd[i]);
     2399       frzndd[i]=frzndd[i]-diffndd;
     2400     }
     2401     if(runoff<0){
     2402       saccu[i]= saccu[i] -runoff;
     2403       smelt[i] = 0;
     2404       precrunoff[i]=prect-saccu[i];
     2405       //here assume pdd residual is 0, =>
     2406       Tsurf[i]= max(Tsurf[i],-frzndd[i]);
     2407     }
     2408     else {
     2409       smelt[i] = runoff;
     2410       precrunoff[i]=prect-max(0.,supice)-saccu[i];}
     2411     //here really need pdd balance, try 0.5 fudge factor?
     2412     //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
     2413     //yet from site plots, can be ice free with Tsurf=-5.5C
     2414     if(Tsurf[i]<0) {
     2415       Tsurf[i]= min(Tsurf[i]+fsupT*diffndd , 0.);}
     2416     
     2417     agd[i] = -smelt[i]+saccu[i];
     2418     pddtj[i]=pddt;
     2419     
     2420     /*Update inputs*/   
     2421     this->inputs->AddInput(new TriaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0])); ////////verifier le nom
     2422     // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
     2423     this->inputs->AddInput(new TriaP1Input(ThermalSpctemperatureEnum,&Tsurf[0]));
     2424     
     2425   }       //end of the for loop over the vertices
    22092426}
    22102427/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r11527 r11778  
    107107                void   MigrateGroundingLine(double* oldfloating,double* sheet_ungrounding);
    108108                void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
    109                 void   PositiveDegreeDay(void);
     109                void   PositiveDegreeDay(double* pdds,double* pds,double signorm);
    110110                void   RequestedOutput(int output_enum,int step,double time);
    111111                void   ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results);
  • issm/trunk/src/m/model/parameterization/parameterize.m

    r11237 r11778  
    2929        eval(temporaryname);
    3030        delete([temporaryname '.m']);
    31 catch me,
     31catch,
    3232        delete([temporaryname '.m']);
    3333
Note: See TracChangeset for help on using the changeset viewer.