Added: Output of basis for ASMsupel as a lagrangian spider mesh

This commit is contained in:
Knut Morten Okstad 2021-04-29 21:27:21 +02:00
parent 6dc48a87d6
commit 7f21078fe7
4 changed files with 35 additions and 13 deletions

View File

@ -81,6 +81,21 @@ bool ASMsupel::read (std::istream& is)
}
bool ASMsupel::write (std::ostream& os, int) const
{
// Write out the spider as a lagrangian mesh
os <<"# LAGRANGIAN nodes="<< 1+nnod <<" elements="<< nnod
<<" type=superelement\n";
os << this->getCoord(0) <<"\n";
for (const Vec3& X : myNodes)
os << X <<"\n";
for (size_t i = 1; i <= nnod; i++)
os <<"0 "<< i <<"\n";
return os.good();
}
bool ASMsupel::generateFEMTopology ()
{
nnod = myNodes.size();
@ -145,10 +160,18 @@ void ASMsupel::getBoundaryNodes (int lIndex, IntVec& nodes,
Vec3 ASMsupel::getCoord (size_t inod) const
{
if (inod > 0 && inod <= nnod)
return myNodes[inod-1];
Vec3 Xn;
if (inod == 0)
{
// Calculate patch center
for (const Vec3& X : myNodes)
Xn += X;
Xn /= nnod;
}
else if (inod <= nnod)
Xn = myNodes[inod-1];
return Vec3();
return Xn;
}
@ -188,13 +211,8 @@ bool ASMsupel::integrate (Integrand& integrand, GlobalIntegral& glbInt,
bool ASMsupel::tesselate (ElementBlock& grid, const int*) const
{
Vec3 XC;
for (const Vec3& X : myNodes)
XC += X;
XC /= nnod;
grid.unStructResize(nnod,1+nnod);
grid.setCoor(0,XC);
grid.setCoor(0,this->getCoord(0));
for (size_t i = 1; i <= nnod; i++)
{
grid.setCoor(i,myNodes[i-1]);

View File

@ -39,8 +39,8 @@ public:
//! \brief Creates an instance by reading the given input stream.
virtual bool read(std::istream& is);
//! \brief Dummy method (basis is unknown).
virtual bool write(std::ostream&, int) const { return false; }
//! \brief Writes the geometry of the patch to the given stream.
virtual bool write(std::ostream&, int) const;
//! \brief Generates the finite element topology data for this patch.
virtual bool generateFEMTopology();
//! \brief Checks if this patch is empty.
@ -54,7 +54,8 @@ public:
virtual IntVec& getNodeSet(const std::string& setName);
//! \brief Returns the global coordinates for the given node.
//! \param[in] inod 1-based node index local to current patch
//! \param[in] inod 1-based node index local to current patch.
//! If \a inod is 0, the centroid of the patch is returned.
virtual Vec3 getCoord(size_t inod) const;
//! \brief Returns a matrix with all nodal coordinates within the patch.
//! \param[out] X nsd\f$\times\f$n-matrix, where \a n is the number of nodes

View File

@ -2157,7 +2157,7 @@ size_t SIMbase::extractPatchSolution (const Vector& sol, Vector& vec,
const IntVec& madof = this->getMADOF(basis,nndof);
pch->extractNodalVec(sol,vec,madof.data(),madof.size());
}
else if (mySam && mySam->getNoNodes('X') > 0)
else if (mySam && (mySam->getNoNodes('X') > 0 || this->getMDflag() > 0))
// Excluding the extraordinary DOFs
pch->extractNodalVec(sol,vec,mySam->getMADOF(),-2);
else

View File

@ -38,6 +38,9 @@ public:
//! \param[in] resetNumb If \e 'y', start element and node numbers from zero
virtual bool createFEMmodel(char resetNumb);
//! \brief Returns the name of this simulator.
virtual std::string getName() const { return "SIMsupel"; }
protected:
using SIMdummy<SIMgeneric>::parse;
//! \brief Parses a data section from an XML element