changed: move the NewtonVerbose parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 10:20:05 +02:00
parent 13964c96be
commit a39ccfd4d3
3 changed files with 58 additions and 19 deletions

View File

@ -27,24 +27,25 @@
#ifndef EWOMS_NEWTON_METHOD_HH
#define EWOMS_NEWTON_METHOD_HH
#include "nullconvergencewriter.hh"
#include "newtonmethodproperties.hh"
#include <dune/istl/istlexception.hh>
#include <dune/common/classname.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <opm/common/Exceptions.hpp>
#include <opm/material/densead/Math.hpp>
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/nonlinear/newtonmethodparameters.hh>
#include <opm/models/nonlinear/newtonmethodproperties.hh>
#include <opm/models/nonlinear/nullconvergencewriter.hh>
#include <opm/models/utils/timer.hh>
#include <opm/models/utils/timerguard.hh>
#include <opm/simulators/linalg/linalgproperties.hh>
#include <dune/istl/istlexception.hh>
#include <dune/common/classname.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <iostream>
#include <sstream>
@ -78,8 +79,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, TTag::NewtonMethod> { static constexpr bool value = false; };
template<class TypeTag>
struct NewtonVerbose<TypeTag, TTag::NewtonMethod> { static constexpr bool value = true; };
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::NewtonMethod>
{
using type = GetPropType<TypeTag, Scalar>;
@ -100,6 +99,14 @@ struct NewtonMaxIterations<TypeTag, TTag::NewtonMethod> { static constexpr int v
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct NewtonVerbose<TypeTag, Properties::TTag::NewtonMethod>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {
/*!
* \ingroup Newton
@ -151,7 +158,7 @@ public:
{
LinearSolverBackend::registerParameters();
Parameters::registerParam<TypeTag, Properties::NewtonVerbose>
Parameters::registerParam<TypeTag, Parameters::NewtonVerbose>
("Specify whether the Newton method should inform "
"the user about its progress or not");
Parameters::registerParam<TypeTag, Properties::NewtonWriteConvergence>
@ -529,7 +536,7 @@ protected:
*/
bool verbose_() const
{
return Parameters::get<TypeTag, Properties::NewtonVerbose>() && (comm_.rank() == 0);
return Parameters::get<TypeTag, Parameters::NewtonVerbose>() && (comm_.rank() == 0);
}
/*!

View File

@ -0,0 +1,36 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_NEWTON_METHOD_PARAMETERS_HH
#define EWOMS_NEWTON_METHOD_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! Specifies whether the Newton method should print messages or not
template<class TypeTag, class MyTypeTag>
struct NewtonVerbose { using type = Properties::UndefinedProperty; };
} // end namespace Opm::Parameters
#endif

View File

@ -20,11 +20,11 @@
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_NEWTON_METHOD_POPERTIES_HH
#define EWOMS_NEWTON_METHOD_POPERTIES_HH
#ifndef EWOMS_NEWTON_METHOD_PROPERTIES_HH
#define EWOMS_NEWTON_METHOD_PROPERTIES_HH
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/parametersystem.hh>
namespace Opm::Properties {
//! Specifies the type of the actual Newton method
@ -35,10 +35,6 @@ struct NewtonMethod { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct Linearizer { using type = UndefinedProperty; };
//! Specifies whether the Newton method should print messages or not
template<class TypeTag, class MyTypeTag>
struct NewtonVerbose { using type = UndefinedProperty; };
//! Specifies the type of the class which writes out the Newton convergence
template<class TypeTag, class MyTypeTag>
struct NewtonConvergenceWriter { using type = UndefinedProperty; };
@ -82,6 +78,6 @@ struct NewtonTargetIterations { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NewtonMaxIterations { using type = UndefinedProperty; };
} // end namespace Opm::Properties
} // end namespace Opm::Properties
#endif