Changeset 12299


Ignore:
Timestamp:
05/29/12 13:58:10 (13 years ago)
Author:
Mathieu Morlighem
Message:

Recover monthly temperatures for PDD module

Location:
issm/trunk/src/c/objects
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r12294 r12299  
    22552255   double sp;             // elevation between altitude of the prec record and current altitude
    22562256
    2257 
    22582257   // PDD and PD constants and variables
    22592258   double siglim;          // sigma limit for the integration which is equal to 2.5 sigmanorm
     
    22952294   GetInputListOnVertices(&prectmp[0],SurfaceforcingsPrecipitationEnum);
    22962295
    2297    for(i=0;i<NUMVERTICES;i++) ttmp[i]=ttmp[i]-273.15; // convertion from Kelvin to celcius
     2296        /*Recover monthly temperatures*/
     2297        Input* input=inputs->GetInput(SurfaceforcingsMonthlytemperatures); _assert_(input);
     2298        GaussTria* gauss=new GaussTria();
     2299        double time,yts;
     2300        this->parameters->FindParam(&time,TimeEnum);
     2301        this->parameters->FindParam(&yts,ConstantsYtsEnum);
     2302        for(int month=0;month<12;month++){
     2303                for(int iv=0;iv<NUMVERTICES;iv++){
     2304                        gauss->GaussVertex(iv);
     2305                        input->GetInputValue(&t[iv][month],gauss,time+month/12*yts);
     2306                        t[iv][month]=t[iv][month]-273.15; // conversion from Kelvin to celcius
     2307                }
     2308        }
    22982309
    22992310   for(i=0;i<NUMVERTICES;i++)
  • issm/trunk/src/c/objects/Inputs/BoolInput.h

    r11995 r12299  
    5454                void GetInputValue(double* pvalue);
    5555                void GetInputValue(double* pvalue,GaussTria* gauss);
     56                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5657                void GetInputValue(double* pvalue,GaussPenta* gauss);
    5758                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/ControlInput.h

    r11995 r12299  
    5959                void GetInputValue(double* pvalue);
    6060                void GetInputValue(double* pvalue,GaussTria* gauss);
     61                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    6162                void GetInputValue(double* pvalue,GaussPenta* gauss);
    6263                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/DatasetInput.h

    r11995 r12299  
    5454                void GetInputValue(double* pvalue){_error_("not implemented yet");};
    5555                void GetInputValue(double* pvalue,GaussTria* gauss){_error_("not implemented yet");};
     56                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5657                void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
    5758                void GetInputValue(double* pvalue,GaussTria* gauss ,int index);
  • issm/trunk/src/c/objects/Inputs/DoubleInput.h

    r11995 r12299  
    5353                void GetInputValue(double* pvalue);
    5454                void GetInputValue(double* pvalue,GaussTria* gauss);
     55                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5556                void GetInputValue(double* pvalue,GaussPenta* gauss);
    5657                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/Input.h

    r11995 r12299  
    2727                virtual void GetInputValue(double* pvalue)=0;
    2828                virtual void GetInputValue(double* pvalue,GaussTria* gauss)=0;
     29                virtual void GetInputValue(double* pvalue,GaussTria* gauss,double time)=0;
    2930                virtual void GetInputValue(double* pvalue,GaussPenta* gauss)=0;
    3031                virtual void GetInputValue(double* pvalue,GaussTria* gauss ,int index)=0;
  • issm/trunk/src/c/objects/Inputs/IntInput.h

    r11995 r12299  
    5454                void GetInputValue(double* pvalue);
    5555                void GetInputValue(double* pvalue,GaussTria* gauss);
     56                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5657                void GetInputValue(double* pvalue,GaussPenta* gauss);
    5758                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/PentaP1Input.h

    r11995 r12299  
    5454                void GetInputValue(double* pvalue){_error_("not implemented yet");};
    5555                void GetInputValue(double* pvalue,GaussTria* gauss){_error_("not implemented yet");};
     56                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5657                void GetInputValue(double* pvalue,GaussPenta* gauss);
    5758                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/TransientInput.cpp

    r11995 r12299  
    22 * \brief: implementation of the TransientInput object
    33 */
    4 /*Headers{{{1*/
     4/*Headers{{{*/
    55#ifdef HAVE_CONFIG_H
    66        #include <config.h>
     
    1919
    2020/*TransientInput constructors and destructor*/
    21 /*FUNCTION TransientInput::TransientInput(){{{1*/
     21/*FUNCTION TransientInput::TransientInput(){{{*/
    2222TransientInput::TransientInput(){
    2323
     
    3030}
    3131/*}}}*/
    32 /*FUNCTION TransientInput::TransientInput(int in_enum_type){{{1*/
     32/*FUNCTION TransientInput::TransientInput(int in_enum_type){{{*/
    3333TransientInput::TransientInput(int in_enum_type)
    3434{
     
    4444}
    4545/*}}}*/
    46 /*FUNCTION TransientInput::~TransientInput{{{1*/
     46/*FUNCTION TransientInput::~TransientInput{{{*/
    4747TransientInput::~TransientInput(){
    4848        xfree((void**)&this->timesteps);
     
    5454}
    5555/*}}}*/
    56 /*FUNCTION void TransientInput::AddTimeInput(Input* input,double time){{{1*/
    57 void TransientInput::AddTimeInput(Input* input,double time){
    58 
    59         /*insert values at time step: */
    60         if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _assert_("timestep values must increase sequentially");
    61 
    62         //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input);
    63    double* old_timesteps=NULL;
    64 
    65         if (this->numtimesteps > 0){
    66                 old_timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
    67                 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(double));
    68                 xfree((void**)&this->timesteps);
    69         }
    70 
    71         this->numtimesteps=this->numtimesteps+1;
    72    this->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
    73 
    74         if (this->numtimesteps > 1){
    75                 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(double));
    76                 xfree((void**)&old_timesteps);
    77         }
    78 
    79         /*go ahead and plug: */
    80         this->timesteps[this->numtimesteps-1]=time;
    81         inputs->AddObject(input);
    82 
    83 }
    84 /*}}}*/
    8556
    8657/*Object virtual functions definitions:*/
    87 /*FUNCTION TransientInput::Echo {{{1*/
     58/*FUNCTION TransientInput::Echo {{{*/
    8859void TransientInput::Echo(void){
    8960        this->DeepEcho();
    9061}
    9162/*}}}*/
    92 /*FUNCTION TransientInput::DeepEcho{{{1*/
     63/*FUNCTION TransientInput::DeepEcho{{{*/
    9364void TransientInput::DeepEcho(void){
    9465
     
    10576}
    10677/*}}}*/
    107 /*FUNCTION TransientInput::Id{{{1*/
     78/*FUNCTION TransientInput::Id{{{*/
    10879int    TransientInput::Id(void){ return -1; }
    10980/*}}}*/
    110 /*FUNCTION TransientInput::MyRank{{{1*/
     81/*FUNCTION TransientInput::MyRank{{{*/
    11182int    TransientInput::MyRank(void){
    11283        extern int my_rank;
     
    11586/*}}}*/
    11687#ifdef _SERIAL_
    117 /*FUNCTION TransientInput::Marshall{{{1*/
     88/*FUNCTION TransientInput::Marshall{{{*/
    11889void  TransientInput::Marshall(char** pmarshalled_dataset){
    11990
     
    149120}
    150121/*}}}*
    151 /*FUNCTION TransientInput::MarshallSize{{{1*/
     122/*FUNCTION TransientInput::MarshallSize{{{*/
    152123int   TransientInput::MarshallSize(){
    153124
     
    160131}
    161132/*}}}*/
    162 /*FUNCTION TransientInput::Demarshall{{{1*/
     133/*FUNCTION TransientInput::Demarshall{{{*/
    163134void  TransientInput::Demarshall(char** pmarshalled_dataset){
    164135
     
    187158/*}}}*/
    188159#endif
    189 /*FUNCTION TransientInput::ObjectEnum{{{1*/
     160/*FUNCTION TransientInput::ObjectEnum{{{*/
    190161int TransientInput::ObjectEnum(void){
    191162
     
    194165}
    195166/*}}}*/
    196 /*FUNCTION TransientInput::copy{{{1*/
     167/*FUNCTION TransientInput::copy{{{*/
    197168Object* TransientInput::copy() {
    198169
     
    213184       
    214185/*TransientInput management*/
    215 /*FUNCTION TransientInput::InstanceEnum{{{1*/
     186/*FUNCTION TransientInput::InstanceEnum{{{*/
    216187int TransientInput::InstanceEnum(void){
    217188
     
    220191}
    221192/*}}}*/
    222 /*FUNCTION TransientInput::SpawnTriaInput{{{1*/
     193/*FUNCTION TransientInput::SpawnTriaInput{{{*/
    223194Input* TransientInput::SpawnTriaInput(int* indices){
    224195
     
    240211}
    241212/*}}}*/
    242 /*FUNCTION TransientInput::SpawnResult{{{1*/
     213/*FUNCTION TransientInput::SpawnResult{{{*/
    243214ElementResult* TransientInput::SpawnResult(int step, double time){
    244215
     
    258229
    259230/*Object functions*/
    260 /*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){{{1*/
     231/*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){{{*/
    261232void TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){
    262        
    263233        double time;
    264234
     
    273243
    274244        delete input;
    275 
    276 }
    277 /*}}}*/
    278 /*FUNCTION TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){{{1*/
     245}
     246/*}}}*/
     247/*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss,double time){{{*/
     248void TransientInput::GetInputValue(double* pvalue,GaussTria* gauss,double time){
     249
     250        /*Retrieve interpolated values for this time step: */
     251        Input* input=GetTimeInput(time);
     252
     253        /*Call input function*/
     254        input->GetInputValue(pvalue,gauss);
     255
     256        delete input;
     257}
     258/*}}}*/
     259/*FUNCTION TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){{{*/
    279260void TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){
    280261
     
    294275}
    295276/*}}}*/
    296 /*FUNCTION TransientInput::ChangeEnum{{{1*/
     277/*FUNCTION TransientInput::ChangeEnum{{{*/
    297278void TransientInput::ChangeEnum(int newenumtype){
    298279        this->enum_type=newenumtype;
    299280}
    300281/*}}}*/
    301 /*FUNCTION TransientInput::GetInputAverage{{{1*/
     282/*FUNCTION TransientInput::GetInputAverage{{{*/
    302283void TransientInput::GetInputAverage(double* pvalue){
    303284       
     
    319300
    320301/*Intermediary*/
    321 /*FUNCTION TransientInput::SquareMin{{{1*/
     302/*FUNCTION TransientInput::AddTimeInput{{{*/
     303void TransientInput::AddTimeInput(Input* input,double time){
     304
     305        /*insert values at time step: */
     306        if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _assert_("timestep values must increase sequentially");
     307
     308        //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input);
     309        double* old_timesteps=NULL;
     310
     311        if (this->numtimesteps > 0){
     312                old_timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
     313                memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(double));
     314                xfree((void**)&this->timesteps);
     315        }
     316
     317        this->numtimesteps=this->numtimesteps+1;
     318        this->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
     319
     320        if (this->numtimesteps > 1){
     321                memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(double));
     322                xfree((void**)&old_timesteps);
     323        }
     324
     325        /*go ahead and plug: */
     326        this->timesteps[this->numtimesteps-1]=time;
     327        inputs->AddObject(input);
     328
     329}
     330/*}}}*/
     331/*FUNCTION TransientInput::SquareMin{{{*/
    322332void TransientInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){
    323333
     
    337347}
    338348/*}}}*/
    339 /*FUNCTION TransientInput::InfinityNorm{{{1*/
     349/*FUNCTION TransientInput::InfinityNorm{{{*/
    340350double TransientInput::InfinityNorm(void){
    341351
     
    357367}
    358368/*}}}*/
    359 /*FUNCTION TransientInput::Max{{{1*/
     369/*FUNCTION TransientInput::Max{{{*/
    360370double TransientInput::Max(void){
    361371
     
    377387}
    378388/*}}}*/
    379 /*FUNCTION TransientInput::MaxAbs{{{1*/
     389/*FUNCTION TransientInput::MaxAbs{{{*/
    380390double TransientInput::MaxAbs(void){
    381391
     
    398408}
    399409/*}}}*/
    400 /*FUNCTION TransientInput::Min{{{1*/
     410/*FUNCTION TransientInput::Min{{{*/
    401411double TransientInput::Min(void){
    402412
     
    419429}
    420430/*}}}*/
    421 /*FUNCTION TransientInput::MinAbs{{{1*/
     431/*FUNCTION TransientInput::MinAbs{{{*/
    422432double TransientInput::MinAbs(void){
    423433
     
    439449}
    440450/*}}}*/
    441 /*FUNCTION TransientInput::GetVectorFromInputs{{{1*/
     451/*FUNCTION TransientInput::GetVectorFromInputs{{{*/
    442452void TransientInput::GetVectorFromInputs(Vector* vector,int* doflist){
    443453
     
    456466
    457467} /*}}}*/
    458 /*FUNCTION TransientInput::GetTimeInput{{{1*/
     468/*FUNCTION TransientInput::GetTimeInput{{{*/
    459469Input* TransientInput::GetTimeInput(double intime){
    460470
     
    515525}
    516526/*}}}*/
    517 /*FUNCTION TransientInput::Configure{{{1*/
     527/*FUNCTION TransientInput::Configure{{{*/
    518528void TransientInput::Configure(Parameters* parameters){
    519529        this->parameters=parameters;
  • issm/trunk/src/c/objects/Inputs/TransientInput.h

    r11995 r12299  
    5656                void GetInputValue(double* pvalue){_error_("not implemented yet");};
    5757                void GetInputValue(double* pvalue,GaussTria* gauss);
     58                void GetInputValue(double* pvalue,GaussTria* gauss,double time);
    5859                void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
    5960                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
  • issm/trunk/src/c/objects/Inputs/TriaP1Input.h

    r11995 r12299  
    5454                void GetInputValue(double* pvalue){_error_("not implemented yet");}
    5555                void GetInputValue(double* pvalue,GaussTria* gauss);
     56                void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");};
    5657                void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");};
    5758                void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
Note: See TracChangeset for help on using the changeset viewer.