move assignment of delStress into MechContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-05 11:35:41 +01:00
parent dd36273cb6
commit 9e8ab101ed
3 changed files with 19 additions and 9 deletions

View File

@ -111,6 +111,19 @@ allocate(const std::size_t bufferSize,
allocated_ = true;
}
template<class Scalar>
void MechContainer<Scalar>::
assignDelStress(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,6>& delStress)
{
this->delstressXX_[globalDofIdx] = delStress[0];
this->delstressYY_[globalDofIdx] = delStress[1];
this->delstressZZ_[globalDofIdx] = delStress[2];
this->delstressYZ_[globalDofIdx] = delStress[3];
this->delstressXZ_[globalDofIdx] = delStress[4];
this->delstressXY_[globalDofIdx] = delStress[5];
}
template<class Scalar>
void MechContainer<Scalar>::
assignDisplacement(const unsigned globalDofIdx,

View File

@ -52,6 +52,9 @@ public:
void assignDisplacement(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,3>& disp);
void assignDelStress(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,6>& delStress);
void assignPotentialForces(const unsigned globalDofIdx,
const Scalar force,
const Scalar pressForce,

View File

@ -209,6 +209,9 @@ public:
const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
// Assume all mechanical things should be written
this->mech_.assignDelStress(globalDofIdx,
model.delstress(globalDofIdx));
this->mech_.assignDisplacement(globalDofIdx,
model.disp(globalDofIdx, /*include_fracture*/true));
@ -224,15 +227,6 @@ public:
this->mech_.assignStress(globalDofIdx,
model.stress(globalDofIdx, /*include_fracture*/true));;
// Not including fracture
const auto delstress = model.delstress(globalDofIdx);
this->mech_.delstressXX_[globalDofIdx] = delstress[Voigt::XX];
this->mech_.delstressYY_[globalDofIdx] = delstress[Voigt::YY];
this->mech_.delstressZZ_[globalDofIdx] = delstress[Voigt::ZZ];
this->mech_.delstressXY_[globalDofIdx] = delstress[Voigt::XY];
this->mech_.delstressXZ_[globalDofIdx] = delstress[Voigt::XZ];
this->mech_.delstressYZ_[globalDofIdx] = delstress[Voigt::YZ];
const auto linstress = model.linstress(globalDofIdx);
this->mech_.linstressXX_[globalDofIdx] = linstress[Voigt::XX];
this->mech_.linstressYY_[globalDofIdx] = linstress[Voigt::YY];