mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-14 07:33:29 -06:00
Added several checks to ensure timestep>0
This commit is contained in:
parent
d9b981e059
commit
3a56213ed8
@ -579,8 +579,10 @@ protected:
|
||||
|
||||
// Use the implicit Euler time discretization
|
||||
for (unsigned eqIdx = 0; eqIdx < numEq; ++eqIdx) {
|
||||
double dt = elemCtx.simulator().timeStepSize();
|
||||
assert(dt>0);
|
||||
tmp[eqIdx] -= tmp2[eqIdx];
|
||||
tmp[eqIdx] *= scvVolume / elemCtx.simulator().timeStepSize();
|
||||
tmp[eqIdx] *= scvVolume / dt;
|
||||
|
||||
residual[dofIdx][eqIdx] += tmp[eqIdx];
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
time_ = 0.0;
|
||||
endTime_ = EWOMS_GET_PARAM(TypeTag, Scalar, EndTime);
|
||||
timeStepSize_ = EWOMS_GET_PARAM(TypeTag, Scalar, InitialTimeStepSize);
|
||||
|
||||
assert(timeStepSize_>0);
|
||||
const std::string& predetTimeStepFile =
|
||||
EWOMS_GET_PARAM(TypeTag, std::string, PredeterminedTimeStepsFile);
|
||||
if (!predetTimeStepFile.empty()) {
|
||||
@ -400,7 +400,12 @@ public:
|
||||
* \param timeStepSize The new value for the time step size \f$\mathrm{[s]}\f$
|
||||
*/
|
||||
void setTimeStepSize(Scalar value)
|
||||
{ timeStepSize_ = value; }
|
||||
{
|
||||
if( not(value>0)){
|
||||
std::cout << "Time step set to zero" << std::endl;
|
||||
}
|
||||
timeStepSize_ = value;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set the current time step index to a given value.
|
||||
@ -443,7 +448,7 @@ public:
|
||||
*/
|
||||
bool finished() const
|
||||
{
|
||||
assert(timeStepSize_ >= 0.0);
|
||||
assert(timeStepSize_ > 0.0);
|
||||
Scalar eps =
|
||||
std::max(Scalar(std::abs(this->time())), timeStepSize())
|
||||
*std::numeric_limits<Scalar>::epsilon()*1e3;
|
||||
|
Loading…
Reference in New Issue
Block a user