blackoilmicpmodules: put parameters in separate class

limits the amount of static variable declarations
This commit is contained in:
Arne Morten Kvarving 2022-09-13 08:51:22 +02:00
parent 893502c6b9
commit f96e449094
2 changed files with 101 additions and 125 deletions

View File

@ -29,6 +29,8 @@
#define EWOMS_BLACK_OIL_MICP_MODULE_HH #define EWOMS_BLACK_OIL_MICP_MODULE_HH
#include "blackoilproperties.hh" #include "blackoilproperties.hh"
#include <opm/models/blackoil/blackoilmicpparams.hh>
#include <opm/models/io/vtkblackoilmicpmodule.hh> #include <opm/models/io/vtkblackoilmicpmodule.hh>
#if HAVE_ECL_INPUT #if HAVE_ECL_INPUT
@ -125,7 +127,7 @@ public:
MICPpara.getMaximumUreaConcentration(), MICPpara.getMaximumUreaConcentration(),
MICPpara.getToleranceBeforeClogging()); MICPpara.getToleranceBeforeClogging());
// obtain the porosity for the clamp in the blackoilnewtonmethod // obtain the porosity for the clamp in the blackoilnewtonmethod
phi_ = eclState.fieldProps().get_double("PORO"); params_.phi_ = eclState.fieldProps().get_double("PORO");
} }
#endif #endif
@ -166,23 +168,23 @@ public:
const Scalar& maximumUreaConcentration, const Scalar& maximumUreaConcentration,
const Scalar& toleranceBeforeClogging) const Scalar& toleranceBeforeClogging)
{ {
densityBiofilm_ = densityBiofilm; params_.densityBiofilm_ = densityBiofilm;
densityCalcite_ = densityCalcite; params_.densityCalcite_ = densityCalcite;
detachmentRate_ = detachmentRate; params_.detachmentRate_ = detachmentRate;
criticalPorosity_ = criticalPorosity; params_.criticalPorosity_ = criticalPorosity;
fittingFactor_ = fittingFactor; params_.fittingFactor_ = fittingFactor;
halfVelocityOxygen_ = halfVelocityOxygen; params_.halfVelocityOxygen_ = halfVelocityOxygen;
halfVelocityUrea_ = halfVelocityUrea; params_.halfVelocityUrea_ = halfVelocityUrea;
maximumGrowthRate_ = maximumGrowthRate; params_.maximumGrowthRate_ = maximumGrowthRate;
maximumUreaUtilization_ = maximumUreaUtilization; params_.maximumUreaUtilization_ = maximumUreaUtilization;
microbialAttachmentRate_ = microbialAttachmentRate; params_.microbialAttachmentRate_ = microbialAttachmentRate;
microbialDeathRate_ = microbialDeathRate; params_.microbialDeathRate_ = microbialDeathRate;
minimumPermeability_ = minimumPermeability; params_.minimumPermeability_ = minimumPermeability;
oxygenConsumptionFactor_ = oxygenConsumptionFactor; params_.oxygenConsumptionFactor_ = oxygenConsumptionFactor;
yieldGrowthCoefficient_ = yieldGrowthCoefficient; params_.yieldGrowthCoefficient_ = yieldGrowthCoefficient;
maximumOxygenConcentration_ = maximumOxygenConcentration; params_.maximumOxygenConcentration_ = maximumOxygenConcentration;
maximumUreaConcentration_ = maximumUreaConcentration; params_.maximumUreaConcentration_ = maximumUreaConcentration;
toleranceBeforeClogging_ = toleranceBeforeClogging; params_.toleranceBeforeClogging_ = toleranceBeforeClogging;
} }
/*! /*!
@ -348,188 +350,102 @@ public:
static const Scalar densityBiofilm() static const Scalar densityBiofilm()
{ {
return densityBiofilm_; return params_.densityBiofilm_;
} }
static const Scalar densityCalcite() static const Scalar densityCalcite()
{ {
return densityCalcite_; return params_.densityCalcite_;
} }
static const Scalar detachmentRate() static const Scalar detachmentRate()
{ {
return detachmentRate_; return params_.detachmentRate_;
} }
static const Scalar criticalPorosity() static const Scalar criticalPorosity()
{ {
return criticalPorosity_; return params_.criticalPorosity_;
} }
static const Scalar fittingFactor() static const Scalar fittingFactor()
{ {
return fittingFactor_; return params_.fittingFactor_;
} }
static const Scalar halfVelocityOxygen() static const Scalar halfVelocityOxygen()
{ {
return halfVelocityOxygen_; return params_.halfVelocityOxygen_;
} }
static const Scalar halfVelocityUrea() static const Scalar halfVelocityUrea()
{ {
return halfVelocityUrea_; return params_.halfVelocityUrea_;
} }
static const Scalar maximumGrowthRate() static const Scalar maximumGrowthRate()
{ {
return maximumGrowthRate_; return params_.maximumGrowthRate_;
} }
static const Scalar maximumOxygenConcentration() static const Scalar maximumOxygenConcentration()
{ {
return maximumOxygenConcentration_; return params_.maximumOxygenConcentration_;
} }
static const Scalar maximumUreaConcentration() static const Scalar maximumUreaConcentration()
{ {
return maximumUreaConcentration_ / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp); return params_.maximumUreaConcentration_ / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp);
} }
static const Scalar maximumUreaUtilization() static const Scalar maximumUreaUtilization()
{ {
return maximumUreaUtilization_; return params_.maximumUreaUtilization_;
} }
static const Scalar microbialAttachmentRate() static const Scalar microbialAttachmentRate()
{ {
return microbialAttachmentRate_; return params_.microbialAttachmentRate_;
} }
static const Scalar microbialDeathRate() static const Scalar microbialDeathRate()
{ {
return microbialDeathRate_; return params_.microbialDeathRate_;
} }
static const Scalar minimumPermeability() static const Scalar minimumPermeability()
{ {
return minimumPermeability_; return params_.minimumPermeability_;
} }
static const Scalar oxygenConsumptionFactor() static const Scalar oxygenConsumptionFactor()
{ {
return oxygenConsumptionFactor_; return params_.oxygenConsumptionFactor_;
} }
static const Scalar toleranceBeforeClogging() static const Scalar toleranceBeforeClogging()
{ {
return toleranceBeforeClogging_; return params_.toleranceBeforeClogging_;
} }
static const Scalar yieldGrowthCoefficient() static const Scalar yieldGrowthCoefficient()
{ {
return yieldGrowthCoefficient_; return params_.yieldGrowthCoefficient_;
} }
static const std::vector<Scalar> phi() static const std::vector<Scalar> phi()
{ {
return phi_; return params_.phi_;
} }
private: private:
static Scalar densityBiofilm_; static BlackOilMICPParams<Scalar> params_;
static Scalar densityCalcite_;
static Scalar detachmentRate_;
static Scalar criticalPorosity_;
static Scalar fittingFactor_;
static Scalar halfVelocityOxygen_;
static Scalar halfVelocityUrea_;
static Scalar maximumGrowthRate_;
static Scalar maximumUreaUtilization_;
static Scalar microbialAttachmentRate_;
static Scalar microbialDeathRate_;
static Scalar minimumPermeability_;
static Scalar oxygenConsumptionFactor_;
static Scalar yieldGrowthCoefficient_;
static Scalar maximumOxygenConcentration_;
static Scalar maximumUreaConcentration_;
static Scalar toleranceBeforeClogging_;
static std::vector<Scalar> phi_;
}; };
template <class TypeTag, bool enableMICPV> template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar BlackOilMICPParams<typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar>
BlackOilMICPModule<TypeTag, enableMICPV>::densityBiofilm_; BlackOilMICPModule<TypeTag, enableMICPV>::params_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::densityCalcite_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::detachmentRate_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::criticalPorosity_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::fittingFactor_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::halfVelocityOxygen_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::halfVelocityUrea_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::maximumGrowthRate_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::maximumUreaUtilization_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::microbialAttachmentRate_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::microbialDeathRate_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::minimumPermeability_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::oxygenConsumptionFactor_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::yieldGrowthCoefficient_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::maximumOxygenConcentration_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::maximumUreaConcentration_;
template <class TypeTag, bool enableMICPV>
typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar
BlackOilMICPModule<TypeTag, enableMICPV>::toleranceBeforeClogging_;
template <class TypeTag, bool enableMICPV>
std::vector<typename BlackOilMICPModule<TypeTag, enableMICPV>::Scalar>
BlackOilMICPModule<TypeTag, enableMICPV>::phi_;
/*! /*!
* \ingroup BlackOil * \ingroup BlackOil

View File

@ -0,0 +1,60 @@
// -*- 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
*
* \brief Contains the parameters required to extend the black-oil model by MICP.
*/
#ifndef EWOMS_BLACK_OIL_MICP_PARAMS_HH
#define EWOMS_BLACK_OIL_MICP_PARAMS_HH
#include <vector>
namespace Opm {
//! \brief Struct holding the parameters for the BlackOilMICPModule class.
template<class Scalar>
struct BlackOilMICPParams {
Scalar densityBiofilm_;
Scalar densityCalcite_;
Scalar detachmentRate_;
Scalar criticalPorosity_;
Scalar fittingFactor_;
Scalar halfVelocityOxygen_;
Scalar halfVelocityUrea_;
Scalar maximumGrowthRate_;
Scalar maximumUreaUtilization_;
Scalar microbialAttachmentRate_;
Scalar microbialDeathRate_;
Scalar minimumPermeability_;
Scalar oxygenConsumptionFactor_;
Scalar yieldGrowthCoefficient_;
Scalar maximumOxygenConcentration_;
Scalar maximumUreaConcentration_;
Scalar toleranceBeforeClogging_;
std::vector<Scalar> phi_;
};
} // namespace Opm
#endif