changed: move the FlashTolerance parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 14:13:14 +02:00
parent ff07e7f04c
commit d2e1b31a1a
5 changed files with 89 additions and 45 deletions

View File

@ -29,12 +29,14 @@
#ifndef EWOMS_ENERGY_MODULE_HH
#define EWOMS_ENERGY_MODULE_HH
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/common/quantitycallbacks.hh>
#include <dune/common/fvector.hh>
#include <opm/material/common/Valgrind.hpp>
#include <dune/common/fvector.hh>
#include <opm/models/common/multiphasebaseproperties.hh>
#include <opm/models/common/quantitycallbacks.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <string>

View File

@ -28,17 +28,18 @@
#ifndef EWOMS_FLASH_INTENSIVE_QUANTITIES_HH
#define EWOMS_FLASH_INTENSIVE_QUANTITIES_HH
#include "flashproperties.hh"
#include "flashindices.hh"
#include <opm/models/common/energymodule.hh>
#include <opm/models/common/diffusionmodule.hh>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/models/common/diffusionmodule.hh>
#include <opm/models/common/energymodule.hh>
#include <opm/models/flash/flashindices.hh>
#include <opm/models/flash/flashparameters.hh>
#include <opm/models/flash/flashproperties.hh>
namespace Opm {
@ -106,7 +107,7 @@ public:
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const auto& problem = elemCtx.problem();
Scalar flashTolerance = Parameters::get<TypeTag, Properties::FlashTolerance>();
Scalar flashTolerance = Parameters::get<TypeTag, Parameters::FlashTolerance>();
// extract the total molar densities of the components
ComponentVector cTotal;

View File

@ -28,25 +28,29 @@
#ifndef EWOMS_FLASH_MODEL_HH
#define EWOMS_FLASH_MODEL_HH
#include <opm/material/constraintsolvers/NcpFlash.hpp>
#include <opm/material/densead/Math.hpp>
#include "flashproperties.hh"
#include "flashprimaryvariables.hh"
#include "flashlocalresidual.hh"
#include "flashratevector.hh"
#include "flashboundaryratevector.hh"
#include "flashintensivequantities.hh"
#include "flashextensivequantities.hh"
#include "flashindices.hh"
#include <opm/models/common/multiphasebasemodel.hh>
#include <opm/models/common/energymodule.hh>
#include <opm/models/io/vtkcompositionmodule.hh>
#include <opm/models/io/vtkenergymodule.hh>
#include <opm/models/io/vtkdiffusionmodule.hh>
#include <opm/material/fluidmatrixinteractions/NullMaterial.hpp>
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
#include <opm/material/constraintsolvers/NcpFlash.hpp>
#include <opm/models/common/energymodule.hh>
#include <opm/models/common/multiphasebasemodel.hh>
#include <opm/models/flash/flashboundaryratevector.hh>
#include <opm/models/flash/flashextensivequantities.hh>
#include <opm/models/flash/flashindices.hh>
#include <opm/models/flash/flashintensivequantities.hh>
#include <opm/models/flash/flashlocalresidual.hh>
#include <opm/models/flash/flashparameters.hh>
#include <opm/models/flash/flashproperties.hh>
#include <opm/models/flash/flashprimaryvariables.hh>
#include <opm/models/flash/flashratevector.hh>
#include <opm/models/io/vtkcompositionmodule.hh>
#include <opm/models/io/vtkdiffusionmodule.hh>
#include <opm/models/io/vtkenergymodule.hh>
#include <sstream>
#include <string>
@ -76,14 +80,6 @@ struct FlashSolver<TypeTag, TTag::FlashModel>
{ using type = Opm::NcpFlash<GetPropType<TypeTag, Properties::Scalar>,
GetPropType<TypeTag, Properties::FluidSystem>>; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, TTag::FlashModel>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = -1.0;
};
//! the Model property
template<class TypeTag>
struct Model<TypeTag, TTag::FlashModel> { using type = Opm::FlashModel<TypeTag>; };
@ -137,6 +133,14 @@ template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, Properties::TTag::FlashModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1.0;
};
} // namespace Opm::Parameters
namespace Opm {
@ -240,7 +244,7 @@ public:
if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::FlashTolerance>
Parameters::registerParam<TypeTag, Parameters::FlashTolerance>
("The maximum tolerance for the flash solver to "
"consider the solution converged");
}

View File

@ -0,0 +1,43 @@
// -*- 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.
*/
/*!
* \file
* \ingroup FlashModel
*
* \brief Declares the parameters for the compositional
* multi-phase model based on flash calculations.
*/
#ifndef EWOMS_FLASH_PARAMETERS_HH
#define EWOMS_FLASH_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! The maximum accepted error of the flash solver
template<class TypeTag, class MyTypeTag>
struct FlashTolerance { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters
#endif

View File

@ -30,19 +30,13 @@
#ifndef EWOMS_FLASH_PROPERTIES_HH
#define EWOMS_FLASH_PROPERTIES_HH
#include <opm/models/common/multiphasebaseproperties.hh>
#include <opm/models/io/vtkcompositionmodule.hh>
#include <opm/models/io/vtkenergymodule.hh>
#include <opm/models/io/vtkdiffusionmodule.hh>
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Properties {
//! The type of the flash constraint solver
template<class TypeTag, class MyTypeTag>
struct FlashSolver { using type = UndefinedProperty; };
//! The maximum accepted error of the flash solver
template<class TypeTag, class MyTypeTag>
struct FlashTolerance { using type = UndefinedProperty; };
} // namespace Opm::Properties