ENH: Added include file to calculate the mechanical energy

This commit is contained in:
Andrew Heather 2017-04-04 12:51:35 +01:00
parent 37b0d85dc4
commit 111c1d2d12
2 changed files with 17 additions and 2 deletions

View File

@ -69,8 +69,7 @@ volScalarField dpdt
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
);
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
#include "createK.H"
#include "createMRF.H"

View File

@ -0,0 +1,16 @@
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));
if (U.nOldTimes())
{
volVectorField* Uold = &U.oldTime();
volScalarField* Kold = &K.oldTime();
*Kold == 0.5*magSqr(*Uold);
while (Uold->nOldTimes())
{
Uold = &Uold->oldTime();
Kold = &Kold->oldTime();
*Kold == 0.5*magSqr(*Uold);
}
}