move assignment of stress into MechContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-05 10:40:35 +01:00
parent 1acedbd3d7
commit 21b41cf5c3
3 changed files with 18 additions and 7 deletions

View File

@ -140,6 +140,19 @@ assignPotentialForces(const unsigned globalDofIdx,
potentialTempForce_[globalDofIdx] = tempForce; potentialTempForce_[globalDofIdx] = tempForce;
} }
template<class Scalar>
void MechContainer<Scalar>::
assignStress(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,6>& stress)
{
this->stressXX_[globalDofIdx] = stress[0];
this->stressYY_[globalDofIdx] = stress[1];
this->stressZZ_[globalDofIdx] = stress[2];
this->stressYZ_[globalDofIdx] = stress[3];
this->stressXZ_[globalDofIdx] = stress[4];
this->stressXY_[globalDofIdx] = stress[5];
}
template<class Scalar> template<class Scalar>
void MechContainer<Scalar>:: void MechContainer<Scalar>::
outputRestart(data::Solution& sol) const outputRestart(data::Solution& sol) const

View File

@ -55,6 +55,9 @@ public:
const Scalar pressForce, const Scalar pressForce,
const Scalar tempForce); const Scalar tempForce);
void assignStress(const unsigned globalDofIdx,
const Dune::FieldVector<Scalar,6>& stress);
void outputRestart(data::Solution& sol) const; void outputRestart(data::Solution& sol) const;
bool allocated() const bool allocated() const

View File

@ -218,13 +218,8 @@ public:
model.mechPotentialTempForce(globalDofIdx)); model.mechPotentialTempForce(globalDofIdx));
// Total stress is not stored but calculated result is Voigt notation // Total stress is not stored but calculated result is Voigt notation
const auto stress = model.stress(globalDofIdx, /*include_fracture*/true); this->mech_.assignStress(globalDofIdx,
this->mech_.stressXX_[globalDofIdx] = stress[Voigt::XX]; model.stress(globalDofIdx, /*include_fracture*/true));;
this->mech_.stressYY_[globalDofIdx] = stress[Voigt::YY];
this->mech_.stressZZ_[globalDofIdx] = stress[Voigt::ZZ];
this->mech_.stressXY_[globalDofIdx] = stress[Voigt::XY];
this->mech_.stressXZ_[globalDofIdx] = stress[Voigt::XZ];
this->mech_.stressYZ_[globalDofIdx] = stress[Voigt::YZ];
const auto strain = model.strain(globalDofIdx, /*include_fracture*/true); const auto strain = model.strain(globalDofIdx, /*include_fracture*/true);
this->mech_.strainXX_[globalDofIdx] = strain[Voigt::XX]; this->mech_.strainXX_[globalDofIdx] = strain[Voigt::XX];