mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4731 from akva2/componentnames_separate
ComponentName: put in separate file
This commit is contained in:
commit
3e58d191e8
@ -72,20 +72,21 @@ list (APPEND MAIN_SOURCE_FILES
|
|||||||
opm/simulators/linalg/PreconditionerFactory6.cpp
|
opm/simulators/linalg/PreconditionerFactory6.cpp
|
||||||
opm/simulators/linalg/PropertyTree.cpp
|
opm/simulators/linalg/PropertyTree.cpp
|
||||||
opm/simulators/linalg/setupPropertyTree.cpp
|
opm/simulators/linalg/setupPropertyTree.cpp
|
||||||
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp
|
|
||||||
opm/simulators/utils/readDeck.cpp
|
|
||||||
opm/simulators/utils/UnsupportedFlowKeywords.cpp
|
|
||||||
opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp
|
opm/simulators/timestepping/AdaptiveSimulatorTimer.cpp
|
||||||
opm/simulators/timestepping/AdaptiveTimeSteppingEbos.cpp
|
opm/simulators/timestepping/AdaptiveTimeSteppingEbos.cpp
|
||||||
opm/simulators/timestepping/TimeStepControl.cpp
|
opm/simulators/timestepping/TimeStepControl.cpp
|
||||||
opm/simulators/timestepping/SimulatorTimer.cpp
|
opm/simulators/timestepping/SimulatorTimer.cpp
|
||||||
opm/simulators/timestepping/SimulatorTimerInterface.cpp
|
opm/simulators/timestepping/SimulatorTimerInterface.cpp
|
||||||
opm/simulators/timestepping/gatherConvergenceReport.cpp
|
opm/simulators/timestepping/gatherConvergenceReport.cpp
|
||||||
|
opm/simulators/utils/ComponentName.cpp
|
||||||
opm/simulators/utils/DeferredLogger.cpp
|
opm/simulators/utils/DeferredLogger.cpp
|
||||||
opm/simulators/utils/gatherDeferredLogger.cpp
|
opm/simulators/utils/gatherDeferredLogger.cpp
|
||||||
opm/simulators/utils/ParallelFileMerger.cpp
|
opm/simulators/utils/ParallelFileMerger.cpp
|
||||||
opm/simulators/utils/ParallelRestart.cpp
|
opm/simulators/utils/ParallelRestart.cpp
|
||||||
|
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp
|
||||||
|
opm/simulators/utils/readDeck.cpp
|
||||||
opm/simulators/utils/SerializationPackers.cpp
|
opm/simulators/utils/SerializationPackers.cpp
|
||||||
|
opm/simulators/utils/UnsupportedFlowKeywords.cpp
|
||||||
opm/simulators/wells/ALQState.cpp
|
opm/simulators/wells/ALQState.cpp
|
||||||
opm/simulators/wells/BlackoilWellModelConstraints.cpp
|
opm/simulators/wells/BlackoilWellModelConstraints.cpp
|
||||||
opm/simulators/wells/BlackoilWellModelGeneric.cpp
|
opm/simulators/wells/BlackoilWellModelGeneric.cpp
|
||||||
@ -441,6 +442,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
|||||||
opm/simulators/timestepping/SimulatorTimer.hpp
|
opm/simulators/timestepping/SimulatorTimer.hpp
|
||||||
opm/simulators/timestepping/SimulatorTimerInterface.hpp
|
opm/simulators/timestepping/SimulatorTimerInterface.hpp
|
||||||
opm/simulators/timestepping/gatherConvergenceReport.hpp
|
opm/simulators/timestepping/gatherConvergenceReport.hpp
|
||||||
|
opm/simulators/utils/ComponentName.hpp
|
||||||
opm/simulators/utils/ParallelFileMerger.hpp
|
opm/simulators/utils/ParallelFileMerger.hpp
|
||||||
opm/simulators/utils/DeferredLoggingErrorHelpers.hpp
|
opm/simulators/utils/DeferredLoggingErrorHelpers.hpp
|
||||||
opm/simulators/utils/DeferredLogger.hpp
|
opm/simulators/utils/DeferredLogger.hpp
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||||
#include <opm/simulators/timestepping/SimulatorReport.hpp>
|
#include <opm/simulators/timestepping/SimulatorReport.hpp>
|
||||||
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
|
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
|
||||||
|
#include <opm/simulators/utils/ComponentName.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
||||||
#include <opm/simulators/wells/BlackoilWellModel.hpp>
|
#include <opm/simulators/wells/BlackoilWellModel.hpp>
|
||||||
@ -203,73 +204,11 @@ namespace Opm {
|
|||||||
using Mat = typename SparseMatrixAdapter::IstlMatrix;
|
using Mat = typename SparseMatrixAdapter::IstlMatrix;
|
||||||
using BVector = Dune::BlockVector<VectorBlockType>;
|
using BVector = Dune::BlockVector<VectorBlockType>;
|
||||||
|
|
||||||
|
using ComponentName = ::Opm::ComponentName<FluidSystem,Indices>;
|
||||||
using Domain = SubDomain<Grid>;
|
using Domain = SubDomain<Grid>;
|
||||||
|
|
||||||
using ISTLSolverType = ISTLSolverEbos<TypeTag>;
|
using ISTLSolverType = ISTLSolverEbos<TypeTag>;
|
||||||
|
|
||||||
class ComponentName
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ComponentName()
|
|
||||||
: names_(numEq)
|
|
||||||
{
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned canonicalCompIdx = FluidSystem::solventComponentIndex(phaseIdx);
|
|
||||||
names_[Indices::canonicalToActiveComponentIndex(canonicalCompIdx)]
|
|
||||||
= FluidSystem::componentName(canonicalCompIdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_solvent_) {
|
|
||||||
names_[solventSaturationIdx] = "Solvent";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_extbo_) {
|
|
||||||
names_[zFractionIdx] = "ZFraction";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_polymer_) {
|
|
||||||
names_[polymerConcentrationIdx] = "Polymer";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_polymermw_) {
|
|
||||||
assert(has_polymer_);
|
|
||||||
names_[polymerMoleWeightIdx] = "MolecularWeightP";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_energy_) {
|
|
||||||
names_[temperatureIdx] = "Energy";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_foam_) {
|
|
||||||
names_[foamConcentrationIdx] = "Foam";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_brine_) {
|
|
||||||
names_[saltConcentrationIdx] = "Brine";
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (has_micp_) {
|
|
||||||
names_[microbialConcentrationIdx] = "Microbes";
|
|
||||||
names_[oxygenConcentrationIdx] = "Oxygen";
|
|
||||||
names_[ureaConcentrationIdx] = "Urea";
|
|
||||||
names_[biofilmConcentrationIdx] = "Biofilm";
|
|
||||||
names_[calciteConcentrationIdx] = "Calcite";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& name(const int compIdx) const
|
|
||||||
{
|
|
||||||
return this->names_[compIdx];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<std::string> names_{};
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------- Public methods ---------
|
// --------- Public methods ---------
|
||||||
|
|
||||||
/// Construct the model. It will retain references to the
|
/// Construct the model. It will retain references to the
|
||||||
|
122
opm/simulators/utils/ComponentName.cpp
Normal file
122
opm/simulators/utils/ComponentName.cpp
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2013, 2015 SINTEF ICT, Applied Mathematics.
|
||||||
|
Copyright 2014, 2015 Dr. Blatt - HPC-Simulation-Software & Services
|
||||||
|
Copyright 2014, 2015 Statoil ASA.
|
||||||
|
Copyright 2015 NTNU
|
||||||
|
Copyright 2015, 2016, 2017 IRIS AS
|
||||||
|
|
||||||
|
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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <opm/simulators/utils/ComponentName.hpp>
|
||||||
|
|
||||||
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
|
|
||||||
|
#include <opm/models/blackoil/blackoilindices.hh>
|
||||||
|
#include <opm/models/blackoil/blackoilonephaseindices.hh>
|
||||||
|
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
template<class FluidSystem, class Indices>
|
||||||
|
ComponentName<FluidSystem,Indices>::ComponentName()
|
||||||
|
: names_(Indices::numEq)
|
||||||
|
{
|
||||||
|
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||||
|
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned canonicalCompIdx = FluidSystem::solventComponentIndex(phaseIdx);
|
||||||
|
names_[Indices::canonicalToActiveComponentIndex(canonicalCompIdx)]
|
||||||
|
= FluidSystem::componentName(canonicalCompIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::enableSolvent) {
|
||||||
|
names_[Indices::solventSaturationIdx] = "Solvent";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::enableExtbo) {
|
||||||
|
names_[Indices::zFractionIdx] = "ZFraction";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::enablePolymer) {
|
||||||
|
names_[Indices::polymerConcentrationIdx] = "Polymer";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::polymerMoleWeightIdx >= 0) {
|
||||||
|
assert(Indices::enablePolymer);
|
||||||
|
names_[Indices::polymerMoleWeightIdx] = "MolecularWeightP";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::enableEnergy) {
|
||||||
|
names_[Indices::temperatureIdx] = "Energy";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::numFoam == 1) {
|
||||||
|
names_[Indices::foamConcentrationIdx] = "Foam";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::numBrine == 1) {
|
||||||
|
names_[Indices::saltConcentrationIdx] = "Brine";
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (Indices::enableMICP) {
|
||||||
|
names_[Indices::microbialConcentrationIdx] = "Microbes";
|
||||||
|
names_[Indices::oxygenConcentrationIdx] = "Oxygen";
|
||||||
|
names_[Indices::ureaConcentrationIdx] = "Urea";
|
||||||
|
names_[Indices::biofilmConcentrationIdx] = "Biofilm";
|
||||||
|
names_[Indices::calciteConcentrationIdx] = "Calcite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define INSTANCE( ...) \
|
||||||
|
template class ComponentName<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, \
|
||||||
|
__VA_ARGS__>;
|
||||||
|
|
||||||
|
// One phase
|
||||||
|
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
|
||||||
|
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||||
|
INSTANCE(BlackOilOnePhaseIndices<0u,0u,0u,0u,false,false,0u,1u,5u>)
|
||||||
|
|
||||||
|
// Two phase
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,0u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,1u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,false,0u,2u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,false,0u,2u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,0u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,0u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,true,0u,0u,0u>)
|
||||||
|
INSTANCE(BlackOilTwoPhaseIndices<1u,0u,0u,0u,false,false,0u,0u,0u>)
|
||||||
|
|
||||||
|
// Blackoil
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,true,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,1u,0u,0u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,1u,0u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,false,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
|
||||||
|
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
|
||||||
|
|
||||||
|
} // namespace Opm
|
50
opm/simulators/utils/ComponentName.hpp
Normal file
50
opm/simulators/utils/ComponentName.hpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2013, 2015 SINTEF ICT, Applied Mathematics.
|
||||||
|
Copyright 2014, 2015 Dr. Blatt - HPC-Simulation-Software & Services
|
||||||
|
Copyright 2014, 2015 Statoil ASA.
|
||||||
|
Copyright 2015 NTNU
|
||||||
|
Copyright 2015, 2016, 2017 IRIS AS
|
||||||
|
|
||||||
|
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 3 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMPONENT_NAME_HPP
|
||||||
|
#define COMPONENT_NAME_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
template<class FluidSystem, class Indices>
|
||||||
|
class ComponentName
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ComponentName();
|
||||||
|
|
||||||
|
const std::string& name(const int compIdx) const
|
||||||
|
{
|
||||||
|
return this->names_[compIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::string> names_{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Opm
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user