move assignment of displacements into MechContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-05 10:27:02 +01:00
parent e6a0ff522a
commit 564c8e5005
3 changed files with 18 additions and 5 deletions

View File

@ -117,6 +117,16 @@ allocate(const std::size_t bufferSize,
allocated_ = true;
}
template<class Scalar>
void MechContainer<Scalar>::
assignDisplacement(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,3>& disp)
{
this->dispX_[globalDofIdx] = disp[0];
this->dispY_[globalDofIdx] = disp[1];
this->dispZ_[globalDofIdx] = disp[2];
}
template<class Scalar>
void MechContainer<Scalar>::
assignPotentialForces(const unsigned globalDofIdx,

View File

@ -26,6 +26,8 @@
#ifndef OPM_MECH_CONTAINER_HPP
#define OPM_MECH_CONTAINER_HPP
#include <dune/common/fvector.hh>
#include <cstddef>
#include <map>
#include <string>
@ -44,6 +46,9 @@ public:
void allocate(const std::size_t bufferSize,
std::map<std::string, int>& rstKeywords);
void assignDisplacement(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,3>& disp);
void assignPotentialForces(const unsigned globalDofIdx,
const Scalar force,
const Scalar pressForce,

View File

@ -209,16 +209,14 @@ public:
const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
// Assume all mechanical things should be written
this->mech_.assignDisplacement(globalDofIdx,
model.disp(globalDofIdx, /*include_fracture*/true));
this->mech_.assignPotentialForces(globalDofIdx,
model.mechPotentialForce(globalDofIdx),
model.mechPotentialPressForce(globalDofIdx),
model.mechPotentialTempForce(globalDofIdx));
const auto disp = model.disp(globalDofIdx, /*include_fracture*/true);
this->mech_.dispX_[globalDofIdx] = disp[Voigt::XX];
this->mech_.dispY_[globalDofIdx] = disp[Voigt::YY];
this->mech_.dispZ_[globalDofIdx] = disp[Voigt::ZZ];
// Total stress is not stored but calculated result is Voigt notation
const auto stress = model.stress(globalDofIdx, /*include_fracture*/true);
this->mech_.stressXX_[globalDofIdx] = stress[Voigt::XX];