Changeset 24366


Ignore:
Timestamp:
11/20/19 05:11:35 (5 years ago)
Author:
bdef
Message:

BUG: fixing temporal mean computation

File:
1 edited

Legend:

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

    r24359 r24366  
    280280        if(M!=iomodel->numberofvertices) _error_("not supported yet");
    281281        if(N!=num_inputs) _error_("sizes are not consistent");
    282        
     282
    283283
    284284        int        tria_vertex_ids[3];
     
    21282128        /*stack the input for each timestep in the slice*/
    21292129        int offset = start_offset;
    2130         while(offset <= end_offset ){
     2130        while(offset < end_offset ){
    21312131
    21322132                if(offset==-1){
     
    21422142                }
    21432143                else{
    2144                         TriaInput2* input = transient_input->GetTriaInput(offset);
     2144                        TriaInput2* input = transient_input->GetTriaInput(offset+1);
    21452145                        _assert_(input->GetInterpolation()==P1Enum);
    21462146                        this->InputServe(input);
     
    21552155                        dt = timesteps[0] - start_time;
    21562156                }
    2157                 else if(offset = numtimesteps-1){
     2157                else if(offset == numtimesteps-1){
    21582158                        dt = end_time - timesteps[offset];
    21592159                }
     
    21762176                                }
    21772177                                else{
    2178                                         for(int iv=0;iv<NUMVERTICES;iv++) averaged_values[iv] += dt*current_values[iv];
     2178                                        for(int iv=0;iv<NUMVERTICES;iv++) averaged_values[iv] *= dt*current_values[iv];
    21792179                                }
    21802180                                break;
     
    21892189                                        for(int iv=0;iv<NUMVERTICES;iv++){
    21902190                                                _assert_(current_values[iv]>1.e-50);
    2191                                                 averaged_values[iv]  = dt*1./current_values[iv];
     2191                                                averaged_values[iv]  += dt*1./current_values[iv];
    21922192                                        }
    21932193                                }
     
    38433843
    38443844        /*First, serarch the input: */
    3845         Input2* data=this->GetInput2(natureofdataenum); 
     3845        Input2* data=this->GetInput2(natureofdataenum);
    38463846
    38473847        /*figure out if we have the vertex id: */
     
    47594759        /*Get material parameters :*/
    47604760        rho_ice=FindParam(MaterialsRhoIceEnum);
    4761         Input2* floatingmelt_input = this->GetInput2(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
     4761        Input2* floatingmelt_input = this->GetInput2(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input);
    47624762        Input2* gllevelset_input   = this->GetInput2(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    47634763        Input2* scalefactor_input  = NULL;
    47644764        if(scaled==true){
    4765                 scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     4765                scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
    47664766        }
    47674767        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    48044804        /*Get material parameters :*/
    48054805        rho_ice=FindParam(MaterialsRhoIceEnum);
    4806         Input2* groundedmelt_input = this->GetInput2(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
     4806        Input2* groundedmelt_input = this->GetInput2(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input);
    48074807        Input2* gllevelset_input = this->GetInput2(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
    48084808        Input2* scalefactor_input = NULL;
    48094809        if(scaled==true){
    4810                 scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input); 
     4810                scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
    48114811        }
    48124812        ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
     
    52985298
    52995299        /*Compute ice thickness change: */
    5300         Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum); 
     5300        Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum);
    53015301        if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
    53025302        deltathickness_input->GetInputAverage(&I);
     
    54365436
    54375437        /*Compute ice thickness change: */
    5438         Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum); 
     5438        Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum);
    54395439        if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
    54405440        deltathickness_input->GetInputAverage(&I);
     
    56705670
    56715671                /*Compute ice thickness change: */
    5672                 Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
     5672                Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
    56735673                if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    56745674                deltathickness_input->GetInputAverage(&I);
     
    58065806
    58075807        /*Compute ice thickness change: */
    5808         Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
     5808        Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
    58095809        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    58105810
     
    61496149
    61506150        /*Compute ice thickness change: */
    6151         Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
     6151        Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
    61526152        if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
    61536153        deltathickness_input->GetInputAverage(&I);
Note: See TracChangeset for help on using the changeset viewer.