Added: SIMgeneric::getInterfaceForces()

This commit is contained in:
Knut Morten Okstad 2022-02-10 13:22:47 +01:00
parent 88ee21ffe0
commit 7736de71ca
2 changed files with 34 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "IntegrandBase.h"
#include "Utilities.h"
#include "Function.h"
#include "SAM.h"
#include "IFEM.h"
@ -59,6 +60,31 @@ Vector SIMgeneric::getSolution (const Vector& psol, const double* par,
}
Vector SIMgeneric::getInterfaceForces (const Vector& sf,
const RealArray& weights, int code) const
{
Vector force(nsd);
if (!mySam)
return force;
IntVec glbNodes;
this->getBoundaryNodes(code,glbNodes);
for (int inod : glbNodes)
{
double w = inod <= (int)weights.size() ? weights[inod-1] : 1.0;
std::pair<int,int> dof = mySam->getNodeDOFs(inod);
for (unsigned char i = 0; i < nsd; i++, dof.first++)
if (dof.first <= dof.second && dof.first < (int)sf.size())
force[i] += w*sf(dof.first);
else
break;
}
return force;
}
int SIMgeneric::evalPoint (const double* xi, Vec3& X, double* param,
int patch, bool global) const
{

View File

@ -57,6 +57,14 @@ public:
int evalPoint(const double* xi, Vec3& X, double* param = nullptr,
int patch = 1, bool global = false) const;
//! \brief Extracts the force resultant on a specified interface.
//! \param[in] sf Internal nodal forces
//! \param[in] weights Nodal weights
//! \param[in] code Code indentifying the interface to extract forces for
//! \return The interface force resultant
Vector getInterfaceForces(const Vector& sf,
const RealArray& weights, int code) const;
//! \brief Returns the element that contains a specified spatial point.
//! \param[in] param The parameters of the point in the knot-span domain
//! \param[in] patch 1-based patch index containing the point