Changeset 19583


Ignore:
Timestamp:
09/25/15 09:12:29 (9 years ago)
Author:
Eric.Larour
Message:

CHG: finalized SMBgemb method and validated against Alex Gardner's model.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r19567 r19583  
    21642164        int         m;
    21652165        IssmDouble  SmbMassBalance=0;
     2166        int         count=0;
    21662167        /*}}}*/
    21672168
     
    22462247                a = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aSnow;         //set albedo equal to fresh snow [fraction]
    22472248                T = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean;         //set initial grid cell temperature to the annual mean temperature [K]
    2248                 swf = xNewZeroInit<IssmDouble>(m);
    22492249
    22502250                //fixed lower temperatuer bounday condition - T is fixed
     
    22652265                DoubleArrayInput* a_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbAEnum));_assert_(a_input);
    22662266                DoubleArrayInput* T_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbTEnum));_assert_(T_input);
    2267                 DoubleArrayInput* swf_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbSwfEnum));_assert_(swf_input);
    22682267               
    22692268                /*Recover arrays: */
     
    22772276                a_input->GetValues(&a,&m);
    22782277                T_input->GetValues(&T,&m);
    2279                 swf_input->GetValues(&swf,&m);
     2278               
     2279                //fixed lower temperatuer bounday condition - T is fixed
     2280                T_bottom=T[m-1];
    22802281
    22812282        } /*}}}*/
     
    22922293
    22932294        /*Start loop: */
     2295        count=1;
    22942296        for (t=time;t<=time+dt;t=t+smb_dt){
    22952297
    2296                 if(VerboseSmb() && this->Sid()==0 && IssmComm::GetRank()==0)_printf0_("Time: t=" << setprecision(8) << t/365.0/24.0/3600.0 << " yr/" << (time+dt)/365.0/24.0/3600.0 << " yr" << "\n");
     2298                if(VerboseSmb() && this->Sid()==0 && IssmComm::GetRank()==0)_printf0_("Time: t=" << setprecision(8) << t/365.0/24.0/3600.0 << " yr/" << (time+dt)/365.0/24.0/3600.0 << " yr" << setprecision(3) << " Step: " << count << "\n");
    22972299
    22982300                /*extract daily data:{{{*/
     
    23152317                                       
    23162318                /*Distribution of absorbed short wave radation with depth:*/
    2317         if(isshortwave)shortwave(swf, swIdx, aIdx, dsw, a[0], d, dz, re,m,this->Sid());
     2319        if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, a[0], d, dz, re,m,this->Sid());
    23182320               
     2321                /*Calculate net shortwave [W m-2]*/
     2322        netSW = cellsum(swf,m);
     2323
    23192324                /*Thermal profile computation:*/
    23202325        if(isthermal)thermo(&EC, T, dz, d, swf, dlw, Ta, V, eAir, pAir, W[0], smb_dt, m, Vz, Tz,this->Sid());     
     
    23382343        ulw = 5.67E-8 * pow(T[0],4.0);
    23392344
    2340                 /*Calculate net shortwave and longwave [W m-2]*/
    2341         netSW = cellsum(swf,m);
     2345                /*Calculate net longwave [W m-2]*/
    23422346        netLW = dlw - ulw;
    23432347               
    23442348                /*Calculate turbulent heat fluxes [W m-2]*/
    23452349        if(isturbulentflux)turbulentFlux(&shf, &lhf, &dayEC, Ta, T[0], V, eAir, pAir, d[0], W[0], Vz, Tz,this->Sid());
     2350               
     2351                /*Verbose some resuls in debug mode: {{{*/
     2352                if(VerboseSmb() && 0){
     2353                        _printf_("smb log: count[" << count << "] m[" << m << "] "
     2354                                << setprecision(16)   << "T[" << cellsum(T,m)  << "] "
     2355                                                          << "d[" << cellsum(d,m)  << "] "
     2356                                                          << "dz[" << cellsum(dz,m)  << "] "
     2357                                                          << "a[" << cellsum(a,m)  << "] "
     2358                                                          << "W[" << cellsum(W,m)  << "] "
     2359                                                          << "re[" << cellsum(re,m)  << "] "
     2360                                                          << "gdn[" << cellsum(gdn,m)  << "] "
     2361                                                          << "gsp[" << cellsum(gsp,m)  << "] "
     2362                                                          << "swf[" << netSW << "] "
     2363                                                                          << "\n");
     2364                } /*}}}*/
    23462365               
    23472366                /*Sum component mass changes [kg m-2]*/
     
    23592378
    23602379                /*Check mass conservation:*/
    2361         if(!VerboseSmb())if (dMass != 0.0) _printf_("total system mass not conserved in MB function");
     2380        if (dMass != 0.0) _printf_("total system mass not conserved in MB function");
    23622381               
    23632382                /*Check bottom grid cell T is unchanged:*/
    2364         if(!VerboseSmb())if (T[m-1]!=T_bottom) _printf_("T(end)~=T_bottom" << "\n");
     2383        if (T[m-1]!=T_bottom) _printf_("T(end)~=T_bottom" << "\n");
    23652384               
    23662385                SmbMassBalance += sumP + sumEC - sumR; //increment SMB for the entire time span of ice-flow dynamics.
    23672386
     2387                count++;
    23682388
    23692389        } //for (t=time;t<=time+dt;t=t+smb_dt)
     
    23922412        xDelete<IssmDouble>(a);
    23932413        xDelete<IssmDouble>(T);
     2414        xDelete<IssmDouble>(swf);
     2415        delete gauss;
    23942416        /*}}}*/
    23952417}
Note: See TracChangeset for help on using the changeset viewer.