changed: move the NewtonWriteConvergence parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 10:20:05 +02:00
parent a39ccfd4d3
commit c54fb7816f
11 changed files with 78 additions and 44 deletions

View File

@ -157,10 +157,6 @@ struct SolidEnergyLaw<TypeTag, TTag::Co2InjectionBaseProblem>
template<class TypeTag>
struct LinearSolverSplice<TypeTag, TTag::Co2InjectionBaseProblem> { using type = TTag::ParallelAmgLinearSolver; };
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr bool value = false; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr bool value = true; };
@ -232,6 +228,15 @@ struct GridFile<TypeTag, TTag::Co2InjectionBaseProblem> { static constexpr auto
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -140,11 +140,6 @@ public:
using type = EffMaterialLaw;
};
// Write the Newton convergence behavior to disk?
template <class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::CO2PTBaseProblem> {
static constexpr bool value = false; };
// Enable gravity false
template <class TypeTag>
struct EnableGravity<TypeTag, TTag::CO2PTBaseProblem> { static constexpr bool value = false;
@ -297,8 +292,14 @@ struct EnableEnergy<TypeTag, TTag::CO2PTBaseProblem> {
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write the Newton convergence behavior to disk?
template <class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@ -124,10 +124,6 @@ struct MaterialLaw<TypeTag, TTag::FingerBaseProblem>
using type = ParkerLenhard;
};
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::FingerBaseProblem> { static constexpr bool value = false; };
// Use forward differences instead of central differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, TTag::FingerBaseProblem> { static constexpr int value = +1; };
@ -192,6 +188,15 @@ struct InitialTimeStepSize<TypeTag, TTag::FingerBaseProblem>
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@ -74,10 +74,6 @@ struct FluidSystem<TypeTag, TTag::InfiltrationBaseProblem>
template<class TypeTag>
struct EnableGravity<TypeTag, TTag::InfiltrationBaseProblem> { static constexpr bool value = true; };
// Write newton convergence?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::InfiltrationBaseProblem> { static constexpr bool value = false; };
// -1 backward differences, 0: central differences, +1: forward differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, TTag::InfiltrationBaseProblem> { static constexpr int value = 1; };
@ -123,6 +119,15 @@ struct GridFile<TypeTag, TTag::InfiltrationBaseProblem>
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write newton convergence?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -129,10 +129,6 @@ public:
using type = Opm::EffToAbsLaw<EffectiveLaw>;
};
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::LensBaseProblem> { static constexpr bool value = false; };
// Use forward differences instead of central differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, TTag::LensBaseProblem> { static constexpr int value = +1; };
@ -239,6 +235,11 @@ template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
// Write the solutions of individual newton iterations?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {

View File

@ -100,10 +100,6 @@ public:
using type = Opm::LinearMaterial<Traits>;
};
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::ReservoirBaseProblem> { static constexpr bool value = false; };
// Enable gravity
template<class TypeTag>
struct EnableGravity<TypeTag, TTag::ReservoirBaseProblem> { static constexpr bool value = true; };
@ -185,6 +181,15 @@ struct NewtonTolerance<TypeTag, TTag::ReservoirBaseProblem>
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write the Newton convergence behavior to disk?
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@ -115,10 +115,6 @@ struct NewtonMaxIterations<TypeTag, TTag::RichardsLensProblem> { static constexp
template<class TypeTag>
struct NewtonTargetIterations<TypeTag, TTag::RichardsLensProblem> { static constexpr int value = 18; };
// Do not write the intermediate results of the newton method
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::RichardsLensProblem> { static constexpr bool value = false; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, TTag::RichardsLensProblem>
@ -141,6 +137,15 @@ struct GridFile<TypeTag, TTag::RichardsLensProblem> { static constexpr auto valu
} // namespace Opm::Properties
namespace Opm::Parameters {
// Do not write the intermediate results of the newton method
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@ -123,10 +123,6 @@ struct EnableGravity<TypeTag, TTag::WaterAirBaseProblem> { static constexpr bool
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, TTag::WaterAirBaseProblem> { static constexpr int value = +1; };
// Write newton convergence
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::WaterAirBaseProblem> { static constexpr bool value = false; };
// The default for the end time of the simulation (1 year)
template<class TypeTag>
struct EndTime<TypeTag, TTag::WaterAirBaseProblem>
@ -164,6 +160,15 @@ struct PreconditionerOrder<TypeTag, TTag::WaterAirBaseProblem> { static constexp
} // namespace Opm::Properties
namespace Opm::Parameters {
// Write newton convergence
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup TestProblems

View File

@ -77,8 +77,6 @@ struct NewtonMethod<TypeTag, TTag::NewtonMethod> { using type = ::Opm::NewtonMet
template<class TypeTag>
struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullConvergenceWriter<TypeTag>; };
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::NewtonMethod> { static constexpr bool value = false; };
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::NewtonMethod>
{
using type = GetPropType<TypeTag, Scalar>;
@ -105,6 +103,10 @@ template<class TypeTag>
struct NewtonVerbose<TypeTag, Properties::TTag::NewtonMethod>
{ static constexpr bool value = true; };
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::NewtonMethod>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
@ -161,7 +163,7 @@ public:
Parameters::registerParam<TypeTag, Parameters::NewtonVerbose>
("Specify whether the Newton method should inform "
"the user about its progress or not");
Parameters::registerParam<TypeTag, Properties::NewtonWriteConvergence>
Parameters::registerParam<TypeTag, Parameters::NewtonWriteConvergence>
("Write the convergence behaviour of the Newton "
"method to a VTK file");
Parameters::registerParam<TypeTag, Properties::NewtonTargetIterations>
@ -549,7 +551,7 @@ protected:
{
numIterations_ = 0;
if (Parameters::get<TypeTag, Properties::NewtonWriteConvergence>())
if (Parameters::get<TypeTag, Parameters::NewtonWriteConvergence>())
convergenceWriter_.beginTimeStep();
}
@ -766,7 +768,7 @@ protected:
void writeConvergence_(const SolutionVector& currentSolution,
const GlobalEqVector& solutionUpdate)
{
if (Parameters::get<TypeTag, Properties::NewtonWriteConvergence>()) {
if (Parameters::get<TypeTag, Parameters::NewtonWriteConvergence>()) {
convergenceWriter_.beginIteration();
convergenceWriter_.writeFields(currentSolution, solutionUpdate);
convergenceWriter_.endIteration();
@ -838,7 +840,7 @@ protected:
*/
void end_()
{
if (Parameters::get<TypeTag, Properties::NewtonWriteConvergence>())
if (Parameters::get<TypeTag, Parameters::NewtonWriteConvergence>())
convergenceWriter_.endTimeStep();
}

View File

@ -31,6 +31,11 @@ namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct NewtonVerbose { using type = Properties::UndefinedProperty; };
//! Specifies whether the convergence rate and the global residual
//! gets written out to disk for every Newton iteration
template<class TypeTag, class MyTypeTag>
struct NewtonWriteConvergence { using type = Properties::UndefinedProperty; };
} // end namespace Opm::Parameters
#endif

View File

@ -39,11 +39,6 @@ struct Linearizer { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NewtonConvergenceWriter { using type = UndefinedProperty; };
//! Specifies whether the convergence rate and the global residual
//! gets written out to disk for every Newton iteration
template<class TypeTag, class MyTypeTag>
struct NewtonWriteConvergence { using type = UndefinedProperty; };
//! Specifies whether the convergence rate and the global residual
//! gets written out to disk for every Newton iteration
template<class TypeTag, class MyTypeTag>