27#ifndef EWOMS_VTK_BLACK_OIL_MODULE_HH
28#define EWOMS_VTK_BLACK_OIL_MODULE_HH
30#include <opm/material/densead/Math.hpp>
39#include <dune/common/fvector.hh>
53template<
class TypeTag,
class MyTypeTag>
55template<
class TypeTag,
class MyTypeTag>
57template<
class TypeTag,
class MyTypeTag>
59template<
class TypeTag,
class MyTypeTag>
61template<
class TypeTag,
class MyTypeTag>
63template<
class TypeTag,
class MyTypeTag>
65template<
class TypeTag,
class MyTypeTag>
67template<
class TypeTag,
class MyTypeTag>
69template<
class TypeTag,
class MyTypeTag>
71template<
class TypeTag,
class MyTypeTag>
73template<
class TypeTag,
class MyTypeTag>
77template<
class TypeTag>
79template<
class TypeTag>
81template<
class TypeTag>
83template<
class TypeTag>
85template<
class TypeTag>
87template<
class TypeTag>
89template<
class TypeTag>
91template<
class TypeTag>
93template<
class TypeTag>
95template<
class TypeTag>
97template<
class TypeTag>
107template <
class TypeTag>
120 static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
123 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
124 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
125 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
127 enum { gasCompIdx = FluidSystem::gasCompIdx };
128 enum { oilCompIdx = FluidSystem::oilCompIdx };
129 enum { waterCompIdx = FluidSystem::waterCompIdx };
144 Parameters::registerParam<TypeTag, Properties::VtkWriteGasDissolutionFactor>
145 (
"Include the gas dissolution factor (R_s) of the observed oil "
146 "in the VTK output files");
147 Parameters::registerParam<TypeTag, Properties::VtkWriteOilVaporizationFactor>
148 (
"Include the oil vaporization factor (R_v) of the observed gas "
149 "in the VTK output files");
150 Parameters::registerParam<TypeTag, Properties::VtkWriteOilFormationVolumeFactor>
151 (
"Include the oil formation volume factor (B_o) in the VTK output files");
152 Parameters::registerParam<TypeTag, Properties::VtkWriteGasFormationVolumeFactor>
153 (
"Include the gas formation volume factor (B_g) in the "
155 Parameters::registerParam<TypeTag, Properties::VtkWriteWaterFormationVolumeFactor>
156 (
"Include the water formation volume factor (B_w) in the "
158 Parameters::registerParam<TypeTag, Properties::VtkWriteOilSaturationPressure>
159 (
"Include the saturation pressure of oil (p_o,sat) in the "
161 Parameters::registerParam<TypeTag, Properties::VtkWriteGasSaturationPressure>
162 (
"Include the saturation pressure of gas (p_g,sat) in the "
164 Parameters::registerParam<TypeTag, Properties::VtkWriteSaturatedOilGasDissolutionFactor>
165 (
"Include the gas dissolution factor (R_s,sat) of gas saturated "
166 "oil in the VTK output files");
167 Parameters::registerParam<TypeTag, Properties::VtkWriteSaturatedGasOilVaporizationFactor>
168 (
"Include the oil vaporization factor (R_v,sat) of oil saturated "
169 "gas in the VTK output files");
170 Parameters::registerParam<TypeTag, Properties::VtkWriteSaturationRatios>
171 (
"Write the ratio of the actually and maximum dissolved component of "
173 Parameters::registerParam<TypeTag, Properties::VtkWritePrimaryVarsMeaning>
174 (
"Include how the primary variables should be interpreted to the "
184 if (gasDissolutionFactorOutput_())
186 if (oilVaporizationFactorOutput_())
188 if (oilFormationVolumeFactorOutput_())
190 if (gasFormationVolumeFactorOutput_())
192 if (waterFormationVolumeFactorOutput_())
194 if (oilSaturationPressureOutput_())
196 if (gasSaturationPressureOutput_())
198 if (saturatedOilGasDissolutionFactorOutput_())
200 if (saturatedGasOilVaporizationFactorOutput_())
202 if (saturationRatiosOutput_()) {
206 if (primaryVarsMeaningOutput_()) {
219 if (!Parameters::get<TypeTag, Properties::EnableVtkOutput>())
222 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
223 const auto& fs = elemCtx.intensiveQuantities(dofIdx, 0).fluidState();
224 using FluidState =
typename std::remove_const<
typename std::remove_reference<
decltype(fs)>::type>::type;
225 unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
227 const auto& primaryVars = elemCtx.primaryVars(dofIdx, 0);
229 unsigned pvtRegionIdx = elemCtx.primaryVars(dofIdx, 0).pvtRegionIndex();
231 if (FluidSystem::phaseIsActive(oilPhaseIdx))
232 SoMax = std::max(getValue(fs.saturation(oilPhaseIdx)),
233 elemCtx.problem().maxOilSaturation(globalDofIdx));
235 if (FluidSystem::phaseIsActive(gasPhaseIdx) && FluidSystem::phaseIsActive(oilPhaseIdx)) {
236 Scalar x_oG = getValue(fs.moleFraction(oilPhaseIdx, gasCompIdx));
237 Scalar x_gO = getValue(fs.moleFraction(gasPhaseIdx, oilCompIdx));
238 Scalar X_oG = getValue(fs.massFraction(oilPhaseIdx, gasCompIdx));
239 Scalar X_gO = getValue(fs.massFraction(gasPhaseIdx, oilCompIdx));
240 Scalar Rs = FluidSystem::convertXoGToRs(X_oG, pvtRegionIdx);
241 Scalar Rv = FluidSystem::convertXgOToRv(X_gO, pvtRegionIdx);
244 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
248 Scalar X_oG_sat = FluidSystem::convertRsToXoG(RsSat, pvtRegionIdx);
249 Scalar x_oG_sat = FluidSystem::convertXoGToxoG(X_oG_sat, pvtRegionIdx);
252 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
256 Scalar X_gO_sat = FluidSystem::convertRvToXgO(RvSat, pvtRegionIdx);
257 Scalar x_gO_sat = FluidSystem::convertXgOToxgO(X_gO_sat, pvtRegionIdx);
258 if (gasDissolutionFactorOutput_())
259 gasDissolutionFactor_[globalDofIdx] = Rs;
260 if (oilVaporizationFactorOutput_())
261 oilVaporizationFactor_[globalDofIdx] = Rv;
262 if (oilSaturationPressureOutput_())
263 oilSaturationPressure_[globalDofIdx] =
264 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
265 if (gasSaturationPressureOutput_())
266 gasSaturationPressure_[globalDofIdx] =
267 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
268 if (saturatedOilGasDissolutionFactorOutput_())
269 saturatedOilGasDissolutionFactor_[globalDofIdx] = RsSat;
270 if (saturatedGasOilVaporizationFactorOutput_())
271 saturatedGasOilVaporizationFactor_[globalDofIdx] = RvSat;
272 if (saturationRatiosOutput_()) {
274 oilSaturationRatio_[globalDofIdx] = 1.0;
276 oilSaturationRatio_[globalDofIdx] = x_oG / x_oG_sat;
279 gasSaturationRatio_[globalDofIdx] = 1.0;
281 gasSaturationRatio_[globalDofIdx] = x_gO / x_gO_sat;
284 if (oilFormationVolumeFactorOutput_())
285 oilFormationVolumeFactor_[globalDofIdx] =
286 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
287 if (gasFormationVolumeFactorOutput_())
288 gasFormationVolumeFactor_[globalDofIdx] =
289 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
290 if (waterFormationVolumeFactorOutput_())
291 waterFormationVolumeFactor_[globalDofIdx] =
292 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, waterPhaseIdx, pvtRegionIdx);
294 if (primaryVarsMeaningOutput_()) {
295 primaryVarsMeaningWater_[globalDofIdx] =
296 static_cast<int>(primaryVars.primaryVarsMeaningWater());
297 primaryVarsMeaningGas_[globalDofIdx] =
298 static_cast<int>(primaryVars.primaryVarsMeaningGas());
299 primaryVarsMeaningPressure_[globalDofIdx] =
300 static_cast<int>(primaryVars.primaryVarsMeaningPressure());
314 if (gasDissolutionFactorOutput_())
316 if (oilVaporizationFactorOutput_())
318 if (oilFormationVolumeFactorOutput_())
320 if (gasFormationVolumeFactorOutput_())
322 if (waterFormationVolumeFactorOutput_())
324 if (oilSaturationPressureOutput_())
326 if (gasSaturationPressureOutput_())
328 if (saturatedOilGasDissolutionFactorOutput_())
330 if (saturatedGasOilVaporizationFactorOutput_())
332 if (saturationRatiosOutput_()) {
337 if (primaryVarsMeaningOutput_()) {
338 this->
commitScalarBuffer_(baseWriter,
"primary vars meaning water", primaryVarsMeaningWater_);
340 this->
commitScalarBuffer_(baseWriter,
"primary vars meaning pressure", primaryVarsMeaningPressure_);
345 static bool gasDissolutionFactorOutput_()
347 static bool val = Parameters::get<TypeTag, Properties::VtkWriteGasDissolutionFactor>();
351 static bool oilVaporizationFactorOutput_()
353 static bool val = Parameters::get<TypeTag, Properties::VtkWriteOilVaporizationFactor>();
357 static bool oilFormationVolumeFactorOutput_()
359 static bool val = Parameters::get<TypeTag, Properties::VtkWriteOilFormationVolumeFactor>();
363 static bool gasFormationVolumeFactorOutput_()
365 static bool val = Parameters::get<TypeTag, Properties::VtkWriteGasFormationVolumeFactor>();
369 static bool waterFormationVolumeFactorOutput_()
371 static bool val = Parameters::get<TypeTag, Properties::VtkWriteWaterFormationVolumeFactor>();
375 static bool oilSaturationPressureOutput_()
377 static bool val = Parameters::get<TypeTag, Properties::VtkWriteOilSaturationPressure>();
381 static bool gasSaturationPressureOutput_()
383 static bool val = Parameters::get<TypeTag, Properties::VtkWriteGasSaturationPressure>();
387 static bool saturatedOilGasDissolutionFactorOutput_()
389 static bool val = Parameters::get<TypeTag, Properties::VtkWriteSaturatedOilGasDissolutionFactor>();
393 static bool saturatedGasOilVaporizationFactorOutput_()
395 static bool val = Parameters::get<TypeTag, Properties::VtkWriteSaturatedGasOilVaporizationFactor>();
399 static bool saturationRatiosOutput_()
401 static bool val = Parameters::get<TypeTag, Properties::VtkWriteSaturationRatios>();
405 static bool primaryVarsMeaningOutput_()
407 static bool val = Parameters::get<TypeTag, Properties::VtkWritePrimaryVarsMeaning>();
411 ScalarBuffer gasDissolutionFactor_;
412 ScalarBuffer oilVaporizationFactor_;
413 ScalarBuffer oilFormationVolumeFactor_;
414 ScalarBuffer gasFormationVolumeFactor_;
415 ScalarBuffer waterFormationVolumeFactor_;
416 ScalarBuffer oilSaturationPressure_;
417 ScalarBuffer gasSaturationPressure_;
419 ScalarBuffer saturatedOilGasDissolutionFactor_;
420 ScalarBuffer saturatedGasOilVaporizationFactor_;
421 ScalarBuffer oilSaturationRatio_;
422 ScalarBuffer gasSaturationRatio_;
424 ScalarBuffer primaryVarsMeaningPressure_;
425 ScalarBuffer primaryVarsMeaningWater_;
426 ScalarBuffer primaryVarsMeaningGas_;
Declares the properties required by the black oil model.
The base class for writer modules.
Definition: baseoutputmodule.hh:73
BaseOutputWriter::ScalarBuffer ScalarBuffer
Definition: baseoutputmodule.hh:91
void commitScalarBuffer_(BaseOutputWriter &baseWriter, const char *name, ScalarBuffer &buffer, BufferType bufferType=DofBuffer)
Add a buffer containing scalar quantities to the result file.
Definition: baseoutputmodule.hh:316
void resizeScalarBuffer_(ScalarBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a scalar quantity.
Definition: baseoutputmodule.hh:162
The base class for all output writers.
Definition: baseoutputwriter.hh:44
VTK output module for the black oil model's parameters.
Definition: vtkblackoilmodule.hh:109
void processElement(const ElementContext &elemCtx)
Modify the internal buffers according to the intensive quantities relevant for an element.
Definition: vtkblackoilmodule.hh:217
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition: vtkblackoilmodule.hh:142
void commitBuffers(BaseOutputWriter &baseWriter)
Add all buffers to the VTK output writer.
Definition: vtkblackoilmodule.hh:308
VtkBlackOilModule(const Simulator &simulator)
Definition: vtkblackoilmodule.hh:134
void allocBuffers()
Allocate memory for the scalar fields we would like to write to the VTK file.
Definition: vtkblackoilmodule.hh:182
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:66
Definition: blackoilmodel.hh:72
Definition: blackoilboundaryratevector.hh:37
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:242
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.
Definition: vtkblackoilmodule.hh:48
a tag to mark properties as undefined
Definition: propertysystem.hh:40
Definition: vtkblackoilmodule.hh:54
Definition: vtkblackoilmodule.hh:66
Definition: vtkblackoilmodule.hh:64
Definition: vtkblackoilmodule.hh:56
Definition: vtkblackoilmodule.hh:74
Definition: vtkblackoilmodule.hh:72
Definition: vtkblackoilmodule.hh:70
Definition: vtkblackoilmodule.hh:68