Changeset 12640


Ignore:
Timestamp:
07/17/12 09:11:29 (13 years ago)
Author:
lemorzad
Message:

adding PddSurfaceMassBalance. Numerical calculation of PositiveDegreeDay

Location:
issm/trunk/src/c
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Makefile.am

    r12330 r12640  
    205205                                        ./shared/Elements/GetGlobalDofList.cpp\
    206206                                        ./shared/Elements/GetNumberOfDofs.cpp\
     207                                        ./shared/Elements/PddSurfaceMassBalance.cpp\
    207208                                        ./shared/String/sharedstring.h\
    208209                                        ./shared/Wrapper/wrappershared.h\
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r12630 r12640  
    22582258void  Penta::PositiveDegreeDay(double* pdds,double* pds,double signorm){
    22592259
    2260    int    i,iqj,imonth;
    2261    double agd[NUMVERTICES];  // surface mass balance
    2262    double saccu[NUMVERTICES] = {0};     // yearly surface accumulation
    2263    double smelt[NUMVERTICES] = {0};     // yearly melt
    2264    double precrunoff[NUMVERTICES];      // yearly runoff
    2265    double prect; // total precipitation during 1 year taking into account des. ef.
    2266    double water; //water=rain + snowmelt
    2267    double runoff; //meltwater only, does not include rain
    2268    double sconv; //rhow_rain/rhoi / 12 months
    2269 
    2270    double rho_water,rho_ice,density;
    2271    double lapser=6.5/1000., sealev=0.;    // lapse rate. degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
    2272    double desfac = 0.5;                 //desert elevation factor
    2273    double s0p[NUMVERTICES]={0};         //should be set to elevation from precip source
    2274    double s0t[NUMVERTICES]={0};         //should be set to elevation from temperature source
    2275    double st;             // elevation between altitude of the temp record and current altitude
    2276    double sp;             // elevation between altitude of the prec record and current altitude
    2277 
    2278    // PDD and PD constants and variables
    2279    double siglim;          // sigma limit for the integration which is equal to 2.5 sigmanorm
    2280    double signormc = signorm - 0.5;     // sigma of the temperature distribution for cloudy day
    2281    double siglimc, siglim0, siglim0c;
    2282    double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
    2283    double DT = 0.02;
    2284    double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
    2285    
    2286    double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
    2287    double qm[NUMVERTICES] = {0};        // snow part of the precipitation
    2288    double qmt[NUMVERTICES] = {0};       // precipitation without desertification effect adjustment
    2289    double qmp[NUMVERTICES] = {0};       // desertification taken into account
    2290    double pdd[NUMVERTICES] = {0};     
    2291    double frzndd[NUMVERTICES] = {0}; 
    2292 
    2293    double tstar;                        // monthly mean surface temp
    2294    double Tsum[NUMVERTICES]= {0};       // average summer (JJA) temperature
    2295    double Tsurf[NUMVERTICES] = {0};     // average annual temperature   
    2296    
    2297    double h[NUMVERTICES],s[NUMVERTICES]; // ,b[NUMVERTICES]
     2260   double agd[NUMVERTICES];             // surface mass balance
    22982261   double monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    2299    double deltm=1./12.;
    2300    int    ismon[12]={11,0,1,2,3,4,5,6,7,8,9,10};
    2301 
    2302    double snwm;  // snow that could have been melted in a year.
    2303    double snwmf; //  ablation factor for snow per positive degree day.
    2304    double smf;   //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
    2305 
    2306    double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
    2307    double supice,supcap,diffndd;
    2308    double fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
    2309    double pddtj[NUMVERTICES], hmx2;
    2310 
    2311    //printf("ok1p\n");
    2312    if(!IsOnBed()) return;
     2262   double h[NUMVERTICES],s[NUMVERTICES]; // ,b
     2263   double rho_water,rho_ice;
     2264   int    i;
    23132265
    23142266   /*Recover monthly temperatures and precipitation*/
     
    23282280     }
    23292281   }
    2330    /*Recover info a the vertices: */
    2331    GetInputListOnVertices(&h[0],ThicknessEnum);
    2332    GetInputListOnVertices(&s[0],SurfaceEnum);
    2333 
    2334    //printf("ok2p\n");
    2335 
    2336    /*Get material parameters :*/
    2337    rho_ice=matpar->GetRhoIce();
    2338    rho_water=matpar->GetRhoFreshwater();
    2339    
    2340    sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
    2341      
    2342      /*PDD constant*/
    2343    siglim = 2.5*signorm;
    2344    siglimc = 2.5*signormc;
    2345    siglim0 =  siglim/DT + 0.5;
    2346    siglim0c =  siglimc/DT + 0.5;
    2347    PDup = siglimc+PDCUT;
    2348    
    2349    // seasonal loop
    2350    for (iqj = 0; iqj < 12; iqj++){
    2351      imonth =  ismon[iqj];
    2352      for (i = 0; i < NUMVERTICES; i++){
    2353        st=(s[i]-s0t[i])/1000.;
    2354        tstar = monthlytemperatures[i][imonth] - lapser *max(st,sealev);
    2355        Tsurf[i] = tstar*deltm+Tsurf[i];       
    2356        
    2357        /*********compute PD ****************/
    2358        if (tstar < PDup){
    2359          pd = 1.;
    2360          if (tstar >= -siglimc){ pd = pds[int(tstar/DT + siglim0c)];}}
    2361        else {
    2362          pd = 0.;}
    2363        
    2364        /******exp des/elev precip reduction*******/
    2365        sp=(s[i]-s0p[i])/1000.; // deselev effect is wrt chng in topo
    2366        if (sp>0.0){q = exp(-desfac*sp);}
    2367        else {q = 1.0;}
    2368        
    2369        qmt[i]= qmt[i] + monthlyprec[i][imonth]*sconv;  //*sconv to convert in m of ice equivalent per month
    2370        qmpt= q*monthlyprec[i][imonth]*sconv;           
    2371        qmp[i]= qmp[i] + qmpt;
    2372        qm[i]= qm[i] + qmpt*pd;
    2373 
    2374        /*********compute PDD************/
    2375        // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
    2376        // gaussian=T_m, so ndd=-(Tsurf-pdd)
    2377        if (iqj>5 &&  iqj<9){ Tsum[i]=Tsum[i]+tstar;}
    2378        if (tstar >= siglim) {pdd[i] = pdd[i] + tstar*deltm;}
    2379        else if (tstar> -siglim){
    2380          pddsig=pdds[int(tstar/DT + siglim0)];
    2381          pdd[i] = pdd[i] + pddsig*deltm;
    2382          frzndd[i] = frzndd[i] - (tstar-pddsig)*deltm;}
    2383        else{frzndd[i] = frzndd[i] - tstar*deltm; }
    2384      }
    2385    } // end of seasonal loop
    2386    
    2387    //******************************************************************
    2388    for(i=0;i<NUMVERTICES;i++){
    2389      saccu[i] = qm[i];
    2390      prect = qmp[i];     // total precipitation during 1 year taking into account des. ef.
    2391      Tsum[i]=Tsum[i]/3;
    2392      
    2393      /***** determine PDD factors *****/
    2394      if(Tsum[i]< -1.) {
    2395        snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
    2396        smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
    2397      }
    2398      else if(Tsum[i]< 10){
    2399        snwmf = (0.15*Tsum[i] + 2.8)*0.001;
    2400        smf = (0.0067*pow((10.-Tsum[i]),3) + 8.3)*0.001;
    2401      }
    2402      else{
    2403        snwmf=4.3*0.001;
    2404        smf=8.3*0.001;
    2405      }
    2406      snwmf=0.95*snwmf;
    2407      smf=0.95*smf;
    2408      
    2409      /*****  compute PDD ablation and refreezing *****/
    2410      pddt = pdd[i] *365;
    2411      snwm = snwmf*pddt;       // snow that could have been melted in a year
    2412      hmx2 = min(h[i],dfrz);   // refreeze active layer max depth: dfrz
    2413      
    2414      if(snwm < saccu[i]) {
    2415        water=prect-saccu[i] + snwm; //water=rain + snowmelt
    2416        //     l 2.2= capillary factor
    2417        //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
    2418        //     dCovrLm concept is of warming of active layer (thickness =d@=1-
    2419        //     >2m)
    2420        //     problem with water seepage into ice: should be sealed after
    2421        //     refreezing
    2422        //     so everything needs to be predicated on 1 year scale, except for
    2423        //     thermal
    2424        //     conductivity through ice
    2425        //     also, need to account that melt season has low accum, so what's
    2426        //     going to
    2427        //     hold the meltwater around for refreezing? And melt-time will have
    2428        //     low seasonal frzndd
    2429        
    2430        //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
    2431        
    2432        supice= min(hmx2*CovrLm*frzndd[i]+2.2*(saccu[i]-snwm), water); // superimposed ice
    2433        supcap=min(2.2*(saccu[i]-snwm),water);
    2434        runoff=snwm - supice;  //meltwater only, does not include rain
    2435      }
    2436      else {  //all snow melted
    2437        supice= min(hmx2*CovrLm*frzndd[i], prect );
    2438        runoff= saccu[i] + smf*(pddt-saccu[i]/snwmf) - supice;
    2439        supcap=0;
    2440      }
    2441      //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
    2442      //     except pdd melt heat source is atmosphere, while refreeze is
    2443      //     ground/ice stored interim
    2444      //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
    2445      //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
    2446      //     <0
    2447      //     assume ndd>pdd, little melt => little supice
    2448      //     bottom line: compare for Tsurf<0 : supice and no supice case,
    2449      //     expect Tsurf difference
    2450      //     except some of cooling flux comes from atmosphere//
    2451      //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
    2452      //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
    2453      //     < 0.1
    2454      
    2455      //     make more sense to just use residual pdd-ndd except that pdd
    2456      //     residual not clear yet
    2457      //     frzndd should not be used up by refreezing in snow, so stick in
    2458      //     supcap.
    2459      diffndd=0;
    2460      if (frzndd[i]>0) {
    2461        diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd[i]);
    2462        frzndd[i]=frzndd[i]-diffndd;
    2463      }
    2464      if(runoff<0){
    2465        saccu[i]= saccu[i] -runoff;
    2466        smelt[i] = 0;
    2467        precrunoff[i]=prect-saccu[i];
    2468        //here assume pdd residual is 0, =>
    2469        Tsurf[i]= max(Tsurf[i],-frzndd[i]);
    2470      }
    2471      else {
    2472        smelt[i] = runoff;
    2473        precrunoff[i]=prect-max(0.,supice)-saccu[i];}
    2474      //here really need pdd balance, try 0.5 fudge factor?
    2475      //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
    2476      //yet from site plots, can be ice free with Tsurf=-5.5C
    2477      if(Tsurf[i]<0) {
    2478        Tsurf[i]= min(Tsurf[i]+fsupT*diffndd , 0.);}
    2479      
    2480      agd[i] = -smelt[i]+saccu[i];
    2481      agd[i] = agd[i]/yts;
    2482      pddtj[i]=pddt;
    2483    }//end of the for loop over the vertices
    2484 
    2485         /*Update inputs*/   
    2486         this->inputs->AddInput(new PentaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0]));
    2487         //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
    2488         this->InputExtrude(SurfaceforcingsMassBalanceEnum,ElementEnum);
     2282
     2283  /*Recover info at the vertices: */
     2284  GetInputListOnVertices(&h[0],ThicknessEnum);
     2285  GetInputListOnVertices(&s[0],SurfaceEnum);
     2286
     2287  /*Get material parameters :*/
     2288  rho_ice=matpar->GetRhoIce();
     2289  rho_water=matpar->GetRhoFreshwater();
     2290
     2291   /*measure the surface mass balance*/
     2292   for (i = 0; i < NUMVERTICES; i++){
     2293     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[0][0], &monthlyprec[0][0], i, pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
     2294   }
     2295
     2296   /*Update inputs*/   
     2297   this->inputs->AddInput(new PentaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0]));
     2298   //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
     2299   this->InputExtrude(SurfaceforcingsMassBalanceEnum,ElementEnum);
    24892300}
    24902301/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r12630 r12640  
    20892089void  Tria::PositiveDegreeDay(double* pdds,double* pds,double signorm){
    20902090
    2091    int    i,iqj,imonth;
    20922091   double agd[NUMVERTICES];             // surface mass balance
    2093    double saccu[NUMVERTICES] = {0};     // yearly surface accumulation
    2094    double smelt[NUMVERTICES] = {0};     // yearly melt
    2095    double precrunoff[NUMVERTICES];      // yearly runoff
    2096    double prect; // total precipitation during 1 year taking into account des. ef.
    2097    double water; //water=rain + snowmelt
    2098    double runoff; //meltwater only, does not include rain
    2099    double sconv; //rhow_rain/rhoi / 12 months
    2100 
    2101    double rho_water,rho_ice,density;
    2102    double lapser=6.5/1000., sealev=0.;    // lapse rate. degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
    2103    double desfac = 0.5;                 // desert elevation factor
    2104    double s0p[NUMVERTICES]={0};         // should be set to elevation from precip source
    2105    double s0t[NUMVERTICES]={0};         // should be set to elevation from temperature source
    2106    double st;             // elevation between altitude of the temp record and current altitude
    2107    double sp;             // elevation between altitude of the prec record and current altitude
    2108 
    2109    // PDD and PD constants and variables
    2110    double siglim;          // sigma limit for the integration which is equal to 2.5 sigmanorm
    2111    double signormc = signorm - 0.5;     // sigma of the temperature distribution for cloudy day
    2112    double siglimc, siglim0, siglim0c;
    2113    double PDup, pddsig, PDCUT = 2.0; // PDcut: rain/snow cutoff temperature (C)
    2114    double DT = 0.02;
    2115    double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
    2116    
    2117    double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
    2118    double qm[NUMVERTICES] = {0};        // snow part of the precipitation
    2119    double qmt[NUMVERTICES] = {0};       // precipitation without desertification effect adjustment
    2120    double qmp[NUMVERTICES] = {0};       // desertification taken into account
    2121    double pdd[NUMVERTICES] = {0};     
    2122    double frzndd[NUMVERTICES] = {0}; 
    2123 
    2124    double tstar;                        // monthly mean surface temp
    2125    double Tsum[NUMVERTICES]= {0};       // average summer (JJA) temperature
    2126    double Tsurf[NUMVERTICES] = {0};     // average annual temperature   
    2127    
    2128    double h[NUMVERTICES],s[NUMVERTICES]; // ,b[NUMVERTICES]
    21292092   double monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    2130    double deltm=1./12.;
    2131    int    ismon[12]={11,0,1,2,3,4,5,6,7,8,9,10};
    2132 
    2133    double snwm;  // snow that could have been melted in a year.
    2134    double snwmf; //  ablation factor for snow per positive degree day.
    2135    double smf;   //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002).
    2136 
    2137    double dfrz=1.5, CovrLm=2009./3.35e+5, dCovrLm=dfrz*CovrLm; //m*J kg^-1 C^-1 /(J kg^-1)=m/C yr
    2138    double supice,supcap,diffndd;
    2139    double fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
    2140    double pddtj[NUMVERTICES], hmx2;
    2141    
    2142    //printf("ok1t\n");
    2143    //if(!IsOnBed()) return;
    2144    //printf("ok2t\n");
     2093   double h[NUMVERTICES],s[NUMVERTICES]; // ,b
     2094   double rho_water,rho_ice;
     2095   int    i;
    21452096
    21462097   /*Recover monthly temperatures and precipitation*/
     
    21602111     }
    21612112   }
     2113
    21622114  /*Recover info at the vertices: */
    2163    GetInputListOnVertices(&h[0],ThicknessEnum);
    2164    GetInputListOnVertices(&s[0],SurfaceEnum);
    2165 
    2166    /*Get material parameters :*/
    2167    rho_ice=matpar->GetRhoIce();
    2168    rho_water=matpar->GetRhoFreshwater();
    2169    
    2170    sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
    2171      
    2172      /*PDD constant*/
    2173    siglim = 2.5*signorm;
    2174    siglimc = 2.5*signormc;
    2175    siglim0 = siglim/DT + 0.5;
    2176    siglim0c = siglimc/DT + 0.5;
    2177    PDup = siglimc+PDCUT;
    2178    
    2179    // seasonal loop
    2180    for (iqj = 0; iqj < 12; iqj++){
    2181      imonth =  ismon[iqj];
    2182      for (i = 0; i < NUMVERTICES; i++){
    2183        st=(s[i]-s0t[i])/1000.;
    2184        tstar = monthlytemperatures[i][imonth] - lapser *max(st,sealev);
    2185        Tsurf[i] = tstar*deltm+Tsurf[i];       
    2186        
    2187        /*********compute PD ****************/
    2188        if (tstar < PDup){
    2189          pd = 1.;
    2190          if (tstar >= -siglimc){ pd = pds[int(tstar/DT + siglim0c)];}}
    2191        else {
    2192          pd = 0.;}
    2193        
    2194        /******exp des/elev precip reduction*******/
    2195        sp=(s[i]-s0p[i])/1000.; // deselev effect is wrt chng in topo
    2196        if (sp>0.0){q = exp(-desfac*sp);}
    2197        else {q = 1.0;}
    2198        
    2199        qmt[i]= qmt[i] + monthlyprec[i][imonth]*sconv;  //*sconv to convert in m of ice equivalent per month
    2200        qmpt= q*monthlyprec[i][imonth]*sconv;           
    2201        qmp[i]= qmp[i] + qmpt;
    2202        qm[i]= qm[i] + qmpt*pd;
    2203 
    2204        /*********compute PDD************/
    2205        // ndd(month)=-(tstar-pdd(month)) since ndd+pdd gives expectation of
    2206        // gaussian=T_m, so ndd=-(Tsurf-pdd)
    2207        if (iqj>5 &&  iqj<9){ Tsum[i]=Tsum[i]+tstar;}
    2208        if (tstar >= siglim) {pdd[i] = pdd[i] + tstar*deltm;}
    2209        else if (tstar> -siglim){
    2210          pddsig=pdds[int(tstar/DT + siglim0)];
    2211          pdd[i] = pdd[i] + pddsig*deltm;
    2212          frzndd[i] = frzndd[i] - (tstar-pddsig)*deltm;}
    2213        else{frzndd[i] = frzndd[i] - tstar*deltm; }
    2214      }
    2215    } // end of seasonal loop
    2216  
    2217    //******************************************************************
    2218    for(i=0;i<NUMVERTICES;i++){
    2219      saccu[i] = qm[i];
    2220      prect = qmp[i];     // total precipitation during 1 year taking into account des. ef.
    2221      Tsum[i]=Tsum[i]/3;
    2222      
    2223      /***** determine PDD factors *****/
    2224      if(Tsum[i]< -1.) {
    2225        snwmf=2.65*0.001;   //  ablation factor for snow per positive degree day.*0.001 to go from mm to m/ppd
    2226        smf=17.22*0.001;    //  ablation factor for ice per pdd (Braithwaite 1995 from tarasov 2002)
    2227      }
    2228      else if(Tsum[i]< 10){
    2229        snwmf = (0.15*Tsum[i] + 2.8)*0.001;
    2230        smf = (0.0067*pow((10.-Tsum[i]),3) + 8.3)*0.001;
    2231      }
    2232      else{
    2233        snwmf=4.3*0.001;
    2234        smf=8.3*0.001;
    2235      }
    2236      snwmf=0.95*snwmf;
    2237      smf=0.95*smf;
    2238      
    2239      /*****  compute PDD ablation and refreezing *****/
    2240      pddt = pdd[i] *365;
    2241      snwm = snwmf*pddt;       // snow that could have been melted in a year
    2242      hmx2 = min(h[i],dfrz);   // refreeze active layer max depth: dfrz
    2243      
    2244      if(snwm < saccu[i]) {
    2245        water=prect-saccu[i] + snwm; //water=rain + snowmelt
    2246        //     l 2.2= capillary factor
    2247        //     Should refreezing be controlled by frzndd or by mean annual Tsurf?
    2248        //     dCovrLm concept is of warming of active layer (thickness =d@=1-
    2249        //     >2m)
    2250        //     problem with water seepage into ice: should be sealed after
    2251        //     refreezing
    2252        //     so everything needs to be predicated on 1 year scale, except for
    2253        //     thermal
    2254        //     conductivity through ice
    2255        //     also, need to account that melt season has low accum, so what's
    2256        //     going to
    2257        //     hold the meltwater around for refreezing? And melt-time will have
    2258        //     low seasonal frzndd
    2259        
    2260        //      Superimposed ice :  Pfeffer et al. 1991, Tarasov 2002
    2261        
    2262        supice= min(hmx2*CovrLm*frzndd[i]+2.2*(saccu[i]-snwm), water); // superimposed ice
    2263        supcap=min(2.2*(saccu[i]-snwm),water);
    2264        runoff=snwm - supice;  //meltwater only, does not include rain
    2265      }
    2266      else {  //all snow melted
    2267        supice= min(hmx2*CovrLm*frzndd[i], prect );
    2268        runoff= saccu[i] + smf*(pddt-saccu[i]/snwmf) - supice;
    2269        supcap=0;
    2270      }
    2271      //     pdd melting doesn't cool Tsurf, so ndd refreeze shouldn't warm it
    2272      //     except pdd melt heat source is atmosphere, while refreeze is
    2273      //     ground/ice stored interim
    2274      //     assume pdd=ndd, then melt should equal refreeze and Tsurf should=0
    2275      //     assume ndd=2*pdd, then all supice is refrozen, but Tsurf should be
    2276      //     <0
    2277      //     assume ndd>pdd, little melt => little supice
    2278      //     bottom line: compare for Tsurf<0 : supice and no supice case,
    2279      //     expect Tsurf difference
    2280      //     except some of cooling flux comes from atmosphere//
    2281      //     1 dm supice should not raise Tsurf by 1/dCovrLm = 16.675C
    2282      //     does supice make sense when H< 0.1m? then d=thermoactive ice layer ////
    2283      //     < 0.1
    2284      
    2285      //     make more sense to just use residual pdd-ndd except that pdd
    2286      //     residual not clear yet
    2287      //     frzndd should not be used up by refreezing in snow, so stick in
    2288      //     supcap.
    2289      diffndd=0;
    2290      if (frzndd[i]>0) {
    2291        diffndd=fsupndd*min((supice-supcap)/dCovrLm ,frzndd[i]);
    2292        frzndd[i]=frzndd[i]-diffndd;
    2293      }
    2294      if(runoff<0){
    2295        saccu[i]= saccu[i] -runoff;
    2296        smelt[i] = 0;
    2297        precrunoff[i]=prect-saccu[i];
    2298        //here assume pdd residual is 0, =>
    2299        Tsurf[i]= max(Tsurf[i],-frzndd[i]);
    2300      }
    2301      else {
    2302        smelt[i] = runoff;
    2303        precrunoff[i]=prect-max(0.,supice)-saccu[i];}
    2304      //here really need pdd balance, try 0.5 fudge factor?
    2305      //at least runoff>0 => it's fairly warm, so Tsurf is !<<0,
    2306      //yet from site plots, can be ice free with Tsurf=-5.5C
    2307      if(Tsurf[i]<0) {
    2308        Tsurf[i]= min(Tsurf[i]+fsupT*diffndd , 0.);}
    2309  
    2310      agd[i] = -smelt[i]+saccu[i];
    2311      agd[i] = agd[i]/yts;
    2312      pddtj[i]=pddt;
    2313 
    2314    } //end of the for loop over the vertices
    2315 
    2316         /*Update inputs*/   
    2317         this->inputs->AddInput(new TriaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0]));
    2318         // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
     2115  GetInputListOnVertices(&h[0],ThicknessEnum);
     2116  GetInputListOnVertices(&s[0],SurfaceEnum);
     2117
     2118  /*Get material parameters :*/
     2119  rho_ice=matpar->GetRhoIce();
     2120  rho_water=matpar->GetRhoFreshwater();
     2121
     2122   /*measure the surface mass balance*/
     2123   for (i = 0; i < NUMVERTICES; i++){
     2124     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[0][0], &monthlyprec[0][0], i, pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
     2125   }
     2126
     2127   /*Update inputs*/   
     2128   this->inputs->AddInput(new TriaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0]));
     2129   // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
    23192130}
    23202131/*}}}*/
  • issm/trunk/src/c/shared/Elements/elements.h

    r12330 r12640  
    1313double Paterson(double temperature);
    1414double Arrhenius(double temperature,double depth,double n);
     15double PddSurfaceMassBlance(double* monthlytemperatures,  double* monthlyprec, int i, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water);
    1516void   GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices);
    1617int    GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum);
Note: See TracChangeset for help on using the changeset viewer.