added: element norm functions in the Poisson integrand
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1040 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
parent
be79a13d26
commit
3e8d8cec1d
@ -183,6 +183,15 @@ bool Poisson::writeGlvT (VTF* vtf, int iStep, int& nBlock) const
|
||||
return vtf->writeVblk(nBlock,"Tractions",1,iStep);
|
||||
}
|
||||
|
||||
double Poisson::evalSol (const Vector& N) const
|
||||
{
|
||||
double u = 0;
|
||||
if (eV && eV->size() == N.size()*nsd)
|
||||
u = eV->dot(N);
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
bool Poisson::formCmatrix (Matrix& C, const Vec3&, bool invers) const
|
||||
{
|
||||
@ -246,6 +255,18 @@ bool Poisson::evalSol (Vector& q, const Matrix& dNdX, const Vec3& X) const
|
||||
return true;
|
||||
}
|
||||
|
||||
ElmNorm* PoissonNorm::getElmNormBuffer (LocalIntegral*& elmInt)
|
||||
{
|
||||
ElmNorm* eNorm = dynamic_cast<ElmNorm*>(elmInt);
|
||||
if (eNorm) return eNorm;
|
||||
|
||||
static double data[4];
|
||||
static ElmNorm buf(data);
|
||||
memset(data,0,4*sizeof(double));
|
||||
elmInt = eNorm = &buf;
|
||||
return eNorm;
|
||||
}
|
||||
|
||||
|
||||
bool Poisson::evalSol (Vector& s, const VecFunc& asol, const Vec3& X) const
|
||||
{
|
||||
@ -329,3 +350,18 @@ bool PoissonNorm::evalInt (LocalIntegral*& elmInt, const FiniteElement& fe,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PoissonNorm::evalBou(LocalIntegral*& elmInt, const FiniteElement& fe,
|
||||
const Vec3& X, const Vec3& normal) const
|
||||
{
|
||||
ElmNorm* eNorm = PoissonNorm::getElmNormBuffer(elmInt);
|
||||
|
||||
// Evaluate the surface flux
|
||||
double T = problem.getTraction(X,normal);
|
||||
// Evaluate the displacement field
|
||||
double u = problem.evalSol(fe.N);
|
||||
|
||||
// Integrate the external energy
|
||||
(*eNorm)[1] += T*u*fe.detJxW;
|
||||
return true;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <map>
|
||||
|
||||
class VTF;
|
||||
class ElmNorm;
|
||||
|
||||
|
||||
/*!
|
||||
@ -87,6 +88,11 @@ public:
|
||||
const Vector& N, const Matrix& dNdX,
|
||||
const Vec3& X, const std::vector<int>& MNPC) const;
|
||||
|
||||
//! \brief Evaluates the primary solution at a result point.
|
||||
//! \param[in] N Basis function values at current point
|
||||
//! \return Primary solution vector at current point
|
||||
double evalSol(const Vector& N) const;
|
||||
|
||||
//! \brief Evaluates the finite element (FE) solution at an integration point.
|
||||
//! \param[out] s The FE solution values at current point
|
||||
//! \param[in] dNdX Basis function gradients at current point
|
||||
@ -186,6 +192,22 @@ public:
|
||||
//! \brief Returns the number of norm quantities.
|
||||
virtual size_t getNoFields(int = 0) const { return anasol ? 3 : 1; }
|
||||
|
||||
protected:
|
||||
//! \brief Evaluates the integrand at a boundary point.
|
||||
//! \param elmInt The local integral object to receive the contributions
|
||||
//! \param[fe] Finite Element quantities
|
||||
//! \param[in] X Cartesian coordinates of current integration point
|
||||
//! \param[in] normal Boundary normal vector at current integration point
|
||||
virtual bool evalBou(LocalIntegral*& elmInt, const FiniteElement& fe,
|
||||
const Vec3& X, const Vec3& normal) const;
|
||||
|
||||
//! \brief Get a pointer to the element norm object to use in the integration.
|
||||
//! \param elmInt The local integral object to receive norm contributions
|
||||
//!
|
||||
//! \details If \a elmInt is NULL or cannot be casted to a ElmNorm pointer,
|
||||
//! a local static buffer is used instead.
|
||||
static ElmNorm* getElmNormBuffer(LocalIntegral*& elmInt);
|
||||
|
||||
private:
|
||||
Poisson& problem; //!< The problem-specific data
|
||||
VecFunc* anasol; //!< Analytical heat flux
|
||||
|
Loading…
Reference in New Issue
Block a user