Added: TimeDomain& argument in the virtual externalEnergy method

This commit is contained in:
Knut Morten Okstad 2018-04-21 17:12:49 +02:00
parent c0d97367eb
commit 0aab0de863
2 changed files with 11 additions and 10 deletions

View File

@ -156,6 +156,8 @@ bool SIMbase::preprocess (const IntVec& ignored, bool fixDup)
return false;
}
PROFILE1("Model preprocessing");
static int substep = 10;
this->printHeading(substep);
@ -1267,10 +1269,10 @@ bool SIMbase::solutionNorms (const TimeDomain& time,
const Vectors& psol, const Vectors& ssol,
Vectors& gNorm, Matrix* eNorm, const char* name)
{
PROFILE1("Norm integration");
if (!mySam) return true; // Silently ignore when uninitialized system
PROFILE1("Norm integration");
NormBase* norm = myProblem->getNormIntegrand(mySol);
if (!norm)
{
@ -1454,7 +1456,7 @@ bool SIMbase::solutionNorms (const TimeDomain& time,
}
// Add problem-dependent external norm contributions
norm->addBoundaryTerms(gNorm,this->externalEnergy(psol));
norm->addBoundaryTerms(gNorm,this->externalEnergy(psol,time));
delete norm;
@ -1468,7 +1470,7 @@ bool SIMbase::solutionNorms (const TimeDomain& time,
}
double SIMbase::externalEnergy (const Vectors& psol) const
double SIMbase::externalEnergy (const Vectors& psol, const TimeDomain&) const
{
const Vector* reactionForces = this->getReactionForces();
if (!reactionForces || !mySam || psol.empty()) return 0.0;

View File

@ -33,6 +33,7 @@ class FunctionBase;
class RealFunc;
class VecFunc;
class TractionFunc;
class ScalarFunc;
class Vec4;
class Vec3;
@ -143,7 +144,7 @@ public:
//! \brief Returns whether a mixed formulation is used (used by HDF5 output).
virtual bool mixedProblem() const { return false; }
//! \brief Obtain the linear solver parameters.
//! \brief Returns the linear equation solver parameters (for PETSc).
const LinSolParams* getSolParams() const { return mySolParams; }
//! \brief Returns the number of parameter dimensions in the model.
@ -380,10 +381,8 @@ public:
nullptr,name);
}
//! \brief Apply app-specific post-processing to element norms.
//! \param gNorm Vector with global norms
//! \param eNorm Matrix with element norms
virtual bool postProcessNorms(Vectors& gNorm, Matrix* eNorm) { return true; }
//! \brief Applies app-specific post-processing to element norms.
virtual bool postProcessNorms(Vectors&, Matrix*) { return true; }
//! \brief Prints out load/time step identification.
//! \param[in] istep Load- or time step counter
@ -639,7 +638,7 @@ protected:
const TimeDomain&) { return true; }
//! \brief Computes (possibly problem-dependent) external energy contribution.
virtual double externalEnergy(const Vectors& psol) const;
virtual double externalEnergy(const Vectors& psol, const TimeDomain&) const;
//! \brief Generates element groups for multi-threading of boundary integrals.
//! \param[in] p Property object identifying a patch boundary