Changed to three phase using new GenericOilGasWaterFluidSystem

This commit is contained in:
Svenn Tveit
2025-01-08 13:12:54 +01:00
parent df6bdbe700
commit fb403d05ae

View File

@@ -38,7 +38,8 @@
#include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
#include <opm/material/fluidmatrixinteractions/BrooksCorey.hpp>
#include <opm/material/constraintsolvers/PTFlash.hpp>
#include <opm/material/fluidsystems/GenericOilGasFluidSystem.hpp>
#include <opm/material/fluidsystems/GenericOilGasWaterFluidSystem.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/models/immiscible/immisciblemodel.hh>
#include <opm/models/discretization/ecfv/ecfvdiscretization.hh>
@@ -106,7 +107,7 @@ private:
static constexpr int num_comp = getPropValue<TypeTag, Properties::NumComp>();
public:
using type = Opm::GenericOilGasFluidSystem<Scalar, num_comp>;
using type = Opm::GenericOilGasWaterFluidSystem<Scalar, num_comp>;
};
// Set the material Law
@@ -118,8 +119,8 @@ private:
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Traits = Opm::TwoPhaseMaterialTraits<Scalar,
// /*wettingPhaseIdx=*/FluidSystem::waterPhaseIdx, // TODO
using Traits = Opm::ThreePhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::waterPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::oilPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gasPhaseIdx>;
@@ -195,6 +196,8 @@ class CO2PTProblem : public GetPropType<TypeTag, Properties::BaseProblem>
enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
enum { conti0EqIdx = Indices::conti0EqIdx };
enum { pressure0Idx = Indices::pressure0Idx };
enum { z0Idx = Indices::z0Idx };
enum { numComponents = getPropValue<TypeTag, Properties::NumComponents>() };
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
enum { enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>() };
@@ -237,6 +240,21 @@ public:
porosity_ = 0.1;
}
void initWaterPVT()
{
using WaterPvt = typename FluidSystem::WaterPvt;
std::shared_ptr<WaterPvt> waterPvt = std::make_shared<WaterPvt>();
waterPvt->setApproach(WaterPvtApproach::ConstantCompressibilityWater);
auto& ccWaterPvt = waterPvt->template getRealPvt<WaterPvtApproach::ConstantCompressibilityWater>();
ccWaterPvt.setNumRegions(/*numPvtRegions=*/1);
Scalar rhoRefW = 1037.0; // [kg]
ccWaterPvt.setReferenceDensities(/*regionIdx=*/0, /*rhoRefO=*/Scalar(0.0), /*rhoRefG=*/Scalar(0.0), rhoRefW);
ccWaterPvt.setViscosity(/*regionIdx=*/0, 9.6e-4);
ccWaterPvt.setCompressibility(/*regionIdx=*/0, 1.450377e-10);
waterPvt->initEnd();
FluidSystem::setWaterPvt(std::move(waterPvt));
}
template <class Context>
const DimVector&
gravity([[maybe_unused]]const Context& context,
@@ -262,8 +280,12 @@ public:
void finishInit()
{
ParentType::finishInit();
// initialize fixed parameters; temperature, permeability, porosity
initPetrophysics();
// Initialize water pvt
initWaterPVT();
}
/*!
@@ -358,8 +380,8 @@ public:
// Calculate storage terms
PrimaryVariables storageL, storageG;
this->model().globalPhaseStorage(storageL, /*phaseIdx=*/0);
this->model().globalPhaseStorage(storageG, /*phaseIdx=*/1);
this->model().globalPhaseStorage(storageL, /*phaseIdx=*/oilPhaseIdx);
this->model().globalPhaseStorage(storageG, /*phaseIdx=*/gasPhaseIdx);
// Write mass balance information for rank 0
// if (this->gridView().comm().rank() == 0) {
@@ -456,12 +478,12 @@ private:
int prod = Parameters::Get<Parameters::CellsX>() - 1;
int spatialIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
ComponentVector comp;
comp[0] = Evaluation::createVariable(0.5, 1);
comp[1] = Evaluation::createVariable(0.3, 2);
comp[0] = Evaluation::createVariable(0.5, z0Idx);
comp[1] = Evaluation::createVariable(0.3, z0Idx + 1);
comp[2] = 1. - comp[0] - comp[1];
if (spatialIdx == inj) {
comp[0] = Evaluation::createVariable(0.99, 1);
comp[1] = Evaluation::createVariable(0.01 - 1e-3, 2);
comp[0] = Evaluation::createVariable(0.99, z0Idx);
comp[1] = Evaluation::createVariable(0.01 - 1e-3, z0Idx + 1);
comp[2] = 1. - comp[0] - comp[1];
}
@@ -475,10 +497,11 @@ private:
if (spatialIdx == prod) {
p0 *= 0.5;
}
Evaluation p_init = Evaluation::createVariable(p0, 0);
Evaluation p_init = Evaluation::createVariable(p0, pressure0Idx);
fs.setPressure(FluidSystem::oilPhaseIdx, p_init);
fs.setPressure(FluidSystem::gasPhaseIdx, p_init);
fs.setPressure(FluidSystem::waterPhaseIdx, p_init);
fs.setTemperature(temperature_);