diff --git a/src/ASM/TimeDomain.h b/src/ASM/TimeDomain.h index 5c75cb74..343da0ac 100644 --- a/src/ASM/TimeDomain.h +++ b/src/ASM/TimeDomain.h @@ -23,16 +23,12 @@ struct TimeDomain { double t; //!< Current time (or pseudo time, load parameter) double dt; //!< Current time (or load parameter) increment + double CFL; //!< Current CFL number (used by CFD simulators) int it; //!< Current iteration within current time/load step bool first; //!< If \e true, this is the first load/time step - bool useCFL; //!< If timestep limited by CFL - double CFL; //!< Current CFL number - double maxCFL; //!< CFL restriction - //! \brief Default constructor. -TimeDomain(int i = 0, bool f = true) : it(i), first(f) - { t = dt = CFL = 0.0; maxCFL = 1.0; useCFL = false; } + TimeDomain(int i = 0, bool f = true) : it(i), first(f) { t = dt = CFL = 0.0; } }; #endif diff --git a/src/SIM/SIMparameters.C b/src/SIM/SIMparameters.C index fc975e4c..78a6372e 100644 --- a/src/SIM/SIMparameters.C +++ b/src/SIM/SIMparameters.C @@ -16,6 +16,7 @@ void SIMparameters::initTime (double start, double stop, const TimeSteps& steps) { + maxCFL = 0.0; starTime = start; stopTime = stop; mySteps = steps; @@ -38,11 +39,10 @@ bool SIMparameters::multiSteps () const bool SIMparameters::increment () { - // Adjust timestep according to CFL number - if (time.useCFL && time.CFL > 1.0e-12) - time.dt = time.maxCFL*time.dt/time.CFL; - - if (stepIt != mySteps.end()) + if (maxCFL > 0.0 && time.CFL > 1.0e-12) + // Adjust time step size according to CFL number + time.dt *= maxCFL/time.CFL; + else if (stepIt != mySteps.end()) if (++lstep <= stepIt->first.size()) time.dt = stepIt->first[lstep-1]; diff --git a/src/SIM/SIMparameters.h b/src/SIM/SIMparameters.h index a0ffee11..b5ed35af 100644 --- a/src/SIM/SIMparameters.h +++ b/src/SIM/SIMparameters.h @@ -28,7 +28,6 @@ class SIMparameters public: //! \brief The constructor initializes the counters to zero. SIMparameters() : step(0), iter(time.it), lstep(0) { stepIt = mySteps.end(); } - //! \brief Empty destructor. virtual ~SIMparameters() {} @@ -49,13 +48,14 @@ public: int& iter; //!< Iteration counter TimeDomain time; //!< Time domain data - double starTime; //!< Start (pseudo)time of simulation - double stopTime; //!< Stop (pseudo)time of simulation - TimeSteps mySteps; //!< Time step definitions + double starTime; //!< Start (pseudo)time of simulation + double stopTime; //!< Stop (pseudo)time of simulation + double maxCFL; //!< CFL restriction on time step size (0.0: no restriction) private: size_t lstep; //!< Local step counter, i.e., within current \a *stepIt + TimeSteps mySteps; //!< Time step definitions TimeSteps::iterator stepIt; //!< Running iterator over the time steps };