Added kinetic energy and momentum monitoring functions.

This commit is contained in:
graham
2009-03-02 13:08:37 +00:00
parent c4099167d0
commit 5e414f1146
3 changed files with 59 additions and 0 deletions

View File

@ -477,11 +477,21 @@ void Foam::DsmcCloud<ParcelType>::evolve()
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::info() const
{
vector linearMomentum = linearMomentumOfSystem();
reduce(linearMomentum, sumOp<vector>());
Info<< "Cloud name: " << this->name() << nl
<< " Current number of parcels = "
<< returnReduce(this->size(), sumOp<label>()) << nl
<< " Current mass in system = "
<< returnReduce(massInSystem(), sumOp<scalar>()) << nl
<< " Linear momentum = "
<< linearMomentum << nl
<< " Linear momentum magnitude = "
<< mag(linearMomentum) << nl
<< " Linear kinetic energy = "
<< returnReduce(linearKineticEnergyOfSystem(), sumOp<scalar>()) << nl
<< endl;
}

View File

@ -282,6 +282,12 @@ public:
//- Total mass in system
inline scalar massInSystem() const;
//- Total linear momentum of the system
inline vector linearMomentumOfSystem() const;
//- Total linear kinetic energy in the system
inline scalar linearKineticEnergyOfSystem() const;
//- Print cloud information
void info() const;

View File

@ -164,6 +164,49 @@ inline Foam::scalar Foam::DsmcCloud<ParcelType>::massInSystem() const
}
template<class ParcelType>
inline Foam::vector Foam::DsmcCloud<ParcelType>::linearMomentumOfSystem() const
{
vector linearMomentum(vector::zero);
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
{
const ParcelType& p = iter();
const typename ParcelType::constantProperties& cP = constProps
(
p.typeId()
);
linearMomentum += cP.mass()*p.U();
}
return nParticle_*linearMomentum;
}
template<class ParcelType>
inline Foam::scalar
Foam::DsmcCloud<ParcelType>::linearKineticEnergyOfSystem() const
{
scalar linearKineticEnergy = 0.0;
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
{
const ParcelType& p = iter();
const typename ParcelType::constantProperties& cP = constProps
(
p.typeId()
);
linearKineticEnergy += 0.5*cP.mass()*(p.U() & p.U());
}
return nParticle_*linearKineticEnergy;
}
template<class ParcelType>
inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
{