source: issm/oecreview/Archive/19101-20495/ISSM-19136-19137.diff@ 20498

Last change on this file since 20498 was 20498, checked in by Mathieu Morlighem, 9 years ago

CHG: done with Archive/19101-20495

File size: 5.5 KB
  • ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    25732573   int        i;
    25742574   IssmDouble agd[NUMVERTICES];             // surface mass balance
    25752575   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
     2576   IssmDouble yearlytemperatures[NUMVERTICES]={0.};
    25762577   IssmDouble tmp[NUMVERTICES];
    25772578   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
    25782579   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
    25792580   IssmDouble PfacTime,TdiffTime,sealevTime;
     2581   IssmDouble mavg=1./12.; //factor for monthly average
    25802582   
    25812583   /*Get material parameters :*/
    25822584   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
     
    25892591  rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
    25902592  rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
    25912593
    2592    /*Recover monthly temperatures and precipitation and Present day and LGm ones*/
     2594   /*Recover monthly temperatures and precipitation and compute the yearly mean temperatures*/
    25932595   Input*     input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
    25942596   Input*     input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
    25952597   GaussTria* gauss=new GaussTria();
     
    25972599   this->parameters->FindParam(&time,TimeEnum);
    25982600   this->parameters->FindParam(&yts,ConstantsYtsEnum);
    25992601
    2600 
    26012602   for(int month=0;month<12;month++) {
    26022603     for(int iv=0;iv<NUMVERTICES;iv++) {
    26032604       gauss->GaussVertex(iv);
    26042605       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
    2605        monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
     2606       yearlytemperatures[iv]=yearlytemperatures[iv]+monthlytemperatures[iv][month]*mavg; // Has to be in Kelvin
     2607       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius for PDD module
    26062608       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
    26072609     }
    2608    }
     2610   }     
    26092611
    26102612  /*Recover Pfac, Tdiff and sealev at time t:
    26112613    This parameters are used to interpolate the temperature
     
    26252627     
    26262628   /*measure the surface mass balance*/
    26272629  for (int iv = 0; iv<NUMVERTICES; iv++){
    2628      agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
     2630    agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
    26292631                                  pdds, pds, signorm, yts, h[iv], s[iv],
    26302632                                  desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
    26312633                                  rho_water,rho_ice);
    2632    }
     2634  }
    26332635
    26342636   /*Update inputs*/   
    26352637   // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
     
    26472649   // NewPrecipitationInput->Configure(this->parameters);
    26482650
    26492651
    2650    this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
     2652  this->inputs->AddInput(new TriaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
     2653  this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
    26512654   // this->inputs->AddInput(NewTemperatureInput);
    26522655   // this->inputs->AddInput(NewPrecipitationInput);
    26532656   // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
  • ../trunk-jpl/src/c/classes/Elements/Penta.cpp

     
    21652165   int        i;
    21662166   IssmDouble agd[NUMVERTICES];             // surface mass balance
    21672167   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
     2168   IssmDouble yearlytemperatures[NUMVERTICES]={0.};
    21682169   IssmDouble tmp[NUMVERTICES];
    21692170   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
    21702171   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
    21712172   IssmDouble PfacTime,TdiffTime,sealevTime;
     2173   IssmDouble mavg=1./12.; //factor for monthly average
    21722174
    21732175   /*Get material parameters :*/
    21742176   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
     
    21932195     for(int iv=0;iv<NUMVERTICES;iv++) {
    21942196       gauss->GaussVertex(iv);
    21952197       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
    2196        monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
     2198       yearlytemperatures[iv]=yearlytemperatures[iv]+monthlytemperatures[iv][month]*mavg; // Has to be in Kelvin
     2199       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius for PDD module
    21972200       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
    21982201     }
    21992202   }
     
    22402243
    22412244
    22422245
     2246   this->inputs->AddInput(new PentaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
    22432247   this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
    22442248   // this->inputs->AddInput(NewTemperatureInput);
    22452249   // this->inputs->AddInput(NewPrecipitationInput);
    22462250   // //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
    22472251    this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
     2252    this->InputExtrude(TemperatureEnum,-1);
    22482253   // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
    22492254   // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
    22502255
Note: See TracBrowser for help on using the repository browser.