25#ifndef VTK_TPSA_MODULE_HPP
26#define VTK_TPSA_MODULE_HPP
28#include <dune/common/dynmatrix.hh>
29#include <dune/common/fvector.hh>
31#include <opm/common/utility/SymmTensor.hpp>
32#include <opm/common/utility/VoigtArray.hpp>
33#include <opm/material/densead/Math.hpp>
49template <
class TypeTag>
59 static constexpr auto vtkFormat = getPropValue<TypeTag, Properties::VtkOutputFormat>();
62 enum { enableMech = getPropValue<TypeTag, Properties::EnableMech>() };
69 using SymTensor = SymmTensor<Scalar>;
70 using Tensor = Dune::DynamicMatrix<Scalar>;
82 if constexpr(enableMech) {
92 if constexpr(enableMech) {
103 if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
108 if constexpr(enableMech) {
159 if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
163 if constexpr(enableMech) {
165 const auto& problem = elemCtx.problem();
166 const auto& geoMechModel = problem.geoMechModel();
167 const auto& faceStressInfo = geoMechModel.linearizer().getStressInfo();
168 for (
unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(0); ++dofIdx) {
169 const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, 0);
170 const auto& materialState = geoMechModel.materialState(globalDofIdx, 0);
173 for (
int dirIdx = 0; dirIdx < 3; ++dirIdx) {
176 displacement_[globalDofIdx][dirIdx] = scalarValue(materialState.displacement(dirIdx));
181 rotation_[globalDofIdx][dirIdx] = scalarValue(materialState.rotation(dirIdx));
187 solidPres_[globalDofIdx] = scalarValue(materialState.solidPressure());
192 potPresForce_[globalDofIdx] =
193 geoMechModel.mechPotentialPressForce(globalDofIdx);
198 SymTensor stressSymTensor = geoMechModel.stress(globalDofIdx,
true);
199 Tensor& stressTensor = stress_[globalDofIdx];
200 setTensorFromVoigt_(stressTensor, stressSymTensor);
205 SymTensor delStressSymTensor = geoMechModel.delstress(globalDofIdx);
206 Tensor& delStressTensor = delStress_[globalDofIdx];
207 setTensorFromVoigt_(delStressTensor, delStressSymTensor);
212 SymTensor linStressSymTensor = geoMechModel.linstress(globalDofIdx);
213 Tensor& linStressTensor = linStress_[globalDofIdx];
214 setTensorFromVoigt_(linStressTensor, linStressSymTensor);
219 SymTensor strainSymTensor = geoMechModel.strain(globalDofIdx,
true);
220 Tensor& strainTensor = strain_[globalDofIdx];
221 setTensorFromVoigt_(strainTensor, strainSymTensor);
239 if constexpr(enableMech) {
257 "potentialPressureForce",
281 static void setTensorFromVoigt_(Tensor& tensor,
const SymTensor& symTensor)
284 constexpr auto& ind = SymTensor::diag_indices;
285 for (std::size_t i = 0; i < 3; ++i) {
286 tensor[i][i] = symTensor[ind[i]];
290 tensor[0][1] = symTensor[VoigtIndex::XY];
291 tensor[0][2] = symTensor[VoigtIndex::XZ];
292 tensor[1][2] = symTensor[VoigtIndex::YZ];
293 for (std::size_t i = 0; i < 3; ++i) {
294 for (std::size_t j = 0; j < 3; ++j) {
296 tensor[i][j] = tensor[j][i];
302 VtkTpsaParams params_{};
304 VectorBuffer displacement_{};
305 VectorBuffer rotation_{};
307 ScalarBuffer solidPres_{};
308 ScalarBuffer potPresForce_{};
310 TensorBuffer stress_{};
311 TensorBuffer delStress_{};
312 TensorBuffer linStress_{};
313 TensorBuffer strain_{};
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
void resizeVectorBuffer_(VectorBuffer &buffer, BufferType bufferType)
Definition: baseoutputmodule.hh:173
BaseOutputWriter::TensorBuffer TensorBuffer
Definition: baseoutputmodule.hh:88
void commitVectorBuffer_(BaseOutputWriter &baseWriter, const char *name, VectorBuffer &buffer, BufferType bufferType)
Add a buffer containing vectorial quantities to the result file.
Definition: baseoutputmodule.hh:260
BufferType
Definition: baseoutputmodule.hh:143
void commitTensorBuffer_(BaseOutputWriter &baseWriter, const char *name, TensorBuffer &buffer, BufferType bufferType)
Add a buffer containing tensorial quantities to the result file.
Definition: baseoutputmodule.hh:282
BaseOutputWriter::VectorBuffer VectorBuffer
Definition: baseoutputmodule.hh:87
void resizeTensorBuffer_(TensorBuffer &buffer, BufferType bufferType)
Allocate the space for a buffer storing a tensorial quantity.
Definition: baseoutputmodule.hh:166
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
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:65
VTK output module for TPSA quantities.
Definition: vtktpsamodule.hpp:51
static void registerParameters()
Register runtime parameters.
Definition: vtktpsamodule.hpp:90
void allocBuffers() override
Allocate memory for output.
Definition: vtktpsamodule.hpp:100
VtkTpsaModule(const Simulator &simulator)
Constructor.
Definition: vtktpsamodule.hpp:78
void commitBuffers(BaseOutputWriter &baseWriter) override
Add buffers to VTK writer.
Definition: vtktpsamodule.hpp:232
void processElement(const ElementContext &elemCtx) override
Assign quantities to output buffers.
Definition: vtktpsamodule.hpp:156
Definition: blackoilbioeffectsmodules.hh:45
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.
bool solidPressureOutput_
Definition: vtktpsaparams.hpp:55
bool stressOutput_
Definition: vtktpsaparams.hpp:56
static void registerParameters()
bool displacementOutput_
Definition: vtktpsaparams.hpp:53
bool linStressOutput_
Definition: vtktpsaparams.hpp:58
bool potPresForceOutput_
Definition: vtktpsaparams.hpp:60
bool rotationOutput_
Definition: vtktpsaparams.hpp:54
bool delStressOutput_
Definition: vtktpsaparams.hpp:57
bool strainOutput_
Definition: vtktpsaparams.hpp:59