mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-26 03:00:17 -06:00
PIDAndIterationCountTimeStepControl: add serialization support
This commit is contained in:
parent
1827de96a2
commit
5f6bc76512
@ -242,6 +242,12 @@ namespace Opm
|
||||
, minTimeStepBasedOnIterations_(minTimeStepBasedOnIterations)
|
||||
{}
|
||||
|
||||
PIDAndIterationCountTimeStepControl
|
||||
PIDAndIterationCountTimeStepControl::serializationTestObject()
|
||||
{
|
||||
return {1, 2.0, 3.0, 4.0, 5.0, true};
|
||||
}
|
||||
|
||||
double PIDAndIterationCountTimeStepControl::
|
||||
computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& relChange, const double simulationTimeElapsed ) const
|
||||
{
|
||||
@ -264,4 +270,13 @@ namespace Opm
|
||||
return std::min(dtEstimatePID, dtEstimateIter);
|
||||
}
|
||||
|
||||
bool PIDAndIterationCountTimeStepControl::operator==(const PIDAndIterationCountTimeStepControl& ctrl) const
|
||||
{
|
||||
return static_cast<const PIDTimeStepControl&>(*this) == ctrl &&
|
||||
this->target_iterations_ == ctrl.target_iterations_ &&
|
||||
this->decayDampingFactor_ == ctrl.decayDampingFactor_ &&
|
||||
this->growthDampingFactor_ == ctrl.growthDampingFactor_ &&
|
||||
this->minTimeStepBasedOnIterations_ == ctrl.minTimeStepBasedOnIterations_;
|
||||
}
|
||||
|
||||
} // end namespace Opm
|
||||
|
@ -138,9 +138,23 @@ namespace Opm
|
||||
const double minTimeStepBasedOnIterations = 0.,
|
||||
const bool verbose = false);
|
||||
|
||||
static PIDAndIterationCountTimeStepControl serializationTestObject();
|
||||
|
||||
/// \brief \copydoc TimeStepControlInterface::computeTimeStepSize
|
||||
double computeTimeStepSize( const double dt, const int iterations, const RelativeChangeInterface& relativeChange, const double /*simulationTimeElapsed */ ) const;
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(static_cast<PIDTimeStepControl&>(*this));
|
||||
serializer(target_iterations_);
|
||||
serializer(decayDampingFactor_);
|
||||
serializer(growthDampingFactor_);
|
||||
serializer(minTimeStepBasedOnIterations_);
|
||||
}
|
||||
|
||||
bool operator==(const PIDAndIterationCountTimeStepControl&) const;
|
||||
|
||||
protected:
|
||||
const int target_iterations_;
|
||||
const double decayDampingFactor_;
|
||||
|
@ -61,6 +61,7 @@ BOOST_AUTO_TEST_CASE(NAME) \
|
||||
TEST_FOR_TYPE_NAMED(TYPE, TYPE)
|
||||
|
||||
TEST_FOR_TYPE(HardcodedTimeStepControl)
|
||||
TEST_FOR_TYPE(PIDAndIterationCountTimeStepControl)
|
||||
TEST_FOR_TYPE(PIDTimeStepControl)
|
||||
TEST_FOR_TYPE(SimpleIterationCountTimeStepControl)
|
||||
TEST_FOR_TYPE(SimulatorTimer)
|
||||
|
Loading…
Reference in New Issue
Block a user