source: issm/oecreview/Archive/12678-13393/ISSM-12865-12866.diff@ 13394

Last change on this file since 13394 was 13394, checked in by Mathieu Morlighem, 13 years ago

Added 12678-13393

File size: 5.4 KB
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/classes/objects/Elements/Tria.cpp

     
    930930                        input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
    931931                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    932932                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    933                         monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr
     933                        PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month]/yts; // converion in m/sec
    934934                }
    935935        }
    936936        /*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/
    937         this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime*yts);
    938         this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-21000)*yts);
    939         this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time*yts);
    940         this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime*yts);
    941         this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,(finaltime-21000)*yts);
    942         this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time*yts);
    943 
     937        this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime);
     938        this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-(21000*yts)));
     939        this->parameters->FindParam(&Delta18oTime,SurfaceforcingsDelta18oEnum,time);
     940        this->parameters->FindParam(&Delta18oSurfacePresent,SurfaceforcingsDelta18oSurfaceEnum,finaltime);
     941        this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,(finaltime-(21000*yts)));
     942        this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time);
     943       
    944944        /*Compute the temperature and precipitation*/
    945945        for(int iv=0;iv<NUMVERTICES;iv++){
    946946                ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime,
     
    949949                                        &TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0],
    950950                                        &monthlytemperatures[iv][0], &monthlyprec[iv][0]);
    951951        }
     952        //if(id==1)     printf(" monthlytemperatures1 %f\n",monthlytemperatures[iv][0]);
     953        //if(id==1)     printf(" monthlyprec1 %f\n",monthlyprec[iv][0]*yts);
    952954        /*Update inputs*/
    953955        TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
    954956        TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
    955957        for (int imonth=0;imonth<12;imonth++) {
    956                 for(int iv=0;iv<NUMVERTICES;iv++) {
    957                         TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[iv][imonth]);
    958                         NewTemperatureInput->AddTimeInput(newmonthinput1,imonth/12.*yts);
    959                         TriaP1Input* newmonthinput2 = new TriaP1Input(SurfaceforcingsPrecipitationEnum,&monthlyprec[iv][imonth]);
    960                         NewPrecipitationInput->AddTimeInput(newmonthinput2,imonth/12.*yts);
    961                 }
     958                        TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&TemperaturesPresentday[0][imonth]);
     959                        //TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[0][imonth]);
     960                        NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     961                        TriaP1Input* newmonthinput2 = new TriaP1Input(SurfaceforcingsPrecipitationEnum,&monthlyprec[0][imonth]);
     962                        NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
    962963        }
    963964        this->inputs->AddInput(NewTemperatureInput);
    964965        this->inputs->AddInput(NewPrecipitationInput);
     
    13841385void  Tria::InputToResult(int enum_type,int step,IssmDouble time){
    13851386
    13861387        int    i;
    1387         Input *input = NULL;
     1388        Input *input = NULL;   
    13881389
    13891390        /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
    13901391        if (enum_type==MaterialsRheologyBbarEnum) input=this->matice->inputs->GetInput(enum_type);
     
    21532154
    21542155   IssmDouble agd[NUMVERTICES];             // surface mass balance
    21552156   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    2156    IssmDouble h[NUMVERTICES],s[NUMVERTICES]; // ,b
     2157   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
    21572158   IssmDouble rho_water,rho_ice;
    21582159
    21592160   /*Recover monthly temperatures and precipitation*/
     
    21692170       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
    21702171       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
    21712172       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
    2172        monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr
     2173       monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion in m/y
    21732174     }
    21742175   }
    21752176
     
    21812182  rho_ice=matpar->GetRhoIce();
    21822183  rho_water=matpar->GetRhoFreshwater();
    21832184
     2185  //if(id==1) printf(" monthlytemperatures %f\n",monthlytemperatures[1][0]);
     2186  //if(id==1) printf("monthlyprec %f\n",monthlyprec[1][0]);
     2187
    21842188   /*measure the surface mass balance*/
    21852189   for (int iv = 0; iv<NUMVERTICES; iv++){
    21862190     agd[iv]=PddSurfaceMassBlance(&monthlytemperatures[iv][0], &monthlyprec[iv][0], pdds, pds, signorm, yts, h[iv], s[iv], rho_ice, rho_water);
Note: See TracBrowser for help on using the repository browser.