diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C index 6caf05a..bf13173 100644 --- a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C @@ -57,7 +57,8 @@ flameControllingVelocityFvPatchVectorField refValue_("refValue", dict, p.size()), Tref_(dict.lookupOrDefault("Tref", 300.0)), startTime_(dict.lookupOrDefault("startTime", db().time().startTime().value())), - lastVolume(-1) + lastVolume(-1), + lastMass(-1) { fvPatchVectorField::operator=(refValue_*patch().nf()); } @@ -154,12 +155,15 @@ void Foam::flameControllingVelocityFvPatchVectorField::updateCoeffs() scalar thisTime = db().time().timeOutputValue(); + const volScalarField &rho (db().lookupObject("rho")); const volScalarField &T (db().lookupObject("T")); dimensionedScalar Tref("Tref", T.dimensions(), Tref_); scalar lowTVolume = fvc::domainIntegrate(Foam::neg(T - Tref)).value(); + scalar lowTMass = fvc::domainIntegrate(rho * Foam::neg(T - Tref)).value(); + if (thisTime - lastTime > 0.0 && startTime_ <= thisTime) { scalar domainVolume = gSum(patch().boundaryMesh().mesh().V()); @@ -176,13 +180,18 @@ void Foam::flameControllingVelocityFvPatchVectorField::updateCoeffs() if (lastVolume < 0) { lastVolume = lowTVolume; + lastMass = lowTMass; } scalar dTV = lowTVolume - lastVolume; + scalar dTM = lowTMass - lastMass; + scalar patchArea = gSum(patch().magSf()); - scalar dVel = (dTV / dt / patchArea); + scalar patchRhoArea = gSum(patch().magSf() * rho.boundaryField()[patch().index()]); + + scalar dVel = (dTM / dt / patchRhoArea); Info << endl; Info << "delta Velocity " ; diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H index c8f2791..1e7cbcc 100644 --- a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H @@ -91,6 +91,8 @@ class flameControllingVelocityFvPatchVectorField scalar lastVolume; + scalar lastMass; + public: //- Runtime type information