27#ifndef EWOMS_BASE_OUTPUT_MODULE_HH
28#define EWOMS_BASE_OUTPUT_MODULE_HH
30#include <dune/common/fvector.hh>
32#include <dune/istl/bvector.hh>
49namespace Opm::Properties {
51template <
class TypeTag,
class MyTypeTag>
65template<
class TypeTag>
79 enum { dim = GridView::dimension };
80 enum { dimWorld = GridView::dimensionworld };
81 using Vector = BaseOutputWriter::Vector;
82 using Tensor = BaseOutputWriter::Tensor;
85 using ScalarBuffer = BaseOutputWriter::ScalarBuffer;
86 using VectorBuffer = BaseOutputWriter::VectorBuffer;
87 using TensorBuffer = BaseOutputWriter::TensorBuffer;
89 using EqBuffer = std::array<ScalarBuffer, numEq>;
90 using PhaseBuffer = std::array<ScalarBuffer, numPhases>;
91 using ComponentBuffer = std::array<ScalarBuffer, numComponents>;
92 using PhaseComponentBuffer = std::array<std::array<ScalarBuffer, numComponents>, numPhases>;
94 using PhaseVectorBuffer = std::array<VectorBuffer, numPhases>;
97 : simulator_(simulator)
174 void resizeVectorBuffer_(VectorBuffer&
buffer,
190 const std::size_t
n = this->getBufferSize(
bufferType);
191 for (
unsigned i = 0; i < numEq; ++i) {
204 const std::size_t
n = this->getBufferSize(
bufferType);
205 for (
unsigned i = 0; i < numPhases; ++i) {
218 const std::size_t
n = this->getBufferSize(
bufferType);
219 for (
unsigned i = 0; i < numComponents; ++i) {
232 const std::size_t
n = this->getBufferSize(
bufferType);
233 for (
unsigned i = 0; i < numPhases; ++i) {
234 for (
unsigned j = 0; j < numComponents; ++j) {
236 std::fill(
buffer[i][j].begin(),
buffer[i][j].end(), 0.0);
259 default:
throw std::logic_error(
"bufferType must be one of Dof, Vertex or Element");
281 default:
throw std::logic_error(
"bufferType must be one of Dof, Vertex or Element");
303 default:
throw std::logic_error(
"bufferType must be one of Dof, Vertex or Element");
316 for (
unsigned i = 0; i < numEq; ++i) {
317 std::string eqName = simulator_.model().primaryVarName(i);
333 for (
unsigned i = 0; i < numEq; ++i) {
334 std::ostringstream
oss;
351 for (
unsigned i = 0; i < numPhases; ++i) {
367 for (
unsigned i = 0; i < numComponents; ++i) {
379 PhaseComponentBuffer&
buffer,
383 for (
unsigned i= 0; i < numPhases; ++i) {
384 for (
unsigned j = 0; j < numComponents; ++j) {
386 FluidSystem::phaseName(i).data(),
387 FluidSystem::componentName(j).data());
399 void attachScalarVertexData_(BaseOutputWriter&
baseWriter,
404 void attachVectorElementData_(BaseOutputWriter&
baseWriter,
409 void attachVectorVertexData_(BaseOutputWriter&
baseWriter,
414 void attachTensorElementData_(BaseOutputWriter&
baseWriter,
419 void attachTensorVertexData_(BaseOutputWriter&
baseWriter,
427 case VertexBuffer:
return simulator_.gridView().size(dim);
429 case DofBuffer:
return simulator_.model().numGridDof();
430 default:
throw std::logic_error(
"bufferType must be one of Dof, Vertex or Element");
434 const Simulator& simulator_;
The base class for all output writers.
Defines a type tags and some fundamental properties all models.
The base class for writer modules.
Definition baseoutputmodule.hh:67
void commitPhaseBuffer_(BaseOutputWriter &baseWriter, const char *pattern, PhaseBuffer &buffer, BufferType bufferType=DofBuffer)
Add a phase-specific buffer to the result file.
Definition baseoutputmodule.hh:345
void resizePhaseBuffer_(PhaseBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a phase-specific quantity.
Definition baseoutputmodule.hh:201
void commitComponentBuffer_(BaseOutputWriter &baseWriter, const char *pattern, ComponentBuffer &buffer, BufferType bufferType=DofBuffer)
Add a component-specific buffer to the result file.
Definition baseoutputmodule.hh:361
virtual bool needExtensiveQuantities() const
Returns true iff the module needs to access the extensive quantities of a context to do its job.
Definition baseoutputmodule.hh:138
void commitTensorBuffer_(BaseOutputWriter &baseWriter, const char *name, TensorBuffer &buffer, BufferType bufferType=DofBuffer)
Add a buffer containing tensorial quantities to the result file.
Definition baseoutputmodule.hh:288
void resizeComponentBuffer_(ComponentBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a component specific quantity.
Definition baseoutputmodule.hh:215
void commitEqBuffer_(BaseOutputWriter &baseWriter, const char *pattern, EqBuffer &buffer, BufferType bufferType=DofBuffer)
Add a buffer with as many variables as PDEs to the result file.
Definition baseoutputmodule.hh:327
void resizePhaseComponentBuffer_(PhaseComponentBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a phase and component specific buffer.
Definition baseoutputmodule.hh:229
BufferType
Definition baseoutputmodule.hh:142
@ DofBuffer
Buffer contains data associated with the degrees of freedom.
Definition baseoutputmodule.hh:144
@ VertexBuffer
Buffer contains data associated with the grid's vertices.
Definition baseoutputmodule.hh:147
@ ElementBuffer
Buffer contains data associated with the grid's elements.
Definition baseoutputmodule.hh:150
void commitPriVarsBuffer_(BaseOutputWriter &baseWriter, const char *pattern, EqBuffer &buffer, BufferType bufferType=DofBuffer)
Add a buffer with as many variables as PDEs to the result file.
Definition baseoutputmodule.hh:310
void resizeEqBuffer_(EqBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a equation specific quantity.
Definition baseoutputmodule.hh:187
void commitPhaseComponentBuffer_(BaseOutputWriter &baseWriter, const char *pattern, PhaseComponentBuffer &buffer, BufferType bufferType=DofBuffer)
Add a phase and component specific quantities to the output.
Definition baseoutputmodule.hh:377
virtual void processElement(const ElementContext &elemCtx)=0
Modify the internal buffers according to the intensive quanties relevant for an element.
void resizeTensorBuffer_(TensorBuffer &buffer, BufferType bufferType=DofBuffer)
Allocate the space for a buffer storing a tensorial quantity.
Definition baseoutputmodule.hh:166
virtual void commitBuffers(BaseOutputWriter &writer)=0
Add all buffers to the VTK output writer.
void commitVectorBuffer_(BaseOutputWriter &baseWriter, const char *name, VectorBuffer &buffer, BufferType bufferType=DofBuffer)
Add a buffer containing vectorial quantities to the result file.
Definition baseoutputmodule.hh:266
virtual void allocBuffers()=0
Allocate memory for the scalar fields we would like to write to disk.
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
Declare the properties used by the infrastructure code of the finite volume discretizations.
Defines the common properties required by the porous medium multi-phase models.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
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.