Changeset 27822


Ignore:
Timestamp:
07/11/23 14:05:03 (21 months ago)
Author:
Mathieu Morlighem
Message:

BUG: fixed problem with adaptive time stepping and cycling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp

    r27361 r27822  
    435435        /*First, recover current time from parameters: */
    436436        bool linear_interp,average,cycle;
     437        int  timestepping;
    437438        IssmDouble dt;
    438439        this->parameters->FindParam(&linear_interp,TimesteppingInterpForcingEnum);
     
    440441        this->parameters->FindParam(&cycle,TimesteppingCycleForcingEnum);
    441442        this->parameters->FindParam(&dt,TimesteppingTimeStepEnum);          /*transient core time step*/
     443        this->parameters->FindParam(&timestepping,TimesteppingTypeEnum);
    442444
    443445        if(cycle){
     
    447449                IssmDouble time1 = this->timesteps[this->numtimesteps - 1];
    448450
    449                 /*We need the end time to be the last timestep that would be taken*/
    450                 /* i.e., the case where GEMB has time stamps (finer timestep) after the last timestep */
    451                 IssmDouble nsteps = reCast<int,IssmDouble>(time1/dt);
    452                 if (reCast<IssmDouble>(nsteps)<time1/dt) nsteps=nsteps+1;
    453                 time1 = nsteps*dt;
     451                if(timestepping!=AdaptiveTimesteppingEnum){
     452                        /*We need the end time to be the last timestep that would be taken*/
     453                        /* i.e., the case where GEMB has time stamps (finer timestep) after the last timestep */
     454                        /* warning: this assumes dt = constant!!*/
     455                        IssmDouble nsteps = reCast<int,IssmDouble>(time1/dt);
     456                        if (reCast<IssmDouble>(nsteps)<time1/dt) nsteps=nsteps+1;
     457                        time1 = nsteps*dt;
     458                }
    454459
    455460                /*See by how many intervals we have to offset time*/
Note: See TracChangeset for help on using the changeset viewer.