Ignore:
Timestamp:
04/16/12 14:48:34 (13 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk and trunk-jpl

Location:
issm/trunk-jpl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl

    • Property svn:ignore
      • TabularUnified  

        old new  
        77config.status
        88configure
        9 doxygen
        109ISSM.paf
        1110ISSM.ppf
        1211ISSM.ppf_cache
        1312libtool
        14 list
        1513Makefile
        1614Makefile.in
        1715stamp-h1
        1816svn-commit*
        19 nightlylog
    • Property svn:mergeinfo changed
      /issm/trunkmerged: 11526,​11533,​11681-11682,​11710,​11778-11779
  • TabularUnified issm/trunk-jpl/src/c/objects/Elements/Penta.cpp

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