diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index bfc251ba787f33a92ab3fd2d7340720a748c45e6..00164e4b5181966b31113b4eb5303a0509c8e653 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -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; } diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index 0cbd4aecba89c303a918cfad49a3cd4f8b770289..63603ff302f3ee754c21de33d060ffc64946c97f 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -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; diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 91d8f9488b3f19c95aa9d88e5b69e2c07ee90bec..3cbc44e98b9df2c396b3f761f55c112bc9869222 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -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() {