move assignment of potential forces into MechContainer

This commit is contained in:
Arne Morten Kvarving 2025-02-05 10:17:54 +01:00
parent b692bbd15e
commit e6a0ff522a
3 changed files with 21 additions and 3 deletions

View File

@ -117,6 +117,18 @@ allocate(const std::size_t bufferSize,
allocated_ = true;
}
template<class Scalar>
void MechContainer<Scalar>::
assignPotentialForces(const unsigned globalDofIdx,
const Scalar force,
const Scalar pressForce,
const Scalar tempForce)
{
potentialForce_[globalDofIdx] = force;
potentialPressForce_[globalDofIdx] = pressForce;
potentialTempForce_[globalDofIdx] = tempForce;
}
template<class Scalar>
void MechContainer<Scalar>::
outputRestart(data::Solution& sol) const

View File

@ -44,6 +44,11 @@ public:
void allocate(const std::size_t bufferSize,
std::map<std::string, int>& rstKeywords);
void assignPotentialForces(const unsigned globalDofIdx,
const Scalar force,
const Scalar pressForce,
const Scalar tempForce);
void outputRestart(data::Solution& sol) const;
bool allocated() const

View File

@ -209,9 +209,10 @@ public:
const unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
// Assume all mechanical things should be written
this->mech_.potentialForce_[globalDofIdx] = model.mechPotentialForce(globalDofIdx);
this->mech_.potentialPressForce_[globalDofIdx] = model.mechPotentialPressForce(globalDofIdx);
this->mech_.potentialTempForce_[globalDofIdx] = model.mechPotentialTempForce(globalDofIdx);
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];