mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added check to field sources to issue warning if source defined but not used
This commit is contained in:
@ -242,6 +242,9 @@ public:
|
||||
//- Return const access to the source active flag
|
||||
inline bool active() const;
|
||||
|
||||
//- Return const access to the applied flag
|
||||
inline bool applied() const;
|
||||
|
||||
//- Return const access to the time start
|
||||
inline scalar timeStart() const;
|
||||
|
||||
|
||||
@ -51,6 +51,12 @@ inline bool Foam::basicSource::active() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::basicSource::applied() const
|
||||
{
|
||||
return applied_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::basicSource::timeStart() const
|
||||
{
|
||||
return timeStart_;
|
||||
|
||||
@ -33,6 +33,24 @@ namespace Foam
|
||||
defineTypeNameAndDebug(basicSourceList, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::basicSourceList::checkApplied() const
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
const basicSource& bs = this->operator[](i);
|
||||
|
||||
if (!bs.applied())
|
||||
{
|
||||
WarningIn("void Foam::basicSourceList::checkApplied() const")
|
||||
<< "Source " << bs.name() << " defined, but not used" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::basicSourceList::basicSourceList
|
||||
|
||||
@ -62,6 +62,9 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check that all sources have been applied
|
||||
void checkApplied() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
basicSourceList(const basicSourceList&);
|
||||
|
||||
|
||||
@ -23,11 +23,19 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::basicSourceList::apply(fvMatrix<Type>& eqn)
|
||||
{
|
||||
if (mesh_.time().timeIndex() == mesh_.time().startTimeIndex() + 1)
|
||||
{
|
||||
checkApplied();
|
||||
}
|
||||
|
||||
const word& fieldName = eqn.psi().name();
|
||||
|
||||
forAll(*this, i)
|
||||
|
||||
Reference in New Issue
Block a user