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> 44 namespace Properties {
66 SET_BOOL_PROP(VtkBlackOil, VtkWriteGasDissolutionFactor,
false);
67 SET_BOOL_PROP(VtkBlackOil, VtkWriteOilVaporizationFactor,
false);
68 SET_BOOL_PROP(VtkBlackOil, VtkWriteOilFormationVolumeFactor,
false);
69 SET_BOOL_PROP(VtkBlackOil, VtkWriteGasFormationVolumeFactor,
false);
70 SET_BOOL_PROP(VtkBlackOil, VtkWriteWaterFormationVolumeFactor,
false);
71 SET_BOOL_PROP(VtkBlackOil, VtkWriteOilSaturationPressure,
false);
72 SET_BOOL_PROP(VtkBlackOil, VtkWriteGasSaturationPressure,
false);
74 SET_BOOL_PROP(VtkBlackOil, VtkWriteSaturatedOilGasDissolutionFactor,
false);
75 SET_BOOL_PROP(VtkBlackOil, VtkWriteSaturatedGasOilVaporizationFactor,
false);
76 SET_BOOL_PROP(VtkBlackOil, VtkWriteSaturatedOilFormationVolumeFactor,
false);
77 SET_BOOL_PROP(VtkBlackOil, VtkWriteSaturatedGasFormationVolumeFactor,
false);
78 SET_BOOL_PROP(VtkBlackOil, VtkWritePrimaryVarsMeaning,
false);
88 template <
class TypeTag>
94 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
95 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
96 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
98 typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
99 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
101 static const int vtkFormat =
GET_PROP_VALUE(TypeTag, VtkOutputFormat);
104 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
105 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
106 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
108 enum { gasCompIdx = FluidSystem::gasCompIdx };
109 enum { oilCompIdx = FluidSystem::oilCompIdx };
110 enum { waterCompIdx = FluidSystem::waterCompIdx };
112 typedef typename ParentType::ScalarBuffer ScalarBuffer;
126 "Include the gas dissolution factor (R_s) of the observed oil " 127 "in the VTK output files");
129 "Include the oil vaporization factor (R_v) of the observed gas " 130 "in the VTK output files");
132 "Include the oil formation volume factor (B_o) of gas saturated " 133 "oil in the VTK output files");
135 "Include the gas formation volume factor (B_g) in the " 138 "Include the water formation volume factor (B_w) in the " 141 "Include the saturation pressure of oil (p_o,sat) in the " 144 "Include the saturation pressure of gas (p_g,sat) in the " 147 "Include the gas dissolution factor (R_s,sat) of gas saturated " 148 "oil in the VTK output files");
150 "Include the oil vaporization factor (R_v,sat) of oil saturated " 151 "gas in the VTK output files");
153 "Write the ratio of the actually and maximum dissolved component of " 156 "Include the formation volume factor (B_o,sat) of saturated oil in the " 159 "Include the formation volume factor (B_g,sat) of saturated gas in the " 162 "Include how the primary variables should be interpreted to the " 172 if (gasDissolutionFactorOutput_())
174 if (oilVaporizationFactorOutput_())
176 if (oilFormationVolumeFactorOutput_())
178 if (gasFormationVolumeFactorOutput_())
180 if (waterFormationVolumeFactorOutput_())
182 if (oilSaturationPressureOutput_())
184 if (gasSaturationPressureOutput_())
186 if (saturatedOilGasDissolutionFactorOutput_())
188 if (saturatedGasOilVaporizationFactorOutput_())
190 if (saturationRatiosOutput_()) {
194 if (saturatedGasFormationVolumeFactorOutput_())
196 if (primaryVarsMeaningOutput_())
209 typedef Opm::MathToolbox<Evaluation> Toolbox;
211 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
212 const auto& fs = elemCtx.intensiveQuantities(dofIdx, 0).fluidState();
213 typedef typename std::remove_const<typename std::remove_reference<decltype(fs)>::type>::type FluidState;
214 unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
216 const auto& primaryVars = elemCtx.primaryVars(dofIdx, 0);
218 unsigned pvtRegionIdx = elemCtx.primaryVars(dofIdx, 0).pvtRegionIndex();
219 Scalar SoMax = elemCtx.model().maxOilSaturation(globalDofIdx);
220 Scalar x_oG = Toolbox::value(fs.moleFraction(oilPhaseIdx, gasCompIdx));
221 Scalar x_gO = Toolbox::value(fs.moleFraction(gasPhaseIdx, oilCompIdx));
222 Scalar X_oG = Toolbox::value(fs.massFraction(oilPhaseIdx, gasCompIdx));
223 Scalar X_gO = Toolbox::value(fs.massFraction(gasPhaseIdx, oilCompIdx));
224 Scalar Rs = FluidSystem::convertXoGToRs(X_oG, pvtRegionIdx);
225 Scalar Rv = FluidSystem::convertXgOToRv(X_gO, pvtRegionIdx);
228 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
232 Scalar X_oG_sat = FluidSystem::convertRsToXoG(RsSat, pvtRegionIdx);
233 Scalar x_oG_sat = FluidSystem::convertXoGToxoG(X_oG_sat, pvtRegionIdx);
236 FluidSystem::template saturatedDissolutionFactor<FluidState, Scalar>(fs,
240 Scalar X_gO_sat = FluidSystem::convertRvToXgO(RvSat, pvtRegionIdx);
241 Scalar x_gO_sat = FluidSystem::convertXgOToxgO(X_gO_sat, pvtRegionIdx);
243 if (gasDissolutionFactorOutput_())
244 gasDissolutionFactor_[globalDofIdx] = Rs;
245 if (oilVaporizationFactorOutput_())
246 oilVaporizationFactor_[globalDofIdx] = Rv;
247 if (oilFormationVolumeFactorOutput_())
248 oilFormationVolumeFactor_[globalDofIdx] =
249 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
250 if (gasFormationVolumeFactorOutput_())
251 gasFormationVolumeFactor_[globalDofIdx] =
252 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
253 if (waterFormationVolumeFactorOutput_())
254 waterFormationVolumeFactor_[globalDofIdx] =
255 1.0/FluidSystem::template inverseFormationVolumeFactor<FluidState, Scalar>(fs, waterPhaseIdx, pvtRegionIdx);
256 if (oilSaturationPressureOutput_())
257 oilSaturationPressure_[globalDofIdx] =
258 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
259 if (gasSaturationPressureOutput_())
260 gasSaturationPressure_[globalDofIdx] =
261 FluidSystem::template saturationPressure<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
262 if (saturatedOilGasDissolutionFactorOutput_())
263 saturatedOilGasDissolutionFactor_[globalDofIdx] = RsSat;
264 if (saturatedGasOilVaporizationFactorOutput_())
265 saturatedGasOilVaporizationFactor_[globalDofIdx] = RvSat;
266 if (saturationRatiosOutput_()) {
268 oilSaturationRatio_[globalDofIdx] = 1.0;
270 oilSaturationRatio_[globalDofIdx] = x_oG / x_oG_sat;
273 gasSaturationRatio_[globalDofIdx] = 1.0;
275 gasSaturationRatio_[globalDofIdx] = x_gO / x_gO_sat;
277 if (saturatedOilFormationVolumeFactorOutput_())
278 saturatedOilFormationVolumeFactor_[globalDofIdx] =
279 1.0/FluidSystem::template saturatedInverseFormationVolumeFactor<FluidState, Scalar>(fs, oilPhaseIdx, pvtRegionIdx);
280 if (saturatedGasFormationVolumeFactorOutput_())
281 saturatedGasFormationVolumeFactor_[globalDofIdx] =
282 1.0/FluidSystem::template saturatedInverseFormationVolumeFactor<FluidState, Scalar>(fs, gasPhaseIdx, pvtRegionIdx);
284 if (primaryVarsMeaningOutput_())
285 primaryVarsMeaning_[globalDofIdx] =
286 primaryVars.primaryVarsMeaning();
299 if (gasDissolutionFactorOutput_())
301 if (oilVaporizationFactorOutput_())
303 if (oilFormationVolumeFactorOutput_())
305 if (gasFormationVolumeFactorOutput_())
307 if (waterFormationVolumeFactorOutput_())
309 if (oilSaturationPressureOutput_())
311 if (gasSaturationPressureOutput_())
313 if (saturatedOilGasDissolutionFactorOutput_())
315 if (saturatedGasOilVaporizationFactorOutput_())
317 if (saturationRatiosOutput_()) {
321 if (saturatedOilFormationVolumeFactorOutput_())
323 if (saturatedGasFormationVolumeFactorOutput_())
326 if (primaryVarsMeaningOutput_())
331 static bool gasDissolutionFactorOutput_()
332 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteGasDissolutionFactor); }
334 static bool oilVaporizationFactorOutput_()
335 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteOilVaporizationFactor); }
337 static bool oilFormationVolumeFactorOutput_()
338 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteOilFormationVolumeFactor); }
340 static bool gasFormationVolumeFactorOutput_()
341 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteGasFormationVolumeFactor); }
343 static bool waterFormationVolumeFactorOutput_()
344 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteWaterFormationVolumeFactor); }
346 static bool oilSaturationPressureOutput_()
347 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteOilSaturationPressure); }
349 static bool gasSaturationPressureOutput_()
350 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteGasSaturationPressure); }
352 static bool saturatedOilGasDissolutionFactorOutput_()
353 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteSaturatedOilGasDissolutionFactor); }
355 static bool saturatedGasOilVaporizationFactorOutput_()
356 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteSaturatedGasOilVaporizationFactor); }
358 static bool saturationRatiosOutput_()
361 static bool saturatedOilFormationVolumeFactorOutput_()
362 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteSaturatedOilFormationVolumeFactor); }
364 static bool saturatedGasFormationVolumeFactorOutput_()
365 {
return EWOMS_GET_PARAM(TypeTag,
bool, VtkWriteSaturatedGasFormationVolumeFactor); }
367 static bool primaryVarsMeaningOutput_()
370 ScalarBuffer gasDissolutionFactor_;
371 ScalarBuffer oilVaporizationFactor_;
372 ScalarBuffer oilFormationVolumeFactor_;
373 ScalarBuffer gasFormationVolumeFactor_;
374 ScalarBuffer waterFormationVolumeFactor_;
375 ScalarBuffer oilSaturationPressure_;
376 ScalarBuffer gasSaturationPressure_;
378 ScalarBuffer saturatedOilGasDissolutionFactor_;
379 ScalarBuffer saturatedGasOilVaporizationFactor_;
380 ScalarBuffer oilSaturationRatio_;
381 ScalarBuffer gasSaturationRatio_;
382 ScalarBuffer saturatedOilFormationVolumeFactor_;
383 ScalarBuffer saturatedGasFormationVolumeFactor_;
385 ScalarBuffer primaryVarsMeaning_;
The base class for all output writers.
Definition: baseoutputwriter.hh:43
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition: propertysystem.hh:361
Definition: baseauxiliarymodule.hh:37
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition: vtkblackoilmodule.hh:123
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:63
void commitBuffers(BaseOutputWriter &baseWriter)
Add all buffers to the VTK output writer.
Definition: vtkblackoilmodule.hh:293
void processElement(const ElementContext &elemCtx)
Modify the internal buffers according to the intensive quantities relevant for an element...
Definition: vtkblackoilmodule.hh:204
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:305
VTK output module for the black oil model's parameters.
Definition: vtkblackoilmodule.hh:89
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:469
The base class for writer modules.
#define NEW_TYPE_TAG(...)
Define a new type tag.
Definition: propertysystem.hh:169
#define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description)
Register a run-time parameter.
Definition: parametersystem.hh:68
Declares the properties required by the black oil model.
This file provides the infrastructure to retrieve run-time parameters.
The base class for writer modules.
Definition: baseoutputmodule.hh:80
#define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName)
Retrieve a runtime parameter.
Definition: parametersystem.hh:99
Provides the magic behind the eWoms property system.
void resizeScalarBuffer_(ScalarBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a scalar quantity.
Definition: baseoutputmodule.hh:170
Simplifies writing multi-file VTK datasets.
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:75
#define NEW_PROP_TAG(PTagName)
Define a property tag.
Definition: propertysystem.hh:247
void allocBuffers()
Allocate memory for the scalar fields we would like to write to the VTK file.
Definition: vtkblackoilmodule.hh:170