FSI update: Some modifications to ensure the mesh mover simulator always gets the same time increment as the CFD simulator

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1491 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2012-02-28 16:47:52 +00:00 committed by Knut Morten Okstad
parent df54429f90
commit fbe0de77c5
3 changed files with 11 additions and 15 deletions

View File

@ -23,16 +23,12 @@ struct TimeDomain
{ {
double t; //!< Current time (or pseudo time, load parameter) double t; //!< Current time (or pseudo time, load parameter)
double dt; //!< Current time (or load parameter) increment 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 int it; //!< Current iteration within current time/load step
bool first; //!< If \e true, this is the first load/time 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. //! \brief Default constructor.
TimeDomain(int i = 0, bool f = true) : it(i), first(f) TimeDomain(int i = 0, bool f = true) : it(i), first(f) { t = dt = CFL = 0.0; }
{ t = dt = CFL = 0.0; maxCFL = 1.0; useCFL = false; }
}; };
#endif #endif

View File

@ -16,6 +16,7 @@
void SIMparameters::initTime (double start, double stop, const TimeSteps& steps) void SIMparameters::initTime (double start, double stop, const TimeSteps& steps)
{ {
maxCFL = 0.0;
starTime = start; starTime = start;
stopTime = stop; stopTime = stop;
mySteps = steps; mySteps = steps;
@ -38,11 +39,10 @@ bool SIMparameters::multiSteps () const
bool SIMparameters::increment () bool SIMparameters::increment ()
{ {
// Adjust timestep according to CFL number if (maxCFL > 0.0 && time.CFL > 1.0e-12)
if (time.useCFL && time.CFL > 1.0e-12) // Adjust time step size according to CFL number
time.dt = time.maxCFL*time.dt/time.CFL; time.dt *= maxCFL/time.CFL;
else if (stepIt != mySteps.end())
if (stepIt != mySteps.end())
if (++lstep <= stepIt->first.size()) if (++lstep <= stepIt->first.size())
time.dt = stepIt->first[lstep-1]; time.dt = stepIt->first[lstep-1];

View File

@ -28,7 +28,6 @@ class SIMparameters
public: public:
//! \brief The constructor initializes the counters to zero. //! \brief The constructor initializes the counters to zero.
SIMparameters() : step(0), iter(time.it), lstep(0) { stepIt = mySteps.end(); } SIMparameters() : step(0), iter(time.it), lstep(0) { stepIt = mySteps.end(); }
//! \brief Empty destructor. //! \brief Empty destructor.
virtual ~SIMparameters() {} virtual ~SIMparameters() {}
@ -49,13 +48,14 @@ public:
int& iter; //!< Iteration counter int& iter; //!< Iteration counter
TimeDomain time; //!< Time domain data TimeDomain time; //!< Time domain data
double starTime; //!< Start (pseudo)time of simulation double starTime; //!< Start (pseudo)time of simulation
double stopTime; //!< Stop (pseudo)time of simulation double stopTime; //!< Stop (pseudo)time of simulation
TimeSteps mySteps; //!< Time step definitions double maxCFL; //!< CFL restriction on time step size (0.0: no restriction)
private: private:
size_t lstep; //!< Local step counter, i.e., within current \a *stepIt 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 TimeSteps::iterator stepIt; //!< Running iterator over the time steps
}; };