diff --git a/opm/models/blackoil/blackoilmicpmodules.hh b/opm/models/blackoil/blackoilmicpmodules.hh index 5e607491a..ac56397fa 100644 --- a/opm/models/blackoil/blackoilmicpmodules.hh +++ b/opm/models/blackoil/blackoilmicpmodules.hh @@ -29,8 +29,9 @@ #define EWOMS_BLACK_OIL_MICP_MODULE_HH #include "blackoilproperties.hh" + +#include #include -#include #if HAVE_ECL_INPUT #include @@ -39,6 +40,9 @@ #include +#include +#include +#include #include namespace Opm { @@ -123,7 +127,7 @@ public: MICPpara.getMaximumUreaConcentration(), MICPpara.getToleranceBeforeClogging()); // obtain the porosity for the clamp in the blackoilnewtonmethod - phi_ = eclState.fieldProps().get_double("PORO"); + params_.phi_ = eclState.fieldProps().get_double("PORO"); } #endif @@ -137,7 +141,7 @@ public: static void checkCloggingMICP(const Model& model, const Scalar phi, unsigned dofIdx) { const PrimaryVariables& priVars = model.solution(/*timeIdx=*/1)[dofIdx]; - if (phi - priVars[biofilmConcentrationIdx] - priVars[calciteConcentrationIdx] < MICPparaToleranceBeforeClogging()) + if (phi - priVars[biofilmConcentrationIdx] - priVars[calciteConcentrationIdx] < toleranceBeforeClogging()) throw std::logic_error("Clogging has been (almost) reached in at least one cell\n"); } @@ -146,41 +150,41 @@ public: * * The index of specified here must be in range [0, numSatRegions) */ - static void setMICPpara(const Scalar& MICPparaDensityBiofilm, - const Scalar& MICPparaDensityCalcite, - const Scalar& MICPparaDetachmentRate, - const Scalar& MICPparaCriticalPorosity, - const Scalar& MICPparaFittingFactor, - const Scalar& MICPparaHalfVelocityOxygen, - const Scalar& MICPparaHalfVelocityUrea, - const Scalar& MICPparaMaximumGrowthRate, - const Scalar& MICPparaMaximumUreaUtilization, - const Scalar& MICPparaMicrobialAttachmentRate, - const Scalar& MICPparaMicrobialDeathRate, - const Scalar& MICPparaMinimumPermeability, - const Scalar& MICPparaOxygenConsumptionFactor, - const Scalar& MICPparaYieldGrowthCoefficient, - const Scalar& MICPparaMaximumOxygenConcentration, - const Scalar& MICPparaMaximumUreaConcentration, - const Scalar& MICPparaToleranceBeforeClogging) + static void setMICPpara(const Scalar& densityBiofilm, + const Scalar& densityCalcite, + const Scalar& detachmentRate, + const Scalar& criticalPorosity, + const Scalar& fittingFactor, + const Scalar& halfVelocityOxygen, + const Scalar& halfVelocityUrea, + const Scalar& maximumGrowthRate, + const Scalar& maximumUreaUtilization, + const Scalar& microbialAttachmentRate, + const Scalar& microbialDeathRate, + const Scalar& minimumPermeability, + const Scalar& oxygenConsumptionFactor, + const Scalar& yieldGrowthCoefficient, + const Scalar& maximumOxygenConcentration, + const Scalar& maximumUreaConcentration, + const Scalar& toleranceBeforeClogging) { - MICPparaDensityBiofilm_ = MICPparaDensityBiofilm; - MICPparaDensityCalcite_ = MICPparaDensityCalcite; - MICPparaDetachmentRate_ = MICPparaDetachmentRate; - MICPparaCriticalPorosity_ = MICPparaCriticalPorosity; - MICPparaFittingFactor_ = MICPparaFittingFactor; - MICPparaHalfVelocityOxygen_ = MICPparaHalfVelocityOxygen; - MICPparaHalfVelocityUrea_ = MICPparaHalfVelocityUrea; - MICPparaMaximumGrowthRate_ = MICPparaMaximumGrowthRate; - MICPparaMaximumUreaUtilization_ = MICPparaMaximumUreaUtilization; - MICPparaMicrobialAttachmentRate_ = MICPparaMicrobialAttachmentRate; - MICPparaMicrobialDeathRate_ = MICPparaMicrobialDeathRate; - MICPparaMinimumPermeability_ = MICPparaMinimumPermeability; - MICPparaOxygenConsumptionFactor_ = MICPparaOxygenConsumptionFactor; - MICPparaYieldGrowthCoefficient_ = MICPparaYieldGrowthCoefficient; - MICPparaMaximumOxygenConcentration_ = MICPparaMaximumOxygenConcentration; - MICPparaMaximumUreaConcentration_ = MICPparaMaximumUreaConcentration; - MICPparaToleranceBeforeClogging_ = MICPparaToleranceBeforeClogging; + params_.densityBiofilm_ = densityBiofilm; + params_.densityCalcite_ = densityCalcite; + params_.detachmentRate_ = detachmentRate; + params_.criticalPorosity_ = criticalPorosity; + params_.fittingFactor_ = fittingFactor; + params_.halfVelocityOxygen_ = halfVelocityOxygen; + params_.halfVelocityUrea_ = halfVelocityUrea; + params_.maximumGrowthRate_ = maximumGrowthRate; + params_.maximumUreaUtilization_ = maximumUreaUtilization; + params_.microbialAttachmentRate_ = microbialAttachmentRate; + params_.microbialDeathRate_ = microbialDeathRate; + params_.minimumPermeability_ = minimumPermeability; + params_.oxygenConsumptionFactor_ = oxygenConsumptionFactor; + params_.yieldGrowthCoefficient_ = yieldGrowthCoefficient; + params_.maximumOxygenConcentration_ = maximumOxygenConcentration; + params_.maximumUreaConcentration_ = maximumUreaConcentration; + params_.toleranceBeforeClogging_ = toleranceBeforeClogging; } /*! @@ -313,17 +317,17 @@ public: } // get the model parameters - Scalar k_a = MICPparaMicrobialAttachmentRate(); - Scalar k_d = MICPparaMicrobialDeathRate(); - Scalar rho_b = MICPparaDensityBiofilm(); - Scalar rho_c = MICPparaDensityCalcite(); - Scalar k_str = MICPparaDetachmentRate(); - Scalar k_o = MICPparaHalfVelocityOxygen(); - Scalar k_u = MICPparaHalfVelocityUrea() / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp) - Scalar mu = MICPparaMaximumGrowthRate(); - Scalar mu_u = MICPparaMaximumUreaUtilization() / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp) - Scalar Y_sb = MICPparaYieldGrowthCoefficient(); - Scalar F = MICPparaOxygenConsumptionFactor(); + Scalar k_a = microbialAttachmentRate(); + Scalar k_d = microbialDeathRate(); + Scalar rho_b = densityBiofilm(); + Scalar rho_c = densityCalcite(); + Scalar k_str = detachmentRate(); + Scalar k_o = halfVelocityOxygen(); + Scalar k_u = halfVelocityUrea() / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp) + Scalar mu = maximumGrowthRate(); + Scalar mu_u = maximumUreaUtilization() / 10.0;//Dividing by scaling factor 10 (see WellInterface_impl.hpp) + Scalar Y_sb = yieldGrowthCoefficient(); + Scalar F = oxygenConsumptionFactor(); Scalar Y_uc = 1.67 * 10; //Multiplying by scaling factor 10 (see WellInterface_impl.hpp) // compute the processes @@ -344,190 +348,104 @@ public: source[Indices::contiCalciteEqIdx] += (rho_b / rho_c) * intQuants.biofilmConcentration() * Y_uc * mu_u * intQuants.ureaConcentration() / (k_u + intQuants.ureaConcentration()); } - static const Scalar MICPparaDensityBiofilm() + static const Scalar densityBiofilm() { - return MICPparaDensityBiofilm_; + return params_.densityBiofilm_; } - static const Scalar MICPparaDensityCalcite() + static const Scalar densityCalcite() { - return MICPparaDensityCalcite_; + return params_.densityCalcite_; } - static const Scalar MICPparaDetachmentRate() + static const Scalar detachmentRate() { - return MICPparaDetachmentRate_; + return params_.detachmentRate_; } - static const Scalar MICPparaCriticalPorosity() + static const Scalar criticalPorosity() { - return MICPparaCriticalPorosity_; + return params_.criticalPorosity_; } - static const Scalar MICPparaFittingFactor() + static const Scalar fittingFactor() { - return MICPparaFittingFactor_; + return params_.fittingFactor_; } - static const Scalar MICPparaHalfVelocityOxygen() + static const Scalar halfVelocityOxygen() { - return MICPparaHalfVelocityOxygen_; + return params_.halfVelocityOxygen_; } - static const Scalar MICPparaHalfVelocityUrea() + static const Scalar halfVelocityUrea() { - return MICPparaHalfVelocityUrea_; + return params_.halfVelocityUrea_; } - static const Scalar MICPparaMaximumGrowthRate() + static const Scalar maximumGrowthRate() { - return MICPparaMaximumGrowthRate_; + return params_.maximumGrowthRate_; } - static const Scalar MICPparaMaximumOxygenConcentration() + static const Scalar maximumOxygenConcentration() { - return MICPparaMaximumOxygenConcentration_; + return params_.maximumOxygenConcentration_; } - static const Scalar MICPparaMaximumUreaConcentration() + static const Scalar maximumUreaConcentration() { - return MICPparaMaximumUreaConcentration_ / 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 MICPparaMaximumUreaUtilization() + static const Scalar maximumUreaUtilization() { - return MICPparaMaximumUreaUtilization_; + return params_.maximumUreaUtilization_; } - static const Scalar MICPparaMicrobialAttachmentRate() + static const Scalar microbialAttachmentRate() { - return MICPparaMicrobialAttachmentRate_; + return params_.microbialAttachmentRate_; } - static const Scalar MICPparaMicrobialDeathRate() + static const Scalar microbialDeathRate() { - return MICPparaMicrobialDeathRate_; + return params_.microbialDeathRate_; } - static const Scalar MICPparaMinimumPermeability() + static const Scalar minimumPermeability() { - return MICPparaMinimumPermeability_; + return params_.minimumPermeability_; } - static const Scalar MICPparaOxygenConsumptionFactor() + static const Scalar oxygenConsumptionFactor() { - return MICPparaOxygenConsumptionFactor_; + return params_.oxygenConsumptionFactor_; } - static const Scalar MICPparaToleranceBeforeClogging() + static const Scalar toleranceBeforeClogging() { - return MICPparaToleranceBeforeClogging_; + return params_.toleranceBeforeClogging_; } - static const Scalar MICPparaYieldGrowthCoefficient() + static const Scalar yieldGrowthCoefficient() { - return MICPparaYieldGrowthCoefficient_; + return params_.yieldGrowthCoefficient_; } static const std::vector phi() { - return phi_; + return params_.phi_; } private: - static Scalar MICPparaDensityBiofilm_; - static Scalar MICPparaDensityCalcite_; - static Scalar MICPparaDetachmentRate_; - static Scalar MICPparaCriticalPorosity_; - static Scalar MICPparaFittingFactor_; - static Scalar MICPparaHalfVelocityOxygen_; - static Scalar MICPparaHalfVelocityUrea_; - static Scalar MICPparaMaximumGrowthRate_; - static Scalar MICPparaMaximumUreaUtilization_; - static Scalar MICPparaMicrobialAttachmentRate_; - static Scalar MICPparaMicrobialDeathRate_; - static Scalar MICPparaMinimumPermeability_; - static Scalar MICPparaOxygenConsumptionFactor_; - static Scalar MICPparaYieldGrowthCoefficient_; - static Scalar MICPparaMaximumOxygenConcentration_; - static Scalar MICPparaMaximumUreaConcentration_; - static Scalar MICPparaToleranceBeforeClogging_; - static std::vector phi_; + static BlackOilMICPParams params_; }; template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaDensityBiofilm_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaDensityCalcite_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaDetachmentRate_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaCriticalPorosity_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaFittingFactor_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaHalfVelocityOxygen_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaHalfVelocityUrea_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMaximumGrowthRate_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMaximumUreaUtilization_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMicrobialAttachmentRate_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMicrobialDeathRate_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMinimumPermeability_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaOxygenConsumptionFactor_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaYieldGrowthCoefficient_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMaximumOxygenConcentration_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaMaximumUreaConcentration_; - -template -typename BlackOilMICPModule::Scalar -BlackOilMICPModule::MICPparaToleranceBeforeClogging_; - -template -std::vector::Scalar> -BlackOilMICPModule::phi_; - +BlackOilMICPParams::Scalar> +BlackOilMICPModule::params_; /*! * \ingroup BlackOil @@ -574,9 +492,9 @@ public: const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, timeIdx); const auto& K = elemCtx.problem().intrinsicPermeability(elemCtx, dofIdx, timeIdx); Scalar referencePorosity_ = elemCtx.problem().porosity(elemCtx, dofIdx, timeIdx); - Scalar eta = MICPModule::MICPparaFittingFactor(); - Scalar k_min = MICPModule::MICPparaMinimumPermeability(); - Scalar phi_crit = MICPModule::MICPparaCriticalPorosity(); + Scalar eta = MICPModule::fittingFactor(); + Scalar k_min = MICPModule::minimumPermeability(); + Scalar phi_crit = MICPModule::criticalPorosity(); microbialConcentration_ = priVars.makeEvaluation(microbialConcentrationIdx, timeIdx, linearizationType); oxygenConcentration_ = priVars.makeEvaluation(oxygenConcentrationIdx, timeIdx, linearizationType); diff --git a/opm/models/blackoil/blackoilmicpparams.hh b/opm/models/blackoil/blackoilmicpparams.hh new file mode 100644 index 000000000..ef25010e0 --- /dev/null +++ b/opm/models/blackoil/blackoilmicpparams.hh @@ -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 . + + 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 + +namespace Opm { + +//! \brief Struct holding the parameters for the BlackOilMICPModule class. +template +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 phi_; +}; + +} // namespace Opm + +#endif diff --git a/opm/models/blackoil/blackoilnewtonmethod.hh b/opm/models/blackoil/blackoilnewtonmethod.hh index e1325cc37..85c537bf2 100644 --- a/opm/models/blackoil/blackoilnewtonmethod.hh +++ b/opm/models/blackoil/blackoilnewtonmethod.hh @@ -404,15 +404,15 @@ protected: // concentration (the urea concentration has been scaled by 10). For // the biofilm and calcite, we set this value equal to the porosity minus the clogging tolerance. if (enableMICP && pvIdx == Indices::microbialConcentrationIdx) - nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::MICPparaDensityBiofilm()); + nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::densityBiofilm()); if (enableMICP && pvIdx == Indices::oxygenConcentrationIdx) - nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::MICPparaMaximumOxygenConcentration()); + nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::maximumOxygenConcentration()); if (enableMICP && pvIdx == Indices::ureaConcentrationIdx) - nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::MICPparaMaximumUreaConcentration()); + nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::maximumUreaConcentration()); if (enableMICP && pvIdx == Indices::biofilmConcentrationIdx) - nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::phi()[globalDofIdx] - MICPModule::MICPparaToleranceBeforeClogging()); + nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging()); if (enableMICP && pvIdx == Indices::calciteConcentrationIdx) - nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::phi()[globalDofIdx] - MICPModule::MICPparaToleranceBeforeClogging()); + nextValue[pvIdx] = std::clamp(nextValue[pvIdx], 0.0, MICPModule::phi()[globalDofIdx] - MICPModule::toleranceBeforeClogging()); } // switch the new primary variables to something which is physically meaningful.