vtkblackoilsolventmodule.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
28#define OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
29
30#include <dune/common/fvector.hh>
31
32#include <opm/material/densead/Math.hpp>
33
35
37
41
44
45namespace Opm {
46
52template <class TypeTag>
54{
56
62
63 static const int vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
65
66 enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
67
69
70public:
71 VtkBlackOilSolventModule(const Simulator& simulator)
72 : ParentType(simulator)
73 {
74 if constexpr (enableSolvent) {
75 params_.read();
76 }
77 }
78
83 static void registerParameters()
84 {
85 if constexpr (enableSolvent) {
87 }
88 }
89
95 {
96 if constexpr (enableSolvent) {
97 if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
98 return;
99 }
100
101 if (params_.solventSaturationOutput_) {
102 this->resizeScalarBuffer_(solventSaturation_);
103 }
104 if (params_.solventRswOutput_) {
105 this->resizeScalarBuffer_(solventRsw_);
106 }
107 if (params_.solventDensityOutput_) {
108 this->resizeScalarBuffer_(solventDensity_);
109 }
110 if (params_.solventViscosityOutput_) {
111 this->resizeScalarBuffer_(solventViscosity_);
112 }
113 if (params_.solventMobilityOutput_) {
114 this->resizeScalarBuffer_(solventMobility_);
115 }
116 }
117 }
118
123 void processElement(const ElementContext& elemCtx)
124 {
125 if constexpr (enableSolvent) {
126 if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
127 return;
128 }
129
130 using Toolbox = MathToolbox<Evaluation>;
131 for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
132 const auto& intQuants = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0);
133 unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
134
135 if (params_.solventSaturationOutput_) {
136 solventSaturation_[globalDofIdx] =
137 Toolbox::scalarValue(intQuants.solventSaturation());
138 }
139
140 if (params_.solventRswOutput_) {
141 solventRsw_[globalDofIdx] =
142 Toolbox::scalarValue(intQuants.rsSolw());
143 }
144
145 if (params_.solventDensityOutput_) {
146 solventDensity_[globalDofIdx] =
147 Toolbox::scalarValue(intQuants.solventDensity());
148 }
149
150 if (params_.solventViscosityOutput_) {
151 solventViscosity_[globalDofIdx] =
152 Toolbox::scalarValue(intQuants.solventViscosity());
153 }
154
155 if (params_.solventMobilityOutput_) {
156 solventMobility_[globalDofIdx] =
157 Toolbox::scalarValue(intQuants.solventMobility());
158 }
159 }
160 }
161 }
162
167 {
168 if constexpr (enableSolvent) {
169 VtkMultiWriter* vtkWriter = dynamic_cast<VtkMultiWriter*>(&baseWriter);
170 if (!vtkWriter) {
171 return;
172 }
173
174 if (params_.solventSaturationOutput_) {
175 this->commitScalarBuffer_(baseWriter, "saturation_solvent", solventSaturation_);
176 }
177
178 if (params_.solventRswOutput_) {
179 this->commitScalarBuffer_(baseWriter, "dissolved_solvent", solventRsw_);
180 }
181
182 if (params_.solventDensityOutput_) {
183 this->commitScalarBuffer_(baseWriter, "density_solvent", solventDensity_);
184 }
185
186 if (params_.solventViscosityOutput_) {
187 this->commitScalarBuffer_(baseWriter, "viscosity_solvent", solventViscosity_);
188 }
189
190 if (params_.solventMobilityOutput_) {
191 this->commitScalarBuffer_(baseWriter, "mobility_solvent", solventMobility_);
192 }
193 }
194 }
195
196private:
197 VtkBlackOilSolventParams params_{};
198 ScalarBuffer solventSaturation_{};
199 ScalarBuffer solventRsw_{};
200 ScalarBuffer solventDensity_{};
201 ScalarBuffer solventViscosity_{};
202 ScalarBuffer solventMobility_{};
203};
204
205} // namespace Opm
206
207#endif // OPM_VTK_BLACK_OIL_SOLVENT_MODULE_HPP
Declares the properties required by the black oil model.
The base class for writer modules.
Definition: baseoutputmodule.hh:67
BaseOutputWriter::ScalarBuffer ScalarBuffer
Definition: baseoutputmodule.hh:85
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:244
void resizeScalarBuffer_(ScalarBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a scalar quantity.
Definition: baseoutputmodule.hh:156
The base class for all output writers.
Definition: baseoutputwriter.hh:44
VTK output module for the black oil model's solvent related quantities.
Definition: vtkblackoilsolventmodule.hpp:54
void commitBuffers(BaseOutputWriter &baseWriter)
Add all buffers to the VTK output writer.
Definition: vtkblackoilsolventmodule.hpp:166
static void registerParameters()
Register all run-time parameters for the multi-phase VTK output module.
Definition: vtkblackoilsolventmodule.hpp:83
void processElement(const ElementContext &elemCtx)
Modify the internal buffers according to the intensive quantities relevant for an element.
Definition: vtkblackoilsolventmodule.hpp:123
VtkBlackOilSolventModule(const Simulator &simulator)
Definition: vtkblackoilsolventmodule.hpp:71
void allocBuffers()
Allocate memory for the scalar fields we would like to write to the VTK file.
Definition: vtkblackoilsolventmodule.hpp:94
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:66
Declare the properties used by the infrastructure code of the finite volume discretizations.
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:235
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.
Struct holding the parameters for VtkBlackoilPolymerModule.
Definition: vtkblackoilsolventparams.hpp:47
bool solventMobilityOutput_
Definition: vtkblackoilsolventparams.hpp:58
bool solventDensityOutput_
Definition: vtkblackoilsolventparams.hpp:56
static void registerParameters()
Registers the parameters in parameter system.
bool solventViscosityOutput_
Definition: vtkblackoilsolventparams.hpp:57
bool solventSaturationOutput_
Definition: vtkblackoilsolventparams.hpp:54
bool solventRswOutput_
Definition: vtkblackoilsolventparams.hpp:55
void read()
Reads the parameter values from the parameter system.