diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C index 57a024f430..de5307c11b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C @@ -46,7 +46,7 @@ Foam::scalar Foam::solidRegionDiffNo / fvc::interpolate(Cprho) ); - DiNum = gMax(kapparhoCpbyDelta.primitiveField())*runTime.deltaT().value(); + DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaT().value(); meanDiNum = (average(kapparhoCpbyDelta)).value()*runTime.deltaT().value(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index fec8114fc1..b33289a0b7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -257,6 +257,73 @@ Foam::ThermalPhaseChangePhaseSystem::massTransfer() const } +template +Foam::tmp +Foam::ThermalPhaseChangePhaseSystem::iDmdt +( + const phasePairKey& key +) const +{ + const scalar dmdtSign(Pair::compare(iDmdt_.find(key).key(), key)); + + return dmdtSign**iDmdt_[key]; +} + + +template +Foam::tmp +Foam::ThermalPhaseChangePhaseSystem::iDmdt +( + const Foam::phaseModel& phase +) const +{ + tmp tiDmdt + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("iDmdt", phase.name()), + this->mesh_.time().timeName(), + this->mesh_ + ), + this->mesh_, + dimensionedScalar("zero", dimDensity/dimTime, 0) + ) + ); + + forAllConstIter + ( + phaseSystem::phasePairTable, + this->phasePairs_, + phasePairIter + ) + { + const phasePair& pair(phasePairIter()); + + if (pair.ordered()) + { + continue; + } + + const phaseModel* phase1 = &pair.phase1(); + const phaseModel* phase2 = &pair.phase2(); + + forAllConstIter(phasePair, pair, iter) + { + if (phase1 == &phase) + { + tiDmdt.ref() += this->iDmdt(pair); + } + + Swap(phase1, phase2); + } + } + + return tiDmdt; +} + + template void Foam::ThermalPhaseChangePhaseSystem::correctThermo() { @@ -265,8 +332,6 @@ void Foam::ThermalPhaseChangePhaseSystem::correctThermo() BasePhaseSystem::correctThermo(); - - forAllConstIter ( phaseSystem::phasePairTable, diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H index c1ab9e7c9c..611666eddc 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H @@ -101,6 +101,12 @@ public: //- Return the mass transfer matrices virtual autoPtr massTransfer() const; + //- Return the interfacial mass flow rate + virtual tmp iDmdt(const phasePairKey& key) const; + + //- Return the total interfacial mass transfer rate for phase + virtual tmp iDmdt(const phaseModel& phase) const; + //- Correct the thermodynamics virtual void correctThermo(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/Make/files b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/Make/files index fb9a8d1042..4b0a2cd0af 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/Make/files +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/Make/files @@ -36,10 +36,33 @@ kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJackson kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/newPartitioningModel.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C + +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/newNucleationSiteModel.C +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C + +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/newDepartureDiameterModel.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C + +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/newDepartureFrequencyModel.C +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C + +derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.C + derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libtwoPhaseReactingTurbulenceModels diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 15e7727bc8..60b92573c4 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -38,6 +38,31 @@ License #include "wallFvPatch.H" #include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* Foam::NamedEnum +< + Foam::compressible:: + alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, + 2 +>::names[] = +{ + "vapor", + "liquid" +}; + +const Foam::NamedEnum +< + Foam::compressible:: + alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, + 2 +> +Foam::compressible:: +alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -55,14 +80,20 @@ alphatWallBoilingWallFunctionFvPatchScalarField ) : alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF), + phaseType_(liquidPhase), relax_(0.5), - AbyV_(p.size(), 0.0), - alphatConv_(p.size(), 0.0) + AbyV_(p.size(), 0), + alphatConv_(p.size(), 0), + dDep_(p.size(), 0), + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiamModel_(nullptr), + departureFreqModel_(nullptr) { AbyV_ = this->patch().magSf(); - forAll(AbyV_,facei) + forAll(AbyV_, facei) { - label faceCelli = this->patch().faceCells()[facei]; + const label faceCelli = this->patch().faceCells()[facei]; AbyV_[facei] /= iF.mesh().V()[faceCelli]; } } @@ -77,19 +108,68 @@ alphatWallBoilingWallFunctionFvPatchScalarField ) : alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), + phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))), relax_(dict.lookupOrDefault("relax", 0.5)), - AbyV_(p.size(), 0.0), - alphatConv_(p.size(), 0.0) + AbyV_(p.size(), 0), + alphatConv_(p.size(), 0), + dDep_(p.size(), 0), + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiamModel_(nullptr), + departureFreqModel_(nullptr) { + switch (phaseType_) + { + case vaporPhase: + { + partitioningModel_ = + wallBoilingModels::partitioningModel::New + ( + dict.subDict("partitioningModel") + ); + + dmdt_ = 0; + + break; + } + case liquidPhase: + { + partitioningModel_ = + wallBoilingModels::partitioningModel::New + ( + dict.subDict("partitioningModel") + ); + + nucleationSiteModel_ = + wallBoilingModels::nucleationSiteModel::New + ( + dict.subDict("nucleationSiteModel") + ); + + departureDiamModel_ = + wallBoilingModels::departureDiameterModel::New + ( + dict.subDict("departureDiamModel") + ); + + departureFreqModel_ = + wallBoilingModels::departureFrequencyModel::New + ( + dict.subDict("departureFreqModel") + ); + break; + } + } + if (dict.found("alphatConv")) { alphatConv_ = scalarField("alphatConv", dict, p.size()); } AbyV_ = this->patch().magSf(); - forAll(AbyV_,facei) + forAll(AbyV_, facei) { - label faceCelli = this->patch().faceCells()[facei]; + const label faceCelli = this->patch().faceCells()[facei]; AbyV_[facei] /= iF.mesh().V()[faceCelli]; } } @@ -113,7 +193,12 @@ alphatWallBoilingWallFunctionFvPatchScalarField ), relax_(psf.relax_), AbyV_(psf.AbyV_), - alphatConv_(psf.alphatConv_, mapper) + alphatConv_(psf.alphatConv_, mapper), + dDep_(psf.dDep_, mapper), + partitioningModel_(psf.partitioningModel_), + nucleationSiteModel_(psf.nucleationSiteModel_), + departureDiamModel_(psf.departureDiamModel_), + departureFreqModel_(psf.departureFreqModel_) {} @@ -126,7 +211,12 @@ alphatWallBoilingWallFunctionFvPatchScalarField alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf), relax_(psf.relax_), AbyV_(psf.AbyV_), - alphatConv_(psf.alphatConv_) + alphatConv_(psf.alphatConv_), + dDep_(psf.dDep_), + partitioningModel_(psf.partitioningModel_), + nucleationSiteModel_(psf.nucleationSiteModel_), + departureDiamModel_(psf.departureDiamModel_), + departureFreqModel_(psf.departureFreqModel_) {} @@ -140,7 +230,12 @@ alphatWallBoilingWallFunctionFvPatchScalarField alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf, iF), relax_(psf.relax_), AbyV_(psf.AbyV_), - alphatConv_(psf.alphatConv_) + alphatConv_(psf.alphatConv_), + dDep_(psf.dDep_), + partitioningModel_(psf.partitioningModel_), + nucleationSiteModel_(psf.nucleationSiteModel_), + departureDiamModel_(psf.departureDiamModel_), + departureFreqModel_(psf.departureFreqModel_) {} @@ -153,13 +248,21 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() return; } + // Check that partitioningModel has been constructed + if (!partitioningModel_.valid()) + { + FatalErrorInFunction + << "partitioningModel has not been constructed!" + << abort(FatalError); + } + // Lookup the fluid model - const ThermalPhaseChangePhaseSystem - >& - fluid - = refCast + MomentumTransferPhaseSystem + < + twoPhaseSystem> + >& fluid = refCast < const ThermalPhaseChangePhaseSystem < @@ -170,192 +273,309 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() db().lookupObject("phaseProperties") ); - const phaseModel& liquid - ( - fluid.phase1().name() == internalField().group() - ? fluid.phase1() - : fluid.phase2() - ); - - const phaseModel& vapor(fluid.otherPhase(liquid)); - const label patchi = patch().index(); - // Retrieve turbulence properties from model - const phaseCompressibleTurbulenceModel& turbModel = liquid.turbulence(); - - const tmp tnutw = turbModel.nut(patchi); - - const scalar Cmu25(pow025(Cmu_)); - - const scalarField& y = turbModel.y()[patchi]; - - const tmp tmuw = turbModel.mu(patchi); - const scalarField& muw = tmuw(); - - const tmp talphaw = liquid.thermo().alpha(patchi); - const scalarField& alphaw = talphaw(); - - const tmp tk = turbModel.k(); - const volScalarField& k = tk(); - const fvPatchScalarField& kw = k.boundaryField()[patchi]; - - const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; - const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const scalarField magGradUw(mag(Uw.snGrad())); - - const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchi]; - const fvPatchScalarField& hew = - liquid.thermo().he().boundaryField()[patchi]; - - const fvPatchScalarField& Tw = - liquid.thermo().T().boundaryField()[patchi]; - const scalarField Tc(Tw.patchInternalField()); - - scalarField uTau(Cmu25*sqrt(kw)); - - scalarField yPlus(uTau*y/(muw/rhow)); - - scalarField Pr(muw/alphaw); - - // Molecular-to-turbulent Prandtl number ratio - scalarField Prat(Pr/Prt_); - - // Thermal sublayer thickness - scalarField P(this->Psmooth(Prat)); - - scalarField yPlusTherm(this->yPlusTherm(P, Prat)); - - const scalarField rhoc(rhow.patchInternalField()); - - tmp trhoVapor = vapor.thermo().rho(); - const volScalarField& rhoVapor = trhoVapor(); - const fvPatchScalarField& rhoVaporw = - rhoVapor.boundaryField()[patchi]; - const scalarField rhoVaporp(rhoVaporw.patchInternalField()); - - tmp tCp = liquid.thermo().Cp(); - const volScalarField& Cp = tCp(); - const fvPatchScalarField& Cpw = Cp.boundaryField()[patchi]; - - // Saturation temperature - const tmp tTsat = - fluid.saturation().Tsat(liquid.thermo().p()); - const volScalarField& Tsat = tTsat(); - const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]); - const scalarField Tsatc(Tsatw.patchInternalField()); - - // Gravitational acceleration - const uniformDimensionedVectorField& g = - db().lookupObject("g"); - - const fvPatchScalarField& pw = - liquid.thermo().p().boundaryField()[patchi]; - - const scalarField L - ( - vapor.thermo().he(pw,Tsatc,patchi)-hew.patchInternalField() - ); - - // Liquid temperature at y+=250 is estimated from logarithmic - // thermal wall function (Koncar, Krepper & Egorov, 2005) - scalarField Tplus_y250(Prt_*(log(E_*250)/kappa_ + P)); - scalarField Tplus(Prt_*(log(E_*yPlus)/kappa_ + P)); - scalarField Tl(Tw - (Tplus_y250/Tplus)*(Tw - Tc)); - Tl = max(Tc - 40, min(Tc, Tl)); - - // Nucleation site density: - // Reformulation of Lemmert & Chawla (Egorov & Menter, 2004) - const scalarField N - ( - 0.8*9.922e5*pow(max((Tw - Tsatw)/10, scalar(0)), 1.805) - ); - - // Bubble departure diameter: - // Tolubinski and Kostanchuk (1970) - const scalarField Tsub(max(Tsatw - Tl, scalar(0))); - const scalarField Ddep - ( - max(min(0.0006*exp(-Tsub/45), scalar(0.0014)), scalar(1e-6)) - ); - - // Bubble departure frequency: - // Cole (1960) - const scalarField F - ( - sqrt - ( - 4*mag(g).value()*(max(rhoc - rhoVaporp, scalar(0.1)))/(3*Ddep*rhow) - ) - ); - - // Area fractions: - - // Del Valle & Kenning (1985) - const scalarField Ja(rhoc*Cpw*Tsub/(rhoVaporp*L)); - const scalarField Al(4.8*exp(-Ja/80)); - - // Liquid phase fraction at the wall - const scalarField liquidw(liquid.boundaryField()[patchi]); - - // Damp boiling at high void fractions. - const scalarField W(min(liquidw/0.2, scalar(1))); - - const scalarField A2(W*min(M_PI*sqr(Ddep)*N*Al/4, scalar(1))); - const scalarField A1(max(1 - A2, scalar(1e-4))); - const scalarField A2E(W*min(M_PI*sqr(Ddep)*N*Al/4, scalar(5))); - - // Wall evaporation heat flux [kg/s3 = J/m2s] - const scalarField Qe((1.0/6.0)*A2E*Ddep*rhoVaporw*F*L); - - // Volumetric mass source in the near wall cell due to the wall boiling - dmdt_ = (1 - relax_)*dmdt_ + relax_*Qe*AbyV_/L; - - // Volumetric source in the near wall cell due to the wall boiling - mDotL_ = dmdt_*L; - - // Quenching heat transfer coefficient - const scalarField hQ - ( - 2*(alphaw*Cpw)*F*sqrt((0.8/F)/(M_PI*alphaw/rhow)) - ); - - // Quenching heat flux - const scalarField Qq(A2*hQ*max(Tw - Tl, scalar(0))); - - // Convective heat flux - alphatConv_ = calcAlphat(alphatConv_); - //const scalarField Qc(A1*(alphatConv_ + alphaw)*hew.snGrad()); - - // Effective thermal diffusivity that corresponds to the calculated - // convective, quenching and evaporative heat fluxes - - operator== - ( - A1*alphatConv_ + (Qq + Qe)/max(liquidw*hew.snGrad(), scalar(1e-16)) - ); - - if(debug) + switch (phaseType_) { - Info<< " L: " << gMin(L) << " - " << gMax(L) << endl; - Info<< " Tl: " << gMin(Tl) << " - " << gMax(Tl) << endl; - Info<< " N: " << gMin(N) << " - " << gMax(N) << endl; - Info<< " Ddep: " << gMin(Ddep) << " - " << gMax(Ddep) << endl; - Info<< " F: " << gMin(F) << " - " << gMax(F) << endl; - Info<< " Al: " << gMin(Al) << " - " << gMax(Al) << endl; - Info<< " A1: " << gMin(A1) << " - " << gMax(A1) << endl; - Info<< " A2: " << gMin(A2) << " - " << gMax(A2) << endl; - Info<< " A2E: " << gMin(A2E) << " - " << gMax(A2E) << endl; - Info<< " dmdtW: " << gMin(dmdt_) << " - " << gMax(dmdt_) << endl; - const scalarField Qc(A1*(alphatConv_ + alphaw)*hew.snGrad()); - Info<< " Qc: " << gMin(Qc) << " - " << gMax(Qc) << endl; - Info<< " Qq: " << gMin(Qq) << " - " << gMax(Qq) << endl; - Info<< " Qe: " << gMin(Qe) << " - " << gMax(Qe) << endl; - const scalarField QEff(liquidw*(*this + alphaw)*hew.snGrad()); - Info<< " QEff: " << gMin(QEff) << " - " << gMax(QEff) << endl; - Info<< " alphat: " << gMin(*this) << " - " << gMax(*this) << endl; - Info<< " alphatConv: " << gMin(alphatConv_) - << " - " << gMax(alphatConv_) << endl; + case vaporPhase: + { + const phaseModel& vapor + ( + fluid.phase1().name() == internalField().group() + ? fluid.phase1() + : fluid.phase2() + ); + + const phaseModel& liquid(fluid.otherPhase(vapor)); + + // Liquid phase fraction at the wall + const scalarField liquidw(liquid.boundaryField()[patchi]); + + // Vapor Liquid phase fraction at the wall + const scalarField vaporw(vapor.boundaryField()[patchi]); + + const scalarField fLiquid + ( + partitioningModel_->fLiquid(liquidw) + ); + + operator== + ( + calcAlphat(*this)*(1 - fLiquid)/max(vaporw, scalar(1e-8)) + ); + break; + } + case liquidPhase: + { + // Check that nucleationSiteModel has been constructed + if (!nucleationSiteModel_.valid()) + { + FatalErrorInFunction + << "nucleationSiteModel has not been constructed!" + << abort(FatalError); + } + + // Check that departureDiameterModel has been constructed + if (!departureDiamModel_.valid()) + { + FatalErrorInFunction + << "departureDiameterModel has not been constructed!" + << abort(FatalError); + } + + // Check that nucleationSiteModel has been constructed + if (!departureFreqModel_.valid()) + { + FatalErrorInFunction + << "departureFrequencyModel has not been constructed!" + << abort(FatalError); + } + + const phaseModel& liquid + ( + fluid.phase1().name() == internalField().group() + ? fluid.phase1() + : fluid.phase2() + ); + + const phaseModel& vapor(fluid.otherPhase(liquid)); + + // Retrieve turbulence properties from model + const phaseCompressibleTurbulenceModel& turbModel = + liquid.turbulence(); + + const tmp tnutw = turbModel.nut(patchi); + + const scalar Cmu25(pow025(Cmu_)); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tmuw = turbModel.mu(patchi); + const scalarField& muw = tmuw(); + + const tmp talphaw = liquid.thermo().alpha(patchi); + const scalarField& alphaw = talphaw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + const fvPatchScalarField& kw = k.boundaryField()[patchi]; + + const fvPatchVectorField& Uw = + turbModel.U().boundaryField()[patchi]; + const scalarField magUp(mag(Uw.patchInternalField() - Uw)); + const scalarField magGradUw(mag(Uw.snGrad())); + + const fvPatchScalarField& rhow = + turbModel.rho().boundaryField()[patchi]; + const fvPatchScalarField& hew = + liquid.thermo().he().boundaryField()[patchi]; + + const fvPatchScalarField& Tw = + liquid.thermo().T().boundaryField()[patchi]; + const scalarField Tc(Tw.patchInternalField()); + + const scalarField uTau(Cmu25*sqrt(kw)); + + const scalarField yPlus(uTau*y/(muw/rhow)); + + const scalarField Pr(muw/alphaw); + + // Molecular-to-turbulent Prandtl number ratio + const scalarField Prat(Pr/Prt_); + + // Thermal sublayer thickness + const scalarField P(this->Psmooth(Prat)); + + const scalarField yPlusTherm(this->yPlusTherm(P, Prat)); + + const fvPatchScalarField& rhoLiquidw = + liquid.turbulence().rho().boundaryField()[patchi]; + + const fvPatchScalarField& rhoVaporw = + vapor.turbulence().rho().boundaryField()[patchi]; + + tmp tCp = liquid.thermo().Cp(); + const volScalarField& Cp = tCp(); + const fvPatchScalarField& Cpw = Cp.boundaryField()[patchi]; + + // Saturation temperature + const tmp tTsat = + fluid.saturation().Tsat(liquid.thermo().p()); + const volScalarField& Tsat = tTsat(); + const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]); + const scalarField Tsatc(Tsatw.patchInternalField()); + + const fvPatchScalarField& pw = + liquid.thermo().p().boundaryField()[patchi]; + + const scalarField L + ( + vapor.thermo().he(pw,Tsatc,patchi)-hew.patchInternalField() + ); + + // Liquid phase fraction at the wall + const scalarField liquidw(liquid.boundaryField()[patchi]); + + const scalarField fLiquid(partitioningModel_->fLiquid(liquidw)); + + // Convective thermal diffusivity + alphatConv_ = calcAlphat(alphatConv_); + + for (label i=0; i<10; i++) + { + // Liquid temperature at y+=250 is estimated from logarithmic + // thermal wall function (Koncar, Krepper & Egorov, 2005) + const scalarField Tplus_y250(Prt_*(log(E_*250)/kappa_ + P)); + + const scalarField Tplus(Prt_*(log(E_*yPlus)/kappa_ + P)); + scalarField Tl(Tw - (Tplus_y250/Tplus)*(Tw - Tc)); + Tl = max(Tc - 40, min(Tc, Tl)); + const scalarField Tsub(max(Tsatw - Tl, scalar(0))); + + // Wall heat flux partitioning + const scalarField fLiquid + ( + partitioningModel_->fLiquid(liquidw) + ); + + // Nucleation site density: + const scalarField N + ( + nucleationSiteModel_->N + ( + liquid, + vapor, + patchi, + Tsatw + ) + ); + + // Bubble departure diameter: + dDep_ = departureDiamModel_->dDeparture + ( + liquid, + vapor, + patchi, + Tsub + ); + + // Bubble departure frequency: + const scalarField fDep + ( + departureFreqModel_->fDeparture + ( + liquid, + vapor, + patchi, + dDep_ + ) + ); + + // Area fractions: + + // Del Valle & Kenning (1985) + const scalarField Ja(rhoLiquidw*Cpw*Tsub/(rhoVaporw*L)); + const scalarField Al(fLiquid*4.8*exp(-Ja/80)); + + const scalarField A2(min(M_PI*sqr(dDep_)*N*Al/4, scalar(1))); + const scalarField A1(max(1 - A2, scalar(1e-4))); + const scalarField A2E(min(M_PI*sqr(dDep_)*N*Al/4, scalar(5))); + + // Wall evaporation heat flux [kg/s3 = J/m2s] + const scalarField Qe((1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*L); + + // Volumetric mass source in the near wall cell due to the + // wall boiling + dmdt_ = (1 - relax_)*dmdt_ + relax_*Qe*AbyV_/L; + + // Volumetric source in the near wall cell due to the wall + // boiling + mDotL_ = dmdt_*L; + + // Quenching heat transfer coefficient + const scalarField hQ + ( + 2*(alphaw*Cpw)*fDep*sqrt((0.8/fDep)/(M_PI*alphaw/rhow)) + ); + + // Quenching heat flux + const scalarField Qq(A2*hQ*max(Tw - Tl, scalar(0))); + + // Effective thermal diffusivity that corresponds to the + // calculated convective, quenching and evaporative heat fluxes + + operator== + ( + ( + A1*alphatConv_ + + (Qq + Qe)/max(hew.snGrad(), scalar(1e-16)) + ) + /max(liquidw, scalar(1e-8)) + ); + + scalarField TsupPrev(max((Tw - Tsatw),scalar(0))); + const_cast(Tw).evaluate(); + scalarField TsupNew(max((Tw - Tsatw),scalar(0))); + + scalar maxErr(max(mag(TsupPrev - TsupNew))); + + if (maxErr < 1e-1) + { + if (i > 0) + { + Info<< "Wall boiling wall function iterations: " + << i + 1 << endl; + } + break; + } + + if (debug) + { + const scalarField Qc + ( + fLiquid*A1*(alphatConv_ + alphaw)*hew.snGrad() + ); + + const scalarField QEff + ( + liquidw*(*this + alphaw)*hew.snGrad() + ); + + Info<< " L: " << gMin(L) << " - " << gMax(L) << endl; + Info<< " Tl: " << gMin(Tl) << " - " << gMax(Tl) << endl; + Info<< " N: " << gMin(N) << " - " << gMax(N) << endl; + Info<< " dDep_: " << gMin(dDep_) << " - " + << gMax(dDep_) << endl; + Info<< " fDep: " << gMin(fDep) << " - " + << gMax(fDep) << endl; + Info<< " Al: " << gMin(Al) << " - " << gMax(Al) << endl; + Info<< " A1: " << gMin(A1) << " - " << gMax(A1) << endl; + Info<< " A2: " << gMin(A2) << " - " << gMax(A2) << endl; + Info<< " A2E: " << gMin(A2E) << " - " + << gMax(A2E) << endl; + Info<< " dmdtW: " << gMin(dmdt_) << " - " + << gMax(dmdt_) << endl; + Info<< " Qc: " << gMin(Qc) << " - " << gMax(Qc) << endl; + Info<< " Qq: " << gMin(fLiquid*Qq) << " - " + << gMax(fLiquid*Qq) << endl; + Info<< " Qe: " << gMin(fLiquid*Qe) << " - " + << gMax(fLiquid*Qe) << endl; + Info<< " QEff: " << gMin(QEff) << " - " + << gMax(QEff) << endl; + Info<< " alphat: " << gMin(*this) << " - " + << gMax(*this) << endl; + Info<< " alphatConv: " << gMin(alphatConv_) + << " - " << gMax(alphatConv_) << endl; + } + } + break; + } + default: + { + FatalErrorInFunction + << "Unknown phase type. Valid types are: " + << phaseTypeNames_ << nl << exit(FatalError); + } } fixedValueFvPatchScalarField::updateCoeffs(); @@ -365,7 +585,47 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const { fvPatchField::write(os); + + os.writeKeyword("phaseType") << phaseTypeNames_[phaseType_] + << token::END_STATEMENT << nl; + os.writeKeyword("relax") << relax_ << token::END_STATEMENT << nl; + + switch (phaseType_) + { + case vaporPhase: + { + os.writeKeyword("partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + break; + } + case liquidPhase: + { + os.writeKeyword("partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + os.writeKeyword("nucleationSiteModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + nucleationSiteModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + os.writeKeyword("departureDiamModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureDiamModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + os.writeKeyword("departureFreqModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureFreqModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + break; + } + } + dmdt_.writeEntry("dmdt", os); alphatConv_.writeEntry("alphatConv", os); writeEntry("value", os); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H old mode 100644 new mode 100755 index cfef83e443..d724d98611 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -28,11 +28,17 @@ Group grpCmpWallFunctions Description - A thermal wall function for simulation of subcooled nucleate wall boiling. + A thermal wall function for simulation of subcooled nucleate wall boiling + with runtime selctable submodels for: + - wall heat flux partitioning model + - nucleation site density + - bubble departure frequency + - bubble departure diameter Implements a version of the well-known RPI wall boiling model (Kurul & Podowski, 1991). The model implementation is similar to the model - described by Peltola & Pättikangas (2012). + described by Peltola & Pättikangas (2012) but has been extended with the + wall heat flux partitioning models. References: \verbatim @@ -51,8 +57,66 @@ Description Daejeon, Korea, September 10-12 2012 \endverbatim -See also - Foam::fixedValueFvPatchField +Usage + \table + Property | Description | Required | Default value + phaseType | 'vapor' or 'liquid' | yes | + relax |wall boiling model relaxation| yes | + Prt | inherited from alphatPhaseChangeJayatillekeWallFunction + Cmu | inherited from alphatPhaseChangeJayatillekeWallFunction + kappa | inherited from alphatPhaseChangeJayatillekeWallFunction + E | inherited from alphatPhaseChangeJayatillekeWallFunction + dmdt | phase change mass flux | yes | + value | initial alphat value | yes | + + if phaseType 'vapor': + + partitioningModel| | yes | + + if phaseType 'liquid': + + partitioningModel| | yes | + nucleationSiteModel| | yes | + departureDiamModel| | yes | + departureFreqModel| | yes | + \endtable + + NOTE: Runtime selectabale submodels may require model specific entries + + Example usage: + \verbatim + hotWall + { + type compressible::alphatWallBoiling2WallFunction; + phaseType liquid; + Prt 0.85; + Cmu 0.09; + kappa 0.41; + E 9.8; + relax 0.001; + dmdt uniform 0; + partitioningModel + { + type Lavieville; + alphaCrit 0.2; + } + nucleationSiteModel + { + type LemmertChawla; + } + departureDiamModel + { + type TolubinskiKostanchuk; + } + departureFreqModel + { + type Cole; + } + value uniform 0.01; + \endverbatim + +SeeAlso + Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField SourceFiles alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -63,6 +127,10 @@ SourceFiles #define compressiblealphatWallBoilingWallFunctionFvPatchScalarField_H #include "alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H" +#include "partitioningModel.H" +#include "nucleationSiteModel.H" +#include "departureDiameterModel.H" +#include "departureFrequencyModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -79,8 +147,28 @@ class alphatWallBoilingWallFunctionFvPatchScalarField : public alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField { +public: + + // Data types + + //- Enumeration listing the possible operational modes + enum phaseType + { + vaporPhase, + liquidPhase + }; + + +private: + // Private data + //- Heat source type names + static const NamedEnum phaseTypeNames_; + + //- Heat source type + phaseType phaseType_; + //- dmdt relaxationFactor scalar relax_; @@ -90,6 +178,25 @@ class alphatWallBoilingWallFunctionFvPatchScalarField //- Convective turbulent thermal diffusivity scalarField alphatConv_; + //- Departure diameter field + scalarField dDep_; + + //- Run-time selected heat flux partitioning model + autoPtr + partitioningModel_; + + //- Run-time selected nucleation site density model + autoPtr + nucleationSiteModel_; + + //- Run-time selected bubble departure diameter model + autoPtr + departureDiamModel_; + + //- Run-time selected bubble departure frequency model + autoPtr + departureFreqModel_; + public: @@ -162,6 +269,13 @@ public: // Member functions + //- Calculate and return the departure diameter field + const scalarField& dDeparture() const + { + return dDep_; + } + + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.C new file mode 100644 index 0000000000..c21e38a0a2 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "wallBoiling.H" +#include "phaseCompressibleTurbulenceModel.H" +#include "alphatWallBoilingWallFunctionFvPatchScalarField.H" +#include "fvmSup.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ +namespace IATEsources +{ + defineTypeNameAndDebug(wallBoiling, 0); + addToRunTimeSelectionTable(IATEsource, wallBoiling, dictionary); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diameterModels::IATEsources::wallBoiling::wallBoiling +( + const IATE& iate, + const dictionary& dict +) +: + IATEsource(iate) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::diameterModels::IATEsources::wallBoiling::R +( + const volScalarField& alphai, + volScalarField& kappai +) const +{ + volScalarField::Internal R + ( + IOobject + ( + "wallBoiling:R", + phase().time().timeName(), + phase().mesh() + ), + phase().mesh(), + dimensionedScalar("R", dimless/dimTime, 0) + ); + + volScalarField::Internal Rdk + ( + IOobject + ( + "wallBoiling:Rdk", + phase().time().timeName(), + phase().mesh() + ), + phase().mesh(), + dimensionedScalar("Rdk", kappai.dimensions()/dimTime, 0) + ); + + const phaseCompressibleTurbulenceModel& turbulence = + const_cast + ( + phase().db().lookupObject + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + otherPhase().name() + ) + ) + ); + + const tmp talphat(turbulence.alphat()); + const volScalarField::Boundary& alphatBf = talphat().boundaryField(); + + const scalarField& rho = phase().rho(); + + typedef compressible::alphatWallBoilingWallFunctionFvPatchScalarField + alphatWallBoilingWallFunction; + + forAll(alphatBf, patchi) + { + if + ( + isA(alphatBf[patchi]) + ) + { + const alphatWallBoilingWallFunction& alphatw = + refCast(alphatBf[patchi]); + + const scalarField& dmdt = alphatw.dmdt(); + const scalarField& dDep = alphatw.dDeparture(); + + const labelList& faceCells = alphatw.patch().faceCells(); + + forAll(alphatw, facei) + { + if (dmdt[facei] > SMALL) + { + const label faceCelli = faceCells[facei]; + R[faceCelli] = + dmdt[facei]/(alphai[faceCelli]*rho[faceCelli]); + Rdk[faceCelli] = R[faceCelli]*(6.0/dDep[facei]); + } + } + } + } + + return Rdk - fvm::Sp(R, kappai); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.H new file mode 100644 index 0000000000..60fffa8acb --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/IATEsource/wallBoiling.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::diameterModels::IATEsources::wallBoiling + +Description + Wall-boiling IATE source. + +SourceFiles + wallBoiling.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallBoiling_H +#define wallBoiling_H + +#include "IATEsource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ +namespace IATEsources +{ + +/*---------------------------------------------------------------------------*\ + Class wallBoiling Declaration +\*---------------------------------------------------------------------------*/ + +class wallBoiling +: + public IATEsource +{ + +public: + + //- Runtime type information + TypeName("wallBoiling"); + + + // Constructors + + wallBoiling + ( + const IATE& iate, + const dictionary& dict + ); + + + //- Destructor + virtual ~wallBoiling() + {} + + + // Member Functions + + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace IATEsources +} // End namespace diameterModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C new file mode 100644 index 0000000000..ae6ecf4620 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "KocamustafaogullariIshii.H" +#include "addToRunTimeSelectionTable.H" +#include "uniformDimensionedFields.H" +#include "compressibleTurbulenceModel.H" +#include "ThermalDiffusivity.H" +#include "PhaseCompressibleTurbulenceModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + defineTypeNameAndDebug(KocamustafaogullariIshii, 0); + addToRunTimeSelectionTable + ( + departureDiameterModel, + KocamustafaogullariIshii, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshii::KocamustafaogullariIshii +( + const dictionary& dict +) +: + departureDiameterModel(), + phi_(readScalar(dict.lookup("phi"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshii::~KocamustafaogullariIshii() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshii::dDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tsub +) const +{ + // Gravitational acceleration + const uniformDimensionedVectorField& g = + liquid.mesh().lookupObject("g"); + + const fvPatchScalarField& rhoLiquid = + liquid.turbulence().rho().boundaryField()[patchi]; + + const fvPatchScalarField& rhoVapor = + vapor.turbulence().rho().boundaryField()[patchi]; + + const scalarField rhoM((rhoLiquid-rhoVapor)/rhoVapor); + + const tmp& tsigma + ( + liquid.fluid().sigma(phasePairKey(liquid.name(),vapor.name())) + ); + const volScalarField& sigma = tsigma(); + const fvPatchScalarField& sigmaw = sigma.boundaryField()[patchi]; + + return + 0.0012*pow(rhoM,0.9)*0.0208*phi_ + *sqrt(sigmaw/(mag(g.value())*(rhoLiquid-rhoVapor))); +} + + +void Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshii::write(Ostream& os) const +{ + departureDiameterModel::write(os); + os.writeKeyword("phi") << phi_ << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H new file mode 100644 index 0000000000..5bbe8d5433 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshii/KocamustafaogullariIshii.H @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::departureDiameterModels::KocamustafaogullariIshii + +Description + A correlation for bubble departure diameter. + + Requires model parameter 'phi': contact angle in degrees. + + Reference: + \verbatim + Kocamustafaogullari, G., & Ishii, M. (1983). + Interfacial area and nucleation site density in boiling systems. + International Journal of Heat and Mass Transfer, 26(9), 1377-1387. + \endverbatim + +SourceFiles + KocamustafaogullariIshii.C + +\*---------------------------------------------------------------------------*/ + +#ifndef KocamustafaogullariIshii_H +#define KocamustafaogullariIshii_H + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + +/*---------------------------------------------------------------------------*\ + Class KocamustafaogullariIshii Declaration +\*---------------------------------------------------------------------------*/ + +class KocamustafaogullariIshii +: + public departureDiameterModel +{ + // Private data + + //- Contact angle + scalar phi_; + + +public: + + //- Runtime type information + TypeName("KocamustafaogullariIshii"); + + // Constructors + + //- Construct from a dictionary + KocamustafaogullariIshii(const dictionary& dict); + + + //- Destructor + virtual ~KocamustafaogullariIshii(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tsub + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureDiameterModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C new file mode 100644 index 0000000000..23229071c0 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "TolubinskiKostanchuk.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + defineTypeNameAndDebug(TolubinskiKostanchuk, 0); + addToRunTimeSelectionTable + ( + departureDiameterModel, + TolubinskiKostanchuk, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::TolubinskiKostanchuk +( + const dictionary& dict +) +: + departureDiameterModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::~TolubinskiKostanchuk() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::dDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tsub +) const +{ + return max(min(0.0006*exp(-Tsub/45), scalar(0.0014)), scalar(1e-6)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H new file mode 100644 index 0000000000..9437f5185b --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::departureDiameterModels::TolubinskiKostanchuk + +Description + Tolubinski-Kostanchuk correlation for bubble departure diameter. + + Reference: + \verbatim + Tolubinsky, V. I., & Kostanchuk, D. M. (1970). + Vapour bubbles growth rate and heat transfer intensity at subcooled + water boiling. + In International Heat Transfer Conference 4 (Vol. 23). Begel House Inc. + \endverbatim + +SourceFiles + TolubinskiKostanchuk.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TolubinskiKostanchuk_H +#define TolubinskiKostanchuk_H + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + +/*---------------------------------------------------------------------------*\ + Class TolubinskiKostanchuk Declaration +\*---------------------------------------------------------------------------*/ + +class TolubinskiKostanchuk +: + public departureDiameterModel +{ + +public: + + //- Runtime type information + TypeName("TolubinskiKostanchuk"); + + + // Constructors + + //- Construct from a dictionary + TolubinskiKostanchuk(const dictionary& dict); + + + //- Destructor + virtual ~TolubinskiKostanchuk(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tsub + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureDiameterModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C new file mode 100644 index 0000000000..4c3564a006 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(departureDiameterModel, 0); + defineRunTimeSelectionTable(departureDiameterModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModel::departureDiameterModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModel::~departureDiameterModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::departureDiameterModel::write(Ostream& os) const +{ + os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; +} + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H new file mode 100644 index 0000000000..47f431eb19 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::departureDiameterModel + +Description + Base class for bubble departure diameter models + +SourceFiles + departureDiameterModel.C + newdepartureDiameterModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef departureDiameterModel_H +#define departureDiameterModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class departureDiameterModel Declaration +\*---------------------------------------------------------------------------*/ + +class departureDiameterModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + departureDiameterModel(const departureDiameterModel&); + + //- Disallow default bitwise assignment + void operator=(const departureDiameterModel&); + + +public: + + //- Runtime type information + TypeName("departureDiameterModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + departureDiameterModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + departureDiameterModel(); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~departureDiameterModel(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tsub + ) const = 0; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/newDepartureDiameterModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/newDepartureDiameterModel.C new file mode 100644 index 0000000000..45301ef6f8 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/newDepartureDiameterModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::departureDiameterModel::New +( + const dictionary& dict +) +{ + word departureDiameterModelType(dict.lookup("type")); + + Info<< "Selecting departureDiameterModel: " + << departureDiameterModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(departureDiameterModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown departureDiameterModelType type " + << departureDiameterModelType << endl << endl + << "Valid departureDiameterModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C new file mode 100644 index 0000000000..b6584caf5f --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "Cole.H" +#include "addToRunTimeSelectionTable.H" +#include "uniformDimensionedFields.H" +#include "compressibleTurbulenceModel.H" +#include "ThermalDiffusivity.H" +#include "PhaseCompressibleTurbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + defineTypeNameAndDebug(Cole, 0); + addToRunTimeSelectionTable + ( + departureFrequencyModel, + Cole, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::Cole(const dictionary& dict) +: + departureFrequencyModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::~Cole() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::fDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& dDep +) const +{ + // Gravitational acceleration + const uniformDimensionedVectorField& g = + liquid.mesh().lookupObject("g"); + + const fvPatchScalarField& rhoLiquid = + liquid.turbulence().rho().boundaryField()[patchi]; + + const fvPatchScalarField& rhoVapor = + vapor.turbulence().rho().boundaryField()[patchi]; + + return sqrt + ( + 4*mag(g).value() + *max(rhoLiquid - rhoVapor, scalar(0.1)) + /(3*dDep*rhoLiquid) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H new file mode 100644 index 0000000000..e3bbba979a --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::departureFrequencyModels::Cole + +Description + Cole correlation for bubble departure frequency. + + Reference: + \verbatim + Cole, R. (1960). + A photographic study of pool boiling in the region of the + critical heat flux. + AIChE Journal, 6(4), 533-538. + \endverbatim + +SourceFiles + Cole.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Cole_H +#define Cole_H + +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + +/*---------------------------------------------------------------------------*\ + Class Cole Declaration +\*---------------------------------------------------------------------------*/ + +class Cole +: + public departureFrequencyModel +{ + +public: + + //- Runtime type information + TypeName("Cole"); + + + // Constructors + + //- Construct from a dictionary + Cole(const dictionary& dict); + + + //- Destructor + virtual ~Cole(); + + + // Member Functions + + //- Calculate and return the bubble departure frequency + virtual tmp fDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& dDep + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureFrequencyModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C new file mode 100644 index 0000000000..e87e520096 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(departureFrequencyModel, 0); + defineRunTimeSelectionTable(departureFrequencyModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModel::departureFrequencyModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModel::~departureFrequencyModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::departureFrequencyModel::write(Ostream& os) const +{ + os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H new file mode 100644 index 0000000000..282df0b123 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::departureFrequencyModel + +Description + Base class for bubble departure frequency models + +SourceFiles + departureFrequencyModel.C + newdepartureFrequencyModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef departureFrequencyModel_H +#define departureFrequencyModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class departureFrequencyModel Declaration +\*---------------------------------------------------------------------------*/ + +class departureFrequencyModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + departureFrequencyModel(const departureFrequencyModel&); + + //- Disallow default bitwise assignment + void operator=(const departureFrequencyModel&); + + +public: + + //- Runtime type information + TypeName("departureFrequencyModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + departureFrequencyModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + departureFrequencyModel(); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~departureFrequencyModel(); + + + // Member Functions + + //- Calculate and return the bubble departure frequency + virtual tmp fDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& dDep + ) const = 0; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/newDepartureFrequencyModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/newDepartureFrequencyModel.C new file mode 100644 index 0000000000..4902b32915 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/newDepartureFrequencyModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::departureFrequencyModel::New +( + const dictionary& dict +) +{ + word departureFrequencyModelType(dict.lookup("type")); + + Info<< "Selecting departureFrequencyModel: " + << departureFrequencyModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(departureFrequencyModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown departureFrequencyModelType type " + << departureFrequencyModelType << endl << endl + << "Valid departureFrequencyModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C new file mode 100644 index 0000000000..28920597d2 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "LemmertChawla.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + defineTypeNameAndDebug(LemmertChawla, 0); + addToRunTimeSelectionTable + ( + nucleationSiteModel, + LemmertChawla, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla +( + const dictionary& dict +) +: + nucleationSiteModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::~LemmertChawla() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::N +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const fvPatchScalarField& Tsatw +) const +{ + const fvPatchScalarField& Tw = + liquid.thermo().T().boundaryField()[patchi]; + + return 0.8*9.922e5*pow(max((Tw - Tsatw)/10, scalar(0)), 1.805); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H new file mode 100644 index 0000000000..a521eb7842 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla + +Description + Lemmert & Chawla function for nucleation site density, + correlation by Egorov & Menter. + + References: + \verbatim + Lemmert, M., & Chawla, J. M. (1977). + Influence of flow velocity on surface boiling heat transfer coefficient. + Heat Transfer in Boiling, 237, 247. + + Egorov, Y., & Menter, F. (2004). + Experimental implementation of the RPI wall boiling model in CFX-5.6. + Staudenfeldweg, 12, 83624. + Technical Report ANSYS/TR-04-10, ANSYS Gmbh. + \endverbatim + +SourceFiles + LemmertChawla.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LemmertChawla_H +#define LemmertChawla_H + +#include "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + +/*---------------------------------------------------------------------------*\ + Class LemmertChawla Declaration +\*---------------------------------------------------------------------------*/ + +class LemmertChawla +: + public nucleationSiteModel +{ + +public: + + //- Runtime type information + TypeName("LemmertChawla"); + + // Constructors + + //- Construct from a dictionary + LemmertChawla(const dictionary& dict); + + + //- Destructor + virtual ~LemmertChawla(); + + + // Member Functions + + //- Calculate and return the nucleation-site density + virtual tmp N + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const fvPatchScalarField& Tsatw + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace nucleationSiteModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/newNucleationSiteModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/newNucleationSiteModel.C new file mode 100644 index 0000000000..486597787d --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/newNucleationSiteModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::nucleationSiteModel::New +( + const dictionary& dict +) +{ + word nucleationSiteModelType(dict.lookup("type")); + + Info<< "Selecting nucleationSiteModel: " + << nucleationSiteModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(nucleationSiteModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown nucleationSiteModelType type " + << nucleationSiteModelType << endl << endl + << "Valid nucleationSiteModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C new file mode 100644 index 0000000000..fbf495a5e2 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(nucleationSiteModel, 0); + defineRunTimeSelectionTable(nucleationSiteModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModel::nucleationSiteModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModel::~nucleationSiteModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::nucleationSiteModel::write(Ostream& os) const +{ + os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H new file mode 100644 index 0000000000..6a26e4de70 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::nucleationSiteModel + +Description + Base class for nucleation site density models + +SourceFiles + nucleationSiteModel.C + newnucleationSiteModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nucleationSiteModel_H +#define nucleationSiteModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class nucleationSiteModel Declaration +\*---------------------------------------------------------------------------*/ + +class nucleationSiteModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + nucleationSiteModel(const nucleationSiteModel&); + + //- Disallow default bitwise assignment + void operator=(const nucleationSiteModel&); + + +public: + + //- Runtime type information + TypeName("nucleationSiteModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + nucleationSiteModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + nucleationSiteModel(); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~nucleationSiteModel(); + + + // Member Functions + + //- Calculate and return the nucleation-site density + virtual tmp N + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const fvPatchScalarField& Tsatw + ) const = 0; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C new file mode 100644 index 0000000000..8feaaf8ca6 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "Lavieville.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(Lavieville, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + Lavieville, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +Lavieville::Lavieville(const dictionary& dict) +: + partitioningModel(), + alphaCrit_(readScalar(dict.lookup("alphaCrit"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +Lavieville::~Lavieville() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +Lavieville::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return + pos(alphaLiquid-alphaCrit_) + *( + 1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_)) + ) + + neg(alphaLiquid - alphaCrit_) + *( + pow(0.5*(alphaLiquid/alphaCrit_), 20*alphaCrit_) + ); +} + + +void Foam::wallBoilingModels::partitioningModels:: +Lavieville::write(Ostream& os) const +{ + partitioningModel::write(os); + os.writeKeyword("alphaCrit") << alphaCrit_ << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H new file mode 100644 index 0000000000..fda516fe9b --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::Lavieville + +Description + Lavieville wall heat flux partitioning model. + + Model parameters: + alphaCrit: critical liquid fraction + + Reference: + \verbatim + Lavieville, J., Quemerais, E., Mimouni, S., Boucker, M., & + Mechitoua, N. (2006). + NEPTUNE CFD V1. 0 theory manual. + NEPTUNE report Nept_2004_L1, 2(3). + \endverbatim + +SourceFiles + Lavieville.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lavieville_H +#define Lavieville_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class Lavieville Declaration +\*---------------------------------------------------------------------------*/ + +class Lavieville +: + public partitioningModel +{ + // Private data + + //- Critical liquid fraction + scalar alphaCrit_; + + +public: + + //- Runtime type information + TypeName("Lavieville"); + + + // Constructors + + //- Construct from a dictionary + Lavieville(const dictionary& dict); + + + //- Destructor + virtual ~Lavieville(); + + + // Member Functions + + //- Liquid blending function + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C new file mode 100644 index 0000000000..69818cf604 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "cosine.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(cosine, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + cosine, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +cosine::cosine(const dictionary& dict) +: + partitioningModel(), + alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))), + alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +cosine::~cosine() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +cosine::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return + pos(alphaLiquid1_ - alphaLiquid) + *( + neg(alphaLiquid0_ - alphaLiquid) + *( + 0.5 + *( + 1 - cos + ( + constant::mathematical::pi + *(alphaLiquid1_ - alphaLiquid) + /(alphaLiquid1_ - alphaLiquid0_) + ) + ) + ) + ) + + neg(alphaLiquid1_ - alphaLiquid); +} + + +void Foam::wallBoilingModels::partitioningModels:: +cosine::write(Ostream& os) const +{ + partitioningModel::write(os); + os.writeKeyword("alphaLiquid1") << alphaLiquid1_ + << token::END_STATEMENT << nl; + os.writeKeyword("alphaLiquid0") << alphaLiquid0_ + << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H new file mode 100644 index 0000000000..17815d94a0 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::cosine + +Description + Cosine wall heat flux partitioning model. + + Proposed threshold liquid fractions: + - alphaLiquid1 0.1 + - alphaLiquid0 0.05 + + \verbatim + Ioilev, A., Samigulin, M., Ustinenko, V., Kucherova, P., Tentner, + A., Lo, S., & Splawski, A. (2007). + Advances in the modeling of cladding heat transfer + and critical heat flux in boiling water reactor fuel assemblies. + In Proc. 12th International Topical Meeting on Nuclear Reactor + Thermal Hydraulics (NURETH-12), + Pittsburgh, Pennsylvania, USA. + \endverbatim + +SourceFiles + cosine.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cosine_H +#define cosine_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class cosine Declaration +\*---------------------------------------------------------------------------*/ + +class cosine +: + public partitioningModel +{ + // Private data + + // Model parameters, threshold liquid phase fractions + scalar alphaLiquid1_; + scalar alphaLiquid0_; + + +public: + + //- Runtime type information + TypeName("cosine"); + + + // Constructors + + //- Construct from a dictionary + cosine(const dictionary& dict); + + + //- Destructor + virtual ~cosine(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C new file mode 100644 index 0000000000..dd1142b137 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "linear.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(linear, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + linear, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +linear::linear(const dictionary& dict) +: + partitioningModel(), + alphaLiquid1_(readScalar(dict.lookup("alphaLiquid1"))), + alphaLiquid0_(readScalar(dict.lookup("alphaLiquid0"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +linear::~linear() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +linear::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return max + ( + scalar(0), + min + ( + scalar(1)-(alphaLiquid1_ - alphaLiquid) + /(alphaLiquid1_ - alphaLiquid0_), + scalar(1) + ) + ); +} + + +void Foam::wallBoilingModels::partitioningModels:: +linear::write(Ostream& os) const +{ + partitioningModel::write(os); + os.writeKeyword("alphaLiquid1") << alphaLiquid1_ + << token::END_STATEMENT << nl; + os.writeKeyword("alphaLiquid0") << alphaLiquid0_ + << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H new file mode 100644 index 0000000000..3e635de085 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::linear + +Description + Linear wall heat flux partitioning model. + + Proposed threshold liquid fractions: + - alphaLiquid1 0.1 + - alphaLiquid0 0.05 + + Reference: + \verbatim + Ioilev, A., Samigulin, M., Ustinenko, V., Kucherova, P., Tentner, A., + Lo, S., & Splawski, A. (2007). + Advances in the modeling of cladding heat transfer + and critical heat flux in boiling water reactor fuel assemblies. + In Proc. 12th International Topical Meeting on + Nuclear Reactor Thermal Hydraulics (NURETH-12), + Pittsburgh, Pennsylvania, USA. + \endverbatim + +SourceFiles + linear.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linear_H +#define linear_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class linear Declaration +\*---------------------------------------------------------------------------*/ + +class linear +: + public partitioningModel +{ + // Private data + + //- Model parameters, threshold liquid phase fractions + scalar alphaLiquid1_; + scalar alphaLiquid0_; + + +public: + + //- Runtime type information + TypeName("linear"); + + + // Constructors + + //- Construct from a dictionary + linear(const dictionary& dict); + + + //- Destructor + virtual ~linear(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/newPartitioningModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/newPartitioningModel.C new file mode 100644 index 0000000000..adfa944c9d --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/newPartitioningModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::partitioningModel::New +( + const dictionary& dict +) +{ + word partitioningModelType(dict.lookup("type")); + + Info<< "Selecting partitioningModel: " + << partitioningModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(partitioningModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown partitioningModelType type " + << partitioningModelType << endl << endl + << "Valid partitioningModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C new file mode 100644 index 0000000000..7b68289d94 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(partitioningModel, 0); + defineRunTimeSelectionTable(partitioningModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModel::partitioningModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModel::~partitioningModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::partitioningModel::write(Ostream& os) const +{ + os.writeKeyword("type") << this->type() << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H new file mode 100644 index 0000000000..c9f635624f --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::partitioningModel + +Description + Base class for wall heat flux partitioning models + +SourceFiles + partitioningModel.C + newpartitioningModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef partitioningModel_H +#define partitioningModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class partitioningModel Declaration +\*---------------------------------------------------------------------------*/ + +class partitioningModel +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + partitioningModel(const partitioningModel&); + + //- Disallow default bitwise assignment + void operator=(const partitioningModel&); + + +public: + + //- Runtime type information + TypeName("partitioningModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + partitioningModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + partitioningModel(); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~partitioningModel(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partitioning + virtual tmp fLiquid + ( + const scalarField& alphaLiquid + ) const = 0; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C new file mode 100644 index 0000000000..74ce07af8e --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "phaseFraction.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(phaseFraction, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + phaseFraction, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::phaseFraction(const dictionary& dict) +: + partitioningModel() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::~phaseFraction() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return tmp(alphaLiquid); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H new file mode 100644 index 0000000000..0752c56a84 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::wallBoilingModels::phaseFraction + +Description + Wall heat-flux partitioned according to the phase volume fraction. + +SourceFiles + phaseFraction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseFraction_H +#define phaseFraction_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class phaseFraction Declaration +\*---------------------------------------------------------------------------*/ + +class phaseFraction +: + public partitioningModel +{ + +public: + + //- Runtime type information + TypeName("phaseFraction"); + + + // Constructors + + //- Construct from a dictionary + phaseFraction(const dictionary& dict); + + + //- Destructor + virtual ~phaseFraction(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/Make/files b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/Make/files index ce89d9907b..3bd53b3cb1 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/Make/files +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/Make/files @@ -3,6 +3,7 @@ diameterModels/IATE/IATEsources/IATEsource/IATEsource.C diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C +diameterModels/IATE/IATEsources/phaseChange/phaseChange.C twoPhaseSystem.C newTwoPhaseSystem.C diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index e085403f76..9bae6c06e8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,43 +116,35 @@ Foam::tmp Foam::diameterModels::IATE::dsm() const return max(6/max(kappai_, 6/dMax_), dMin_); } -// Placeholder for the nucleation/condensation model -// Foam::tmp Foam::diameterModels::IATE::Rph() const -// { -// const volScalarField& T = phase_thermo().T(); -// const volScalarField& p = phase_.p(); -// -// scalar A, B, C, sigma, vm, Rph; -// -// volScalarField ps(1e5*pow(10, A - B/(T + C))); -// volScalarField Dbc -// ( -// 4*sigma*vm/(constant::physicoChemical::k*T*log(p/ps)) -// ); -// -// return constant::mathematical::pi*sqr(Dbc)*Rph; -// } - void Foam::diameterModels::IATE::correct() { - // Initialise the accumulated source term to the dilatation effect - volScalarField R + volScalarField alphaAv ( + max ( - (1.0/3.0) - /max - ( - fvc::average(phase_ + phase_.oldTime()), - residualAlpha_ - ) + fvc::average(phase_ + phase_.oldTime()), + residualAlpha_ + ) + ); + + // Initialise the accumulated source term to the dilatation effect + fvScalarMatrix R + ( + -fvm::SuSp + ( + ((1.0/3.0)/alphaAv) + *( + fvc::ddt(phase_) + fvc::div(phase_.alphaPhi()) + - phase_.continuityError()/phase_.rho() + ), + kappai_ ) - *(fvc::ddt(phase_) + fvc::div(phase_.alphaPhi())) ); // Accumulate the run-time selectable sources forAll(sources_, j) { - R -= sources_[j].R(); + R += sources_[j].R(alphaAv, kappai_); } fv::options& fvOptions(fv::options::New(phase_.mesh())); @@ -163,8 +155,7 @@ void Foam::diameterModels::IATE::correct() fvm::ddt(kappai_) + fvm::div(phase_.phi(), kappai_) - fvm::Sp(fvc::div(phase_.phi()), kappai_) == - - fvm::SuSp(R, kappai_) - //+ Rph() // Omit the nucleation/condensation term + R + fvOptions(kappai_) ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H index 5e135c1615..3183796015 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/IATEsource/IATEsource.H @@ -177,7 +177,11 @@ public: //- Return the bubble Webber number tmp We() const; - virtual tmp R() const = 0; + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const = 0; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.C index d7244b14d4..c086f1f5d0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,23 +43,26 @@ namespace IATEsources // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::diameterModels::IATEsources::dummy::R() const +Foam::tmp +Foam::diameterModels::IATEsources::dummy::R +( + const volScalarField& alphai, + volScalarField& kappai +) const { - return tmp + volScalarField::Internal R ( - new volScalarField + IOobject ( - IOobject - ( - "R", - iate_.phase().U().time().timeName(), - iate_.phase().mesh() - ), - iate_.phase().U().mesh(), - dimensionedScalar("R", dimless/dimTime, 0) - ) + "dummy:R", + iate_.phase().time().timeName(), + iate_.phase().mesh() + ), + iate_.phase().mesh(), + dimensionedScalar("R", kappai.dimensions()/dimTime, 0) ); + + return fvm::Su(R, kappai); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.H index e9c6529a97..583c35b472 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/dummy/dummy.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,11 @@ public: // Member Functions - virtual tmp R() const; + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C new file mode 100644 index 0000000000..229be87d48 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "phaseChange.H" +#include "twoPhaseSystem.H" +#include "phaseSystem.H" +#include "ThermalPhaseChangePhaseSystem.H" +#include "MomentumTransferPhaseSystem.H" +#include "fvmSup.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ +namespace IATEsources +{ + defineTypeNameAndDebug(phaseChange, 0); + addToRunTimeSelectionTable(IATEsource, phaseChange, dictionary); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diameterModels::IATEsources::phaseChange::phaseChange +( + const IATE& iate, + const dictionary& dict +) +: + IATEsource(iate) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::diameterModels::IATEsources::phaseChange::R +( + const volScalarField& alphai, + volScalarField& kappai +) const +{ + const ThermalPhaseChangePhaseSystem + < + MomentumTransferPhaseSystem + < + twoPhaseSystem + > + >& phaseChangeFluid = refCast + < + const ThermalPhaseChangePhaseSystem + < + MomentumTransferPhaseSystem + > + >(fluid()); + + return -fvm::SuSp + ( + (1.0/3.0) + *phaseChangeFluid.iDmdt(phase())()() + /(alphai()*phase().rho()()), + kappai + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H new file mode 100644 index 0000000000..ce8132451c --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::diameterModels::IATEsources::phaseChange + +Description + Phase-change IATE source. + +SourceFiles + phaseChange.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseChange_H +#define phaseChange_H + +#include "IATEsource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ +namespace IATEsources +{ + +/*---------------------------------------------------------------------------*\ + Class phaseChange Declaration +\*---------------------------------------------------------------------------*/ + +class phaseChange +: + public IATEsource +{ + +public: + + //- Runtime type information + TypeName("phaseChange"); + + + // Constructors + + phaseChange + ( + const IATE& iate, + const dictionary& dict + ); + + + //- Destructor + virtual ~phaseChange() + {} + + + // Member Functions + + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace IATEsources +} // End namespace diameterModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C index 86072b8dd0..10739955e8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "randomCoalescence.H" +#include "fvmSup.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -59,42 +60,40 @@ randomCoalescence // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::diameterModels::IATEsources::randomCoalescence::R() const +Foam::tmp +Foam::diameterModels::IATEsources::randomCoalescence::R +( + const volScalarField& alphai, + volScalarField& kappai +) const { - tmp tR + volScalarField::Internal R ( - new volScalarField + IOobject ( - IOobject - ( - "R", - iate_.phase().time().timeName(), - iate_.phase().mesh() - ), - iate_.phase().mesh(), - dimensionedScalar("R", dimless/dimTime, 0) - ) + "randomCoalescence:R", + iate_.phase().time().timeName(), + iate_.phase().mesh() + ), + iate_.phase().mesh(), + dimensionedScalar("R", dimless/dimTime, 0) ); - volScalarField R = tR(); - - scalar Crc = Crc_.value(); - scalar C = C_.value(); - scalar alphaMax = alphaMax_.value(); - volScalarField Ut(this->Ut()); + const scalar Crc = Crc_.value(); + const scalar C = C_.value(); + const scalar alphaMax = alphaMax_.value(); + const volScalarField Ut(this->Ut()); const volScalarField& alpha = phase(); - const volScalarField& kappai = iate_.kappai(); - scalar cbrtAlphaMax = cbrt(alphaMax); + const scalar cbrtAlphaMax = cbrt(alphaMax); forAll(R, celli) { if (alpha[celli] < alphaMax - SMALL) { - scalar cbrtAlphaMaxMAlpha = cbrtAlphaMax - cbrt(alpha[celli]); + const scalar cbrtAlphaMaxMAlpha = cbrtAlphaMax - cbrt(alpha[celli]); R[celli] = - (-12)*phi()*kappai[celli]*alpha[celli] + 12*phi()*kappai[celli]*alpha[celli] *Crc *Ut[celli] *(1 - exp(-C*cbrt(alpha[celli]*alphaMax)/cbrtAlphaMaxMAlpha)) @@ -102,7 +101,7 @@ Foam::diameterModels::IATEsources::randomCoalescence::R() const } } - return tR; + return -fvm::Sp(R, kappai); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.H index 42dad81250..5ebc6f8466 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,7 +89,11 @@ public: // Member Functions - virtual tmp R() const; + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C index 1dde056beb..f1135bd51a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "turbulentBreakUp.H" +#include "fvmSup.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -58,46 +59,40 @@ turbulentBreakUp // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::diameterModels::IATEsources::turbulentBreakUp::R() const +Foam::tmp +Foam::diameterModels::IATEsources::turbulentBreakUp::R +( + const volScalarField& alphai, + volScalarField& kappai +) const { - tmp tR + volScalarField::Internal R ( - new volScalarField + IOobject ( - IOobject - ( - "R", - iate_.phase().time().timeName(), - iate_.phase().mesh() - ), - iate_.phase().mesh(), - dimensionedScalar("R", dimless/dimTime, 0) - ) + "turbulentBreakUp:R", + iate_.phase().time().timeName(), + iate_.phase().mesh() + ), + iate_.phase().mesh(), + dimensionedScalar("R", kappai.dimensions()/dimTime, 0) ); - volScalarField R = tR(); - - scalar Cti = Cti_.value(); - scalar WeCr = WeCr_.value(); - volScalarField Ut(this->Ut()); - volScalarField We(this->We()); - const volScalarField& d(iate_.d()()); + const scalar Cti = Cti_.value(); + const scalar WeCr = WeCr_.value(); + const volScalarField Ut(this->Ut()); + const volScalarField We(this->We()); forAll(R, celli) { if (We[celli] > WeCr) { R[celli] = - (1.0/3.0) - *Cti/d[celli] - *Ut[celli] - *sqrt(1 - WeCr/We[celli]) - *exp(-WeCr/We[celli]); + 2*Cti*Ut[celli]*sqrt(1 - WeCr/We[celli])*exp(-WeCr/We[celli]); } } - return tR; + return fvm::Su(R, kappai); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.H index d2040379c3..b534865923 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.H @@ -1,8 +1,8 @@ -/*---------------------------------------------------------------------------*\ +/*---------------------------------------------------------------------------* \ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,7 +87,11 @@ public: // Member Functions - virtual tmp R() const; + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C index 20634b3204..02bfe48da7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "wakeEntrainmentCoalescence.H" +#include "fvmSup.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -62,10 +63,14 @@ wakeEntrainmentCoalescence // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::diameterModels::IATEsources::wakeEntrainmentCoalescence::R() const +Foam::tmp +Foam::diameterModels::IATEsources::wakeEntrainmentCoalescence::R +( + const volScalarField& alphai, + volScalarField& kappai +) const { - return (-12)*phi()*Cwe_*cbrt(CD())*iate_.a()*Ur(); + return -fvm::SuSp(12*phi()*Cwe_*cbrt(CD())*iate_.a()*Ur(), kappai); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.H index ed18bbc9b3..dc4d7554e7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,7 +86,11 @@ public: // Member Functions - virtual tmp R() const; + virtual tmp R + ( + const volScalarField& alphai, + volScalarField& kappai + ) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 6c039598a3..8115f05cd0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -403,7 +403,7 @@ void Foam::twoPhaseSystem::solve() fvScalarMatrix alpha1Eqn ( fvm::ddt(alpha1) - fvc::ddt(alpha1) - - fvm::laplacian(alphaDbyA, alpha1, "bounded") + - fvm::laplacian(alphaDbyA(), alpha1, "bounded") ); alpha1Eqn.relax(); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/Make/files b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/Make/files index 62c1628475..f6510d618c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/Make/files +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/Make/files @@ -31,6 +31,7 @@ kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStress kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStressModel.C kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C index 32d6431b6c..651de2ea03 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -190,6 +190,14 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() ) ); + const scalarField nuFric + ( + patch().lookupPatchField + ( + IOobject::groupName("nuFric", phased.name()) + ) + ); + word ThetaName(IOobject::groupName("Theta", phased.name())); const fvPatchScalarField& Theta @@ -222,7 +230,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() *gs0 *specularityCoefficient_.value() *sqrt(3.0*Theta) - /max(6.0*nu*alphaMax.value(), SMALL) + /max(6.0*(nu - nuFric)*alphaMax.value(), SMALL) ); this->valueFraction() = c/(c + patch().deltaCoeffs()); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C index 84303276ec..2d8a5cce8e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -65,7 +65,8 @@ JohnsonJacksonParticleThetaFvPatchScalarField mixedFvPatchScalarField(ptf, p, iF, mapper), restitutionCoefficient_(ptf.restitutionCoefficient_), specularityCoefficient_(ptf.specularityCoefficient_) -{} +{ +} Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C index ab5fb531ea..ab6d3d354a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,15 +81,16 @@ Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: frictionalPressure ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { + const volScalarField& alpha = phase; return - Fr_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_) - /pow(max(alphaMax - alpha1, alphaDeltaMin_), p_); + Fr_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + /pow(max(alphaMax - alpha, alphaDeltaMin_), p_); } @@ -97,24 +98,26 @@ Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: frictionalPressurePrime ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { + const volScalarField& alpha = phase; + return Fr_* ( - eta_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_ - 1.0) - *(alphaMax-alpha1) - + p_*pow(max(alpha1 - alphaMinFriction, scalar(0)), eta_) - )/pow(max(alphaMax - alpha1, alphaDeltaMin_), p_ + 1.0); + eta_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_ - 1.0) + *(alphaMax-alpha) + + p_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + )/pow(max(alphaMax - alpha, alphaDeltaMin_), p_ + 1.0); } Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H index 1fe92e7d0e..3013fc25ef 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,21 +93,21 @@ public: virtual tmp frictionalPressure ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; virtual tmp frictionalPressurePrime ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; virtual tmp nu ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C new file mode 100644 index 0000000000..3b69aa8a62 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "JohnsonJacksonSchaefferFrictionalStress.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + defineTypeNameAndDebug(JohnsonJacksonSchaeffer, 0); + + addToRunTimeSelectionTable + ( + frictionalStressModel, + JohnsonJacksonSchaeffer, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer +( + const dictionary& dict +) +: + frictionalStressModel(dict), + coeffDict_(dict.subDict(typeName + "Coeffs")), + Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), + eta_("eta", dimless, coeffDict_), + p_("p", dimless, coeffDict_), + phi_("phi", dimless, coeffDict_), + alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_) +{ + phi_ *= constant::mathematical::pi/180.0; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::~JohnsonJacksonSchaeffer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::frictionalPressure +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return + Fr_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + /pow(max(alphaMax - alpha, alphaDeltaMin_), p_); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::frictionalPressurePrime +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return Fr_* + ( + eta_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_ - 1.0) + *(alphaMax-alpha) + + p_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + )/pow(max(alphaMax - alpha, alphaDeltaMin_), p_ + 1.0); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::nu +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D +) const +{ + const volScalarField& alpha = phase; + + tmp tnu + ( + new volScalarField + ( + IOobject + ( + "JohnsonJacksonSchaeffer:nu", + phase.mesh().time().timeName(), + phase.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + phase.mesh(), + dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0.0) + ) + ); + + volScalarField& nuf = tnu.ref(); + + forAll(D, celli) + { + if (alpha[celli] > alphaMinFriction.value()) + { + nuf[celli] = + 0.5*pf[celli]*sin(phi_.value()) + /( + sqrt((1.0/3.0)*sqr(tr(D[celli])) - invariantII(D[celli])) + + SMALL + ); + } + } + + const fvPatchList& patches = phase.mesh().boundary(); + const volVectorField& U = phase.U(); + + volScalarField::Boundary& nufBf = nuf.boundaryFieldRef(); + + forAll(patches, patchi) + { + if (!patches[patchi].coupled()) + { + nufBf[patchi] = + ( + pf.boundaryField()[patchi]*sin(phi_.value()) + /( + mag(U.boundaryField()[patchi].snGrad()) + + SMALL + ) + ); + } + } + + // Correct coupled BCs + nuf.correctBoundaryConditions(); + + return tnu; +} + + +bool Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::read() +{ + coeffDict_ <<= dict_.subDict(typeName + "Coeffs"); + + Fr_.read(coeffDict_); + eta_.read(coeffDict_); + p_.read(coeffDict_); + + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; + + alphaDeltaMin_.read(coeffDict_); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H new file mode 100644 index 0000000000..2f8c971894 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::kineticTheoryModels::frictionalStressModels::JohnsonJacksonSchaeffer + +Description + +SourceFiles + JohnsonJacksonSchaefferFrictionalStress.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonSchaeffer_H +#define JohnsonJacksonSchaeffer_H + +#include "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonSchaeffer Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonSchaeffer +: + public frictionalStressModel +{ + // Private data + + dictionary coeffDict_; + + //- Material constant for frictional normal stress + dimensionedScalar Fr_; + + //- Material constant for frictional normal stress + dimensionedScalar eta_; + + //- Material constant for frictional normal stress + dimensionedScalar p_; + + //- Angle of internal friction + dimensionedScalar phi_; + + //- Lower limit for (alphaMax - alpha1) + dimensionedScalar alphaDeltaMin_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonSchaeffer"); + + + // Constructors + + //- Construct from components + JohnsonJacksonSchaeffer(const dictionary& dict); + + + //- Destructor + virtual ~JohnsonJacksonSchaeffer(); + + + // Member functions + + virtual tmp frictionalPressure + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp frictionalPressurePrime + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp nu + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace frictionalStressModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C index b88ec0923a..be2555958c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C @@ -74,14 +74,16 @@ Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::Schaeffer:: frictionalPressure ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { + const volScalarField& alpha = phase; + return dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24) - *pow(Foam::max(alpha1 - alphaMinFriction, scalar(0)), 10.0); + *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0); } @@ -89,31 +91,31 @@ Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::Schaeffer:: frictionalPressurePrime ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const { + const volScalarField& alpha = phase; + return dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25) - *pow(Foam::max(alpha1 - alphaMinFriction, scalar(0)), 9.0); + *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0); } Foam::tmp Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, const volSymmTensorField& D ) const { - const scalar I2Dsmall = 1.0e-15; + const volScalarField& alpha = phase; - // Creating nu assuming it should be 0 on the boundary which may not be - // true tmp tnu ( new volScalarField @@ -121,13 +123,13 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu IOobject ( "Schaeffer:nu", - alpha1.mesh().time().timeName(), - alpha1.mesh(), + phase.mesh().time().timeName(), + phase.mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - alpha1.mesh(), + phase.mesh(), dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0.0) ) ); @@ -136,16 +138,33 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu forAll(D, celli) { - if (alpha1[celli] > alphaMinFriction.value()) + if (alpha[celli] > alphaMinFriction.value()) { nuf[celli] = 0.5*pf[celli]*sin(phi_.value()) /( - sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) - + sqr(D[celli].yy() - D[celli].zz()) - + sqr(D[celli].zz() - D[celli].xx())) - + sqr(D[celli].xy()) + sqr(D[celli].xz()) - + sqr(D[celli].yz())) + I2Dsmall + sqrt((1.0/3.0)*sqr(tr(D[celli])) - invariantII(D[celli])) + + SMALL + ); + } + } + + const fvPatchList& patches = phase.mesh().boundary(); + const volVectorField& U = phase.U(); + + volScalarField::Boundary& nufBf = nuf.boundaryFieldRef(); + + forAll(patches, patchi) + { + if (!patches[patchi].coupled()) + { + nufBf[patchi] = + ( + pf.boundaryField()[patchi]*sin(phi_.value()) + /( + mag(U.boundaryField()[patchi].snGrad()) + + SMALL + ) ); } } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H index d4a304eb40..2b388df27a 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,21 +81,21 @@ public: virtual tmp frictionalPressure ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; virtual tmp frictionalPressurePrime ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const; virtual tmp nu ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H index 923a1fce3f..20feced234 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ SourceFiles #include "volFields.H" #include "dimensionedTypes.H" #include "runTimeSelectionTables.H" +#include "phaseModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -107,21 +108,21 @@ public: virtual tmp frictionalPressure ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const = 0; virtual tmp frictionalPressurePrime ( - const volScalarField& alpha1f, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax ) const = 0; virtual tmp nu ( - const volScalarField& alpha1, + const phaseModel& phase, const dimensionedScalar& alphaMinFriction, const dimensionedScalar& alphaMax, const volScalarField& pf, diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 29a83a0639..9f96dd7492 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -26,6 +26,7 @@ License #include "kineticTheoryModel.H" #include "mathematicalConstants.H" #include "twoPhaseSystem.H" +#include "fvOptions.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -43,10 +44,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel : eddyViscosity < - RASModel - >>> + RASModel> > ( type, @@ -113,6 +111,13 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel coeffDict_ ), + maxNut_ + ( + "maxNut", + dimensionSet(0,2,-1,0,0), + coeffDict_.lookupOrDefault("maxNut",1000) + ), + Theta_ ( IOobject @@ -166,6 +171,20 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel ), U.mesh(), dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0) + ), + + nuFric_ + ( + IOobject + ( + IOobject::groupName("nuFric", phase.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + U.mesh(), + dimensionedScalar("zero", dimensionSet(0, 2, -1, 0, 0), 0.0) ) { if (type == typeName) @@ -189,10 +208,7 @@ bool Foam::RASModels::kineticTheoryModel::read() ( eddyViscosity < - RASModel - >>> + RASModel> >::read() ) { @@ -272,7 +288,7 @@ Foam::RASModels::kineticTheoryModel::pPrime() const ) + frictionalStressModel_->frictionalPressurePrime ( - alpha_, + phase_, alphaMinFriction_, alphaMax_ ) @@ -424,6 +440,8 @@ void Foam::RASModels::kineticTheoryModel::correct() // 'thermal' conductivity (Table 3.3, p. 49) kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rho, da, e_); + fv::options& fvOptions(fv::options::New(mesh_)); + // Construct the granular temperature equation (Eq. 3.20, p. 44) // NB. note that there are two typos in Eq. 3.20: // Ps should be without grad @@ -443,10 +461,13 @@ void Foam::RASModels::kineticTheoryModel::correct() + fvm::Sp(-gammaCoeff, Theta_) + fvm::Sp(-J1, Theta_) + fvm::Sp(J2/(Theta_ + ThetaSmall), Theta_) + + fvOptions(alpha, rho, Theta_) ); ThetaEqn.relax(); + fvOptions.constrain(ThetaEqn); ThetaEqn.solve(); + fvOptions.correct(Theta_); } else { @@ -519,24 +540,25 @@ void Foam::RASModels::kineticTheoryModel::correct() ( frictionalStressModel_->frictionalPressure ( - alpha, + phase_, alphaMinFriction_, alphaMax_ ) ); - // Add frictional shear viscosity, Eq. 3.30, p. 52 - nut_ += frictionalStressModel_->nu + nuFric_ = frictionalStressModel_->nu ( - alpha, + phase_, alphaMinFriction_, alphaMax_, pf/rho, D ); - // Limit viscosity - nut_.min(100); + // Limit viscosity and add frictional viscosity + nut_.min(maxNut_); + nuFric_ = min(nuFric_, maxNut_ - nut_); + nut_ += nuFric_; } if (debug) diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H index 91f58d3449..03f323e519 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H @@ -47,8 +47,7 @@ SourceFiles #include "RASModel.H" #include "eddyViscosity.H" -#include "PhaseCompressibleTurbulenceModel.H" -#include "ThermalDiffusivity.H" +#include "phaseCompressibleTurbulenceModel.H" #include "EddyDiffusivity.H" #include "phaseModel.H" #include "dragModel.H" @@ -74,10 +73,7 @@ class kineticTheoryModel : public eddyViscosity < - RASModel - >>> + RASModel> > { // Private data @@ -124,6 +120,9 @@ class kineticTheoryModel //- Residual phase fraction dimensionedScalar residualAlpha_; + //- Maximum turbulent viscosity + dimensionedScalar maxNut_; + // Kinetic Theory Model Fields @@ -139,6 +138,9 @@ class kineticTheoryModel //- The granular "thermal" conductivity volScalarField kappa_; + //- The frictional viscosity + volScalarField nuFric_; + // Private Member Functions diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModel.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModel.H new file mode 100644 index 0000000000..d869907a33 --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModel.H @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::phaseCompressibleTurbulenceModel + +Description + Typedef for phaseCompressibleTurbulenceModel + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseCompressibleTurbulenceModel_H +#define phaseCompressibleTurbulenceModel_H + +#include "phaseCompressibleTurbulenceModelFwd.H" +#include "PhaseCompressibleTurbulenceModel.H" +#include "ThermalDiffusivity.H" +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef ThermalDiffusivity> + phaseCompressibleTurbulenceModel; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModelFwd.H b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModelFwd.H new file mode 100644 index 0000000000..417c6cea6d --- /dev/null +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModelFwd.H @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::phaseCompressibleTurbulenceModel + +Description + Forward declaration of typedef for phaseCompressibleTurbulenceModel + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseCompressibleTurbulenceModelFwd_H +#define phaseCompressibleTurbulenceModelFwd_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + class phaseModel; + + template + class PhaseCompressibleTurbulenceModel; + + template + class ThermalDiffusivity; + + typedef ThermalDiffusivity> + phaseCompressibleTurbulenceModel; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C index 011cfbcd50..7c2323a030 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/twoPhaseSystem.C @@ -523,7 +523,7 @@ void Foam::twoPhaseSystem::solve() fvScalarMatrix alpha1Eqn ( fvm::ddt(alpha1) - fvc::ddt(alpha1) - - fvm::laplacian(alpha1alpha2f*pPrimeByA_(), alpha1, "bounded") + - fvm::laplacian(alpha1alpha2f()*pPrimeByA_(), alpha1, "bounded") ); alpha1Eqn.relax(); diff --git a/applications/utilities/mesh/generation/blockMesh/Make/options b/applications/utilities/mesh/generation/blockMesh/Make/options index 2e07c477da..9d13a25de6 100644 --- a/applications/utilities/mesh/generation/blockMesh/Make/options +++ b/applications/utilities/mesh/generation/blockMesh/Make/options @@ -1,9 +1,11 @@ EXE_INC = \ -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ -lblockMesh \ -lmeshTools \ + -lfileFormats \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index 31761f4009..cdea2a93ba 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -179,8 +179,6 @@ int main(int argc, char *argv[]) Info<< "Creating block mesh from\n " << meshDictIO.objectPath() << endl; - blockMesh::verbose(true); - IOdictionary meshDict(meshDictIO); blockMesh blocks(meshDict, regionName); @@ -289,8 +287,8 @@ int main(int argc, char *argv[]) forAll(blocks, blockI) { const block& b = blocks[blockI]; - const labelListList& blockCells = b.cells(); - const word& zoneName = b.blockDef().zoneName(); + const List> blockCells = b.cells(); + const word& zoneName = b.zoneName(); if (zoneName.size()) { diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index b22803c56b..099e3281eb 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -41,8 +41,6 @@ SourceFiles #ifndef conformalVoronoiMesh_H #define conformalVoronoiMesh_H -// Include uint.H before CGAL headers to define __STDC_LIMIT_MACROS -#include "uint.H" #include "CGALTriangulation3Ddefs.H" #include "searchableSurfaces.H" #include "conformationSurfaces.H" diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformer.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformer.H index 21cdc53e31..249c8d8cba 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformer.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformer.H @@ -39,8 +39,6 @@ SourceFiles #ifndef featurePointConformer_H #define featurePointConformer_H -// Include uint.H before CGAL headers to define __STDC_LIMIT_MACROS -#include "uint.H" #include "CGALTriangulation3Ddefs.H" #include "vector.H" #include "DynamicList.H" diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H index da273a90d2..6bbe59b937 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H +++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -117,8 +117,6 @@ SourceFiles #define CGAL_INEXACT #define CGAL_HIERARCHY -// Include uint.H before CGAL headers to define __STDC_LIMIT_MACROS -#include "uint.H" #include "CGALTriangulation2Ddefs.H" #include "Time.H" #include "point2DFieldFwd.H" diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C index 968d235e54..7cd62abbdc 100644 --- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C +++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C @@ -43,14 +43,21 @@ Usage - \par -set \ Adds or replaces the entry + - \par -remove + Remove the selected entry + + - \par -diff \ + Write differences with respect to the specified dictionary + (or sub entry if -entry specified) + - \par -expand Read the specified dictionary file, expand the macros etc. and write the resulting dictionary to standard output. - \par -includes - List the \c #include and \c #includeIfPresent files to standard output. + List the \c #include and \c #includeIfPresent files to standard output - Typical usage: + Example usage: - Change simulation to run for one timestep only: \verbatim foamDictionary system/controlDict -entry stopAt -set writeNow @@ -78,6 +85,18 @@ Usage -set "{type uniformFixedValue; uniformValue (2 0 0);}" \endverbatim + - Write the differences with respect to a template dictionary: + \verbatim + foamDictionary 0/U -diff $FOAM_ETC/templates/closedVolume/0/U + \endverbatim + + - Write the differences in boundaryField with respect to a + template dictionary: + \verbatim + foamDictionary 0/U -diff $FOAM_ETC/templates/closedVolume/0/U \ + -entry boundaryField + \endverbatim + \*---------------------------------------------------------------------------*/ #include "argList.H" @@ -111,135 +130,94 @@ word scope(const fileName& entryName) } -//- Extract keyword (last bit of scoped name -word keyword(const word& scopedName) +//- Extracts dict name and keyword +Pair dictAndKeyword(const word& scopedName) { - word key(scopedName); string::size_type i = scopedName.find_last_of("."); if (i != string::npos) { - key = scopedName.substr(i+1, string::npos); - } - return key; -} - - -void setScoped -( - dictionary& dict, - const word& keyword, - const bool overwrite, - entry* d -) -{ - if (keyword[0] == ':') - { - // Go up to top level and recurse to find entries - setScoped + return Pair ( - const_cast(dict.topDict()), - keyword.substr(1, keyword.size()-1), - overwrite, - d + scopedName.substr(0, i), + scopedName.substr(i+1, string::npos) ); - return; } else { - string::size_type dotPos = keyword.find('.'); + return Pair("", scopedName); + } +} - if (dotPos == string::npos) + +const dictionary& lookupScopedDict +( + const dictionary& dict, + const word& subDictName +) +{ + if (subDictName == "") + { + return dict; + } + else + { + const entry* entPtr = dict.lookupScopedEntryPtr + ( + subDictName, + false, + false + ); + if (!entPtr || !entPtr->isDict()) { - // Non-scoped lookup - if (overwrite) - { - dict.set(d); - } - else - { - dict.add(d, false); - } - return; + FatalIOErrorInFunction(dict) + << "keyword " << subDictName + << " is undefined in dictionary " + << dict.name() << " or is not a dictionary" + << endl + << "Valid keywords are " << dict.keys() + << exit(FatalIOError); } - else + return entPtr->dict(); + } +} + + +void remove(dictionary& dict, const dictionary& removeDict) +{ + forAllConstIter(dictionary, removeDict, iter) + { + const entry* entPtr = dict.lookupEntryPtr + ( + iter().keyword(), + false, + false + ); + + if (entPtr) { - if (dotPos == 0) + if (entPtr->isDict()) { - // Starting with a '.'. Go up for every 2nd '.' found - - const dictionary* dictPtr = &dict; - - string::size_type begVar = dotPos + 1; - string::const_iterator iter = - keyword.begin() + begVar; - string::size_type endVar = begVar; - while - ( - iter != keyword.end() - && *iter == '.' - ) + if (iter().isDict()) { - ++iter; - ++endVar; + remove + ( + const_cast(entPtr->dict()), + iter().dict() + ); - // Go to parent - if (&dictPtr->parent() == &dictionary::null) + // Check if dictionary is empty + if (!entPtr->dict().size()) { - FatalIOErrorInFunction(dict) - << "No parent of current dictionary" - << " when searching for " - << keyword.substr - ( - begVar, - keyword.size() - begVar - ) - << exit(FatalIOError); + dict.remove(iter().keyword()); } - dictPtr = &dictPtr->parent(); } - - setScoped - ( - const_cast(*dictPtr), - keyword.substr(endVar), - overwrite, - d - ); - return; } - else + else if (!iter().isDict()) { - // Extract the first word - word firstWord = keyword.substr(0, dotPos); - - const entry* entPtr = dict.lookupScopedEntryPtr - ( - firstWord, - false, // Recursive - false - ); - - if (!entPtr || !entPtr->isDict()) + if (*entPtr == iter()) { - FatalIOErrorInFunction(dict) - << "keyword " << firstWord - << " is undefined in dictionary " - << dict.name() << " or is not a dictionary" - << endl - << "Valid keywords are " << dict.keys() - << exit(FatalIOError); + dict.remove(iter().keyword()); } - - const dictionary& firstDict = entPtr->dict(); - - setScoped - ( - const_cast(firstDict), - keyword.substr(dotPos, keyword.size()-dotPos), - overwrite, - d - ); - return; } } } @@ -257,30 +235,41 @@ int main(int argc, char *argv[]) argList::addBoolOption ( "value", - "print entry value" + "Print entry value" ); argList::addOption ( "set", "value", - "set entry value or add new entry" + "Set entry value or add new entry" ); argList::addOption ( "add", "value", - "add a new entry" + "Add a new entry" + ); + argList::addBoolOption + ( + "remove", + "Remove the entry." + ); + argList::addOption + ( + "diff", + "dict", + "Write differences with respect to the specified dictionary" ); argList::addBoolOption ( "includes", - "List the #include/#includeIfPresent files to standard output." + "List the #include/#includeIfPresent files to standard output" ); argList::addBoolOption ( "expand", "Read the specified dictionary file, expand the macros etc. and write " - "the resulting dictionary to standard output." + "the resulting dictionary to standard output" ); argList args(argc, argv); @@ -295,140 +284,212 @@ int main(int argc, char *argv[]) fileName dictFileName(args[1]); autoPtr dictFile(new IFstream(dictFileName)); - - if (dictFile().good()) - { - bool changed = false; - - // Read but preserve headers - dictionary dict; - dict.read(dictFile(), true); - - if (listIncludes) - { - return 0; - } - else if (args.optionFound("expand")) - { - IOobject::writeBanner(Info) - <<"//\n// " << dictFileName << "\n//\n"; - dict.write(Info, false); - IOobject::writeDivider(Info); - - return 0; - } - - word entryName; - if (args.optionReadIfPresent("entry", entryName)) - { - word scopedName(scope(entryName)); - - string newValue; - if - ( - args.optionReadIfPresent("set", newValue) - || args.optionReadIfPresent("add", newValue) - ) - { - bool overwrite = args.optionFound("set"); - - word key(keyword(scopedName)); - - IStringStream str(string(key) + ' ' + newValue + ';'); - setScoped(dict, scopedName, overwrite, entry::New(str).ptr()); - changed = true; - - // Print the changed entry - const entry* entPtr = dict.lookupScopedEntryPtr - ( - scopedName, - false, - true // Support wildcards - ); - if (entPtr) - { - Info<< *entPtr << endl; - } - } - else - { - const entry* entPtr = dict.lookupScopedEntryPtr - ( - scopedName, - false, - true // Support wildcards - ); - - if (entPtr) - { - if (args.optionFound("keywords")) - { - const dictionary& dict = entPtr->dict(); - forAllConstIter(dictionary, dict, iter) - { - Info<< iter().keyword() << endl; - } - } - else - { - if (args.optionFound("value")) - { - if (entPtr->isStream()) - { - const tokenList& tokens = entPtr->stream(); - forAll(tokens, i) - { - Info<< tokens[i] << token::SPACE; - } - Info<< endl; - } - else if (entPtr->isDict()) - { - Info<< entPtr->dict(); - } - } - else - { - Info<< *entPtr << endl; - } - } - } - else - { - FatalIOErrorInFunction(dictFile) - << "Cannot find entry " << entryName - << exit(FatalError, 2); - } - } - } - else if (args.optionFound("keywords")) - { - forAllConstIter(dictionary, dict, iter) - { - Info<< iter().keyword() << endl; - } - } - else - { - Info<< dict; - } - - if (changed) - { - dictFile.clear(); - OFstream os(dictFileName); - IOobject::writeBanner(os); - dict.write(os, false); - IOobject::writeEndDivider(os); - } - } - else + if (!dictFile().good()) { FatalErrorInFunction << "Cannot open file " << dictFileName << exit(FatalError, 1); } + + bool changed = false; + + // Read but preserve headers + dictionary dict; + dict.read(dictFile(), true); + + if (listIncludes) + { + return 0; + } + else if (args.optionFound("expand")) + { + IOobject::writeBanner(Info) + <<"//\n// " << dictFileName << "\n//\n"; + dict.write(Info, false); + IOobject::writeDivider(Info); + + return 0; + } + + + // Second dictionary for -diff + dictionary diffDict; + fileName diffFileName; + if (args.optionReadIfPresent("diff", diffFileName)) + { + autoPtr diffFile(new IFstream(diffFileName)); + if (!diffFile().good()) + { + FatalErrorInFunction + << "Cannot open file " << diffFileName + << exit(FatalError, 1); + } + + // Read but preserve headers + diffDict.read(diffFile(), true); + } + + + word entryName; + if (args.optionReadIfPresent("entry", entryName)) + { + word scopedName(scope(entryName)); + + string newValue; + if + ( + args.optionReadIfPresent("set", newValue) + || args.optionReadIfPresent("add", newValue) + ) + { + bool overwrite = args.optionFound("set"); + + Pair dAk(dictAndKeyword(scopedName)); + + IStringStream str(string(dAk.second()) + ' ' + newValue + ';'); + entry* ePtr(entry::New(str).ptr()); + const dictionary& d(lookupScopedDict(dict, dAk.first())); + + if (overwrite) + { + const_cast(d).set(ePtr); + } + else + { + const_cast(d).add(ePtr, false); + } + changed = true; + + // Print the changed entry + const entry* entPtr = dict.lookupScopedEntryPtr + ( + scopedName, + false, + true // Support wildcards + ); + if (entPtr) + { + Info<< *entPtr << endl; + } + } + else if (args.optionFound("remove")) + { + // Extract dictionary name and keyword + Pair dAk(dictAndKeyword(scopedName)); + + const dictionary& d(lookupScopedDict(dict, dAk.first())); + const_cast(d).remove(dAk.second()); + changed = true; + } + else + { + // Optionally remove a second dictionary + if (args.optionFound("diff")) + { + Pair dAk(dictAndKeyword(scopedName)); + + const dictionary& d(lookupScopedDict(dict, dAk.first())); + const dictionary& d2(lookupScopedDict(diffDict, dAk.first())); + + const entry* ePtr = + d.lookupEntryPtr(dAk.second(), false, true); + const entry* e2Ptr = + d2.lookupEntryPtr(dAk.second(), false, true); + + if (ePtr && e2Ptr) + { + if (*ePtr == *e2Ptr) + { + const_cast(d).remove(dAk.second()); + } + else if (ePtr->isDict() && e2Ptr->isDict()) + { + remove + ( + const_cast(ePtr->dict()), + e2Ptr->dict() + ); + } + } + } + + + const entry* entPtr = dict.lookupScopedEntryPtr + ( + scopedName, + false, + true // Support wildcards + ); + + if (entPtr) + { + if (args.optionFound("keywords")) + { + const dictionary& dict = entPtr->dict(); + forAllConstIter(dictionary, dict, iter) + { + Info<< iter().keyword() << endl; + } + } + else + { + if (args.optionFound("value")) + { + if (entPtr->isStream()) + { + const tokenList& tokens = entPtr->stream(); + forAll(tokens, i) + { + Info<< tokens[i] << token::SPACE; + } + Info<< endl; + } + else if (entPtr->isDict()) + { + Info<< entPtr->dict(); + } + } + else + { + Info<< *entPtr << endl; + } + } + } + else + { + FatalIOErrorInFunction(dictFile) + << "Cannot find entry " << entryName + << exit(FatalError, 2); + } + } + } + else if (args.optionFound("keywords")) + { + forAllConstIter(dictionary, dict, iter) + { + Info<< iter().keyword() << endl; + } + } + else if (args.optionFound("diff")) + { + remove(dict, diffDict); + dict.write(Info, false); + } + else + { + dict.write(Info, false); + } + + if (changed) + { + dictFile.clear(); + OFstream os(dictFileName); + IOobject::writeBanner(os); + dict.write(os, false); + IOobject::writeEndDivider(os); + } + return 0; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriter.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriter.C index c6760b298a..a43c625f17 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriter.C @@ -384,7 +384,6 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const } } - void Foam::tecplotWriter::writeConnectivity ( const indirectPrimitivePatch& pp @@ -394,7 +393,8 @@ void Foam::tecplotWriter::writeConnectivity INTEGER4 NumFaceNodes = 2*pp.nEdges(); // All faces (=edges) have 2 nodes - List FaceNodeCounts(NumFaces, 2); + List FaceNodeCounts(NumFaces); + FaceNodeCounts = 2; List FaceNodes(NumFaceNodes); label nodeI = 0; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriterTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriterTemplates.C index 9dfe7d4978..7d8496faab 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriterTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecplotWriterTemplates.C @@ -93,7 +93,7 @@ Foam::tmp> Foam::tecplotWriter::getFaceField const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh(); tmp> tfld(new Field(faceLabels.size())); - Field& fld = tfld(); + Field& fld = tfld.ref(); forAll(faceLabels, i) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H index c9ea6c4b14..ec6045b534 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -156,7 +156,7 @@ public: if (useSubMesh()) { tmp subFld = subsetter_.interpolate(fld); - subFld().rename(fld.name()); + subFld.ref().rename(fld.name()); return subFld; } else diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C index f79068826b..3aea81a887 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C @@ -75,7 +75,7 @@ void Foam::vtkPV3blockMesh::updateInfoBlocks const int nBlocks = blkMesh.size(); for (int blockI = 0; blockI < nBlocks; ++blockI) { - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; word partName = Foam::name(blockI); @@ -115,7 +115,7 @@ void Foam::vtkPV3blockMesh::updateInfoEdges arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); const int nEdges = edges.size(); forAll(edges, edgeI) @@ -429,7 +429,7 @@ void Foam::vtkPV3blockMesh::renderPointNumbers if (show && meshPtr_) { - const pointField& cornerPts = meshPtr_->blockPointField(); + const pointField& cornerPts = meshPtr_->vertices(); const scalar scaleFactor = meshPtr_->scaleFactor(); pointNumberTextActorsPtrs_.setSize(cornerPts.size()); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C index b54b5dd221..8dce33a982 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const Foam::pointField& blockPoints = blkMesh.blockPointField(); + const Foam::pointField& blockPoints = blkMesh.vertices(); if (debug) { @@ -77,7 +77,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks continue; } - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New(); @@ -148,7 +148,7 @@ void Foam::vtkPV3blockMesh::convertMeshEdges label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); int edgeI = 0; const scalar scaleFactor = blkMesh.scaleFactor(); @@ -168,7 +168,7 @@ void Foam::vtkPV3blockMesh::convertMeshEdges // search each block forAll(blkMesh, blockI) { - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; edgeList blkEdges = blockDef.blockShape().edges(); @@ -256,7 +256,7 @@ void Foam::vtkPV3blockMesh::convertMeshCorners range.block(blockNo); // set output block label datasetNo = 0; // restart at dataset 0 - const pointField& blockPoints = meshPtr_->blockPointField(); + const pointField& blockPoints = meshPtr_->vertices(); const scalar& scaleFactor = meshPtr_->scaleFactor(); if (debug) diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/Make/options index ccbea978f7..9dcba4b39b 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/Make/options +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ -I$(ParaView_INCLUDE_DIR) \ -I$(ParaView_INCLUDE_DIR)/vtkkwiml \ @@ -8,6 +9,7 @@ EXE_INC = \ LIB_LIBS = \ -lmeshTools \ + -lfileFormats \ -lblockMesh \ -L$(FOAM_LIBBIN) -lvtkPVReaders \ $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C index b855990c68..a9932ffcc9 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C @@ -75,7 +75,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks const int nBlocks = blkMesh.size(); for (int blockI = 0; blockI < nBlocks; ++blockI) { - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; word partName = Foam::name(blockI); @@ -115,7 +115,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); const int nEdges = edges.size(); forAll(edges, edgeI) @@ -429,7 +429,7 @@ void Foam::vtkPVblockMesh::renderPointNumbers if (show && meshPtr_) { - const pointField& cornerPts = meshPtr_->blockPointField(); + const pointField& cornerPts = meshPtr_->vertices(); const scalar scaleFactor = meshPtr_->scaleFactor(); pointNumberTextActorsPtrs_.setSize(cornerPts.size()); diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C index b723b36bca..9c7f8a06ba 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C @@ -55,7 +55,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const Foam::pointField& blockPoints = blkMesh.blockPointField(); + const Foam::pointField& blockPoints = blkMesh.vertices(); if (debug) { @@ -77,7 +77,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks continue; } - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New(); @@ -148,7 +148,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); int edgeI = 0; const scalar scaleFactor = blkMesh.scaleFactor(); @@ -168,10 +168,15 @@ void Foam::vtkPVblockMesh::convertMeshEdges // search each block forAll(blkMesh, blockI) { - const blockDescriptor& blockDef = blkMesh[blockI].blockDef(); + const blockDescriptor& blockDef = blkMesh[blockI]; edgeList blkEdges = blockDef.blockShape().edges(); + // List of edge point and weighting factors + pointField edgesPoints[12]; + scalarList edgesWeights[12]; + blockDef.edgesPointsWeights(edgesPoints, edgesWeights); + // find the corresponding edge within the block label foundEdgeI = -1; forAll(blkEdges, blkEdgeI) @@ -185,9 +190,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges if (foundEdgeI != -1) { - const List& edgePoints = - blockDef.blockEdgePoints()[foundEdgeI]; - + const List& edgePoints = edgesPoints[foundEdgeI]; vtkPolyData* vtkmesh = vtkPolyData::New(); vtkPoints* vtkpoints = vtkPoints::New(); @@ -256,7 +259,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners range.block(blockNo); // set output block label datasetNo = 0; // restart at dataset 0 - const pointField& blockPoints = meshPtr_->blockPointField(); + const pointField& blockPoints = meshPtr_->vertices(); const scalar& scaleFactor = meshPtr_->scaleFactor(); if (debug) diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 0c08a7eb7a..a0a667c604 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -104,14 +104,7 @@ cleanCase() cleanSnappyFiles if [ -d constant/polyMesh ] then - (cd constant/polyMesh && \ - rm -rf \ - allOwner* cell* face* meshModifiers* \ - owner* neighbour* point* edge* \ - cellLevel* pointLevel* refinementHistory* level0Edge* surfaceIndex* sets \ - boundary \ - > /dev/null 2>&1 \ - ) + rm -rf constant/polyMesh > /dev/null 2>&1 fi if [ -d constant ] then diff --git a/etc/config.csh/unset b/etc/config.csh/unset index 7194f4853c..a1ef724b3c 100644 --- a/etc/config.csh/unset +++ b/etc/config.csh/unset @@ -86,8 +86,9 @@ unsetenv WM_THIRD_PARTY_DIR unsetenv FOAM_APPBIN unsetenv FOAM_APP -unsetenv FOAM_EXT_LIBBIN unsetenv FOAM_CODE_TEMPLATES +unsetenv FOAM_ETC +unsetenv FOAM_EXT_LIBBIN unsetenv FOAM_INST_DIR unsetenv FOAM_JOB_DIR unsetenv FOAM_LIBBIN diff --git a/etc/config.sh/unset b/etc/config.sh/unset index c51dcf4c53..114f313a39 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -77,8 +77,9 @@ unset WM_THIRD_PARTY_DIR unset FOAM_APPBIN unset FOAM_APP -unset FOAM_EXT_LIBBIN unset FOAM_CODE_TEMPLATES +unset FOAM_ETC +unset FOAM_EXT_LIBBIN unset FOAM_INST_DIR unset FOAM_JOB_DIR unset FOAM_LIBBIN diff --git a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H index 2c23754e8a..997fa8287e 100644 --- a/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H +++ b/src/OpenFOAM/db/runTimeSelection/construction/addToRunTimeSelectionTable.H @@ -31,8 +31,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// add to hash-table of functions with typename as the key +//- Add to hash-table of functions with typename as the key #define addToRunTimeSelectionTable\ (baseType,thisType,argNames) \ \ @@ -41,7 +40,7 @@ Description add##thisType##argNames##ConstructorTo##baseType##Table_ -// add to hash-table of functions with 'lookup' as the key +//- Add to hash-table of functions with 'lookup' as the key #define addNamedToRunTimeSelectionTable\ (baseType,thisType,argNames,lookup) \ \ @@ -51,7 +50,7 @@ Description (#lookup) -// add to hash-table of functions with typename as the key +//- Add to hash-table of functions with typename as the key #define addRemovableToRunTimeSelectionTable\ (baseType,thisType,argNames) \ \ @@ -60,7 +59,7 @@ Description addRemovable##thisType##argNames##ConstructorTo##baseType##Table_ -// add to hash-table of functions with 'lookup' as the key +//- Add to hash-table of functions with 'lookup' as the key #define addRemovableNamedToRunTimeSelectionTable\ (baseType,thisType,argNames,lookup) \ \ @@ -72,9 +71,8 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// add to hash-table of functions with typename as the key -// use when baseType doesn't need a template argument (eg, is a typedef) +//- Add to hash-table of functions with typename as the key. +// Use when baseType doesn't need a template argument (eg, is a typedef) #define addTemplateToRunTimeSelectionTable\ (baseType,thisType,Targ,argNames) \ \ @@ -83,8 +81,8 @@ Description add##thisType##Targ##argNames##ConstructorTo##baseType##Table_ -// add to hash-table of functions with 'lookup' as the key -// use when baseType doesn't need a template argument (eg, is a typedef) +//- Add to hash-table of functions with 'lookup' as the key. +// Use when baseType doesn't need a template argument (eg, is a typedef) #define addNamedTemplateToRunTimeSelectionTable\ (baseType,thisType,Targ,argNames,lookup) \ \ @@ -96,9 +94,8 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// add to hash-table of functions with typename as the key -// use when baseType requires the Targ template argument as well +//- Add to hash-table of functions with typename as the key. +// Use when baseType requires the Targ template argument as well #define addTemplatedToRunTimeSelectionTable\ (baseType,thisType,Targ,argNames) \ \ @@ -107,8 +104,8 @@ Description add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_ -// add to hash-table of functions with 'lookup' as the key -// use when baseType requires the Targ template argument as well +//- Add to hash-table of functions with 'lookup' as the key. +// Use when baseType requires the Targ template argument as well #define addNamedTemplatedToRunTimeSelectionTable\ (baseType,thisType,Targ,argNames,lookup) \ \ diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.H b/src/OpenFOAM/fields/Fields/fieldTypes.H index 8550930357..13e17a3cce 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.H +++ b/src/OpenFOAM/fields/Fields/fieldTypes.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,22 @@ Description #include "symmTensor.H" #include "tensor.H" #include "triad.H" +#include "macros.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define CAPITALIZE_scalar Scalar +#define CAPITALIZE_vector Vector +#define CAPITALIZE_sphericalTensor SphericalTensor +#define CAPITALIZE_symmTensor SymmTensor +#define CAPITALIZE_tensor Tensor + +#define FOR_ALL_FIELD_TYPES(Macro, ...) \ + Macro(scalar, __VA_ARGS__) \ + Macro(vector, __VA_ARGS__) \ + Macro(sphericalTensor, __VA_ARGS__) \ + Macro(symmTensor, __VA_ARGS__) \ + Macro(tensor, __VA_ARGS__) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/debug/registerSwitch.H b/src/OpenFOAM/global/debug/registerSwitch.H index 9e6d3580e4..306a6663a4 100644 --- a/src/OpenFOAM/global/debug/registerSwitch.H +++ b/src/OpenFOAM/global/debug/registerSwitch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,6 +34,7 @@ Description #define registerSwitch_H #include "simpleRegIOobject.H" +#include "macros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -85,10 +86,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define CONCAT(x, y) x ## y -#define CONCAT2(x, y) CONCAT(x, y) -#define FILE_UNIQUE(x) CONCAT2(x, __LINE__) - #define registerOptSwitch(Name, Type, Switch) \ static Foam::RegisterSwitch FILE_UNIQUE(_addToOpt_) \ (Foam::debug::addOptimisationObject, Name, Switch) diff --git a/src/OpenFOAM/include/macros.H b/src/OpenFOAM/include/macros.H new file mode 100644 index 0000000000..c6648aeac2 --- /dev/null +++ b/src/OpenFOAM/include/macros.H @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + General C-preprocessor macros + +\*---------------------------------------------------------------------------*/ + +#ifndef macros_H +#define macros_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Concatenate two preprocessor tokens +#define CAT_(a, b) a ## b +#define CAT(a, b) CAT_(a, b) + +//- Concatenate three preprocessor tokens +#define CAT3_(a, b, c) a ## b ## c +#define CAT3(a, b, c) CAT3_(a, b, c) + +//- Concatenate four preprocessor tokens +#define CAT4_(a, b, c, d) a ## b ## c ## d +#define CAT4(a, b, c, d) CAT4_(a, b, c, d) + +//- Concatenate five preprocessor tokens +#define CAT5_(a, b, c, d, e) a ## b ## c ## d ## e +#define CAT5(a, b, c, d, e) CAT5_(a, b, c, d, e) + +//- Generate an identifier unique within the file in which it is generated +#define FILE_UNIQUE(x) CAT(x, __LINE__) + +//- Map 'name' to 'Name' via the predefined macro CAPITALIZE_name +#define CAPITALIZE(name) CAPITALIZE_##name + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C index 72a27c7bc3..01c7ec471c 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C @@ -56,7 +56,14 @@ Foam::label Foam::primitiveMesh::getEdge // Make new edge. label edgeI = es.size(); pe[pointi].append(edgeI); - pe[nextPointi].append(edgeI); + + if (nextPointi != pointi) + { + // Very occasionally (e.g. blockMesh) a face can have duplicate + // vertices. Make sure we register pointEdges only once. + pe[nextPointi].append(edgeI); + } + if (pointi < nextPointi) { es.append(edge(pointi, nextPointi)); diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H index 784b14c791..ca4d7ef0f1 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H +++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H @@ -129,7 +129,7 @@ public: explicit plane(const vector& normalVector); //- Construct from normal vector and point in plane - plane + explicit plane ( const point& basePoint, const vector& normalVector, @@ -137,7 +137,12 @@ public: ); //- Construct from three points in plane - plane(const point&, const point&, const point&); + explicit plane + ( + const point& point1, + const point& point2, + const point& point3 + ); //- Construct from coefficients for the // plane equation: ax + by + cz + d = 0 diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H index f90adbb0ff..3488217e07 100644 --- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H +++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H @@ -106,7 +106,7 @@ inline const Cmpt& VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -125,7 +125,7 @@ inline Cmpt& VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << "out of range" << abort(FatalError); } #endif @@ -145,7 +145,7 @@ inline void VectorSpace::component if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -165,7 +165,7 @@ inline void VectorSpace::replace if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -205,7 +205,7 @@ inline const Cmpt& VectorSpace::operator[] if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -224,7 +224,7 @@ inline Cmpt& VectorSpace::operator[] if (d >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -246,7 +246,7 @@ ConstBlock::operator[] if (i >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } #endif @@ -269,7 +269,7 @@ ConstBlock::operator() if (i >= Ncmpts) { FatalErrorInFunction - << "index out of range" + << "index " << d << " out of range" << abort(FatalError); } diff --git a/src/OpenFOAM/primitives/direction/direction.H b/src/OpenFOAM/primitives/direction/direction.H index 459138fc50..b382c20aee 100644 --- a/src/OpenFOAM/primitives/direction/direction.H +++ b/src/OpenFOAM/primitives/direction/direction.H @@ -33,8 +33,7 @@ Description #ifndef direction_H #define direction_H -#define __STDC_LIMIT_MACROS -#include +#include #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/ints/int32/int32.H b/src/OpenFOAM/primitives/ints/int32/int32.H index 96c748b052..62ae4b7af7 100644 --- a/src/OpenFOAM/primitives/ints/int32/int32.H +++ b/src/OpenFOAM/primitives/ints/int32/int32.H @@ -36,8 +36,7 @@ SourceFiles #ifndef int32_H #define int32_H -#define __STDC_LIMIT_MACROS -#include +#include #include #include diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 58b0adc5b7..addb637a77 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -36,8 +36,7 @@ SourceFiles #ifndef int64_H #define int64_H -#define __STDC_LIMIT_MACROS -#include +#include #include #include diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.H b/src/OpenFOAM/primitives/ints/uint32/uint32.H index 469189e976..72707d30da 100644 --- a/src/OpenFOAM/primitives/ints/uint32/uint32.H +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.H @@ -36,8 +36,7 @@ SourceFiles #ifndef uint32_H #define uint32_H -#define __STDC_LIMIT_MACROS -#include +#include #include #include diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H index f55c73d531..af79433e3f 100644 --- a/src/OpenFOAM/primitives/ints/uint64/uint64.H +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H @@ -36,8 +36,7 @@ SourceFiles #ifndef uint64_H #define uint64_H -#define __STDC_LIMIT_MACROS -#include +#include #include #include diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C index 27646f6dbb..e6c2a9bd99 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,8 +49,8 @@ alphatPhaseChangeWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF), - dmdt_(p.size(), 0.0), - mDotL_(p.size(), 0.0) + dmdt_(p.size(), 0), + mDotL_(p.size(), 0) {} @@ -63,8 +63,8 @@ alphatPhaseChangeWallFunctionFvPatchScalarField ) : fixedValueFvPatchScalarField(p, iF, dict), - dmdt_(p.size(), 0.0), - mDotL_(p.size(), 0.0) + dmdt_(p.size(), 0), + mDotL_(p.size(), 0) { if (dict.found("dmdt")) { diff --git a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C index 625a7a1ca8..7ed9800463 100644 --- a/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -561,7 +561,7 @@ void SpalartAllmarasDES::correct() bound(nuTilda_, dimensionedScalar("0", nuTilda_.dimensions(), 0.0)); nuTilda_.correctBoundaryConditions(); - correctNut(fv1); + correctNut(); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchFields.C index d919d49814..60d46338fa 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFieldsTypeName(coupled); +makePatchFieldTypeNames(coupled); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchFields.C index fa4a05aca9..e58113a03e 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFieldsTypeName(transform); +makePatchFieldTypeNames(transform); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C index 56ce7bdbe4..fc620604db 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchFields.C @@ -31,7 +31,7 @@ License namespace Foam { - makePatchFieldsTypeName(jumpCyclic); + makePatchFieldTypeNames(jumpCyclic); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C index 8985ed6900..c567c40062 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C @@ -34,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makePatchFieldsTypeName(jumpCyclicAMI); +makePatchFieldTypeNames(jumpCyclicAMI); // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C index 737c6e81d5..5979a03139 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processorCyclic/processorCyclicFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,11 +35,6 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // makePatchFields(processorCyclic); -// makeTemplatePatchTypeField -// ( -// fvPatchScalarField, -// processorCyclicFvPatchScalarField -// ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index fd0b61bdaa..8810b9f8a4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -132,11 +132,7 @@ Foam::fanFvPatchField::fanFvPatchField namespace Foam { - makeTemplatePatchTypeField - ( - fvPatchScalarField, - fanFvPatchScalarField - ); + makeTemplatePatchTypeField(scalar, fan); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C index d1bd512787..79bd108b8d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,16 +34,8 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeTemplatePatchTypeField -( - fvPatchVectorField, - fixedNormalSlipFvPatchVectorField -); -makeTemplatePatchTypeField -( - fvPatchTensorField, - fixedNormalSlipFvPatchTensorField -); +makeTemplatePatchTypeField(vector, fixedNormalSlip); +makeTemplatePatchTypeField(tensor, fixedNormalSlip); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H index 1f0b695231..76cd359a33 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.H @@ -37,7 +37,7 @@ Usage Property | Description | Required | Default value U | velocity field name | no | U phi | flux field name | no | phi - psi | compressibility field name | no | psi + psi | compressibility field name | no | thermo:psi gamma | heat capacity ration (Cp/Cv) | yes | inletValue | reverse flow (inlet) value | yes | T0 | static temperature [K] | yes | diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H index 9978d3b61c..ef6bca1ace 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H @@ -29,8 +29,7 @@ Group Description This boundary condition provides a velocity condition for cases with - moving walls. In addition, it should also be applied to 'moving' walls - for moving reference frame (MRF) calculations. + moving walls. Usage Example of the boundary condition specification: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.H index e2e6a6c960..63865c8892 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.H @@ -52,7 +52,7 @@ Usage Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho - psi | compressibility field name | no | psi + psi | compressibility field name | no | thermo:psi gamma | ratio of specific heats (Cp/Cv) | yes | \endtable diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 1d689139b9..3fe1d2b0f6 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -46,6 +46,7 @@ SourceFiles #include "fvPatch.H" #include "DimensionedField.H" +#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -628,7 +629,7 @@ defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary); ); -// use with caution +// Use with caution #define addRemovableToPatchFieldRunTimeSelection\ (PatchTypeField, typePatchTypeField) \ \ @@ -652,67 +653,48 @@ defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary); ); -// for non-templated patch fields +// For non-templated patch fields #define makePatchTypeField(PatchTypeField, typePatchTypeField) \ defineTypeNameAndDebug(typePatchTypeField, 0); \ addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) -// for non-templated patch fields - use with caution +// For non-templated patch fields - use with caution #define makeRemovablePatchTypeField(PatchTypeField, typePatchTypeField) \ defineTypeNameAndDebug(typePatchTypeField, 0); \ addRemovableToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - -// for templated patch fields -#define makeTemplatePatchTypeField(PatchTypeField, typePatchTypeField) \ - defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - +// For templated patch fields +#define makeTemplatePatchTypeField(fieldType, type) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(type, FvPatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); \ + addToPatchFieldRunTimeSelection \ + ( \ + CAT3(fvPatch, CAPITALIZE(fieldType), Field), \ + CAT4(type, FvPatch, CAPITALIZE(fieldType), Field) \ + ) #define makePatchFields(type) \ - makeTemplatePatchTypeField \ + FOR_ALL_FIELD_TYPES(makeTemplatePatchTypeField, type) + +#define makePatchFieldTypeName(fieldType, type) \ + defineNamedTemplateTypeNameAndDebug \ ( \ - fvPatchScalarField, \ - type##FvPatchScalarField \ - ); \ - makeTemplatePatchTypeField \ - ( \ - fvPatchVectorField, \ - type##FvPatchVectorField \ - ); \ - makeTemplatePatchTypeField \ - ( \ - fvPatchSphericalTensorField, \ - type##FvPatchSphericalTensorField \ - ); \ - makeTemplatePatchTypeField \ - ( \ - fvPatchSymmTensorField, \ - type##FvPatchSymmTensorField \ - ); \ - makeTemplatePatchTypeField \ - ( \ - fvPatchTensorField, \ - type##FvPatchTensorField \ + CAT4(type, FvPatch, CAPITALIZE(fieldType), Field), \ + 0 \ ); +#define makePatchFieldTypeNames(type) \ + FOR_ALL_FIELD_TYPES(makePatchFieldTypeName, type) -#define makePatchFieldsTypeName(type) \ - defineNamedTemplateTypeNameAndDebug(type##FvPatchScalarField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##FvPatchVectorField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##FvPatchSphericalTensorField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##FvPatchSymmTensorField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##FvPatchTensorField, 0) - +#define makePatchTypeFieldTypedef(fieldType, type) \ + typedef type##FvPatchField \ + CAT4(type, FvPatch, CAPITALIZE(fieldType), Field); #define makePatchTypeFieldTypedefs(type) \ - typedef type##FvPatchField type##FvPatchScalarField; \ - typedef type##FvPatchField type##FvPatchVectorField; \ - typedef type##FvPatchField \ - type##FvPatchSphericalTensorField; \ - typedef type##FvPatchField type##FvPatchSymmTensorField; \ - typedef type##FvPatchField type##FvPatchTensorField; - + FOR_ALL_FIELD_TYPES(makePatchTypeFieldTypedef, type) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files index 584db6cf61..53d856529d 100644 --- a/src/mesh/blockMesh/Make/files +++ b/src/mesh/blockMesh/Make/files @@ -1,15 +1,22 @@ -curvedEdges/BSpline.C -curvedEdges/CatmullRomSpline.C -curvedEdges/polyLine.C +blockVertices/blockVertex/blockVertex.C +blockVertices/pointVertex/pointVertex.C +blockVertices/projectVertex/projectVertex.C -curvedEdges/arcEdge.C -curvedEdges/bezier.C -curvedEdges/curvedEdge.C -curvedEdges/lineEdge.C -curvedEdges/polyLineEdge.C -curvedEdges/lineDivide.C -curvedEdges/BSplineEdge.C -curvedEdges/splineEdge.C +blockEdges/bezier/bezier.C +blockEdges/blockEdge/blockEdge.C +blockEdges/lineDivide/lineDivide.C +blockEdges/lineEdge/lineEdge.C +blockEdges/polyLineEdge/polyLine.C +blockEdges/polyLineEdge/polyLineEdge.C +blockEdges/arcEdge/arcEdge.C +blockEdges/BSplineEdge/BSpline.C +blockEdges/BSplineEdge/BSplineEdge.C +blockEdges/splineEdge/CatmullRomSpline.C +blockEdges/splineEdge/splineEdge.C +blockEdges/projectEdge/projectEdge.C + +blockFaces/blockFace/blockFace.C +blockFaces/projectFace/projectFace.C gradingDescriptor/gradingDescriptor.C gradingDescriptor/gradingDescriptors.C diff --git a/src/mesh/blockMesh/Make/options b/src/mesh/blockMesh/Make/options index 1618ab57ec..bf6ca71abf 100644 --- a/src/mesh/blockMesh/Make/options +++ b/src/mesh/blockMesh/Make/options @@ -1,7 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/surfMesh/lnInclude LIB_LIBS = \ -lmeshTools \ - -ldynamicMesh + -lfileFormats \ + -lsurfMesh diff --git a/src/mesh/blockMesh/block/block.C b/src/mesh/blockMesh/block/block.C index 3130bcef9a..1722b0095e 100644 --- a/src/mesh/blockMesh/block/block.C +++ b/src/mesh/blockMesh/block/block.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,72 +23,31 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "block.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::block::block ( - const pointField& blockPointField, - const curvedEdgeList& edges, + const pointField& vertices, + const blockEdgeList& edges, + const blockFaceList& faces, Istream& is ) : - blockDescriptor(blockPointField, edges, is), - vertices_(0), - cells_(0), - boundaryPatches_(0) -{} + blockDescriptor(vertices, edges, faces, is) +{ + createPoints(); + createBoundary(); +} Foam::block::block(const blockDescriptor& blockDesc) : - blockDescriptor(blockDesc), - vertices_(0), - cells_(0), - boundaryPatches_(0) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::block::~block() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::pointField& Foam::block::points() const + blockDescriptor(blockDesc) { - if (vertices_.empty()) - { - createPoints(); - } - - return vertices_; -} - - -const Foam::labelListList& Foam::block::cells() const -{ - if (cells_.empty()) - { - createCells(); - } - - return cells_; -} - - -const Foam::labelListListList& Foam::block::boundaryPatches() const -{ - if (boundaryPatches_.empty()) - { - createBoundary(); - } - - return boundaryPatches_; + createPoints(); + createBoundary(); } diff --git a/src/mesh/blockMesh/block/block.H b/src/mesh/blockMesh/block/block.H index 3e47a80a6f..7b55c5f59f 100644 --- a/src/mesh/blockMesh/block/block.H +++ b/src/mesh/blockMesh/block/block.H @@ -67,26 +67,20 @@ class block { // Private data - //- List of vertices - mutable pointField vertices_; - - //- List of cells - mutable labelListList cells_; + //- List of points + pointField points_; //- Boundary patches - mutable labelListListList boundaryPatches_; + FixedList>, 6> boundaryPatches_; // Private Member Functions //- Creates vertices for cells filling the block - void createPoints() const; - - //- Creates cells for filling the block - void createCells() const; + void createPoints(); //- Creates boundary patch faces for the block - void createBoundary() const; + void createBoundary(); //- Disallow default bitwise copy construct block(const block&); @@ -94,6 +88,7 @@ class block //- Disallow default bitwise assignment void operator=(const block&); + public: // Constructors @@ -101,9 +96,10 @@ public: //- Construct from components with Istream block ( - const pointField& blockPointField, - const curvedEdgeList&, - Istream& + const pointField& vertices, + const blockEdgeList& edges, + const blockFaceList& faces, + Istream& is ); //- Construct from a block definition @@ -116,35 +112,48 @@ public: return autoPtr(nullptr); } + //- Class used for the read-construction of + // PtrLists of blocks + class iNew + { + const pointField& points_; + const blockEdgeList& edges_; + const blockFaceList& faces_; - //- Destructor - ~block(); + public: + + iNew + ( + const pointField& points, + const blockEdgeList& edges, + const blockFaceList& faces + ) + : + points_(points), + edges_(edges), + faces_(faces) + {} + + autoPtr operator()(Istream& is) const + { + return autoPtr(new block(points_, edges_, faces_, is)); + } + }; // Member Functions // Access - //- Return the block definition - inline const blockDescriptor& blockDef() const; - - //- Vertex label offset for a particular i,j,k position - inline label vtxLabel(label i, label j, label k) const; - //- Return the points for filling the block - const pointField& points() const; + inline const pointField& points() const; //- Return the cells for filling the block - const labelListList& cells() const; + List> cells() const; //- Return the boundary patch faces for the block - const labelListListList& boundaryPatches() const; - - - // Edit - - //- Clear geometry (internal points, cells, boundaryPatches) - void clearGeom(); + inline const FixedList>, 6>& + boundaryPatches() const; // Ostream Operator diff --git a/src/mesh/blockMesh/block/blockCreate.C b/src/mesh/blockMesh/block/blockCreate.C index b3ce7d3a31..8f63d629fd 100644 --- a/src/mesh/blockMesh/block/blockCreate.C +++ b/src/mesh/blockMesh/block/blockCreate.C @@ -23,17 +23,31 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "block.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::block::createPoints() const +#define w0 w[0][i] +#define w1 w[1][i] +#define w2 w[2][i] +#define w3 w[3][i] + +#define w4 w[4][j] +#define w5 w[5][j] +#define w6 w[6][j] +#define w7 w[7][j] + +#define w8 w[8][k] +#define w9 w[9][k] +#define w10 w[10][k] +#define w11 w[11][k] + +void Foam::block::createPoints() { // Set local variables for mesh specification - const label ni = meshDensity().x(); - const label nj = meshDensity().y(); - const label nk = meshDensity().z(); + const label ni = density().x(); + const label nj = density().y(); + const label nk = density().z(); const point& p000 = blockPoint(0); const point& p100 = blockPoint(1); @@ -45,191 +59,286 @@ void Foam::block::createPoints() const const point& p111 = blockPoint(6); const point& p011 = blockPoint(7); - // List of edge point and weighting factors - const List>& p = blockEdgePoints(); - const scalarListList& w = blockEdgeWeights(); + pointField p[12]; + scalarList w[12]; + label nCurvedEdges = edgesPointsWeights(p, w); - // - // Generate vertices - // - vertices_.clear(); - vertices_.setSize(nPoints()); + points_.setSize(nPoints()); - for (label k = 0; k <= nk; k++) + points_[pointLabel(0, 0, 0)] = p000; + points_[pointLabel(ni, 0, 0)] = p100; + points_[pointLabel(ni, nj, 0)] = p110; + points_[pointLabel(0, nj, 0)] = p010; + points_[pointLabel(0, 0, nk)] = p001; + points_[pointLabel(ni, 0, nk)] = p101; + points_[pointLabel(ni, nj, nk)] = p111; + points_[pointLabel(0, nj, nk)] = p011; + + for (label k=0; k<=nk; k++) { - for (label j = 0; j <= nj; j++) + for (label j=0; j<=nj; j++) { - for (label i = 0; i <= ni; i++) + for (label i=0; i<=ni; i++) { - const label vertexNo = vtxLabel(i, j, k); + // Skip block vertices + if (vertex(i, j, k)) continue; - // Points on edges - vector edgex1 = p000 + (p100 - p000)*w[0][i]; - vector edgex2 = p010 + (p110 - p010)*w[1][i]; - vector edgex3 = p011 + (p111 - p011)*w[2][i]; - vector edgex4 = p001 + (p101 - p001)*w[3][i]; + const label vijk = pointLabel(i, j, k); - vector edgey1 = p000 + (p010 - p000)*w[4][j]; - vector edgey2 = p100 + (p110 - p100)*w[5][j]; - vector edgey3 = p101 + (p111 - p101)*w[6][j]; - vector edgey4 = p001 + (p011 - p001)*w[7][j]; - - vector edgez1 = p000 + (p001 - p000)*w[8][k]; - vector edgez2 = p100 + (p101 - p100)*w[9][k]; - vector edgez3 = p110 + (p111 - p110)*w[10][k]; - vector edgez4 = p010 + (p011 - p010)*w[11][k]; - - - // Calculate the importance factors for all edges + // Calculate the weighting factors for all edges // x-direction - scalar impx1 = - ( - (1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k]) - + w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k]) - ); + scalar wx1 = (1 - w0)*(1 - w4)*(1 - w8) + w0*(1 - w5)*(1 - w9); + scalar wx2 = (1 - w1)*w4*(1 - w11) + w1*w5*(1 - w10); + scalar wx3 = (1 - w2)*w7*w11 + w2*w6*w10; + scalar wx4 = (1 - w3)*(1 - w7)*w8 + w3*(1 - w6)*w9; - scalar impx2 = - ( - (1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k]) - + w[1][i]*w[5][j]*(1.0 - w[10][k]) - ); - - scalar impx3 = - ( - (1.0 - w[2][i])*w[7][j]*w[11][k] - + w[2][i]*w[6][j]*w[10][k] - ); - - scalar impx4 = - ( - (1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k] - + w[3][i]*(1.0 - w[6][j])*w[9][k] - ); - - scalar magImpx = impx1 + impx2 + impx3 + impx4; - impx1 /= magImpx; - impx2 /= magImpx; - impx3 /= magImpx; - impx4 /= magImpx; + const scalar sumWx = wx1 + wx2 + wx3 + wx4; + wx1 /= sumWx; + wx2 /= sumWx; + wx3 /= sumWx; + wx4 /= sumWx; // y-direction - scalar impy1 = - ( - (1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k]) - + w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k]) - ); + scalar wy1 = (1 - w4)*(1 - w0)*(1 - w8) + w4*(1 - w1)*(1 - w11); + scalar wy2 = (1 - w5)*w0*(1 - w9) + w5*w1*(1 - w10); + scalar wy3 = (1 - w6)*w3*w9 + w6*w2*w10; + scalar wy4 = (1 - w7)*(1 - w3)*w8 + w7*(1 - w2)*w11; - scalar impy2 = - ( - (1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k]) - + w[5][j]*w[1][i]*(1.0 - w[10][k]) - ); - - scalar impy3 = - ( - (1.0 - w[6][j])*w[3][i]*w[9][k] - + w[6][j]*w[2][i]*w[10][k] - ); - - scalar impy4 = - ( - (1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k] - + w[7][j]*(1.0 - w[2][i])*w[11][k] - ); - - scalar magImpy = impy1 + impy2 + impy3 + impy4; - impy1 /= magImpy; - impy2 /= magImpy; - impy3 /= magImpy; - impy4 /= magImpy; + const scalar sumWy = wy1 + wy2 + wy3 + wy4; + wy1 /= sumWy; + wy2 /= sumWy; + wy3 /= sumWy; + wy4 /= sumWy; // z-direction - scalar impz1 = - ( - (1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j]) - + w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j]) - ); + scalar wz1 = (1 - w8)*(1 - w0)*(1 - w4) + w8*(1 - w3)*(1 - w7); + scalar wz2 = (1 - w9)*w0*(1 - w5) + w9*w3*(1 - w6); + scalar wz3 = (1 - w10)*w1*w5 + w10*w2*w6; + scalar wz4 = (1 - w11)*(1 - w1)*w4 + w11*(1 - w2)*w7; - scalar impz2 = - ( - (1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j]) - + w[9][k]*w[3][i]*(1.0 - w[6][j]) - ); - - scalar impz3 = - ( - (1.0 - w[10][k])*w[1][i]*w[5][j] - + w[10][k]*w[2][i]*w[6][j] - ); - - scalar impz4 = - ( - (1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j] - + w[11][k]*(1.0 - w[2][i])*w[7][j] - ); - - scalar magImpz = impz1 + impz2 + impz3 + impz4; - impz1 /= magImpz; - impz2 /= magImpz; - impz3 /= magImpz; - impz4 /= magImpz; + const scalar sumWz = wz1 + wz2 + wz3 + wz4; + wz1 /= sumWz; + wz2 /= sumWz; + wz3 /= sumWz; + wz4 /= sumWz; - // Calculate the correction vectors - vector corx1 = impx1*(p[0][i] - edgex1); - vector corx2 = impx2*(p[1][i] - edgex2); - vector corx3 = impx3*(p[2][i] - edgex3); - vector corx4 = impx4*(p[3][i] - edgex4); + // Points on straight edges + const vector edgex1 = p000 + (p100 - p000)*w0; + const vector edgex2 = p010 + (p110 - p010)*w1; + const vector edgex3 = p011 + (p111 - p011)*w2; + const vector edgex4 = p001 + (p101 - p001)*w3; - vector cory1 = impy1*(p[4][j] - edgey1); - vector cory2 = impy2*(p[5][j] - edgey2); - vector cory3 = impy3*(p[6][j] - edgey3); - vector cory4 = impy4*(p[7][j] - edgey4); - - vector corz1 = impz1*(p[8][k] - edgez1); - vector corz2 = impz2*(p[9][k] - edgez2); - vector corz3 = impz3*(p[10][k] - edgez3); - vector corz4 = impz4*(p[11][k] - edgez4); - - - // Multiply by the importance factor - - // x-direction - edgex1 *= impx1; - edgex2 *= impx2; - edgex3 *= impx3; - edgex4 *= impx4; - - // y-direction - edgey1 *= impy1; - edgey2 *= impy2; - edgey3 *= impy3; - edgey4 *= impy4; - - // z-direction - edgez1 *= impz1; - edgez2 *= impz2; - edgez3 *= impz3; - edgez4 *= impz4; + const vector edgey1 = p000 + (p010 - p000)*w4; + const vector edgey2 = p100 + (p110 - p100)*w5; + const vector edgey3 = p101 + (p111 - p101)*w6; + const vector edgey4 = p001 + (p011 - p001)*w7; + const vector edgez1 = p000 + (p001 - p000)*w8; + const vector edgez2 = p100 + (p101 - p100)*w9; + const vector edgez3 = p110 + (p111 - p110)*w10; + const vector edgez4 = p010 + (p011 - p010)*w11; // Add the contributions - vertices_[vertexNo] = + points_[vijk] = ( - edgex1 + edgex2 + edgex3 + edgex4 - + edgey1 + edgey2 + edgey3 + edgey4 - + edgez1 + edgez2 + edgez3 + edgez4 - ) / 3.0; + wx1*edgex1 + wx2*edgex2 + wx3*edgex3 + wx4*edgex4 + + wy1*edgey1 + wy2*edgey2 + wy3*edgey3 + wy4*edgey4 + + wz1*edgez1 + wz2*edgez2 + wz3*edgez3 + wz4*edgez4 + )/3; - vertices_[vertexNo] += + + // Apply curved-edge correction if block has curved edges + if (nCurvedEdges) + { + // Calculate the correction vectors + const vector corx1 = wx1*(p[0][i] - edgex1); + const vector corx2 = wx2*(p[1][i] - edgex2); + const vector corx3 = wx3*(p[2][i] - edgex3); + const vector corx4 = wx4*(p[3][i] - edgex4); + + const vector cory1 = wy1*(p[4][j] - edgey1); + const vector cory2 = wy2*(p[5][j] - edgey2); + const vector cory3 = wy3*(p[6][j] - edgey3); + const vector cory4 = wy4*(p[7][j] - edgey4); + + const vector corz1 = wz1*(p[8][k] - edgez1); + const vector corz2 = wz2*(p[9][k] - edgez2); + const vector corz3 = wz3*(p[10][k] - edgez3); + const vector corz4 = wz4*(p[11][k] - edgez4); + + points_[vijk] += + ( + corx1 + corx2 + corx3 + corx4 + + cory1 + cory2 + cory3 + cory4 + + corz1 + corz2 + corz3 + corz4 + ); + } + } + } + } + + if (!nCurvedFaces()) return; + + // Apply curvature correction to face points + FixedList facePoints(this->facePoints(points_)); + correctFacePoints(facePoints); + + // Loop over points and apply the correction from the from the i-faces + for (label ii=0; ii<=ni; ii++) + { + // Process the points on the curved faces last + label i = (ii + 1)%(ni + 1); + + for (label j=0; j<=nj; j++) + { + for (label k=0; k<=nk; k++) + { + // Skip non-curved faces and edges + if (flatFaceOrEdge(i, j, k)) continue; + + const label vijk = pointLabel(i, j, k); + + scalar wf0 = ( - corx1 + corx2 + corx3 + corx4 - + cory1 + cory2 + cory3 + cory4 - + corz1 + corz2 + corz3 + corz4 + (1 - w0)*(1 - w4)*(1 - w8) + + (1 - w1)*w4*(1 - w11) + + (1 - w2)*w7*w11 + + (1 - w3)*(1 - w7)*w8 + ); + + scalar wf1 = + ( + w0*(1 - w5)*(1 - w9) + + w1*w5*(1 - w10) + + w2*w5*w10 + + w3*(1 - w6)*w9 + ); + + const scalar sumWf = wf0 + wf1; + wf0 /= sumWf; + wf1 /= sumWf; + + points_[vijk] += + ( + wf0 + *( + facePoints[0][facePointLabel(0, j, k)] + - points_[pointLabel(0, j, k)] + ) + + wf1 + *( + facePoints[1][facePointLabel(1, j, k)] + - points_[pointLabel(ni, j, k)] + ) + ); + } + } + } + + // Loop over points and apply the correction from the from the j-faces + for (label jj=0; jj<=nj; jj++) + { + // Process the points on the curved faces last + label j = (jj + 1)%(nj + 1); + + for (label i=0; i<=ni; i++) + { + for (label k=0; k<=nk; k++) + { + // Skip flat faces and edges + if (flatFaceOrEdge(i, j, k)) continue; + + const label vijk = pointLabel(i, j, k); + + scalar wf2 = + ( + (1 - w4)*(1 - w1)*(1 - w8) + + (1 - w5)*w0*(1 - w9) + + (1 - w6)*w3*w9 + + (1 - w7)*(1 - w3)*w8 + ); + + scalar wf3 = + ( + w4*(1 - w1)*(1 - w11) + + w5*w1*(1 - w10) + + w6*w2*w10 + + w7*(1 - w2)*w11 + ); + + const scalar sumWf = wf2 + wf3; + wf2 /= sumWf; + wf3 /= sumWf; + + points_[vijk] += + ( + wf2 + *( + facePoints[2][facePointLabel(2, i, k)] + - points_[pointLabel(i, 0, k)] + ) + + wf3 + *( + facePoints[3][facePointLabel(3, i, k)] + - points_[pointLabel(i, nj, k)] + ) + ); + } + } + } + + // Loop over points and apply the correction from the from the k-faces + for (label kk=0; kk<=nk; kk++) + { + // Process the points on the curved faces last + label k = (kk + 1)%(nk + 1); + + for (label i=0; i<=ni; i++) + { + for (label j=0; j<=nj; j++) + { + // Skip flat faces and edges + if (flatFaceOrEdge(i, j, k)) continue; + + const label vijk = pointLabel(i, j, k); + + scalar wf4 = + ( + (1 - w8)*(1 - w0)*(1 - w4) + + (1 - w9)*w0*(1 - w5) + + (1 - w10)*w1*w5 + + (1 - w11)*(1 - w1)*w4 + ); + + scalar wf5 = + ( + w8*(1 - w3)*(1 - w7) + + w9*w3*(1 - w6) + + w10*w2*w6 + + w11*(1 - w2)*w7 + ); + + const scalar sumWf = wf4 + wf5; + wf4 /= sumWf; + wf5 /= sumWf; + + points_[vijk] += + ( + wf4 + *( + facePoints[4][facePointLabel(4, i, j)] + - points_[pointLabel(i, j, 0)] + ) + + wf5 + *( + facePoints[5][facePointLabel(5, i, j)] + - points_[pointLabel(i, j, nk)] + ) ); } } @@ -237,230 +346,164 @@ void Foam::block::createPoints() const } -void Foam::block::createCells() const +Foam::List> Foam::block::cells() const { - const label ni = meshDensity().x(); - const label nj = meshDensity().y(); - const label nk = meshDensity().z(); + const label ni = density().x(); + const label nj = density().y(); + const label nk = density().z(); - // - // Generate cells - // - cells_.clear(); - cells_.setSize(nCells()); + List> cells(nCells()); - label cellNo = 0; + label celli = 0; - for (label k = 0; k < nk; k++) + for (label k=0; k>, 6>& +Foam::block::boundaryPatches() const { - return *this; + return boundaryPatches_; } diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C index 1f8c9118c1..fb9a413013 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C @@ -38,17 +38,17 @@ void Foam::blockDescriptor::check(const Istream& is) << " in block " << *this << exit(FatalIOError); } - else if (blockShape_[pi] >= blockPointField_.size()) + else if (blockShape_[pi] >= vertices_.size()) { FatalIOErrorInFunction(is) << "Point label " << blockShape_[pi] - << " out of range 0.." << blockPointField_.size() - 1 + << " out of range 0.." << vertices_.size() - 1 << " in block " << *this << exit(FatalIOError); } } - const point blockCentre(blockShape_.centre(blockPointField_)); + const point blockCentre(blockShape_.centre(vertices_)); const faceList faces(blockShape_.faces()); // Check each face is outward-pointing with respect to the block centre @@ -57,8 +57,8 @@ void Foam::blockDescriptor::check(const Istream& is) forAll(faces, i) { - point faceCentre(faces[i].centre(blockPointField_)); - vector faceNormal(faces[i].normal(blockPointField_)); + point faceCentre(faces[i].centre(vertices_)); + vector faceNormal(faces[i].normal(vertices_)); if (mag(faceNormal) > SMALL) { if (((faceCentre - blockCentre) & faceNormal) > 0) @@ -102,26 +102,54 @@ void Foam::blockDescriptor::check(const Istream& is) } +void Foam::blockDescriptor::findCurvedFaces() +{ + const faceList blockFaces(blockShape().faces()); + + forAll(blockFaces, blockFacei) + { + forAll(faces_, facei) + { + if + ( + face::sameVertices + ( + faces_[facei].vertices(), + blockFaces[blockFacei] + ) + ) + { + curvedFaces_[blockFacei] = facei; + nCurvedFaces_++; + break; + } + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::blockDescriptor::blockDescriptor ( const cellShape& bshape, - const pointField& blockPointField, - const curvedEdgeList& edges, - const Vector