27#ifndef OPM_VTK_BLACK_OIL_MODULE_HPP
28#define OPM_VTK_BLACK_OIL_MODULE_HPP
30#include <dune/common/fvector.hh>
32#include <opm/material/densead/Math.hpp>
55template <
class TypeTag>
68 static constexpr auto vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
71 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
72 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
73 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
75 enum { gasCompIdx = FluidSystem::gasCompIdx };
76 enum { oilCompIdx = FluidSystem::oilCompIdx };
77 enum { waterCompIdx = FluidSystem::waterCompIdx };
148 if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
152 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
153 const auto& fs = elemCtx.intensiveQuantities(dofIdx, 0).fluidState();
154 using FluidState = std::remove_const_t<std::remove_reference_t<
decltype(fs)>>;
155 const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
157 const auto& primaryVars = elemCtx.primaryVars(dofIdx, 0);
159 const unsigned pvtRegionIdx = elemCtx.primaryVars(dofIdx, 0).pvtRegionIndex();
161 FluidSystem::phaseIsActive(oilPhaseIdx)
162 ? std::max(getValue(fs.saturation(oilPhaseIdx)),
163 elemCtx.problem().maxOilSaturation(globalDofIdx))
166 if (FluidSystem::phaseIsActive(gasPhaseIdx) && FluidSystem::phaseIsActive(oilPhaseIdx)) {
167 const Scalar x_oG = getValue(fs.moleFraction(oilPhaseIdx, gasCompIdx));
168 const Scalar x_gO = getValue(fs.moleFraction(gasPhaseIdx, oilCompIdx));
169 const Scalar X_oG = getValue(fs.massFraction(oilPhaseIdx, gasCompIdx));
170 const Scalar X_gO = getValue(fs.massFraction(gasPhaseIdx, oilCompIdx));
171 const Scalar Rs = FluidSystem::convertXoGToRs(X_oG, pvtRegionIdx);
172 const Scalar Rv = FluidSystem::convertXgOToRv(X_gO, pvtRegionIdx);
175 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
179 const Scalar X_oG_sat = FluidSystem::convertRsToXoG(RsSat, pvtRegionIdx);
180 const Scalar x_oG_sat = FluidSystem::convertXoGToxoG(X_oG_sat, pvtRegionIdx);
183 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
187 const Scalar X_gO_sat = FluidSystem::convertRvToXgO(RvSat, pvtRegionIdx);
188 const Scalar x_gO_sat = FluidSystem::convertXgOToxgO(X_gO_sat, pvtRegionIdx);
190 gasDissolutionFactor_[globalDofIdx] = Rs;
193 oilVaporizationFactor_[globalDofIdx] = Rv;
196 oilSaturationPressure_[globalDofIdx] =
197 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
200 gasSaturationPressure_[globalDofIdx] =
201 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
204 saturatedOilGasDissolutionFactor_[globalDofIdx] = RsSat;
207 saturatedGasOilVaporizationFactor_[globalDofIdx] = RvSat;
210 if (x_oG_sat <= 0.0) {
211 oilSaturationRatio_[globalDofIdx] = 1.0;
214 oilSaturationRatio_[globalDofIdx] = x_oG / x_oG_sat;
217 if (x_gO_sat <= 0.0) {
218 gasSaturationRatio_[globalDofIdx] = 1.0;
221 gasSaturationRatio_[globalDofIdx] = x_gO / x_gO_sat;
226 oilFormationVolumeFactor_[globalDofIdx] =
227 1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
230 gasFormationVolumeFactor_[globalDofIdx] =
231 1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
234 waterFormationVolumeFactor_[globalDofIdx] =
235 1.0 / FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, waterPhaseIdx, pvtRegionIdx);
239 primaryVarsMeaningWater_[globalDofIdx] =
240 static_cast<int>(primaryVars.primaryVarsMeaningWater());
241 primaryVarsMeaningGas_[globalDofIdx] =
242 static_cast<int>(primaryVars.primaryVarsMeaningGas());
243 primaryVarsMeaningPressure_[globalDofIdx] =
244 static_cast<int>(primaryVars.primaryVarsMeaningPressure());
260 gasDissolutionFactor_, BufferType::Dof);
264 oilVaporizationFactor_, BufferType::Dof);
268 oilFormationVolumeFactor_, BufferType::Dof);
272 gasFormationVolumeFactor_, BufferType::Dof);
276 waterFormationVolumeFactor_, BufferType::Dof);
280 oilSaturationPressure_, BufferType::Dof);
284 gasSaturationPressure_, BufferType::Dof);
288 saturatedOilGasDissolutionFactor_, BufferType::Dof);
292 saturatedGasOilVaporizationFactor_, BufferType::Dof);
296 oilSaturationRatio_, BufferType::Dof);
298 gasSaturationRatio_, BufferType::Dof);
303 primaryVarsMeaningWater_, BufferType::Dof);
305 primaryVarsMeaningGas_, BufferType::Dof);
307 primaryVarsMeaningPressure_, BufferType::Dof);
313 ScalarBuffer gasDissolutionFactor_{};
314 ScalarBuffer oilVaporizationFactor_{};
315 ScalarBuffer oilFormationVolumeFactor_{};
316 ScalarBuffer gasFormationVolumeFactor_{};
317 ScalarBuffer waterFormationVolumeFactor_{};
318 ScalarBuffer oilSaturationPressure_{};
319 ScalarBuffer gasSaturationPressure_{};
321 ScalarBuffer saturatedOilGasDissolutionFactor_{};
322 ScalarBuffer saturatedGasOilVaporizationFactor_{};
323 ScalarBuffer oilSaturationRatio_{};
324 ScalarBuffer gasSaturationRatio_{};
326 ScalarBuffer primaryVarsMeaningPressure_{};
327 ScalarBuffer primaryVarsMeaningWater_{};
328 ScalarBuffer primaryVarsMeaningGas_{};
Declares the properties required by the black oil model.
The base class for writer modules.
Definition: baseoutputmodule.hh:68
BaseOutputWriter::ScalarBuffer ScalarBuffer
Definition: baseoutputmodule.hh:86
void resizeScalarBuffer_(ScalarBuffer &buffer, BufferType bufferType)
Allocate the space for a buffer storing a scalar quantity.
Definition: baseoutputmodule.hh:157
BufferType
Definition: baseoutputmodule.hh:143
void commitScalarBuffer_(BaseOutputWriter &baseWriter, const char *name, ScalarBuffer &buffer, BufferType bufferType)
Add a buffer containing scalar quantities to the result file.
Definition: baseoutputmodule.hh:238
The base class for all output writers.
Definition: baseoutputwriter.hh:46
VTK output module for the black oil model's parameters.
Definition: vtkblackoilmodule.hpp:57
void processElement(const ElementContext &elemCtx) override
Modify the internal buffers according to the intensive quantities relevant for an element.
Definition: vtkblackoilmodule.hpp:146
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition: vtkblackoilmodule.hpp:93
void commitBuffers(BaseOutputWriter &baseWriter) override
Add all buffers to the VTK output writer.
Definition: vtkblackoilmodule.hpp:252
void allocBuffers() override
Allocate memory for the scalar fields we would like to write to the VTK file.
Definition: vtkblackoilmodule.hpp:102
VtkBlackOilModule(const Simulator &simulator)
Definition: vtkblackoilmodule.hpp:83
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:65
Declare the properties used by the infrastructure code of the finite volume discretizations.
Definition: blackoilboundaryratevector.hh:39
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.
Struct holding the parameters for VtkBlackoilOutputModule.
Definition: vtkblackoilparams.hpp:53
bool gasSaturationPressureOutput_
Definition: vtkblackoilparams.hpp:66
bool oilFormationVolumeFactorOutput_
Definition: vtkblackoilparams.hpp:62
static void registerParameters()
Registers the parameters in parameter system.
bool gasFormationVolumeFactorOutput_
Definition: vtkblackoilparams.hpp:63
bool oilVaporizationFactorOutput_
Definition: vtkblackoilparams.hpp:61
bool saturatedGasOilVaporizationFactorOutput_
Definition: vtkblackoilparams.hpp:68
bool primaryVarsMeaningOutput_
Definition: vtkblackoilparams.hpp:70
bool gasDissolutionFactorOutput_
Definition: vtkblackoilparams.hpp:60
bool waterFormationVolumeFactorOutput_
Definition: vtkblackoilparams.hpp:64
bool saturatedOilGasDissolutionFactorOutput_
Definition: vtkblackoilparams.hpp:67
bool saturationRatiosOutput_
Definition: vtkblackoilparams.hpp:69
bool oilSaturationPressureOutput_
Definition: vtkblackoilparams.hpp:65
void read()
Reads the parameter values from the parameter system.