diff --git a/flameControllingVelocity/Make/options b/flameControllingVelocity/Make/options index 97dc674..c0aaa29 100644 --- a/flameControllingVelocity/Make/options +++ b/flameControllingVelocity/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -g \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C index 762ef2f..6caf05a 100644 --- a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.C @@ -27,6 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" #include "fvPatchFieldMapper.H" +#include "fvcVolumeIntegrate.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -38,7 +39,9 @@ flameControllingVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_(p.size()) + refValue_(p.size()), + Tref_(300.0), + startTime_(db().time().startTime().value()) {} @@ -51,7 +54,10 @@ flameControllingVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_("refValue", dict, p.size()) + refValue_("refValue", dict, p.size()), + Tref_(dict.lookupOrDefault("Tref", 300.0)), + startTime_(dict.lookupOrDefault("startTime", db().time().startTime().value())), + lastVolume(-1) { fvPatchVectorField::operator=(refValue_*patch().nf()); } @@ -67,7 +73,9 @@ flameControllingVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_(ptf.refValue_, mapper) + refValue_(ptf.refValue_, mapper), + Tref_(ptf.Tref_), + startTime_(ptf.startTime_) { // Note: calculate product only on ptf to avoid multiplication on // unset values in reconstructPar. @@ -89,7 +97,9 @@ flameControllingVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(pivpvf), - refValue_(pivpvf.refValue_) + refValue_(pivpvf.refValue_), + Tref_(pivpvf.Tref_), + startTime_(pivpvf.startTime_) {} @@ -101,7 +111,9 @@ flameControllingVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(pivpvf, iF), - refValue_(pivpvf.refValue_) + refValue_(pivpvf.refValue_), + Tref_(pivpvf.Tref_), + startTime_(pivpvf.startTime_) {} @@ -139,6 +151,53 @@ void Foam::flameControllingVelocityFvPatchVectorField::updateCoeffs() return; } + scalar thisTime = db().time().timeOutputValue(); + + + const volScalarField &T (db().lookupObject("T")); + + dimensionedScalar Tref("Tref", T.dimensions(), Tref_); + + scalar lowTVolume = fvc::domainIntegrate(Foam::neg(T - Tref)).value(); + + if (thisTime - lastTime > 0.0 && startTime_ <= thisTime) + { + scalar domainVolume = gSum(patch().boundaryMesh().mesh().V()); + + Info << endl; + Info << "Volume calculation test" ; + Info << lowTVolume << token::END_STATEMENT + << domainVolume << token::END_STATEMENT + << lowTVolume / domainVolume; + Info << endl; + + scalar dt = thisTime - lastTime; + + if (lastVolume < 0) + { + lastVolume = lowTVolume; + } + + scalar dTV = lowTVolume - lastVolume; + + scalar patchArea = gSum(patch().magSf()); + + scalar dVel = (dTV / dt / patchArea); + + Info << endl; + Info << "delta Velocity " ; + Info << dVel << token::END_STATEMENT; + Info << endl; + + + refValue_ += dVel; + + } + + lastTime = thisTime; + + // lastVolume = lowTVolume; + fvPatchVectorField::operator=(refValue_*patch().nf()); fvPatchVectorField::updateCoeffs(); } @@ -148,6 +207,8 @@ void Foam::flameControllingVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); refValue_.writeEntry("refValue", os); + writeEntryIfDifferent(os, "Tref", Tref_, 300.0); + writeEntryIfDifferent(os, "startTime", startTime_, db().time().startTime().value()); } diff --git a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H index b0df8d4..c8f2791 100644 --- a/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H +++ b/flameControllingVelocity/flameControllingVelocityFvPatchVectorField.H @@ -81,6 +81,15 @@ class flameControllingVelocityFvPatchVectorField scalarField refValue_; + // scalar fuelVolumeRatio; + + scalar Tref_; + + scalar startTime_; + + scalar lastTime; + + scalar lastVolume; public: