From d627582dd6b953b57547e292ec644597aff4d0df Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 26 Jul 2018 10:55:10 +0100 Subject: [PATCH] combustionModel: Removed the deprecated "active" switch. To switch-off combustion choose the "noCombustion" model selected with the name "none" in the combustionProperties file: combustionModel none; --- src/combustionModels/EDC/EDC.C | 169 ++++++++---------- src/combustionModels/FSD/FSD.C | 5 +- src/combustionModels/PaSR/PaSR.C | 49 +++-- .../combustionModel/combustionModel.C | 2 - .../combustionModel/combustionModel.H | 6 - .../combustionModel/combustionModelI.H | 6 - src/combustionModels/diffusion/diffusion.C | 30 ++-- .../infinitelyFastChemistry.C | 30 ++-- src/combustionModels/laminar/laminar.C | 74 ++------ .../noCombustion/noCombustion.C | 4 +- .../polyTopoChange/polyTopoChange.C | 104 ++++++++++- .../polyTopoChange/polyTopoChange.H | 29 +++ .../constant/combustionProperties | 2 - .../constant/combustionProperties | 2 - .../constant/combustionProperties | 2 - .../constant/combustionProperties | 2 - .../DLR_A_LTS/constant/combustionProperties | 2 - .../SandiaD_LTS/constant/combustionProperties | 2 - .../constant/combustionProperties | 7 - .../constant/combustionProperties | 7 - .../constant/combustionProperties | 7 - .../constant/combustionProperties | 7 - .../constant/combustionProperties | 7 - .../constant/gas/combustionProperties | 3 - .../constant/combustionProperties | 2 - .../constant/combustionProperties | 7 - .../cylinder/constant/combustionProperties | 10 +- .../filter/constant/combustionProperties | 8 +- .../hotBoxes/constant/combustionProperties | 8 +- .../parcelInBox/constant/combustionProperties | 8 +- .../constant/combustionProperties | 8 +- .../splashPanel/constant/combustionProperties | 8 +- .../constant/combustionProperties | 8 +- .../constant/combustionProperties | 8 +- .../constant/combustionProperties | 7 +- .../aachenBomb/constant/combustionProperties | 2 - .../constant/combustionProperties.gas | 8 - 37 files changed, 285 insertions(+), 365 deletions(-) diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 7e3e3f1255..2fd250a8f9 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -82,95 +82,92 @@ Foam::combustionModels::EDC::~EDC() template void Foam::combustionModels::EDC::correct() { - if (this->active()) + tmp tepsilon(this->turbulence().epsilon()); + const volScalarField& epsilon = tepsilon(); + + tmp tmu(this->turbulence().mu()); + const volScalarField& mu = tmu(); + + tmp tk(this->turbulence().k()); + const volScalarField& k = tk(); + + tmp trho(this->rho()); + const volScalarField& rho = trho(); + + scalarField tauStar(epsilon.size(), 0); + + if (version_ == EDCversions::v2016) { - tmp tepsilon(this->turbulence().epsilon()); - const volScalarField& epsilon = tepsilon(); + tmp ttc(this->chemistryPtr_->tc()); + const volScalarField& tc = ttc(); - tmp tmu(this->turbulence().mu()); - const volScalarField& mu = tmu(); - - tmp tk(this->turbulence().k()); - const volScalarField& k = tk(); - - tmp trho(this->rho()); - const volScalarField& rho = trho(); - - scalarField tauStar(epsilon.size(), 0); - - if (version_ == EDCversions::v2016) + forAll(tauStar, i) { - tmp ttc(this->chemistryPtr_->tc()); - const volScalarField& tc = ttc(); + const scalar nu = mu[i]/(rho[i] + small); - forAll(tauStar, i) + const scalar Da = + max(min(sqrt(nu/(epsilon[i] + small))/tc[i], 10), 1e-10); + + const scalar ReT = sqr(k[i])/(nu*epsilon[i] + small); + const scalar CtauI = min(C1_/(Da*sqrt(ReT + 1)), 2.1377); + + const scalar CgammaI = + max(min(C2_*sqrt(Da*(ReT + 1)), 5), 0.4082); + + const scalar gammaL = + CgammaI*pow025(nu*epsilon[i]/(sqr(k[i]) + small)); + + tauStar[i] = CtauI*sqrt(nu/(epsilon[i] + small)); + + if (gammaL >= 1) { - const scalar nu = mu[i]/(rho[i] + small); - - const scalar Da = - max(min(sqrt(nu/(epsilon[i] + small))/tc[i], 10), 1e-10); - - const scalar ReT = sqr(k[i])/(nu*epsilon[i] + small); - const scalar CtauI = min(C1_/(Da*sqrt(ReT + 1)), 2.1377); - - const scalar CgammaI = - max(min(C2_*sqrt(Da*(ReT + 1)), 5), 0.4082); - - const scalar gammaL = - CgammaI*pow025(nu*epsilon[i]/(sqr(k[i]) + small)); - - tauStar[i] = CtauI*sqrt(nu/(epsilon[i] + small)); - - if (gammaL >= 1) - { - kappa_[i] = 1; - } - else - { - kappa_[i] = - max + kappa_[i] = 1; + } + else + { + kappa_[i] = + max + ( + min ( - min - ( - pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)), - 1 - ), - 0 - ); - } + pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)), + 1 + ), + 0 + ); } } - else - { - forAll(tauStar, i) - { - const scalar nu = mu[i]/(rho[i] + small); - const scalar gammaL = - Cgamma_*pow025(nu*epsilon[i]/(sqr(k[i]) + small)); - - tauStar[i] = Ctau_*sqrt(nu/(epsilon[i] + small)); - if (gammaL >= 1) - { - kappa_[i] = 1; - } - else - { - kappa_[i] = - max - ( - min - ( - pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)), - 1 - ), - 0 - ); - } - } - } - - this->chemistryPtr_->solve(tauStar); } + else + { + forAll(tauStar, i) + { + const scalar nu = mu[i]/(rho[i] + small); + const scalar gammaL = + Cgamma_*pow025(nu*epsilon[i]/(sqr(k[i]) + small)); + + tauStar[i] = Ctau_*sqrt(nu/(epsilon[i] + small)); + if (gammaL >= 1) + { + kappa_[i] = 1; + } + else + { + kappa_[i] = + max + ( + min + ( + pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)), + 1 + ), + 0 + ); + } + } + } + + this->chemistryPtr_->solve(tauStar); } @@ -186,7 +183,7 @@ template Foam::tmp Foam::combustionModels::EDC::Qdot() const { - tmp tQdot + return tmp ( new volScalarField ( @@ -199,17 +196,9 @@ Foam::combustionModels::EDC::Qdot() const IOobject::NO_WRITE, false ), - this->mesh(), - dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0) + kappa_*this->chemistryPtr_->Qdot() ) ); - - if (this->active()) - { - tQdot.ref() = kappa_*this->chemistryPtr_->Qdot(); - } - - return tQdot; } diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C index 858243cdf6..c8d75c7353 100644 --- a/src/combustionModels/FSD/FSD.C +++ b/src/combustionModels/FSD/FSD.C @@ -341,10 +341,7 @@ void FSD::correct() this->wFuel_ == dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); - if (this->active()) - { - calculateSourceNorm(); - } + calculateSourceNorm(); } diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index de60000fed..e3db078f86 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.C @@ -66,35 +66,32 @@ Foam::combustionModels::PaSR::~PaSR() template void Foam::combustionModels::PaSR::correct() { - if (this->active()) + laminar::correct(); + + tmp tepsilon(this->turbulence().epsilon()); + const scalarField& epsilon = tepsilon(); + + tmp tmuEff(this->turbulence().muEff()); + const scalarField& muEff = tmuEff(); + + tmp ttc(this->tc()); + const scalarField& tc = ttc(); + + tmp trho(this->rho()); + const scalarField& rho = trho(); + + forAll(epsilon, i) { - laminar::correct(); + const scalar tk = + Cmix_*sqrt(max(muEff[i]/rho[i]/(epsilon[i] + small), 0)); - tmp tepsilon(this->turbulence().epsilon()); - const scalarField& epsilon = tepsilon(); - - tmp tmuEff(this->turbulence().muEff()); - const scalarField& muEff = tmuEff(); - - tmp ttc(this->tc()); - const scalarField& tc = ttc(); - - tmp trho(this->rho()); - const scalarField& rho = trho(); - - forAll(epsilon, i) + if (tk > small) { - const scalar tk = - Cmix_*sqrt(max(muEff[i]/rho[i]/(epsilon[i] + small), 0)); - - if (tk > small) - { - kappa_[i] = tc[i]/(tc[i] + tk); - } - else - { - kappa_[i] = 1.0; - } + kappa_[i] = tc[i]/(tc[i] + tk); + } + else + { + kappa_[i] = 1.0; } } } diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index a22b9c594b..d7b351fd7d 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -81,7 +81,6 @@ Foam::combustionModel::combustionModel IOdictionary(createIOobject(thermo, combustionProperties)), mesh_(thermo.p().mesh()), turb_(turb), - active_(lookupOrDefault("active", true)), coeffs_(optionalSubDict(modelType + "Coeffs")), modelType_(modelType) {} @@ -99,7 +98,6 @@ bool Foam::combustionModel::read() { if (regIOobject::read()) { - this->lookup("active") >> active_; coeffs_ = optionalSubDict(modelType_ + "Coeffs"); return true; } diff --git a/src/combustionModels/combustionModel/combustionModel.H b/src/combustionModels/combustionModel/combustionModel.H index 6fb6d92acd..19bf177471 100644 --- a/src/combustionModels/combustionModel/combustionModel.H +++ b/src/combustionModels/combustionModel/combustionModel.H @@ -77,9 +77,6 @@ protected: //- Reference to the turbulence model const compressibleTurbulenceModel& turb_; - //- Active - Switch active_; - //- Dictionary of the model dictionary coeffs_; @@ -138,9 +135,6 @@ public: //- Return const access to phi inline tmp phi() const; - //- Is combustion active? - inline const Switch& active() const; - //- Return const dictionary of the model inline const dictionary& coeffs() const; diff --git a/src/combustionModels/combustionModel/combustionModelI.H b/src/combustionModels/combustionModel/combustionModelI.H index 09967b9bbb..a31d3aa380 100644 --- a/src/combustionModels/combustionModel/combustionModelI.H +++ b/src/combustionModels/combustionModel/combustionModelI.H @@ -50,12 +50,6 @@ inline Foam::tmp Foam::combustionModel::phi() const } -inline const Foam::Switch& Foam::combustionModel::active() const -{ - return active_; -} - - inline const Foam::dictionary& Foam::combustionModel::coeffs() const { return coeffs_; diff --git a/src/combustionModels/diffusion/diffusion.C b/src/combustionModels/diffusion/diffusion.C index c147aa2396..65a77bc11c 100644 --- a/src/combustionModels/diffusion/diffusion.C +++ b/src/combustionModels/diffusion/diffusion.C @@ -69,25 +69,21 @@ void diffusion::correct() this->wFuel_ == dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); - if (this->active()) + this->singleMixturePtr_->fresCorrect(); + + const label fuelI = this->singleMixturePtr_->fuelIndex(); + + const volScalarField& YFuel = this->thermo().composition().Y()[fuelI]; + + if (this->thermo().composition().contains(oxidantName_)) { - this->singleMixturePtr_->fresCorrect(); + const volScalarField& YO2 = + this->thermo().composition().Y(oxidantName_); - const label fuelI = this->singleMixturePtr_->fuelIndex(); - - const volScalarField& YFuel = - this->thermo().composition().Y()[fuelI]; - - if (this->thermo().composition().contains(oxidantName_)) - { - const volScalarField& YO2 = - this->thermo().composition().Y(oxidantName_); - - this->wFuel_ == - C_*this->turbulence().muEff() - *mag(fvc::grad(YFuel) & fvc::grad(YO2)) - *pos0(YFuel)*pos0(YO2); - } + this->wFuel_ == + C_*this->turbulence().muEff() + *mag(fvc::grad(YFuel) & fvc::grad(YO2)) + *pos0(YFuel)*pos0(YO2); } } diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C index 09c1cd0aca..6743397054 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -67,25 +67,21 @@ void infinitelyFastChemistry::correct() this->wFuel_ == dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); - if (this->active()) + this->singleMixturePtr_->fresCorrect(); + + const label fuelI = this->singleMixturePtr_->fuelIndex(); + + const volScalarField& YFuel = this->thermo().composition().Y()[fuelI]; + + const dimensionedScalar s = this->singleMixturePtr_->s(); + + if (this->thermo().composition().contains("O2")) { - this->singleMixturePtr_->fresCorrect(); + const volScalarField& YO2 = this->thermo().composition().Y("O2"); - const label fuelI = this->singleMixturePtr_->fuelIndex(); - - const volScalarField& YFuel = - this->thermo().composition().Y()[fuelI]; - - const dimensionedScalar s = this->singleMixturePtr_->s(); - - if (this->thermo().composition().contains("O2")) - { - const volScalarField& YO2 = this->thermo().composition().Y("O2"); - - this->wFuel_ == - this->rho()/(this->mesh().time().deltaT()*C_) - *min(YFuel, YO2/s.value()); - } + this->wFuel_ == + this->rho()/(this->mesh().time().deltaT()*C_) + *min(YFuel, YO2/s.value()); } } diff --git a/src/combustionModels/laminar/laminar.C b/src/combustionModels/laminar/laminar.C index b6d094b0f6..5d19152cf9 100644 --- a/src/combustionModels/laminar/laminar.C +++ b/src/combustionModels/laminar/laminar.C @@ -81,40 +81,33 @@ Foam::combustionModels::laminar::tc() const template void Foam::combustionModels::laminar::correct() { - if (this->active()) + if (integrateReactionRate_) { - if (integrateReactionRate_) + if (fv::localEulerDdt::enabled(this->mesh())) { - if (fv::localEulerDdt::enabled(this->mesh())) + const scalarField& rDeltaT = + fv::localEulerDdt::localRDeltaT(this->mesh()); + + if (this->coeffs().found("maxIntegrationTime")) { - const scalarField& rDeltaT = - fv::localEulerDdt::localRDeltaT(this->mesh()); + const scalar maxIntegrationTime + ( + readScalar(this->coeffs().lookup("maxIntegrationTime")) + ); - if (this->coeffs().found("maxIntegrationTime")) - { - scalar maxIntegrationTime - ( - readScalar(this->coeffs().lookup("maxIntegrationTime")) - ); - - this->chemistryPtr_->solve - ( - min(1.0/rDeltaT, maxIntegrationTime)() - ); - } - else - { - this->chemistryPtr_->solve((1.0/rDeltaT)()); - } + this->chemistryPtr_->solve + ( + min(1.0/rDeltaT, maxIntegrationTime)() + ); } else { - this->chemistryPtr_->solve(this->mesh().time().deltaTValue()); + this->chemistryPtr_->solve((1.0/rDeltaT)()); } } else { - this->chemistryPtr_->calculate(); + this->chemistryPtr_->solve(this->mesh().time().deltaTValue()); } } } @@ -125,16 +118,10 @@ Foam::tmp Foam::combustionModels::laminar::R(volScalarField& Y) const { tmp tSu(new fvScalarMatrix(Y, dimMass/dimTime)); - fvScalarMatrix& Su = tSu.ref(); - if (this->active()) - { - const label specieI = - this->thermo().composition().species()[Y.member()]; - - Su += this->chemistryPtr_->RR(specieI); - } + const label specieI = this->thermo().composition().species()[Y.member()]; + Su += this->chemistryPtr_->RR(specieI); return tSu; } @@ -144,30 +131,7 @@ template Foam::tmp Foam::combustionModels::laminar::Qdot() const { - tmp tQdot - ( - new volScalarField - ( - IOobject - ( - this->thermo().phasePropertyName(typeName + ":Qdot"), - this->mesh().time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - this->mesh(), - dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) - ) - ); - - if (this->active()) - { - tQdot.ref() = this->chemistryPtr_->Qdot(); - } - - return tQdot; + return this->chemistryPtr_->Qdot(); } diff --git a/src/combustionModels/noCombustion/noCombustion.C b/src/combustionModels/noCombustion/noCombustion.C index 7646d0d7fb..fbd06948bb 100644 --- a/src/combustionModels/noCombustion/noCombustion.C +++ b/src/combustionModels/noCombustion/noCombustion.C @@ -75,7 +75,7 @@ template Foam::tmp Foam::combustionModels::noCombustion::Qdot() const { - tmp tQdot + return tmp ( new volScalarField ( @@ -92,8 +92,6 @@ Foam::combustionModels::noCombustion::Qdot() const dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) ) ); - - return tQdot; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index 395c5ac471..89a8b246ee 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -1075,6 +1075,7 @@ void Foam::polyTopoChange::compact renumberReverseMap(localPointMap, reversePointMap_); renumberKey(localPointMap, pointZone_); + renumberKey(localPointMap, oldPoints_); renumber(localPointMap, retiredPoints_); // Use map to relabel face vertices @@ -2175,6 +2176,7 @@ Foam::polyTopoChange::polyTopoChange(const label nPatches, const bool strict) reversePointMap_(0), pointZone_(0), retiredPoints_(0), + oldPoints_(0), faces_(0), region_(0), faceOwner_(0), @@ -2210,6 +2212,7 @@ Foam::polyTopoChange::polyTopoChange reversePointMap_(0), pointZone_(0), retiredPoints_(0), + oldPoints_(0), faces_(0), region_(0), faceOwner_(0), @@ -2249,6 +2252,7 @@ void Foam::polyTopoChange::clear() reversePointMap_.clearStorage(); pointZone_.clearStorage(); retiredPoints_.clearStorage(); + oldPoints_.clearStorage(); faces_.clearStorage(); region_.clearStorage(); @@ -2299,6 +2303,7 @@ void Foam::polyTopoChange::addMesh pointMap_.setCapacity(pointMap_.size() + points.size()); reversePointMap_.setCapacity(reversePointMap_.size() + points.size()); pointZone_.resize(pointZone_.size() + points.size()/100); + // No need to extend oldPoints_ // Precalc offset zones labelList newZoneID(points.size(), -1); @@ -2717,6 +2722,81 @@ void Foam::polyTopoChange::modifyPoint { retiredPoints_.insert(pointi); } + + oldPoints_.erase(pointi); +} + + +Foam::label Foam::polyTopoChange::addPoint +( + const point& pt, + const point& oldPt, + const label masterPointID, + const label zoneID +) +{ + label pointi = points_.size(); + + points_.append(pt); + pointMap_.append(masterPointID); + reversePointMap_.append(pointi); + + if (zoneID >= 0) + { + pointZone_.insert(pointi, zoneID); + } + + oldPoints_.insert(pointi, oldPt); + + return pointi; +} + + +void Foam::polyTopoChange::modifyPoint +( + const label pointi, + const point& pt, + const point& oldPt, + const label newZoneID +) +{ + if (pointi < 0 || pointi >= points_.size()) + { + FatalErrorInFunction + << "illegal point label " << pointi << endl + << "Valid point labels are 0 .. " << points_.size()-1 + << abort(FatalError); + } + if (pointRemoved(pointi) || pointMap_[pointi] == -1) + { + FatalErrorInFunction + << "point " << pointi << " already marked for removal" + << abort(FatalError); + } + points_[pointi] = pt; + + Map