diff --git a/applications/solvers/combustion/dieselEngineFoam/Make/options b/applications/solvers/combustion/dieselEngineFoam/Make/options index c4d65fa137..8fdb0c5c33 100644 --- a/applications/solvers/combustion/dieselEngineFoam/Make/options +++ b/applications/solvers/combustion/dieselEngineFoam/Make/options @@ -16,6 +16,7 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ -lengine \ @@ -35,4 +36,5 @@ EXE_LIBS = \ -llaminarFlameSpeedModels \ -lchemistryModel \ -lODE \ - -ldistributionModels + -ldistributionModels \ + -lcombustionModels diff --git a/applications/solvers/combustion/dieselEngineFoam/YEqn.H b/applications/solvers/combustion/dieselEngineFoam/YEqn.H index b8d39b4f46..46d0f364e6 100644 --- a/applications/solvers/combustion/dieselEngineFoam/YEqn.H +++ b/applications/solvers/combustion/dieselEngineFoam/YEqn.H @@ -10,7 +10,8 @@ tmp > mvConvection ); { - + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -20,17 +21,19 @@ tmp > mvConvection { volScalarField& Yi = Y[i]; - solve + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == dieselSpray.evaporationSource(i) - + kappa*chemistry.RR(i), - mesh.solver("Yi") + + combustion->R(Yi) ); + YiEqn.relax(); + YiEqn.solve(mesh.solver("Yi")); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/combustion/dieselEngineFoam/createFields.H b/applications/solvers/combustion/dieselEngineFoam/createFields.H index 4bd9f1a916..bbb9000943 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createFields.H +++ b/applications/solvers/combustion/dieselEngineFoam/createFields.H @@ -1,10 +1,14 @@ -Info<< nl << "Reading thermophysicalProperties" << endl; +Info<< "Creating combustion model\n" << endl; -autoPtr pChemistry +autoPtr combustion ( - psiChemistryModel::New(mesh) + combustionModels::psiChemistryCombustionModel::New + ( + mesh + ) ); -psiChemistryModel& chemistry = pChemistry(); + +psiChemistryModel& chemistry = combustion->pChemistry(); hsCombustionThermo& thermo = chemistry.thermo(); @@ -55,20 +59,6 @@ volScalarField& hs = thermo.hs(); #include "compressibleCreatePhi.H" -volScalarField kappa -( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) -); - Info << "Creating turbulence model.\n" << nl; autoPtr turbulence ( @@ -81,6 +71,9 @@ autoPtr turbulence ) ); +// Set the turbulence into the combustion model +combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -96,16 +89,16 @@ forAll(Y, i) } fields.add(hs); -DimensionedField chemistrySh +volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index 94ab928999..807051318f 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -32,8 +32,8 @@ Description #include "fvCFD.H" #include "engineTime.H" #include "engineMesh.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" +#include "psiChemistryCombustionModel.H" #include "spray.H" #include "psiChemistryModel.H" #include "chemistrySolver.H" @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) #include "createEngineMesh.H" #include "createFields.H" #include "readGravitationalAcceleration.H" - #include "readCombustionProperties.H" #include "createSpray.H" #include "initContinuityErrs.H" #include "readEngineTimeControls.H" @@ -82,29 +81,6 @@ int main(int argc, char *argv[]) dieselSpray.evolve(); - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - { - volScalarField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - volScalarField tc(chemistry.tc()); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk); - } - - chemistrySh = kappa*chemistry.Sh()(); - - #include "rhoEqn.H" for (pimple.start(); pimple.loop(); pimple++) @@ -130,10 +106,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/combustion/dieselEngineFoam/hsEqn.H b/applications/solvers/combustion/dieselEngineFoam/hsEqn.H index 7ae59feb81..7c0b7f9dc3 100644 --- a/applications/solvers/combustion/dieselEngineFoam/hsEqn.H +++ b/applications/solvers/combustion/dieselEngineFoam/hsEqn.H @@ -1,14 +1,21 @@ { - solve + fvScalarMatrix hsEqn ( fvm::ddt(rho, hs) + mvConvection->fvmDiv(phi, hs) - fvm::laplacian(turbulence->alphaEff(), hs) == - DpDt - + dieselSpray.heatTransferSource()().dimensionedInternalField() - + chemistrySh + DpDt + + combustion->Sh() + + dieselSpray.heatTransferSource()() + ); + hsEqn.relax(); + hsEqn.solve(); + thermo.correct(); + + Info<< "min/max(T) = " + << min(T).value() << ", " << max(T).value() << endl; } diff --git a/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H b/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H deleted file mode 100644 index 84cf9b9756..0000000000 --- a/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H +++ /dev/null @@ -1,18 +0,0 @@ -Info<< "Reading combustion properties\n" << endl; - -IOdictionary combustionProperties -( - IOobject - ( - "combustionProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) -); - -dimensionedScalar Cmix -( - combustionProperties.lookup("Cmix") -); diff --git a/applications/solvers/combustion/dieselFoam/Make/options b/applications/solvers/combustion/dieselFoam/Make/options index 124371575d..4083a59e9f 100644 --- a/applications/solvers/combustion/dieselFoam/Make/options +++ b/applications/solvers/combustion/dieselFoam/Make/options @@ -14,7 +14,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ -I$(LIB_SRC)/../applications/solvers/reactionThermo/XiFoam \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ -lcompressibleTurbulenceModel \ @@ -33,4 +34,5 @@ EXE_LIBS = \ -lchemistryModel \ -lODE \ -ldistributionModels \ - -lfiniteVolume + -lfiniteVolume \ + -lcombustionModels diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 7fd7410247..45ee55195c 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -30,12 +30,11 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" +#include "psiChemistryCombustionModel.H" #include "turbulenceModel.H" -#include "spray.H" #include "psiChemistryModel.H" #include "chemistrySolver.H" - +#include "spray.H" #include "multivariateScheme.H" #include "IFstream.H" #include "OFstream.H" @@ -52,7 +51,6 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "createFields.H" #include "readGravitationalAcceleration.H" - #include "readCombustionProperties.H" #include "createSpray.H" #include "initContinuityErrs.H" #include "readTimeControls.H" @@ -79,26 +77,6 @@ int main(int argc, char *argv[]) Info<< "Solving chemistry" << endl; - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - { - volScalarField tk - ( - Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon()) - ); - volScalarField tc(chemistry.tc()); - - // Chalmers PaSR model - kappa = (runTime.deltaT() + tc)/(runTime.deltaT()+tc+tk); - } - - chemistrySh = kappa*chemistry.Sh()(); - #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop @@ -124,10 +102,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/combustion/fireFoam/YhsEqn.H b/applications/solvers/combustion/fireFoam/YhsEqn.H index aed41a4431..299eb64ab7 100644 --- a/applications/solvers/combustion/fireFoam/YhsEqn.H +++ b/applications/solvers/combustion/fireFoam/YhsEqn.H @@ -20,7 +20,6 @@ tmp > mvConvection if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; - fvScalarMatrix R(combustion->R(Yi)); fvScalarMatrix YiEqn ( @@ -30,7 +29,7 @@ tmp > mvConvection == parcels.SYi(i, Yi) + surfaceFilm.Srho(i) - + R + + combustion->R(Yi) ); YiEqn.relax(); @@ -55,7 +54,7 @@ tmp > mvConvection - fvm::laplacian(turbulence->alphaEff(), hs) == DpDt - + dQ + + combustion->Sh() + radiation->Shs(thermo) + parcels.Sh(hs) + surfaceFilm.Sh() @@ -66,5 +65,6 @@ tmp > mvConvection thermo.correct(); - Info<< "min/max(T) = " << min(T).value() << ", " << max(T).value() << endl; + Info<< "min/max(T) = " + << min(T).value() << ", " << max(T).value() << endl; } diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index f1e152dc32..afabd393c7 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -1,10 +1,16 @@ + Info<< "Creating combustion model\n" << endl; + + autoPtr combustion + ( + combustionModels::psiCombustionModel::New + ( + mesh + ) + ); + Info<< "Reading thermophysical properties\n" << endl; - autoPtr pThermo - ( - hsCombustionThermo::New(mesh) - ); - hsCombustionThermo& thermo = pThermo(); + hsCombustionThermo& thermo = combustion->thermo(); SLGThermo slgThermo(mesh, thermo); @@ -60,30 +66,8 @@ ) ); - IOdictionary combustionProperties - ( - IOobject - ( - "combustionProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - Info<< "Creating combustion model\n" << endl; - autoPtr combustion - ( - combustionModel::combustionModel::New - ( - combustionProperties, - thermo, - turbulence(), - phi, - rho - ) - ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); volScalarField dQ ( @@ -96,7 +80,7 @@ IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("dQ", dimMass/pow3(dimTime)/dimLength, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); Info<< "Creating field DpDt\n" << endl; diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index 7c58a722d1..89968c6e58 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -38,9 +38,8 @@ Description #include "pyrolysisModel.H" #include "radiationModel.H" #include "SLGThermo.H" -#include "hsCombustionThermo.H" #include "solidChemistryModel.H" -#include "combustionModel.H" +#include "psiCombustionModel.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,7 +50,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createClouds.H" diff --git a/applications/solvers/combustion/fireFoam/readChemistryProperties.H b/applications/solvers/combustion/fireFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/combustion/fireFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options index 6386af8c55..8eb6d4cabd 100644 --- a/applications/solvers/combustion/reactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/Make/options @@ -5,7 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ -lcompressibleTurbulenceModel \ @@ -16,4 +17,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lchemistryModel \ -lODE \ - -lfiniteVolume + -lfiniteVolume \ + -lcombustionModels diff --git a/applications/solvers/combustion/reactingFoam/YEqn.H b/applications/solvers/combustion/reactingFoam/YEqn.H index 8d63a12868..87b25079ff 100644 --- a/applications/solvers/combustion/reactingFoam/YEqn.H +++ b/applications/solvers/combustion/reactingFoam/YEqn.H @@ -10,6 +10,8 @@ tmp > mvConvection ); { + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -19,16 +21,18 @@ tmp > mvConvection { volScalarField& Yi = Y[i]; - solve + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == - kappa*chemistry.RR(i), - mesh.solver("Yi") + combustion->R(Yi) ); + YiEqn.relax(); + YiEqn.solve(mesh.solver("Yi")); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/combustion/reactingFoam/chemistry.H b/applications/solvers/combustion/reactingFoam/chemistry.H deleted file mode 100644 index 99f418af6f..0000000000 --- a/applications/solvers/combustion/reactingFoam/chemistry.H +++ /dev/null @@ -1,44 +0,0 @@ -if (chemistry.chemistry()) -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - tmp tepsilon(turbulence->epsilon()); - const volScalarField& epsilon = tepsilon(); - tmp tmuEff(turbulence->muEff()); - const volScalarField& muEff = tmuEff(); - tmp ttc(chemistry.tc()); - const volScalarField& tc = ttc(); - - forAll(epsilon, i) - { - if (epsilon[i] > 0) - { - // Chalmers PaSR model - scalar tk = Cmix.value()*Foam::sqrt(muEff[i]/rho[i]/epsilon[i]); - kappa[i] = - (runTime.deltaTValue() + tc[i]) - /(runTime.deltaTValue() + tc[i] + tk); - } - else - { - // Return to laminar combustion - kappa[i] = 1.0; - } - } - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/combustion/reactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/createFields.H index a2f016e046..7cf94f754d 100644 --- a/applications/solvers/combustion/reactingFoam/createFields.H +++ b/applications/solvers/combustion/reactingFoam/createFields.H @@ -1,9 +1,14 @@ -Info<< nl << "Reading thermophysicalProperties" << endl; -autoPtr pChemistry +Info<< "Creating combustion model\n" << endl; + +autoPtr combustion ( - psiChemistryModel::New(mesh) + combustionModels::psiChemistryCombustionModel::New + ( + mesh + ) ); -psiChemistryModel& chemistry = pChemistry(); + +psiChemistryModel& chemistry = combustion->pChemistry(); hsCombustionThermo& thermo = chemistry.thermo(); @@ -45,20 +50,6 @@ const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" -volScalarField kappa -( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) -); - Info << "Creating turbulence model.\n" << nl; autoPtr turbulence ( @@ -71,6 +62,9 @@ autoPtr turbulence ) ); +// Set the turbulence into the combustion model +combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -85,16 +79,16 @@ forAll(Y, i) } fields.add(hs); -DimensionedField chemistrySh +volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/combustion/reactingFoam/hsEqn.H b/applications/solvers/combustion/reactingFoam/hsEqn.H index e3fa4e7a13..de1a85fddf 100644 --- a/applications/solvers/combustion/reactingFoam/hsEqn.H +++ b/applications/solvers/combustion/reactingFoam/hsEqn.H @@ -7,7 +7,7 @@ // - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no. == DpDt - + chemistrySh + + combustion->Sh() ); hsEqn.relax(); diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index ca156c3f7f..75fb9ad71d 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -30,10 +30,8 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" -#include "psiChemistryModel.H" -#include "chemistrySolver.H" +#include "psiChemistryCombustionModel.H" #include "multivariateScheme.H" #include "pimpleControl.H" @@ -44,7 +42,6 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" @@ -67,7 +64,6 @@ int main(int argc, char *argv[]) runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - #include "chemistry.H" #include "rhoEqn.H" for (pimple.start(); pimple.loop(); pimple++) @@ -88,11 +84,6 @@ int main(int argc, char *argv[]) } } - if (runTime.write()) - { - chemistry.dQ()().write(); - } - runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/combustion/reactingFoam/readChemistryProperties.H b/applications/solvers/combustion/reactingFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/combustion/reactingFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/options b/applications/solvers/combustion/rhoReactingFoam/Make/options index d6306816fd..5a5df2ed7b 100644 --- a/applications/solvers/combustion/rhoReactingFoam/Make/options +++ b/applications/solvers/combustion/rhoReactingFoam/Make/options @@ -6,7 +6,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(FOAM_SOLVERS)/combustion/reactingFoam + -I$(FOAM_SOLVERS)/combustion/reactingFoam \ + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ @@ -18,4 +19,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lchemistryModel \ -lODE \ - -lfiniteVolume + -lfiniteVolume \ + -lcombustionModels diff --git a/applications/solvers/combustion/rhoReactingFoam/YEqn.H b/applications/solvers/combustion/rhoReactingFoam/YEqn.H index 8d63a12868..3a371f035c 100644 --- a/applications/solvers/combustion/rhoReactingFoam/YEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/YEqn.H @@ -10,6 +10,8 @@ tmp > mvConvection ); { + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -19,14 +21,13 @@ tmp > mvConvection { volScalarField& Yi = Y[i]; - solve + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == - kappa*chemistry.RR(i), - mesh.solver("Yi") + combustion->R(Yi) ); Yi.max(0.0); diff --git a/applications/solvers/combustion/rhoReactingFoam/createFields.H b/applications/solvers/combustion/rhoReactingFoam/createFields.H index d58e082f5b..65860a67eb 100644 --- a/applications/solvers/combustion/rhoReactingFoam/createFields.H +++ b/applications/solvers/combustion/rhoReactingFoam/createFields.H @@ -1,9 +1,14 @@ -Info<< nl << "Reading thermophysicalProperties" << endl; -autoPtr pChemistry +Info<< "Creating combustion model\n" << endl; + +autoPtr combustion ( - rhoChemistryModel::New(mesh) + combustionModels::rhoChemistryCombustionModel::New + ( + mesh + ) ); -rhoChemistryModel& chemistry = pChemistry(); + +rhoChemistryModel& chemistry = combustion->pChemistry(); hsReactionThermo& thermo = chemistry.thermo(); @@ -46,19 +51,6 @@ const volScalarField& T = thermo.T(); #include "compressibleCreatePhi.H" -volScalarField kappa -( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) -); Info << "Creating turbulence model.\n" << nl; autoPtr turbulence @@ -72,6 +64,9 @@ autoPtr turbulence ) ); +// Set the turbulence into the combustion model +combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -86,16 +81,16 @@ forAll(Y, i) } fields.add(hs); -DimensionedField chemistrySh +volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/combustion/rhoReactingFoam/hsEqn.H b/applications/solvers/combustion/rhoReactingFoam/hsEqn.H index 81bd6ea9d7..01f85ac1da 100644 --- a/applications/solvers/combustion/rhoReactingFoam/hsEqn.H +++ b/applications/solvers/combustion/rhoReactingFoam/hsEqn.H @@ -4,9 +4,10 @@ fvm::ddt(rho, hs) + mvConvection->fvmDiv(phi, hs) - fvm::laplacian(turbulence->alphaEff(), hs) +// - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no. == DpDt - + chemistrySh + + combustion->Sh() ); hsEqn.relax(); @@ -14,6 +15,6 @@ thermo.correct(); - Info<< "T gas min/max = " << min(T).value() << ", " - << max(T).value() << endl; + Info<< "min/max(T) = " + << min(T).value() << ", " << max(T).value() << endl; } diff --git a/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H b/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C index 9c22e63c51..afa7d9771d 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C @@ -31,10 +31,8 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hReactionThermo.H" +#include "rhoChemistryCombustionModel.H" #include "turbulenceModel.H" -#include "rhoChemistryModel.H" -#include "chemistrySolver.H" #include "multivariateScheme.H" #include "pimpleControl.H" @@ -45,7 +43,6 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" @@ -68,7 +65,6 @@ int main(int argc, char *argv[]) runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - #include "chemistry.H" #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop @@ -92,10 +88,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options index d3a5f0beb2..0c40e89430 100644 --- a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C index a9da394140..9f2955bc2f 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -36,11 +36,9 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hReactionThermo.H" #include "turbulenceModel.H" #include "basicReactingMultiphaseCloud.H" -#include "rhoChemistryModel.H" -#include "chemistrySolver.H" +#include "rhoChemistryCombustionModel.H" #include "radiationModel.H" #include "porousZones.H" #include "timeActivatedExplicitSource.H" @@ -75,7 +73,6 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readChemistryProperties.H" #include "readAdditionalSolutionControls.H" #include "readTimeControls.H" @@ -85,7 +82,6 @@ int main(int argc, char *argv[]) parcels.evolve(); - #include "chemistry.H" #include "timeScales.H" #include "rhoEqn.H" @@ -111,10 +107,7 @@ int main(int argc, char *argv[]) } } - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/Make/options b/applications/solvers/lagrangian/LTSReactingParcelFoam/Make/options index 91ee4a594d..36e9c44270 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/Make/options @@ -20,7 +20,8 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -44,4 +45,5 @@ EXE_LIBS = \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H index c941691d66..625c940a66 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/YEqn.H @@ -9,6 +9,9 @@ tmp > mvConvection ) ); +combustion->correct(); +dQ = combustion->dQ(); + if (solveSpecies) { label inertIndex = -1; @@ -19,14 +22,15 @@ if (solveSpecies) if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; + solve ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) - == + == parcels.SYi(i, Yi) - + kappa*chemistry.RR(i)().dimensionedInternalField() + + combustion->R(Yi) + massSource.Su(i), mesh.solver("Yi") ); diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/createFields.H index 103ead9d78..f1f6173cd6 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/createFields.H @@ -1,10 +1,14 @@ - Info<< "Reading thermophysical properties\n" << endl; + Info<< "Creating combustion model\n" << endl; - autoPtr pChemistry + autoPtr combustion ( - rhoChemistryModel::New(mesh) + combustionModels::rhoChemistryCombustionModel::New + ( + mesh + ) ); - rhoChemistryModel& chemistry = pChemistry(); + + rhoChemistryModel& chemistry = combustion->pChemistry(); hsReactionThermo& thermo = chemistry.thermo(); @@ -57,20 +61,6 @@ #include "compressibleCreatePhi.H" - DimensionedField kappa - ( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - dimensionedScalar rhoMax ( mesh.solutionDict().subDict("PIMPLE").lookup("rhoMax") @@ -93,6 +83,9 @@ ) ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + Info<< "Creating multi-variate interpolation scheme\n" << endl; multivariateSurfaceInterpolationScheme::fieldTable fields; @@ -102,20 +95,21 @@ } fields.add(hs); - DimensionedField chemistrySh + volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); + volScalarField rDeltaT ( IOobject diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/hsEqn.H index 5954b1217e..55bf1d6dd0 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/hsEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/hsEqn.H @@ -9,7 +9,7 @@ + parcels.Sh(hs) + radiation->Shs(thermo) + energySource.Su() - + chemistrySh + + combustion->Sh() ); hsEqn.solve(); diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/readChemistryProperties.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/readChemistryProperties.H deleted file mode 100644 index e742e9fea7..0000000000 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -// Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H index e6d0fa85c4..05fe8a1c77 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/timeScales.H @@ -77,7 +77,7 @@ Info<< "Time scales min/max:" << endl; DpDt + parcels.hsTrans()/(mesh.V()*runTime.deltaT()) + energySource.Su() - + chemistrySh + + combustion->Sh()() ) /rho ); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index f2f8d1e758..e8a8718373 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -21,6 +21,7 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam @@ -47,4 +48,5 @@ EXE_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -lODE \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H index be82d6e2b6..e9bd1c6581 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H @@ -11,6 +11,8 @@ tmp > mvConvection { + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -19,16 +21,20 @@ tmp > mvConvection if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; - solve + + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == coalParcels.SYi(i, Yi) - + kappa*chemistry.RR(i)().dimensionedInternalField() + + combustion->R(Yi) ); + YiEqn.relax(); + YiEqn.solve(mesh.solver("Yi")); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 3d0eabcef8..1e6daed0fd 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -36,12 +36,10 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" #include "basicThermoCloud.H" #include "coalCloud.H" -#include "psiChemistryModel.H" -#include "chemistrySolver.H" +#include "psiChemistryCombustionModel.H" #include "timeActivatedExplicitSource.H" #include "radiationModel.H" #include "SLGThermo.H" @@ -55,7 +53,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createClouds.H" @@ -88,7 +85,6 @@ int main(int argc, char *argv[]) limestoneParcels.evolve(); - #include "chemistry.H" #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop @@ -112,10 +108,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index 97e409215c..4d0a2b7408 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -1,10 +1,14 @@ - Info<< "Reading thermophysical properties\n" << endl; + Info<< "Creating combustion model\n" << endl; - autoPtr pChemistry + autoPtr combustion ( - psiChemistryModel::New(mesh) + combustionModels::psiChemistryCombustionModel::New + ( + mesh + ) ); - psiChemistryModel& chemistry = pChemistry(); + + psiChemistryModel& chemistry = combustion->pChemistry(); hsCombustionThermo& thermo = chemistry.thermo(); @@ -96,20 +100,6 @@ #include "compressibleCreatePhi.H" - DimensionedField kappa - ( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( @@ -122,6 +112,9 @@ ) ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -138,16 +131,16 @@ "hs" ); - DimensionedField chemistrySh + volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H index e6901a9c6f..9a4665accd 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/hsEqn.H @@ -6,15 +6,14 @@ - fvm::laplacian(turbulence->alphaEff(), hs) == DpDt + + combustion->Sh() + coalParcels.Sh(hs) + limestoneParcels.Sh(hs) + enthalpySource.Su() + radiation->Shs(thermo) - + chemistrySh ); hsEqn.relax(); - hsEqn.solve(); thermo.correct(); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H b/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options index f2dffe2998..1abdd72178 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options @@ -21,6 +21,7 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam @@ -46,4 +47,5 @@ EXE_LIBS = \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H index 53c6b25d81..5ef4aaa3a3 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H @@ -10,6 +10,8 @@ tmp > mvConvection ) ); +combustion->correct(); +dQ = combustion->dQ(); if (solveSpecies) { @@ -21,6 +23,7 @@ if (solveSpecies) if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; + solve ( fvm::ddt(rho, Yi) @@ -28,7 +31,7 @@ if (solveSpecies) - fvm::laplacian(turbulence->muEff(), Yi) == parcels.SYi(i, Yi) - + kappa*chemistry.RR(i)().dimensionedInternalField() + + combustion->R(Yi) + massSource.Su(i), mesh.solver("Yi") ); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H index 22d7c1f219..ab6b01f9ce 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createFields.H @@ -1,10 +1,14 @@ - Info<< "Reading thermophysical properties\n" << endl; + Info<< "Creating combustion model\n" << endl; - autoPtr pChemistry + autoPtr combustion ( - rhoChemistryModel::New(mesh) + combustionModels::rhoChemistryCombustionModel::New + ( + mesh + ) ); - rhoChemistryModel& chemistry = pChemistry(); + + rhoChemistryModel& chemistry = combustion->pChemistry(); hsReactionThermo& thermo = chemistry.thermo(); @@ -57,20 +61,6 @@ #include "compressibleCreatePhi.H" - DimensionedField kappa - ( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( @@ -83,6 +73,9 @@ ) ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + Info<< "Creating multi-variate interpolation scheme\n" << endl; multivariateSurfaceInterpolationScheme::fieldTable fields; @@ -92,16 +85,16 @@ } fields.add(hs); - DimensionedField chemistrySh + volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H index 58e0b69943..0e2c61a9ff 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H @@ -39,7 +39,7 @@ + parcels.Sh(hs) + radiation->Shs(thermo) + energySource.Su() - + chemistrySh + + combustion->Sh() ); thermo.correct(); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index 638d83da0c..e077836709 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -40,11 +40,9 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hReactionThermo.H" #include "turbulenceModel.H" #include "basicReactingMultiphaseCloud.H" -#include "rhoChemistryModel.H" -#include "chemistrySolver.H" +#include "rhoChemistryCombustionModel.H" #include "radiationModel.H" #include "porousZones.H" #include "timeActivatedExplicitSource.H" @@ -59,7 +57,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createRadiationModel.H" @@ -90,7 +87,6 @@ int main(int argc, char *argv[]) parcels.evolve(); - #include "chemistry.H" #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop @@ -114,10 +110,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index 6e225cc092..3f762b6bd0 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -20,6 +20,7 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam @@ -41,4 +42,5 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -llagrangianIntermediate \ -lODE \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H index db79376614..4fad16b57d 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H @@ -11,6 +11,8 @@ tmp > mvConvection { + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -19,6 +21,7 @@ tmp > mvConvection if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; + solve ( fvm::ddt(rho, Yi) @@ -27,7 +30,7 @@ tmp > mvConvection == parcels.SYi(i, Yi) + surfaceFilm.Srho(i) - + kappa*chemistry.RR(i)().dimensionedInternalField(), + + combustion->R(Yi), mesh.solver("Yi") ); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H index e2db33f1f7..999515f430 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/createFields.H @@ -1,10 +1,14 @@ - Info<< "Reading thermophysical properties\n" << endl; + Info<< "Creating combustion model\n" << endl; - autoPtr pChemistry + autoPtr combustion ( - psiChemistryModel::New(mesh) + combustionModels::psiChemistryCombustionModel::New + ( + mesh + ) ); - psiChemistryModel& chemistry = pChemistry(); + + psiChemistryModel& chemistry = combustion->pChemistry(); hsCombustionThermo& thermo = chemistry.thermo(); @@ -50,21 +54,6 @@ #include "compressibleCreatePhi.H" - Info<< "Creating field kappa\n" << endl; - DimensionedField kappa - ( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( @@ -77,6 +66,9 @@ ) ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -131,16 +123,16 @@ additionalControlsDict.lookup("solvePrimaryRegion") ); - DimensionedField chemistrySh + volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0) + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H index feb112f652..79c5e1c5b3 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H @@ -9,7 +9,7 @@ + parcels.Sh(hs) + surfaceFilm.Sh() + radiation->Shs(thermo) - + chemistrySh + + combustion->Sh() ); hsEqn.relax(); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index 6ae930c7a7..ea8e9e6e5b 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -31,12 +31,10 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" #include "basicReactingCloud.H" #include "surfaceFilmModel.H" -#include "psiChemistryModel.H" -#include "chemistrySolver.H" +#include "psiChemistryCombustionModel.H" #include "radiationModel.H" #include "SLGThermo.H" #include "pimpleControl.H" @@ -49,7 +47,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createClouds.H" @@ -83,7 +80,6 @@ int main(int argc, char *argv[]) if (solvePrimaryRegion) { - #include "chemistry.H" #include "rhoEqn.H" // --- PIMPLE loop @@ -107,10 +103,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); } else { diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/readChemistryProperties.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index fc312bb5fa..e406727104 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -20,6 +20,7 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam @@ -45,4 +46,5 @@ EXE_LIBS = \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H index a180973321..78bbe14bbf 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H @@ -11,6 +11,8 @@ tmp > mvConvection { + combustion->correct(); + dQ = combustion->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); @@ -19,17 +21,20 @@ tmp > mvConvection if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; - solve + + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == parcels.SYi(i, Yi) - + kappa*chemistry.RR(i)().dimensionedInternalField(), - mesh.solver("Yi") + + combustion->R(Yi) ); + YiEqn.relax(); + YiEqn.solve(mesh.solver("Yi")); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index 089489a014..c318498d94 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -1,10 +1,14 @@ - Info<< "Reading thermophysical properties\n" << endl; + Info<< "Creating combustion model\n" << endl; - autoPtr pChemistry + autoPtr combustion ( - psiChemistryModel::New(mesh) + combustionModels::psiChemistryCombustionModel::New + ( + mesh + ) ); - psiChemistryModel& chemistry = pChemistry(); + + psiChemistryModel& chemistry = combustion->pChemistry(); hsCombustionThermo& thermo = chemistry.thermo(); @@ -57,20 +61,6 @@ #include "compressibleCreatePhi.H" - DimensionedField kappa - ( - IOobject - ( - "kappa", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - mesh, - dimensionedScalar("zero", dimless, 0.0) - ); - Info<< "Creating turbulence model\n" << endl; autoPtr turbulence ( @@ -83,6 +73,9 @@ ) ); + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + Info<< "Creating field DpDt\n" << endl; volScalarField DpDt ( @@ -98,16 +91,16 @@ } fields.add(hs); - DimensionedField chemistrySh + volScalarField dQ ( IOobject ( - "chemistry::Sh", + "dQ", runTime.timeName(), mesh, IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::AUTO_WRITE ), mesh, - dimensionedScalar("chemistry::Sh", dimEnergy/dimTime/dimVolume, 0.0) - ); + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + ); \ No newline at end of file diff --git a/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H index 7821d340d4..f7499813c7 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H @@ -8,7 +8,7 @@ DpDt + parcels.Sh(hs) + radiation->Shs(thermo) - + chemistrySh + + combustion->Sh() ); hEqn.relax(); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index ae2a06a363..0d00af9c2a 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -31,11 +31,9 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" #include "basicReactingCloud.H" -#include "psiChemistryModel.H" -#include "chemistrySolver.H" +#include "psiChemistryCombustionModel.H" #include "radiationModel.H" #include "SLGThermo.H" #include "pimpleControl.H" @@ -48,7 +46,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createClouds.H" @@ -76,7 +73,6 @@ int main(int argc, char *argv[]) parcels.evolve(); - #include "chemistry.H" #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop @@ -100,10 +96,7 @@ int main(int argc, char *argv[]) rho = thermo.rho(); - if (runTime.write()) - { - chemistry.dQ()().write(); - } + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H b/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H deleted file mode 100644 index f0bcf7597f..0000000000 --- a/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H +++ /dev/null @@ -1,23 +0,0 @@ -Info<< "Reading chemistry properties\n" << endl; - -IOdictionary chemistryProperties -( - IOobject - ( - "chemistryProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) -); - -Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction")); - -dimensionedScalar Cmix("Cmix", dimless, 1.0); - -if (turbulentReaction) -{ - chemistryProperties.lookup("Cmix") >> Cmix; -} diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options index ff504df32f..f4c66f06f9 100644 --- a/applications/solvers/lagrangian/sprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -21,6 +21,7 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam @@ -47,4 +48,5 @@ EXE_LIBS = \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lcombustionModels diff --git a/applications/solvers/lagrangian/sprayFoam/chemistry.H b/applications/solvers/lagrangian/sprayFoam/chemistry.H deleted file mode 100644 index 99f418af6f..0000000000 --- a/applications/solvers/lagrangian/sprayFoam/chemistry.H +++ /dev/null @@ -1,44 +0,0 @@ -if (chemistry.chemistry()) -{ - Info<< "Solving chemistry" << endl; - - chemistry.solve - ( - runTime.value() - runTime.deltaTValue(), - runTime.deltaTValue() - ); - - // turbulent time scale - if (turbulentReaction) - { - tmp tepsilon(turbulence->epsilon()); - const volScalarField& epsilon = tepsilon(); - tmp tmuEff(turbulence->muEff()); - const volScalarField& muEff = tmuEff(); - tmp ttc(chemistry.tc()); - const volScalarField& tc = ttc(); - - forAll(epsilon, i) - { - if (epsilon[i] > 0) - { - // Chalmers PaSR model - scalar tk = Cmix.value()*Foam::sqrt(muEff[i]/rho[i]/epsilon[i]); - kappa[i] = - (runTime.deltaTValue() + tc[i]) - /(runTime.deltaTValue() + tc[i] + tk); - } - else - { - // Return to laminar combustion - kappa[i] = 1.0; - } - } - } - else - { - kappa = 1.0; - } - - chemistrySh = kappa*chemistry.Sh()(); -} diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C index 5252fd3cf3..d1f70654ea 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -31,11 +31,9 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "hCombustionThermo.H" #include "turbulenceModel.H" #include "basicSprayCloud.H" -#include "psiChemistryModel.H" -#include "chemistrySolver.H" +#include "psiChemistryCombustionModel.H" #include "radiationModel.H" #include "SLGThermo.H" #include "pimpleControl.H" @@ -48,7 +46,6 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" - #include "readChemistryProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" #include "createClouds.H" @@ -76,7 +73,6 @@ int main(int argc, char *argv[]) parcels.evolve(); - #include "chemistry.H" #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C index d028a1376f..e526266c90 100644 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C @@ -34,6 +34,7 @@ Description #include "nearWallDist.H" #include "wallFvPatch.H" #include "Switch.H" + #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,9 @@ int main(int argc, char *argv[]) #include "readGravitationalAcceleration.H" #include "createFields.H" #include "initContinuityErrs.H" + #include "readTimeControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" pimpleControl pimple(mesh); @@ -54,16 +58,23 @@ int main(int argc, char *argv[]) Info<< "\nStarting time loop\n" << endl; - while (runTime.loop()) + while (runTime.run()) { - Info<< "Time = " << runTime.timeName() << nl << endl; - #include "readBubbleFoamControls.H" #include "CourantNo.H" + #include "setDeltaT.H" + + runTime++; + Info<< "Time = " << runTime.timeName() << nl << endl; // --- Pressure-velocity PIMPLE corrector loop for (pimple.start(); pimple.loop(); pimple++) { + if (pimple.nOuterCorr() != 1) + { + p.storePrevIter(); + } + #include "alphaEqn.H" #include "liftDragCoeffs.H" #include "UEqns.H" @@ -73,7 +84,7 @@ int main(int argc, char *argv[]) { #include "pEqn.H" - if (correctAlpha) + if (correctAlpha && !pimple.finalIter()) { #include "alphaEqn.H" } diff --git a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C b/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C index 5edf003719..1bf6e435a1 100644 --- a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C +++ b/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - threePhaseMixture - \*---------------------------------------------------------------------------*/ #include "threePhaseMixture.H" diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 17cf2e7ec0..3341d192dd 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -26,7 +26,7 @@ Application Description Solver for a system of 2 incompressible fluid phases with one phase - dispersed, e.g. gas bubbles in a liquid. + dispersed, e.g. gas bubbles in a liquid or solid particles in a gas. \*---------------------------------------------------------------------------*/ @@ -78,10 +78,13 @@ int main(int argc, char *argv[]) // --- Pressure-velocity PIMPLE corrector loop for (pimple.start(); pimple.loop(); pimple++) { + if (pimple.nOuterCorr() != 1) + { + p.storePrevIter(); + } + #include "alphaEqn.H" - #include "liftDragCoeffs.H" - #include "UEqns.H" // --- PISO loop diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index 650393d5ec..205dc6fc5c 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -757,9 +757,23 @@ int main(int argc, char *argv[]) "retain raw orientation for prisms/hexs" ); +# include "addRegionOption.H" + # include "setRootCase.H" # include "createTime.H" + Foam::word regionName; + + if (args.optionReadIfPresent("region", regionName)) + { + Foam::Info + << "Creating polyMesh for region " << regionName << endl; + } + else + { + regionName = Foam::polyMesh::defaultRegion; + } + const bool keepOrientation = args.optionFound("keepOrientation"); IFstream inFile(args[1]); @@ -894,7 +908,7 @@ int main(int argc, char *argv[]) ( IOobject ( - polyMesh::defaultRegion, + regionName, runTime.constant(), runTime ), @@ -984,6 +998,7 @@ int main(int argc, char *argv[]) //Get polyMesh to write to constant + runTime.setTime(instant(runTime.constant()), 0); repatcher.repatch(); @@ -1079,6 +1094,32 @@ int main(int argc, char *argv[]) mesh.addZones(List(0), fz, cz); } + // Remove empty defaultFaces + label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName); + if (mesh.boundaryMesh()[defaultPatchID].size() == 0) + { + List newPatchPtrList((mesh.boundaryMesh().size() - 1)); + label newPatchI = 0; + forAll(mesh.boundaryMesh(), patchI) + { + if (patchI != defaultPatchID) + { + const polyPatch& patch = mesh.boundaryMesh()[patchI]; + + newPatchPtrList[newPatchI] = patch.clone + ( + mesh.boundaryMesh(), + newPatchI, + patch.size(), + patch.start() + ).ptr(); + + newPatchI++; + } + } + repatcher.changePatches(newPatchPtrList); + } + mesh.write(); Info<< "End\n" << endl; diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict index fbd26416b8..739f929fd3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -20,6 +20,9 @@ region liquidFilm; // FaceZones to extrude faceZones (f0); +// FaceZone shadow +//faceZonesShadow (fBaffleShadow); + // Adapt the original mesh to have directMapped patches at where the // faceZones are? // If true: @@ -32,6 +35,10 @@ adaptMesh true; // Extrude 1D-columns of cells? oneD false; +// If oneD is true. Specify which boundary is wanted between the layers +//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch + + //- Extrusion model to use. The only logical choice is linearNormal? //- Linear extrusion in normal direction diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index 2f90994c9c..8cd16cffbd 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - meshDualiser - \*---------------------------------------------------------------------------*/ #include "meshDualiser.H" diff --git a/applications/utilities/mesh/manipulation/setSet/writeFuns.H b/applications/utilities/mesh/manipulation/setSet/writeFuns.H index 1b9aef4f8e..de5f7a1c44 100644 --- a/applications/utilities/mesh/manipulation/setSet/writeFuns.H +++ b/applications/utilities/mesh/manipulation/setSet/writeFuns.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::writeFunctions + Foam::writeFuns Description Various functions for collecting and writing binary data. SourceFiles - writeFunctions.C + writeFuns.C \*---------------------------------------------------------------------------*/ -#ifndef writeFunctions_H -#define writeFunctions_H +#ifndef writeFuns_H +#define writeFuns_H #include "labelList.H" #include "floatScalar.H" diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C index 8f0e53f4e2..9370236411 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C +++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,12 @@ int main(int argc, char *argv[]) if (args.optionFound("old") || args.optionFound("new")) { - dictionary controlDict(IFstream(findEtcFile("controlDict", true))()); + fileNameList controlDictFiles = findEtcFiles("controlDict", true); + dictionary controlDict; + forAllReverse(controlDictFiles, cdfi) + { + controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])())); + } wordHashSet oldDebug ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/writeFuns.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/writeFuns.H index ecd7225ee5..fd7980ec28 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/writeFuns.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/writeFuns.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::writeFunctions + Foam::writeFuns Description Various functions for collecting and writing binary data. SourceFiles - writeFunctions.C + writeFuns.C \*---------------------------------------------------------------------------*/ -#ifndef writeFunctions_H -#define writeFunctions_H +#ifndef writeFuns_H +#define writeFuns_H #include "floatScalar.H" #include "DynamicList.H" diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index becaae12f7..ca79e6aa47 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -49,6 +49,9 @@ formatOptions // cell : use cell-centre value only; constant over cells (default) // cellPoint : use cell-centre and vertex values // cellPointFace : use cell-centre, vertex and face values. +// pointMVC : use point values only (Mean Value Coordinates) +// cellPatchConstrained : use cell-centre except on boundary faces where +// it uses the boundary value. For use with e.g. patchCloudSet. // 1] vertex values determined from neighbouring cell-centre values // 2] face values determined using the current face interpolation scheme // for the field (linear, gamma, etc.) @@ -83,6 +86,7 @@ fields // uniform, face, midPoint, midPointAndFace : start and end coordinate // uniform: extra number of sampling points // polyLine, cloud: list of coordinates +// patchCloud: list of coordinates and set of patches to look for nearest sets ( lineX1 @@ -113,8 +117,21 @@ sets points ((0.049 0.049 0.00501)(0.051 0.049 0.00501)); } + somePatchPoints + { + // Sample nearest points on selected patches. Use with + // interpolations: + // - cell (cell value) + // - cellPatchConstrained (boundary value) + // - cellPoint (interpolated boundary value) + type patchCloud; + axis xyz; + points ((0.049 0.099 0.005)(0.051 0.054 0.005)); + patches (".*Wall.*"); + } ); + // Surface sampling definition // // 1] patches are not triangulated by default @@ -241,4 +258,5 @@ surfaces } ); + // *********************************************************************** // diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 387b791592..13ea44c345 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) label patchI = pp.index(); finalAgglom[patchI].setSize(pp.size(), 0); - if (pp.size() > 0 && !pp.coupled()) + if (!pp.coupled()) { if (agglomDict.found(pp.name())) { diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index 75eca8bc28..095436b1a1 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -2,8 +2,7 @@ // Pre-size by assuming a certain percentage is visible. // Maximum lenght for dynamicList -const label maxDynListLenght = 10000; -//label lenghtCount = 0; +const label maxDynListLength = 10000; for (label procI = 0; procI < Pstream::nProcs(); procI++) { @@ -22,69 +21,51 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) const pointField& remoteArea = remoteCoarseSf[procI]; const pointField& remoteFc = remoteCoarseCf[procI]; - if (myFc.size()*remoteFc.size() > 0) + label i = 0; + label j = 0; + do { - forAll(myFc, i) + for (; i < myFc.size(); i++) { const point& fc = myFc[i]; const vector& fA = myArea[i]; - forAll(remoteFc, j) + for (; j < remoteFc.size(); j++)// { if (procI != Pstream::myProcNo() || i != j) { const point& remFc = remoteFc[j]; const vector& remA = remoteArea[j]; - const vector& d = remFc-fc; + const vector& d = remFc - fc; if (((d & fA) < 0.) && ((d & remA) > 0)) { - //lenghtCount ++; start.append(fc + 0.0001*d); startIndex.append(i); end.append(fc + 0.9999*d); label globalI = globalNumbering.toGlobal(procI, j); endIndex.append(globalI); - - if (startIndex.size() > maxDynListLenght) + if (startIndex.size() > maxDynListLength) { - List hitInfo(startIndex.size()); - surfacesMesh.findLine - ( - start, - end, - hitInfo - ); - surfacesMesh.findLine(start, end, hitInfo); - forAll (hitInfo, rayI) - { - if (!hitInfo[rayI].hit()) - { - rayStartFace.append(startIndex[rayI]); - rayEndFace.append(endIndex[rayI]); - } - } - //lenghtCount = 0; - start.clear(); - startIndex.clear(); - end.clear(); - endIndex.clear(); + break; } } } } + if (startIndex.size() > maxDynListLength) + { + break; + } + + if (j == remoteFc.size()) + { + j = 0; + } } - } - if (!start.empty()) - { + List hitInfo(startIndex.size()); - surfacesMesh.findLine - ( - start, - end, - hitInfo - ); surfacesMesh.findLine(start, end, hitInfo); + forAll (hitInfo, rayI) { if (!hitInfo[rayI].hit()) @@ -93,5 +74,12 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) rayEndFace.append(endIndex[rayI]); } } - } + + start.clear(); + startIndex.clear(); + end.clear(); + endIndex.clear(); + + }while (returnReduce(i < myFc.size(), orOp())); + } diff --git a/bin/paraFoam b/bin/paraFoam index fe11bcb6e8..6092623b00 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -70,6 +70,8 @@ export LC_ALL=C # reader extension extension=OpenFOAM +requirePV=1 + # parse options while [ "$#" -gt 0 ] do @@ -97,10 +99,12 @@ do ;; -touch) optTouch=true + requirePV=0 shift ;; -touchAll) optTouch=all + requirePV=0 shift ;; --) @@ -117,6 +121,24 @@ do done +# +# check that reader module has been built +# +if [ $requirePV -eq 1 -a ! -f $PV_PLUGIN_PATH/libPV3FoamReader_SM.so ] +then + cat<< BUILDREADER + +FATAL ERROR: ParaView reader module libraries do not exist + +Please build the reader module before continuing: +cd \$FOAM_UTILITIES/postProcessing/graphics/PV3Readers +./Allwclean +./Allwmake + +BUILDREADER + exit 1 +fi + # # check for --data=... argument # diff --git a/etc/bashrc b/etc/bashrc index edebe538fc..e6e528df4d 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -32,7 +32,7 @@ #------------------------------------------------------------------------------ export WM_PROJECT=OpenFOAM -export WM_PROJECT_VERSION=dev +export WM_PROJECT_VERSION=dev.cvm ################################################################################ # USER EDITABLE PART: Changes made here may be lost with the next upgrade diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 6b5f43dbc8..d153e4216f 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -209,10 +209,10 @@ case ThirdParty: breaksw case Gcc46: case Gcc46++0x: - set gcc_version=gcc-4.6.0 - set gmp_version=gmp-5.0.1 - set mpfr_version=mpfr-2.4.2 - set mpc_version=mpc-0.8.1 + set gcc_version=gcc-4.6.1 + set gmp_version=gmp-5.0.2 + set mpfr_version=mpfr-3.0.1 + set mpc_version=mpc-0.9 breaksw case Gcc45: case Gcc45++0x: @@ -236,8 +236,8 @@ case ThirdParty: # using clang - not gcc setenv WM_CC 'clang' setenv WM_CXX 'clang++' - set clang_version=llvm-2.9 - #set clang_version=llvm-svn + #set clang_version=llvm-2.9 + set clang_version=llvm-svn breaksw default: echo diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 4e801efd83..bc87934f5b 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -228,10 +228,11 @@ OpenFOAM | ThirdParty) mpfr_version=mpfr-2.4.2 ;; Gcc46 | Gcc46++0x) - gcc_version=gcc-4.6.0 - gmp_version=gmp-5.0.1 - mpfr_version=mpfr-2.4.2 - mpc_version=mpc-0.8.1 + gcc_version=gcc-4.6.1 + gmp_version=gmp-5.0.2 + mpfr_version=mpfr-3.0.1 + mpc_version=mpc-0.9 + gmpPACKAGE=gmp-5.0.2 ;; Gcc45 | Gcc45++0x) gcc_version=gcc-4.5.2 @@ -253,8 +254,8 @@ OpenFOAM | ThirdParty) # using clang - not gcc export WM_CC='clang' export WM_CXX='clang++' - clang_version=llvm-2.9 - #clang_version=llvm-svn + #clang_version=llvm-2.9 + clang_version=llvm-svn ;; *) echo diff --git a/etc/controlDict b/etc/controlDict index a4880c4b9d..4f2a881488 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -24,7 +24,6 @@ Documentation "$WM_PROJECT_USER_DIR/html" "~OpenFOAM/html" "$WM_PROJECT_DIR/doc/Doxygen/html" - "$WM_PROJECT_DIR/doc/doxygen/html" ); doxySourceFileExts ( @@ -38,6 +37,7 @@ InfoSwitches { writePrecision 6; writeJobInfo 0; + writeDictionaries 0; // Allow case-supplied C++ code (#codeStream, codedFixedValue) allowSystemOperations 0; diff --git a/etc/cshrc b/etc/cshrc index 658f93da69..455099df5f 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -31,7 +31,7 @@ #------------------------------------------------------------------------------ setenv WM_PROJECT OpenFOAM -setenv WM_PROJECT_VERSION dev +setenv WM_PROJECT_VERSION dev.cvm #dev ################################################################################ # USER EDITABLE PART: Changes made here may be lost with the next upgrade diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index c79d8f0290..bc06554811 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -264,10 +264,16 @@ bool Foam::chDir(const fileName& dir) } -Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) +Foam::fileNameList Foam::findEtcFiles +( + const fileName& name, + bool mandatory, + bool findFirst +) { - // - // search for user files in + fileNameList results; + + // Search for user files in // * ~/.OpenFOAM/VERSION // * ~/.OpenFOAM // @@ -277,19 +283,25 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } fullName = searchDir/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } } - - // - // search for group (site) files in + // Search for group (site) files in // * $WM_PROJECT_SITE/VERSION // * $WM_PROJECT_SITE // @@ -301,19 +313,26 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } fullName = searchDir/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } } } else { - // // OR search for group (site) files in // * $WM_PROJECT_INST_DIR/site/VERSION // * $WM_PROJECT_INST_DIR/site @@ -324,20 +343,26 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/"site"/FOAMversion/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } fullName = searchDir/"site"/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } } } - - // - // search for other (shipped) files in + // Search for other (shipped) files in // * $WM_PROJECT_DIR/etc // searchDir = getEnv("WM_PROJECT_DIR"); @@ -346,24 +371,45 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) fileName fullName = searchDir/"etc"/name; if (isFile(fullName)) { - return fullName; + results.append(fullName); + if (findFirst) + { + return results; + } } } // Not found - // abort if the file is mandatory, otherwise return null - if (mandatory) + if (results.empty()) { - std::cerr - << "--> FOAM FATAL ERROR in Foam::findEtcFile() :" - " could not find mandatory file\n '" - << name.c_str() << "'\n\n" << std::endl; - ::exit(1); + // Abort if the file is mandatory, otherwise return null + if (mandatory) + { + std::cerr + << "--> FOAM FATAL ERROR in Foam::findEtcFiles() :" + " could not find mandatory file\n '" + << name.c_str() << "'\n\n" << std::endl; + ::exit(1); + } } - // Return null-constructed fileName rather than fileName::null - // to avoid cyclic dependencies in the construction of globals - return fileName(); + // Return list of matching paths or empty list if none found + return results; +} + + +Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) +{ + fileNameList results(findEtcFiles(name, mandatory, true)); + + if (results.size()) + { + return results[0]; + } + else + { + return fileName(); + } } diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C index cb0e8be4d7..cdf40208a4 100644 --- a/src/OSspecific/POSIX/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor.C @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - fileMonitor - \*----------------------------------------------------------------------------*/ #include "fileMonitor.H" diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index 2c5087c120..92991459a3 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C @@ -21,12 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - IOdictionary is derived from dictionary and IOobject to give the - dictionary automatic IO functionality via the objectRegistry. To facilitate - IO, IOdictioanry is provided with a constructor from IOobject and writeData - and write functions. - \*---------------------------------------------------------------------------*/ #include "IOdictionary.H" @@ -37,84 +31,10 @@ Description defineTypeNameAndDebug(Foam::IOdictionary, 0); - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// Parallel aware reading, using non-virtual type information (typeName instead -// of type()) because of use in constructor. -void Foam::IOdictionary::readFile(const bool masterOnly) -{ - if (Pstream::master() || !masterOnly) - { - if (debug) - { - Pout<< "IOdictionary : Reading " << objectPath() - << " from file " << endl; - } - readStream(typeName) >> *this; - close(); - } - - if (masterOnly && Pstream::parRun()) - { - // Scatter master data using communication scheme - - const List& comms = - ( - (Pstream::nProcs() < Pstream::nProcsSimpleSum) - ? Pstream::linearCommunication() - : Pstream::treeCommunication() - ); - - // Master reads headerclassname from file. Make sure this gets - // transfered as well as contents. - Pstream::scatter(comms, const_cast(headerClassName())); - Pstream::scatter(comms, note()); - - // Get my communication order - const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()]; - - // Reveive from up - if (myComm.above() != -1) - { - if (debug) - { - Pout<< "IOdictionary : Reading " << objectPath() - << " from processor " << myComm.above() << endl; - } - - // Note: use ASCII for now - binary IO of dictionaries is - // not currently supported - IPstream fromAbove - ( - Pstream::scheduled, - myComm.above(), - 0, - IOstream::ASCII - ); - IOdictionary::readData(fromAbove); - } - - // Send to my downstairs neighbours - forAll(myComm.below(), belowI) - { - if (debug) - { - Pout<< "IOdictionary : Sending " << objectPath() - << " to processor " << myComm.below()[belowI] << endl; - } - OPstream toBelow - ( - Pstream::scheduled, - myComm.below()[belowI], - 0, - Pstream::msgType(), - IOstream::ASCII - ); - IOdictionary::writeData(toBelow); - } - } -} +bool Foam::IOdictionary::writeDictionaries +( + Foam::debug::infoSwitch("writeDictionaries", 0) +); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H index 581d9bec72..e7fecbce91 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.H @@ -25,10 +25,10 @@ Class Foam::IOdictionary Description - IOdictionary is derived from dictionary and IOobject to give the - dictionary automatic IO functionality via the objectRegistry. To facilitate - IO, IOdictioanry is provided with a constructor from IOobject and writeData - and write functions. + IOdictionary is derived from dictionary and IOobject to give the dictionary + automatic IO functionality via the objectRegistry. To facilitate IO, + IOdictioanry is provided with a constructor from IOobject and writeData and + write functions. SourceFiles IOdictionary.C @@ -56,12 +56,17 @@ class IOdictionary public regIOobject, public dictionary { + // Private data + + static bool writeDictionaries; + // Private Member Functions - //- read dictionary from file + //- Read dictionary from file void readFile(const bool); + public: TypeName("dictionary"); diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C index 288056f63b..b1e90be300 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionaryIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,21 +21,116 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - IOdictionary is derived from dictionary and IOobject to give the - dictionary automatic IO functionality via the objectRegistry. To facilitate - IO, IOdictioanry is provided with a constructor from IOobject and writeData - and write functions. - \*---------------------------------------------------------------------------*/ #include "IOdictionary.H" +#include "Pstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// Parallel aware reading, using non-virtual type information (typeName instead +// of type()) because of use in constructor. +void Foam::IOdictionary::readFile(const bool masterOnly) +{ + if (Pstream::master() || !masterOnly) + { + if (debug) + { + Pout<< "IOdictionary : Reading " << objectPath() + << " from file " << endl; + } + readStream(typeName) >> *this; + close(); + + if (writeDictionaries && Pstream::master()) + { + Sout<< nl + << "--- IOdictionary " << name() + << ' ' << objectPath() << ":" << nl; + writeHeader(Sout); + writeData(Sout); + Sout<< "--- End of IOdictionary " << name() << nl << endl; + } + } + + if (masterOnly && Pstream::parRun()) + { + // Scatter master data using communication scheme + + const List& comms = + ( + (Pstream::nProcs() < Pstream::nProcsSimpleSum) + ? Pstream::linearCommunication() + : Pstream::treeCommunication() + ); + + // Master reads headerclassname from file. Make sure this gets + // transfered as well as contents. + Pstream::scatter(comms, const_cast(headerClassName())); + Pstream::scatter(comms, note()); + + // Get my communication order + const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()]; + + // Reveive from up + if (myComm.above() != -1) + { + if (debug) + { + Pout<< "IOdictionary : Reading " << objectPath() + << " from processor " << myComm.above() << endl; + } + + // Note: use ASCII for now - binary IO of dictionaries is + // not currently supported + IPstream fromAbove + ( + Pstream::scheduled, + myComm.above(), + 0, + IOstream::ASCII + ); + IOdictionary::readData(fromAbove); + } + + // Send to my downstairs neighbours + forAll(myComm.below(), belowI) + { + if (debug) + { + Pout<< "IOdictionary : Sending " << objectPath() + << " to processor " << myComm.below()[belowI] << endl; + } + OPstream toBelow + ( + Pstream::scheduled, + myComm.below()[belowI], + 0, + Pstream::msgType(), + IOstream::ASCII + ); + IOdictionary::writeData(toBelow); + } + } +} + + +// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * // bool Foam::IOdictionary::readData(Istream& is) { is >> *this; + + if (writeDictionaries && Pstream::master() && !is.bad()) + { + Sout<< nl + << "--- IOdictionary " << name() + << ' ' << objectPath() << ":" << nl; + writeHeader(Sout); + writeData(Sout); + Sout<< "--- End of IOdictionary " << name() << nl << endl; + } + return !is.bad(); } @@ -46,4 +141,5 @@ bool Foam::IOdictionary::writeData(Ostream& os) const return os.good(); } + // ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/entry/entry.C b/src/OpenFOAM/db/dictionary/entry/entry.C index 3bba611dee..d933585265 100644 --- a/src/OpenFOAM/db/dictionary/entry/entry.C +++ b/src/OpenFOAM/db/dictionary/entry/entry.C @@ -39,12 +39,14 @@ int Foam::entry::disableFunctionEntries Foam::entry::entry(const keyType& keyword) : + IDLList::link(), keyword_(keyword) {} Foam::entry::entry(const entry& e) : + IDLList::link(), keyword_(e.keyword_) {} diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index ebbb6efb81..34dd4e80d1 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -197,22 +197,25 @@ Foam::functionEntries::codeStream::getFunction } } - // all processes must wait for compile to finish - except if this - // file is only read on the master - bool masterOnly = - ( - regIOobject::fileModificationChecking - == regIOobject::timeStampMaster - ) - || ( - regIOobject::fileModificationChecking - == regIOobject::inotifyMaster - ); - - if (!masterOnly) - { + //- We don't know whether this code was from IOdictionary + // (possibly read on master only) or from e.g. Field so cannot + // decide here. + //// all processes must wait for compile to finish - except if this + //// file is only read on the master + //bool masterOnly = + // ( + // regIOobject::fileModificationChecking + // == regIOobject::timeStampMaster + // ) + // || ( + // regIOobject::fileModificationChecking + // == regIOobject::inotifyMaster + // ); + // + //if (!masterOnly) + //{ reduce(create, orOp()); - } + //} if (isA(topDict(parentDict))) { diff --git a/src/OpenFOAM/db/error/StaticAssert.H b/src/OpenFOAM/db/error/StaticAssert.H index beab97f85d..5d209d3f93 100644 --- a/src/OpenFOAM/db/error/StaticAssert.H +++ b/src/OpenFOAM/db/error/StaticAssert.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::StaticAssertFailed + Foam::StaticAssertionFailed Description Macros and classes to provide static (compile-time) assertions. diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C index e2ed73d474..b578744888 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectRead.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectRead.C @@ -98,7 +98,7 @@ Foam::Istream& Foam::regIOobject::readStream() } } - // Mark as uptodate if read succesfully + // Mark as uptodate if read successfully if (watchIndex_ != -1) { time().setUnmodified(watchIndex_); @@ -173,7 +173,7 @@ bool Foam::regIOobject::read() // Note: cannot do anything in readStream itself since this is used by // e.g. GeometricField. - bool masterOnly = + bool masterOnly = regIOobject::fileModificationChecking == timeStampMaster || regIOobject::fileModificationChecking == inotifyMaster; diff --git a/src/OpenFOAM/db/typeInfo/className.H b/src/OpenFOAM/db/typeInfo/className.H index f14cc6100c..d4b87023d2 100644 --- a/src/OpenFOAM/db/typeInfo/className.H +++ b/src/OpenFOAM/db/typeInfo/className.H @@ -119,7 +119,6 @@ public: \ defineTypeNameWithName(Type, Name) //- Define the typeName as \a Name for template sub-classes # define defineTemplate2TypeNameWithName(Type, Name) \ - template<> \ template<> \ defineTypeNameWithName(Type, Name) #endif @@ -161,7 +160,6 @@ public: \ defineDebugSwitchWithName(Type, Name, DebugSwitch) //- Define the debug information for templates sub-classes, lookup as \a Name # define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ - template<> \ template<> \ defineDebugSwitchWithName(Type, Name, DebugSwitch) #endif diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H index 76b096cb1e..ff2a76025a 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::GeometricField + Foam::geometricOneField Description A class representing the concept of a GeometricField of 1 used to avoid diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H index ec7c6ff48a..c42891a7fa 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::GeometricField + Foam::geometricZeroField Description A class representing the concept of a GeometricField of 1 used to avoid diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index b0c696987a..2cd9c861fe 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.C @@ -75,10 +75,15 @@ Foam::dictionary& Foam::debug::controlDict() { if (!controlDictPtr_) { - controlDictPtr_ = new dictionary - ( - IFstream(findEtcFile("controlDict", true))() - ); + fileNameList controlDictFiles = findEtcFiles("controlDict", true); + controlDictPtr_ = new dictionary(); + forAllReverse(controlDictFiles, cdfi) + { + controlDictPtr_->merge + ( + dictionary(IFstream(controlDictFiles[cdfi])()) + ); + } } return *controlDictPtr_; diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index b774997339..5491223fcd 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -93,7 +93,7 @@ fileName cwd(); // else return false bool chDir(const fileName& dir); -//- Search for a file from user/group/shipped directories. +//- Search for files from user/group/shipped directories. // The search scheme allows for version-specific and // version-independent files using the following hierarchy: // - \b user settings: @@ -108,8 +108,21 @@ bool chDir(const fileName& dir); // - \b other (shipped) settings: // - $WM_PROJECT_DIR/etc/ // -// \return The full path name or fileName() if the name cannot be found -// Optionally abort if the file cannot be found +// \return The list of full paths of all the matching files or +// an empty list if the name cannot be found. +// Optionally abort if the file cannot be found. +// Optionally stop search after the first file has been found. +fileNameList findEtcFiles +( + const fileName&, + bool mandatory=false, + bool findFirst=false +); + +//- Search for a file using findEtcFiles. +// \return The full path name of the first file found in the +// search hierarchy or an empty fileName if the name cannot be found. +// Optionally abort if the file cannot be found. fileName findEtcFile(const fileName&, bool mandatory=false); //- Make a directory and return an error if it could not be created diff --git a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/tableReaders.H b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/tableReaders.H index 8e1c8a0561..0a9aae4cd5 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/tableReaders.H +++ b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/tableReaders.H @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::tableReader - SourceFiles tableReaders.C diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 9321959b2d..d49d26d9f2 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -1352,10 +1352,10 @@ void Foam::syncTools::syncBoundaryFaceList label sz = cycPatch.size(); // Transform (copy of) data on both sides - Field ownVals(SubField(faceValues, sz, ownStart)); + Field ownVals = SubField(faceValues, sz, ownStart); top(nbrPatch, ownVals); - Field nbrVals(SubField(faceValues, sz, nbrStart)); + Field nbrVals = SubField(faceValues, sz, nbrStart); top(cycPatch, nbrVals); label i0 = ownStart; diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H index 4f02043dab..1ee3d72ee9 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H +++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::cellZone + Foam::zone Description Base class for zones diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H index 741416c426..020cf25bbb 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransformI.H @@ -512,7 +512,7 @@ Foam::labelList Foam::globalIndexAndTransform::transformIndicesForPatches } } - label nUsedTrans = sum(mag(permutation)); + label nUsedTrans = round(sum(mag(permutation))); if (nUsedTrans == 0) { diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C new file mode 100644 index 0000000000..32dab1eece --- /dev/null +++ b/src/combustionModels/FSD/FSD.C @@ -0,0 +1,366 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "FSD.H" +#include "addToRunTimeSelectionTable.H" +#include "LESModel.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +FSD::FSD +( + const word& modelType, const fvMesh& mesh +) +: + singleStepCombustion(modelType, mesh), + reactionRateFlameArea_ + ( + reactionRateFlameArea::New + ( + this->coeffs(), + this->mesh(), + *this + ) + ), + ft_ + ( + IOobject + ( + "ft", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + this->mesh(), + dimensionedScalar("zero", dimless, 0.0) + ), + YFuelFuelStream_ + ( + dimensionedScalar("YFuelStream", dimless, 1.0) + ), + YO2OxiStream_ + ( + dimensionedScalar("YOxiStream", dimless, 0.23) + ), + Cv_(readScalar(this->coeffs().lookup("Cv"))), + C_(5.0), + ftMin_(0.0), + ftMax_(1.0), + ftDim_(300), + ftVarMin_(readScalar(this->coeffs().lookup("ftVarMin"))) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template +FSD::~FSD() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +void FSD::calculateSourceNorm() +{ + this->singleMixture_.fresCorrect(); + + const label fuelI = this->singleMixture_.fuelIndex(); + + const volScalarField& YFuel = this->thermo_->composition().Y()[fuelI]; + + const volScalarField& YO2 = this->thermo_->composition().Y("O2"); + + const dimensionedScalar s = this->singleMixture_.s(); + + ft_ = + (s*YFuel - (YO2 - YO2OxiStream_))/(s*YFuelFuelStream_ + YO2OxiStream_); + + + volVectorField nft(fvc::grad(ft_)); + + volScalarField mgft(mag(nft)); + + surfaceVectorField SfHat(this->mesh().Sf()/this->mesh().magSf()); + + volScalarField cAux(scalar(1) - ft_); + + dimensionedScalar dMgft = 1.0e-3* + (ft_*cAux*mgft)().weightedAverage(this->mesh().V()) + /((ft_*cAux)().weightedAverage(this->mesh().V()) + SMALL) + + dimensionedScalar("ddMgft", mgft.dimensions(), SMALL); + + mgft += dMgft; + + nft /= mgft; + + const volVectorField& U = YO2.db().lookupObject("U"); + + const volScalarField sigma + ( + (nft & nft)*fvc::div(U) - (nft & fvc::grad(U) & nft) + ); + + reactionRateFlameArea_->correct(sigma); + + const volScalarField& omegaFuel = reactionRateFlameArea_->omega(); + + + const scalar ftStoich = + YO2OxiStream_.value() + /( + s.value()*YFuelFuelStream_.value() + YO2OxiStream_.value() + ); + + tmp tPc + ( + new volScalarField + ( + IOobject + ( + "Pc", + U.time().timeName(), + U.db(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar("Pc", dimless, 0) + ) + ); + + volScalarField& pc = tPc(); + + tmp tomegaFuel + ( + new volScalarField + ( + IOobject + ( + "omegaFuelBar", + U.time().timeName(), + U.db(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar + ( + "omegaFuelBar", + omegaFuel.dimensions(), + 0 + ) + ) + ); + + volScalarField& omegaFuelBar = tomegaFuel(); + + // Calculation of the mixture fraction variance (ftVar) + const compressible::LESModel& lesModel = + YO2.db().lookupObject("LESProperties"); + + const volScalarField& delta = lesModel.delta(); + const volScalarField ftVar(Cv_*sqr(delta)*sqr(mgft)); + + // Thickened flame (average flame thickness for counterflow configuration + // is 1.5 mm) + + volScalarField deltaF + ( + lesModel.delta()/dimensionedScalar("flame",dimLength, 1.5e-3) + ); + + // Linear correlation between delta and flame thickness + volScalarField omegaF(max(deltaF*(4.0/3.0) + (2.0/3.0), 1.0)); + + scalar deltaFt = 1.0/ftDim_; + + forAll(ft_, cellI) + { + if(ft_[cellI] > ftMin_ && ft_[cellI] < ftMax_) + { + scalar ftCell = ft_[cellI]; + + if(ftVar[cellI] > ftVarMin_) //sub-grid beta pdf of ft_ + { + scalar ftVarc = ftVar[cellI]; + scalar a = + max(ftCell*(ftCell*(1.0 - ftCell)/ftVarc - 1.0), 0.0); + scalar b = max(a/ftCell - a, 0.0); + + for(int i=1; i productsIndex(2, -1); + { + label i = 0; + forAll (this->singleMixture_.specieProd(), specieI) + { + if (this->singleMixture_.specieProd()[specieI] < 0) + { + productsIndex[i] = specieI; + i++; + } + } + } + + + // Flamelet probability of the progress c based on IFC (reuse pc) + scalar YprodTotal = 0; + forAll (productsIndex, j) + { + YprodTotal += this->singleMixture_.Yprod0()[productsIndex[j]]; + } + + forAll(ft_, cellI) + { + if(ft_[cellI] < ftStoich) + { + pc[cellI] = ft_[cellI]*(YprodTotal/ftStoich); + } + else + { + pc[cellI] = (1.0 - ft_[cellI])*(YprodTotal/(1.0 - ftStoich)); + } + } + + tmp tproducts + ( + new volScalarField + ( + IOobject + ( + "products", + U.time().timeName(), + U.db(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar("products", dimless, 0) + ) + ); + + volScalarField& products = tproducts(); + + forAll (productsIndex, j) + { + label specieI = productsIndex[j]; + const volScalarField& Yp = this->thermo_->composition().Y()[specieI]; + products += Yp; + } + + volScalarField c(max(scalar(1.0) - products/max(pc, 1e-5), 0.0)); + + pc = min(C_*c, scalar(1.0)); + + const volScalarField fres(this->singleMixture_.fres(fuelI)); + + this->wFuel_ == mgft*pc*omegaFuelBar; +} + + +template +void FSD::correct() +{ + this->wFuel_ == + dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); + + if (this->active()) + { + calculateSourceNorm(); + } +} + + +template +bool FSD::read() +{ + if (singleStepCombustion::read()) + { + this->coeffs().lookup("Cv") >> Cv_ ; + this->coeffs().lookup("ftVarMin") >> ftVarMin_; + reactionRateFlameArea_->read(this->coeffs()); + return true; + } + else + { + return false; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/FSD/FSD.H b/src/combustionModels/FSD/FSD.H new file mode 100644 index 0000000000..f727790e62 --- /dev/null +++ b/src/combustionModels/FSD/FSD.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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::combustionModels::FSD + +Description + + Flame Surface Dennsity (FDS) combustion model. + + The fuel source term is given by mgft*pc*omegaFuelBar. + + where: + mgft: filtered flame area. + pc: probability of the combustion progress. + omegaFuelBar: filtered consumption speed per unit of flame area. + + pc is considered from the IFC solution. + omegaFuelBar is calculated solving a relaxation equation which tends to + omegaEq. This omegaEq is obtained from the flamelet solution for + different strain rates and fit using a expential distribution. + + The spacial distribution of the consumption speed (omega) is obtained also + from a strained flamelet solution and it is assumed to have a guassian + distribution. + + If the grid resolution is not enough to resolve the flame, the consumption + speed distribution is linearly thickened conserving the overall heat + release. + + If the turbulent fluctuation of the mixture fraction at the sub-grid level + is large (>1E-04) then a beta pdf is used for filtering. + + At the moment the flame area combustion model is only fit to work in a LES + frame work. In RAS the subgrid fluctiuation has to be solved by an extra + transport equation. + +SourceFiles + FSD.C + +\*---------------------------------------------------------------------------*/ + +#ifndef FSD_H +#define FSD_H + +#include "singleStepCombustion.H" +#include "reactionRateFlameArea.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class FSD Declaration +\*---------------------------------------------------------------------------*/ + +template +class FSD +: + public singleStepCombustion +{ + // Private data + + //- Auto pointer to consumption speed per unit of flame area model + autoPtr reactionRateFlameArea_; + + //- Mixture fraction + volScalarField ft_; + + //- Fuel mass concentration on the fuel stream + dimensionedScalar YFuelFuelStream_; + + //- Oxygen mass concentration on the oxydizer stream + dimensionedScalar YO2OxiStream_; + + //- Similarity constant for the sub-grid ft fluctuations + scalar Cv_; + + //- Model constant + scalar C_; + + //- Lower flammability limit + scalar ftMin_; + + //- Upper flammability limit + scalar ftMax_; + + //- Dimension of the ft space. Used to integrate the beta-pdf + scalar ftDim_; + + //- Minimum mixture freaction variance to calculate pdf + scalar ftVarMin_; + + + // Private Member Functions + + //- Calculate the normalised fuel source term + void calculateSourceNorm(); + + //- Disallow copy construct + FSD(const FSD&); + + //- Disallow default bitwise assignment + void operator=(const FSD&); + + +public: + + //- Runtime type information + TypeName("FSD"); + + + // Constructors + + //- Construct from components + FSD(const word& modelType, const fvMesh& mesh); + + + // Destructor + virtual ~FSD(); + + + // Evolution + + //- Correct combustion rate + virtual void correct(); + + + // I-O + + //- Update properties + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "FSD.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/FSDs.C b/src/combustionModels/FSD/FSDs.C new file mode 100644 index 0000000000..1d85272169 --- /dev/null +++ b/src/combustionModels/FSD/FSDs.C @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "makeCombustionTypes.H" + +#include "thermoPhysicsTypes.H" +#include "psiCombustionModel.H" +#include "FSD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + makeCombustionTypesThermo + ( + FSD, + psiCombustionModel, + gasThermoPhysics + ); + +} +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C new file mode 100644 index 0000000000..db8b464457 --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "consumptionSpeed.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(consumptionSpeed, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::consumptionSpeed::consumptionSpeed +( + const dictionary& dict +) +: omega0_(readScalar(dict.lookup("omega0"))), + eta_(readScalar(dict.lookup("eta"))), + sigmaExt_(readScalar(dict.lookup("sigmaExt"))), + omegaMin_(readScalar(dict.lookup("omegaMin"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::consumptionSpeed::~consumptionSpeed() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::consumptionSpeed::omega0Sigma +( + scalar sigma, + scalar a +) const +{ + scalar omega0 = 0.0; + if (sigma < sigmaExt_) + { + omega0 = + max + ( + a*omega0_*(1.0 - exp(eta_*max(sigma, 0.0))), + omegaMin_ + ) ; + } + return omega0; +} + + +Foam::tmp Foam::consumptionSpeed::omega0Sigma +( + const volScalarField& sigma +) +{ + tmp tomega0 + ( + new volScalarField + ( + IOobject + ( + "omega0", + sigma.time().timeName(), + sigma.db(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + sigma.mesh(), + dimensionedScalar + ( + "omega0", + dimensionSet(1, -2, -1, 0, 0, 0, 0), + 0 + ) + ) + ); + + volScalarField& omega0 = tomega0(); + + forAll(omega0, celli) + { + omega0[celli] = omega0Sigma(sigma[celli], 1.0); + } + + forAll(omega0.boundaryField(), patchi) + { + forAll(omega0.boundaryField()[patchi], facei) + { + omega0.boundaryField()[patchi][facei] = + omega0Sigma + ( + sigma.boundaryField()[patchi][facei], + 1.0 + ); + } + } + + return tomega0; +} + + +void Foam::consumptionSpeed::read(const dictionary& dict) +{ + dict.lookup("omega0") >> omega0_ ; + dict.lookup("eta") >> eta_ ; + dict.lookup("sigmaExt") >> sigmaExt_; + dict.lookup("omegaMin") >> omegaMin_; +} + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H new file mode 100644 index 0000000000..80c0dc9a48 --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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::reactionRateFlameAreaModels::consumptionSpeed + +Description + Correlation function for laminar consumption speed obtained from flamelet + solution at increasing strain rates. + +SourceFiles + consumptionSpeed.C + +\*---------------------------------------------------------------------------*/ + +#ifndef consumptionSpeed_H +#define consumptionSpeed_H + +#include "IOdictionary.H" +#include "volFields.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class consumptionSpeed Declaration +\*---------------------------------------------------------------------------*/ + +class consumptionSpeed +{ + // Private Data + + + //- Maximum consumption speed + scalar omega0_; + + //- Exponential factor + scalar eta_; + + //- Extinction strain + scalar sigmaExt_; + + //- Minimum consumption speed + scalar omegaMin_; + + + // Private member functions + + //- Return consumption rate + scalar omega0Sigma(scalar sigma, scalar a) const; + + //- Disallow copy construct + consumptionSpeed(const consumptionSpeed&); + + //- Disallow default bitwise assignment + void operator=(const consumptionSpeed&); + + +public: + + //- Runtime type information + TypeName("consumptionSpeed"); + + + // Constructors + + //- Construct from dictionary + consumptionSpeed(const dictionary& dict); + + + //- Destructor + virtual ~consumptionSpeed(); + + + // Member functions + + //- Return speed consumption rate temp + tmp omega0Sigma(const volScalarField& sigma); + + + // Access functions + + scalar omega0() const + { + return omega0_; + } + + scalar eta() const + { + return eta_; + } + + scalar sigmaExt() const + { + return sigmaExt_; + } + + scalar omegaMin() const + { + return omegaMin_; + } + + + // I-O + + //- Update properties + void read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C new file mode 100644 index 0000000000..f7adc032ab --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "reactionRateFlameArea.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(reactionRateFlameArea, 0); + defineRunTimeSelectionTable(reactionRateFlameArea, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::reactionRateFlameArea::reactionRateFlameArea +( + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel +) +: + coeffDict_(dictionary::null), + mesh_(mesh), + combModel_(combModel), + fuel_(dict.lookup("fuel")), + omega_ + ( + IOobject + ( + "omega", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) +{ +} + + +Foam::reactionRateFlameArea::reactionRateFlameArea +( + const word& modelType, + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel +) +: + coeffDict_(dict.subDict(modelType + "Coeffs")), + mesh_(mesh), + combModel_(combModel), + fuel_(dict.lookup("fuel")), + omega_ + ( + IOobject + ( + "omega", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) +{ +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::reactionRateFlameArea::~reactionRateFlameArea() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::reactionRateFlameArea::read(const dictionary& dict) +{ + dict.lookup("fuel") >> fuel_; + return true; + +} + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H new file mode 100644 index 0000000000..6353f7241d --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::reactionRateFlameArea + +Description + Abstract class for reaction rate per flame area unit + +SourceFiles + reactionRateFlameArea.C + reactionRateFlameAreaNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef reactionRateFlameArea_H +#define reactionRateFlameArea_H + +#include "runTimeSelectionTables.H" +#include "dictionary.H" +#include "autoPtr.H" +#include "volFields.H" +#include "combustionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class reactionRateFlameArea Declaration +\*---------------------------------------------------------------------------*/ + +class reactionRateFlameArea +{ + +protected: + + // Protected data + + //- Dictionary + dictionary coeffDict_; + + //- Mesh reference + const fvMesh& mesh_; + + //- Combstion model owner + const combustionModel& combModel_; + + //- Fuel name + word fuel_; + + //- Fuel consumption rate per unit of flame area + volScalarField omega_; + + +private: + + // Private member functions + + //- Disallow copy construct + reactionRateFlameArea(const reactionRateFlameArea&); + + //- Disallow default bitwise assignment + void operator=(const reactionRateFlameArea&); + + +public: + + //- Runtime type information + TypeName("reactionRateFlameArea"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + reactionRateFlameArea, + dictionary, + ( + const word modelType, + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel + ), + (modelType, dict, mesh, combModel) + ); + + + // Constructors + + //- Construct from dictionary and hsCombustionThermo + reactionRateFlameArea + ( + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel + ); + + //- Construct from components + reactionRateFlameArea + ( + const word& modelType, + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel + ); + + + // Selector + + static autoPtr New + ( + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel + ); + + + // Destructor + + virtual ~reactionRateFlameArea(); + + + // Member functions + + //- Access functions + + //- Return omega + const volScalarField& omega() const + { + return omega_; + } + + + //- Correct omega + virtual void correct(const volScalarField& sigma) = 0; + + //- Update from dictionary + virtual bool read(const dictionary& dictProperties); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C new file mode 100644 index 0000000000..bd8e28062b --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "reactionRateFlameArea.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::reactionRateFlameArea::New +( + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel +) +{ + word reactionRateFlameAreaType + ( + dict.lookup("reactionRateFlameArea") + ); + + Info<< "Selecting reaction rate flame area correlation " + << reactionRateFlameAreaType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(reactionRateFlameAreaType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalIOErrorIn + ( + "reactionRateFlameArea::New(const hsCombustionThermo&)", + dict + ) << "Unknown reactionRateFlameArea type " + << reactionRateFlameAreaType << endl << endl + << "Valid reaction rate flame area types are :" << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalIOError); + } + + const label tempOpen = reactionRateFlameAreaType.find('<'); + + const word className = reactionRateFlameAreaType(0, tempOpen); + + return autoPtr + (cstrIter()(className, dict, mesh, combModel)); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C new file mode 100644 index 0000000000..5a29b0fe13 --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "relaxation.H" +#include "addToRunTimeSelectionTable.H" +#include "fvm.H" +#include "LESModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace reactionRateFlameAreaModels +{ + defineTypeNameAndDebug(relaxation, 0); + addToRunTimeSelectionTable + ( + reactionRateFlameArea, + relaxation, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::reactionRateFlameAreaModels::relaxation::relaxation +( + const word modelType, + const dictionary& dict, + const fvMesh& mesh, + const combustionModel& combModel +) +: + reactionRateFlameArea(modelType, dict, mesh, combModel), + correlation_(dict.subDict(typeName + "Coeffs").subDict(fuel_)), + C_(readScalar(dict.subDict(typeName + "Coeffs").lookup("C"))), + alpha_(readScalar(dict.subDict(typeName + "Coeffs").lookup("alpha"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::reactionRateFlameAreaModels::relaxation::~relaxation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::reactionRateFlameAreaModels::relaxation::correct +( + const volScalarField& sigma +) +{ + + dimensionedScalar omega0 + ( + "omega0", + dimensionSet(1, -2, -1, 0, 0, 0, 0), + correlation_.omega0() + ); + + dimensionedScalar sigmaExt + ( + "sigmaExt", + dimensionSet(0, 0, -1, 0, 0, 0, 0), + correlation_.sigmaExt() + ); + + dimensionedScalar omegaMin + ( + "omegaMin", + omega0.dimensions(), + 1e-4 + ); + + const compressible::LESModel& lesModel = + omega_.db().lookupObject("LESProperties"); + + // Total strain : resolved and sub-grid (just LES for now) + const volScalarField sigmaTotal + ( + sigma + alpha_*lesModel.epsilon()/(lesModel.k() + lesModel.kMin()) + ); + + const volScalarField omegaInf(correlation_.omega0Sigma(sigmaTotal)); + + dimensionedScalar sigma0("sigma0", sigma.dimensions(), 0.0); + + const volScalarField tau(C_*mag(sigmaTotal)); + + volScalarField Rc + ( + (tau*omegaInf*(omega0 - omegaInf) + sqr(omegaMin)*sigmaExt) + /(sqr(omega0 - omegaInf) + sqr(omegaMin)) + ); + + const volScalarField rho(combModel_.rho()); + const surfaceScalarField phi(combModel_.phi()); + + solve + ( + fvm::ddt(rho, omega_) + + fvm::div(phi, omega_, "div(phi,omega)") + == + rho*Rc*omega0 + - fvm::SuSp(rho*(tau + Rc), omega_) + ); + + omega_.min(omega0); + omega_.max(0.0); +} + + +bool Foam::reactionRateFlameAreaModels::relaxation::read +( + const dictionary& dict +) +{ + if (reactionRateFlameArea::read(dict)) + { + coeffDict_ = dict.subDict(typeName + "Coeffs"); + coeffDict_.lookup("C") >> C_; + coeffDict_.lookup("alpha") >> alpha_; + correlation_.read + ( + coeffDict_.subDict(fuel_) + ); + return true; + } + else + { + return false; + } +} + +// ************************************************************************* // diff --git a/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H new file mode 100644 index 0000000000..3e0aea5b8b --- /dev/null +++ b/src/combustionModels/FSD/reactionRateFlameAreaModels/relaxation/relaxation.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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::reactionRateFlameAreaModels::relaxation + +Description + Consumption rate per unit of flame area obtained from a relaxation equation + +SourceFiles + relaxation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef relaxation_H +#define relaxation_H + +#include "reactionRateFlameArea.H" +#include "consumptionSpeed.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace reactionRateFlameAreaModels +{ + +/*---------------------------------------------------------------------------*\ + Class relaxation Declaration +\*---------------------------------------------------------------------------*/ + +class relaxation +: + public reactionRateFlameArea +{ + // Private Data + + //- Correlation + consumptionSpeed correlation_; + + //- Proportionality constant for time scale in the relaxation Eq. + scalar C_; + + //- Proportionality constant for sub-grid strain + scalar alpha_; + + + // Private Member Functions + + //- Disallow copy construct + relaxation(const relaxation&); + + //- Disallow default bitwise assignment + void operator=(const relaxation&); + + +public: + + //- Runtime type information + TypeName("relaxation"); + + + // Constructors + + //- Construct from dictionary and hsCombustionThermo + relaxation + ( + const word modelType, + const dictionary& dictCoeffs, + const fvMesh& mesh, + const combustionModel& combModel + ); + + + // Destructor + + virtual ~relaxation(); + + + // Member functions + + //- Correct omega + virtual void correct(const volScalarField& sigma); + + + // I-O + + //- Update properties from given dictionary + virtual bool read(const dictionary& dictProperties); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End reactionRateFlameAreaModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/Make/files b/src/combustionModels/Make/files index 86696b0709..3bb286c7d6 100644 --- a/src/combustionModels/Make/files +++ b/src/combustionModels/Make/files @@ -1,9 +1,27 @@ combustionModel/combustionModel.C -combustionModel/combustionModelNew.C -infinitelyFastChemistry/infinitelyFastChemistry.C +psiCombustionModel/psiCombustionModel.C +psiCombustionModel/psiCombustionModelNew.C -noCombustion/noCombustion.C +rhoCombustionModel/rhoCombustionModel.C +rhoCombustionModel/rhoCombustionModelNew.C + +infinitelyFastChemistry/infinitelyFastChemistrys.C + +psiChemistryCombustionModel/psiChemistryCombustionModel.C +psiChemistryCombustionModel/psiChemistryCombustionModelNew.C + +rhoChemistryCombustionModel/rhoChemistryCombustionModel.C +rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C + +PaSR/PaSRs.C + +FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C +FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C +FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C +FSD/reactionRateFlameAreaModels/relaxation/relaxation.C + +FSD/FSDs.C LIB = $(FOAM_LIBBIN)/libcombustionModels diff --git a/src/combustionModels/Make/options b/src/combustionModels/Make/options index 314c820f24..77f96e3a4a 100644 --- a/src/combustionModels/Make/options +++ b/src/combustionModels/Make/options @@ -2,8 +2,14 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/turbulenceModels/ \ + -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/LES/LESfilters/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lchemistryModel diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C new file mode 100644 index 0000000000..a33b778bab --- /dev/null +++ b/src/combustionModels/PaSR/PaSR.C @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "PaSR.H" +#include "fvmSup.H" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::combustionModels::PaSR::PaSR +( + const word& modelType, + const fvMesh& mesh +) +: + CombThermoType(modelType, mesh), + Cmix_(this->coeffs().lookup("Cmix")), + turbulentReaction_(this->coeffs().lookup("turbulentReaction")), + kappa_ + ( + IOobject + ( + "kappa", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimensionedScalar("kappa", dimless, 0.0) + ), + useReactionRate_(this->coeffs().lookupOrDefault("useReactionRate", false)) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template +Foam::combustionModels::PaSR::~PaSR() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +template +Foam::tmp +Foam::combustionModels::PaSR::tc() const +{ + return this->pChemistry_->tc(); +} + + +template +void Foam::combustionModels::PaSR::correct() +{ + if (this->active()) + { + if (!useReactionRate_) + { + this->pChemistry_->solve + ( + this->mesh().time().value()-this->mesh().time().deltaTValue(), + this->mesh().time().deltaTValue() + ); + } + else + { + this->pChemistry_->calculate(); + } + + if (turbulentReaction_) + { + tmp tepsilon(this->turbulence().epsilon()); + const volScalarField& epsilon = tepsilon(); + tmp tmuEff(this->turbulence().muEff()); + const volScalarField& muEff = tmuEff(); + tmp ttc(tc()); + const volScalarField& tc = ttc(); + forAll(epsilon, i) + { + if (epsilon[i] > 0) + { + const dimensionedScalar e0 + ( + "e0", + sqr(dimLength)/pow3(dimTime), SMALL + ); + + scalar tk = + Cmix_.value() + *Foam::sqrt + ( + muEff[i]/this->rho()()[i]/(epsilon[i] + e0.value()) + ); + + // Chalmers PaSR model + if (!useReactionRate_) + { + kappa_[i] = + ( this->mesh().time().deltaTValue() + tc[i]) + /( this->mesh().time().deltaTValue() + tc[i] + tk); + } + else + { + kappa_[i] = tc[i]/(tc[i] + tk); + } + } + else + { + // Return to laminar combustion + kappa_[i] = 1.0; + } + } + } + else + { + kappa_ = 1.0; + } + } +} + + +template +Foam::tmp +Foam::combustionModels::PaSR::R(const volScalarField& Y) const +{ + + tmp tSu + ( + new fvScalarMatrix(Y, dimMass/dimTime) + ); + + fvScalarMatrix& Su = tSu(); + + if (this->active()) + { + const label specieI = this->thermo().composition().species()[Y.name()]; + + Su += kappa_*this->pChemistry_->RR(specieI); + } + + return tSu; +} + + +template +Foam::tmp +Foam::combustionModels::PaSR::dQ() const +{ + tmp tdQ + ( + new volScalarField + ( + IOobject + ( + "dQ", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh(), + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + if (this->active()) + { + volScalarField& dQ = tdQ(); + dQ = kappa_*this->pChemistry_->dQ(); + } + + return tdQ; +} + + +template +Foam::tmp +Foam::combustionModels::PaSR::Sh() const +{ + tmp tSh + ( + new volScalarField + ( + IOobject + ( + "Sh", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh(), + dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + if (this->active()) + { + scalarField& Sh = tSh(); + Sh = kappa_*this->pChemistry_->Sh(); + } + + return tSh; +} + + +template +bool Foam::combustionModels::PaSR::read() +{ + if (CombThermoType::read()) + { + this->coeffs().lookup("Cmix") >> Cmix_; + this->coeffs().lookup("turbulentReaction") >> turbulentReaction_; + this->coeffs().lookup("useReactionRate") >> useReactionRate_; + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/combustionModels/PaSR/PaSR.H b/src/combustionModels/PaSR/PaSR.H new file mode 100644 index 0000000000..4250c63a6a --- /dev/null +++ b/src/combustionModels/PaSR/PaSR.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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::combustionModels::PaSR + +Description + Simple infinitely fast chemistry combustion model based on the principle + mixed is burnt. Additional parameter C is used to distribute the heat + release rate.in time + +SourceFiles + PaSR.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PaSR_H +#define PaSR_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class PaSR Declaration +\*---------------------------------------------------------------------------*/ + +template +class PaSR +: + public CombThermoType +{ + // Private data + + //- Mixing constant + dimensionedScalar Cmix_; + + //- Turbulent reaction switch + Switch turbulentReaction_; + + //- Mixing parameter + volScalarField kappa_; + + //- Use reaction rate + bool useReactionRate_; + + + // Private Member Functions + + //- Return the chemical time scale + tmp tc() const; + + //- Disallow copy construct + PaSR(const PaSR&); + + //- Disallow default bitwise assignment + void operator=(const PaSR&); + + +public: + + //- Runtime type information + TypeName("PaSR"); + + + // Constructors + + //- Construct from components + PaSR + ( + const word& modelType, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~PaSR(); + + + // Member Functions + + // Evolution + + //- Correct combustion rate + virtual void correct(); + + //- Fuel consumption rate matrix. + virtual tmp R(const volScalarField& Y) const; + + //- Heat release rate calculated from fuel consumption rate matrix + virtual tmp dQ() const; + + //- Return source for enthalpy equation [kg/m/s3] + virtual tmp Sh() const; + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PaSR.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/PaSR/PaSRs.C b/src/combustionModels/PaSR/PaSRs.C new file mode 100644 index 0000000000..650ef98676 --- /dev/null +++ b/src/combustionModels/PaSR/PaSRs.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "makeCombustionTypes.H" + +#include "psiChemistryCombustionModel.H" +#include "rhoChemistryCombustionModel.H" +#include "PaSR.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + makeCombustionTypes + ( + PaSR, + psiChemistryCombustionModel + ); + + makeCombustionTypes + ( + PaSR, + rhoChemistryCombustionModel + ); +} +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/combustionModel/combustionModel.C b/src/combustionModels/combustionModel/combustionModel.C index bfccadf733..b87503a924 100644 --- a/src/combustionModels/combustionModel/combustionModel.C +++ b/src/combustionModels/combustionModel/combustionModel.C @@ -1,153 +1,111 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - - 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 "combustionModel.H" -#include "surfaceFields.H" -#include "fvScalarMatrix.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(combustionModel, 0); - defineRunTimeSelectionTable(combustionModel, dictionary); -}; - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::combustionModel::combustionModel -( - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho -) -: - coeffs_(dictionary::null), - thermo_(thermo), - turbulence_(turbulence), - mesh_(phi.mesh()), - phi_(phi), - rho_(rho) -{} - - -Foam::combustionModel::combustionModel -( - const word& modelType, - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho -) -: - coeffs_(combustionProps.subDict(modelType + "Coeffs")), - thermo_(thermo), - turbulence_(turbulence), - mesh_(phi.mesh()), - phi_(phi), - rho_(rho) -{} - - -// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // - -Foam::combustionModel::~combustionModel() -{} - - -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -void Foam::combustionModel::correct() -{ - // do nothing -} - - -Foam::tmp Foam::combustionModel::R -( - volScalarField& Y -) const -{ - return tmp - ( - new fvScalarMatrix(Y, dimMass/dimTime*Y.dimensions()) - ); -} - - -Foam::tmp Foam::combustionModel::dQ() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "dQ", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0) - ) - ); -} - - -Foam::tmp Foam::combustionModel::wFuelNorm() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "wFuelNorm", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar("zero", dimMass/dimTime/pow3(dimLength), 0.0) - ) - ); -} - - -bool Foam::combustionModel::read(const dictionary& combustionProps) -{ - coeffs_ = combustionProps.subDict(type() + "Coeffs"); - - return true; -} - - -// ************************************************************************* // +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "combustionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(combustionModel, 0); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::combustionModel::combustionModel +( + const word& modelType, + const fvMesh& mesh +) +: + IOdictionary + ( + IOobject + ( + "combustionProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ), + turbulencePtr_(), + mesh_(mesh), + active_(lookupOrDefault("active", true)), + coeffs_(subDict(modelType + "Coeffs")), + modelType_(modelType) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::combustionModel::~combustionModel() +{ + if (turbulencePtr_) + { + turbulencePtr_ = 0; + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +bool Foam::combustionModel::read() +{ + if (regIOobject::read()) + { + this->lookup("active") >> active_; + coeffs_ = subDict(modelType_ + "Coeffs"); + return true; + } + else + { + return false; + } +} + + +Foam::tmp Foam::combustionModel::Sh() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "Sh", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/combustionModel/combustionModel.H b/src/combustionModels/combustionModel/combustionModel.H index 28ccb85b1b..7b997fce70 100644 --- a/src/combustionModels/combustionModel/combustionModel.H +++ b/src/combustionModels/combustionModel/combustionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,8 +24,7 @@ Class Foam::combustionModel Description - Base class for all non-premixed combustion models based on single step - chemistry + Base class for combustion models SourceFiles combustionModel.C @@ -36,9 +35,7 @@ SourceFiles #define combustionModel_H #include "IOdictionary.H" -#include "hsCombustionThermo.H" #include "turbulenceModel.H" -#include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,29 +47,28 @@ namespace Foam \*---------------------------------------------------------------------------*/ class combustionModel +: + public IOdictionary { protected: // Protected data - //- Dictionary of coefficients for the particular model - dictionary coeffs_; - - //- Reference to the thermodynamics - hsCombustionThermo& thermo_; - //- Reference to the turbulence model - const compressible::turbulenceModel& turbulence_; + compressible::turbulenceModel* turbulencePtr_; //- Reference to the mesh database const fvMesh& mesh_; - //- Reference to mass-flux field - const surfaceScalarField& phi_; + //- Active + Switch active_; - //- Reference to the density field - const volScalarField& rho_; + //- Dictionary of the model + dictionary coeffs_; + + //- Model name + const word modelType_; private: @@ -92,65 +88,11 @@ public: TypeName("combustionModel"); - // Declare run-time constructor selection table - - declareRunTimeSelectionTable - ( - autoPtr, - combustionModel, - dictionary, - ( - const dictionary& combustionProperties, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho - ), - ( - combustionProperties, - thermo, - turbulence, - phi, - rho - ) - ); - - - // Selectors - - //- Return a reference to the selected combustion model - static autoPtr New - ( - const dictionary& combustionProperties, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho - ); - - // Constructors - //- Construct null from components - combustionModel - ( - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho - ); //- Construct from components - combustionModel - ( - const word& modelType, - const dictionary& combustionProperties, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho - ); + combustionModel(const word& modelType, const fvMesh& mesh); //- Destructor @@ -159,34 +101,53 @@ public: // Member Functions - // Access functions + // Access - //- Access combustion dictionary - const dictionary coeffs() const - { - return coeffs_; - } + + //- Return const access to the mesh database + inline const fvMesh& mesh() const; + + //- Return const access to phi + inline const surfaceScalarField& phi() const; + + //- Return const access to rho + virtual tmp rho() const = 0; + + //- Return access to turbulence + inline const compressible::turbulenceModel& turbulence() const; + + //- Set turbulence + inline void setTurbulence + ( + compressible::turbulenceModel& turbModel + ); + + //- Is combustion active? + inline const Switch& active() const; + + //- Return const dictionary of the model + inline const dictionary& coeffs() const; // Evolution //- Correct combustion rate - virtual void correct(); + virtual void correct() = 0; //- Fuel consumption rate matrix, i.e. source term for fuel equation - virtual tmp R(volScalarField& Y) const; + virtual tmp R(const volScalarField& Y) const = 0; //- Heat release rate calculated from fuel consumption rate matrix - virtual tmp dQ() const; + virtual tmp dQ() const = 0; - //- Return normalised consumption rate of (fu - fres) - virtual tmp wFuelNorm() const; + //- Return source for enthalpy equation [kg/m/s3] + virtual tmp Sh() const; // I-O //- Update properties from given dictionary - virtual bool read(const dictionary& combustionProps); + virtual bool read(); }; @@ -196,6 +157,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "combustionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/combustionModels/combustionModel/combustionModelI.H b/src/combustionModels/combustionModel/combustionModelI.H new file mode 100644 index 0000000000..208ed6d2ee --- /dev/null +++ b/src/combustionModels/combustionModel/combustionModelI.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline const Foam::fvMesh& Foam::combustionModel::mesh() const +{ + return mesh_; +} + + +inline const Foam::surfaceScalarField& Foam::combustionModel::phi() const +{ + if (turbulencePtr_) + { + return turbulencePtr_->phi(); + } + else + { + FatalErrorIn + ( + "const Foam::compressible::turbulenceModel& " + "Foam::combustionModel::turbulence() const " + ) << "turbulencePtr_ is empty. Please use " + << "combustionModel::setTurbulence " + << "(compressible::turbulenceModel& )" + << abort(FatalError); + + return turbulencePtr_->phi(); + } +} + + +inline const Foam::compressible::turbulenceModel& +Foam::combustionModel::turbulence() const +{ + if (turbulencePtr_) + { + return *turbulencePtr_; + } + else + { + FatalErrorIn + ( + "const Foam::compressible::turbulenceModel& " + "Foam::combustionModel::turbulence() const " + ) << "turbulencePtr_ is empty. Please use " + << "combustionModel::setTurbulence " + << "(compressible::turbulenceModel& )" + << abort(FatalError); + + return *turbulencePtr_; + } +} + + +inline const Foam::Switch& Foam::combustionModel::active() const +{ + return active_; +} + + +inline void Foam::combustionModel::setTurbulence +( + compressible::turbulenceModel& turbModel +) +{ + turbulencePtr_ = &turbModel; +} + + +inline const Foam::dictionary& Foam::combustionModel::coeffs() const +{ + return coeffs_; +} + +// ************************************************************************* // diff --git a/src/combustionModels/combustionModel/makeCombustionTypes.H b/src/combustionModels/combustionModel/makeCombustionTypes.H new file mode 100644 index 0000000000..f3d2ee8e24 --- /dev/null +++ b/src/combustionModels/combustionModel/makeCombustionTypes.H @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeCombustionTypes_H +#define makeCombustionTypes_H + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeCombustionTypesThermo(CombModel, Comb, Thermo) \ + \ + typedef CombModel CombModel##Comb##Thermo; \ + \ + \ + defineTemplateTypeNameAndDebugWithName \ + ( \ + CombModel##Comb##Thermo, \ + #CombModel"<"#Comb","#Thermo">", \ + 0 \ + ); \ + \ + \ + addToRunTimeSelectionTable \ + ( \ + Comb, \ + CombModel##Comb##Thermo, \ + dictionary \ + ); + +#define makeCombustionTypes(CombModel, CombThermoType) \ + \ + typedef CombModel \ + CombModel##CombThermoType; \ + \ + defineTemplateTypeNameAndDebugWithName \ + ( \ + CombModel##CombThermoType, \ + #CombModel"<"#CombThermoType">", \ + 0 \ + ); \ + \ + addToRunTimeSelectionTable \ + ( \ + CombThermoType, \ + CombModel##CombThermoType, \ + dictionary \ + ); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C index 2748e31efa..16c32e9e56 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,131 +23,80 @@ License \*---------------------------------------------------------------------------*/ #include "infinitelyFastChemistry.H" -#include "addToRunTimeSelectionTable.H" -#include "fvmSup.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace combustionModels { - defineTypeNameAndDebug(infinitelyFastChemistry, 0); - addToRunTimeSelectionTable - ( - combustionModel, - infinitelyFastChemistry, - dictionary - ); -}; -}; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry +template +infinitelyFastChemistry::infinitelyFastChemistry ( - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho + const word& modelType, const fvMesh& mesh ) : - combustionModel(typeName, combustionProps, thermo, turbulence, phi, rho), - C_(readScalar(coeffs_.lookup("C"))), - singleMixture_ - ( - dynamic_cast&>(thermo) - ), - wFuelNorm_ - ( - IOobject - ( - "wFuelNorm", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0) - ) + singleStepCombustion(modelType, mesh), + C_(readScalar(this->coeffs().lookup("C"))) {} // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // -Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry() +template +infinitelyFastChemistry::~infinitelyFastChemistry() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::combustionModels::infinitelyFastChemistry::correct() +template +void infinitelyFastChemistry::correct() { - singleMixture_.fresCorrect(); + this->wFuel_ == + dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); - const label fuelI = singleMixture_.fuelIndex(); - - const volScalarField& YFuel = thermo_.composition().Y()[fuelI]; - - const dimensionedScalar s = singleMixture_.s(); - - if (thermo_.composition().contains("O2")) + if (this->active()) { - const volScalarField& YO2 = thermo_.composition().Y("O2"); - wFuelNorm_ == rho_/(mesh_.time().deltaT()*C_)*min(YFuel, YO2/s.value()); + this->singleMixture_.fresCorrect(); + + const label fuelI = this->singleMixture_.fuelIndex(); + + const volScalarField& YFuel = this->thermo_->composition().Y()[fuelI]; + + const dimensionedScalar s = this->singleMixture_.s(); + + if (this->thermo_->composition().contains("O2")) + { + const volScalarField& YO2 = this->thermo_->composition().Y("O2"); + + this->wFuel_ == + this->rho()/(this->mesh().time().deltaT()*C_) + *min(YFuel, YO2/s.value()); + } } } -Foam::tmp -Foam::combustionModels::infinitelyFastChemistry::R(volScalarField& Y) const +template +bool infinitelyFastChemistry::read() { - const label specieI = thermo_.composition().species()[Y.name()]; - - const label fNorm = singleMixture_.specieProd()[specieI]; - - const volScalarField fres(singleMixture_.fres(specieI)); - - const volScalarField wSpecie - ( - wFuelNorm_*singleMixture_.specieStoichCoeffs()[specieI] - / max(fNorm*(Y - fres), scalar(0.001)) - ); - - return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y); + if (singleStepCombustion::read()) + { + this->coeffs().lookup("C") >> C_ ; + return true; + } + else + { + return false; + } } -Foam::tmp -Foam::combustionModels::infinitelyFastChemistry::dQ() const -{ - const label fuelI = singleMixture_.fuelIndex(); - volScalarField& YFuel = thermo_.composition().Y(fuelI); +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - return -singleMixture_.qFuel()*(R(YFuel) & YFuel); -} +} // End namespace combustionModels +} // End namespace Foam - -Foam::tmp -Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const -{ - return wFuelNorm_; -} - - -bool Foam::combustionModels::infinitelyFastChemistry::read -( - const dictionary& combustionProps -) -{ - combustionModel::read(combustionProps); - coeffs_.lookup("C") >> C_ ; - - return true; -} - - -// ************************************************************************* // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H index 304dba46a3..3293089a62 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,10 +35,7 @@ SourceFiles #ifndef infinitelyFastChemistry_H #define infinitelyFastChemistry_H - -#include "combustionModel.H" -#include "singleStepReactingMixture.H" -#include "thermoPhysicsTypes.H" +#include "singleStepCombustion.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,21 +48,16 @@ namespace combustionModels Class infinitelyFastChemistry Declaration \*---------------------------------------------------------------------------*/ +template class infinitelyFastChemistry : - public combustionModel + public singleStepCombustion { // Private data //- Model constant scalar C_; - //- Reference to singleStepReactingMixture mixture - singleStepReactingMixture& singleMixture_; - - //- Normalised consumption rate of (fu - fres) - volScalarField wFuelNorm_; - // Private Member Functions @@ -87,11 +79,7 @@ public: //- Construct from components infinitelyFastChemistry ( - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho + const word& modelType, const fvMesh& mesh ); @@ -106,20 +94,11 @@ public: //- Correct combustion rate virtual void correct(); - //- Fuel consumption rate matrix, i.e. source term for fuel equation - virtual tmp R(volScalarField& Y) const; - - //- Heat release rate calculated from fuel consumption rate matrix - virtual tmp dQ() const; - - //- Return normalised consumption rate of (fu - fres) - virtual tmp wFuelNorm() const; - // I-O - //- Update properties from given dictionary - virtual bool read(const dictionary& combustionProperties); + //- Update properties + virtual bool read(); }; @@ -128,6 +107,13 @@ public: } // End namespace combustionModels } // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "infinitelyFastChemistry.C" +#endif + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C new file mode 100644 index 0000000000..29315599f4 --- /dev/null +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "makeCombustionTypes.H" + +#include "thermoPhysicsTypes.H" +#include "psiCombustionModel.H" +#include "rhoCombustionModel.H" +#include "infinitelyFastChemistry.H" +#include "singleStepCombustion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + + makeCombustionTypesThermo + ( + infinitelyFastChemistry, + psiCombustionModel, + gasThermoPhysics + ); + + makeCombustionTypesThermo + ( + infinitelyFastChemistry, + psiCombustionModel, + constGasThermoPhysics + ); + + makeCombustionTypesThermo + ( + infinitelyFastChemistry, + rhoCombustionModel, + gasThermoPhysics + ); +} +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C new file mode 100644 index 0000000000..426d370b8f --- /dev/null +++ b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "psiChemistryCombustionModel.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(psiChemistryCombustionModel, 0); + defineRunTimeSelectionTable(psiChemistryCombustionModel, dictionary); + + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +psiChemistryCombustionModel::psiChemistryCombustionModel +( + const word& modelType, + const fvMesh& mesh +) +: + combustionModel(modelType, mesh), + pChemistry_(psiChemistryModel::New(mesh)) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +psiChemistryCombustionModel::~psiChemistryCombustionModel() +{} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +bool psiChemistryCombustionModel::read() +{ + if (combustionModel::read()) + { + return true; + } + else + { + return false; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.H b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.H new file mode 100644 index 0000000000..e345904f1c --- /dev/null +++ b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::psiChemistryCombustionModel + +Description + Combustion models for compressibility-based thermodynamics + +SourceFiles + psiChemistryCombustionModelI.H + psiChemistryCombustionModel.C + psiChemistryCombustionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef psiChemistryCombustionModel_H +#define psiChemistryCombustionModel_H + +#include "combustionModel.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "psiChemistryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + class psiChemistryCombustionModel Declaration +\*---------------------------------------------------------------------------*/ + +class psiChemistryCombustionModel +: + public combustionModel +{ + + // Private Member Functions + + //- Construct as copy (not implemented) + psiChemistryCombustionModel(const psiChemistryCombustionModel&); + + //- Disallow default bitwise assignment + void operator=(const psiChemistryCombustionModel&); + + +protected: + + // Protected data + + //- Auto pointer to psiChemistry + autoPtr pChemistry_; + + +public: + + //- Runtime type information + TypeName("psiChemistryCombustionModel"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + psiChemistryCombustionModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh + ), + (modelType, mesh) + ); + + + // Constructors + + + //- Construct from components and thermo + psiChemistryCombustionModel + ( + const word& modelType, + const fvMesh& mesh + ); + + + + //- Selector + static autoPtr New + ( + const fvMesh& mesh + ); + + + //- Destructor + virtual ~psiChemistryCombustionModel(); + + + // Member Functions + + + //- Return access to the thermo package + inline psiChemistryModel& pChemistry(); + + //- Return const access to the thermo package + inline const psiChemistryModel& pChemistry() const; + + //- Return const access to rho + inline tmp rho() const; + + //- Return const access to rho + inline const hsCombustionThermo& thermo() const; + + //- Return non const access to rho + inline hsCombustionThermo& thermo(); + + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "psiChemistryCombustionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelI.H b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelI.H new file mode 100644 index 0000000000..1a54dab2d2 --- /dev/null +++ b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelI.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::psiChemistryModel& +Foam::combustionModels::psiChemistryCombustionModel::pChemistry() +{ + return pChemistry_(); +} + +inline const Foam::psiChemistryModel& +Foam::combustionModels::psiChemistryCombustionModel:: +pChemistry() const +{ + return pChemistry_(); +} + +inline Foam::tmp +Foam::combustionModels::psiChemistryCombustionModel::rho() const +{ + return pChemistry_->thermo().rho(); +} + +inline const Foam::hsCombustionThermo& +Foam::combustionModels::psiChemistryCombustionModel::thermo() const +{ + return pChemistry_->thermo(); +} + +inline Foam::hsCombustionThermo& +Foam::combustionModels::psiChemistryCombustionModel::thermo() +{ + return pChemistry_->thermo(); +} + +// ************************************************************************* // diff --git a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelNew.C b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelNew.C new file mode 100644 index 0000000000..64c60228d1 --- /dev/null +++ b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelNew.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ 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 "psiChemistryCombustionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::combustionModels::psiChemistryCombustionModel::New +( + const fvMesh& mesh +) +{ + const word combModelName + ( + IOdictionary + ( + IOobject + ( + "combustionProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("combustionModel") + ); + + Info<< "Selecting combustion model " << combModelName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(combModelName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "psiChemistryCombustionModel::New" + ) << "Unknown psiChemistryCombustionModel type " + << combModelName << endl << endl + << "Valid combustionModels are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + const label tempOpen = combModelName.find('<'); + + const word className = combModelName(0, tempOpen); + + return autoPtr + (cstrIter()(className, mesh)); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModel.C b/src/combustionModels/psiCombustionModel/psiCombustionModel.C new file mode 100644 index 0000000000..76d52e4541 --- /dev/null +++ b/src/combustionModels/psiCombustionModel/psiCombustionModel.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "psiCombustionModel.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(psiCombustionModel, 0); + defineRunTimeSelectionTable(psiCombustionModel, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::combustionModels::psiCombustionModel::psiCombustionModel +( + const word& modelType, + const fvMesh& mesh +) +: + combustionModel(modelType, mesh), + thermo_(hsCombustionThermo::New(mesh)) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::combustionModels::psiCombustionModel::~psiCombustionModel() +{} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +bool Foam::combustionModels::psiCombustionModel::read() +{ + if (combustionModel::read()) + { + return true; + } + else + { + return false; + } +} + +Foam::tmp +Foam::combustionModels::psiCombustionModel::rho() const +{ + return thermo_->rho(); +} + +// ************************************************************************* // diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModel.H b/src/combustionModels/psiCombustionModel/psiCombustionModel.H new file mode 100644 index 0000000000..aa1e26dac4 --- /dev/null +++ b/src/combustionModels/psiCombustionModel/psiCombustionModel.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::psiCombustionModel + +Description + Combustion models for compressibility-based thermodynamics + +SourceFiles + psiCombustionModelI.H + psiCombustionModel.C + psiCombustionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef psiCombustionModel_H +#define psiCombustionModel_H + +#include "combustionModel.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "hsCombustionThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + class psiCombustionModel Declaration +\*---------------------------------------------------------------------------*/ + +class psiCombustionModel +: + public combustionModel +{ + + // Private Member Functions + + //- Construct as copy (not implemented) + psiCombustionModel(const psiCombustionModel&); + + //- Disallow default bitwise assignment + void operator=(const psiCombustionModel&); + + +protected: + + // Protected data + + + //- Thermo package + autoPtr thermo_; + + + + +public: + + //- Runtime type information + TypeName("psiCombustionModel"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + psiCombustionModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh + ), + (modelType, mesh) + ); + + + // Constructors + + + //- Construct from components and thermo + psiCombustionModel + ( + const word& modelType, + const fvMesh& mesh + ); + + + + //- Selector + static autoPtr New + ( + const fvMesh& mesh + ); + + + //- Destructor + virtual ~psiCombustionModel(); + + + // Member Functions + + //- Return access to the thermo package + inline hsCombustionThermo& thermo(); + + //- Return const access to the thermo package + inline const hsCombustionThermo& thermo() const; + + //- Return tmp of rho + virtual tmp rho() const; + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "psiCombustionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModelI.H b/src/combustionModels/psiCombustionModel/psiCombustionModelI.H new file mode 100644 index 0000000000..f208d4ea29 --- /dev/null +++ b/src/combustionModels/psiCombustionModel/psiCombustionModelI.H @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::hsCombustionThermo& +Foam::combustionModels::psiCombustionModel::thermo() +{ + return thermo_(); +} + +inline const Foam::hsCombustionThermo& +Foam::combustionModels::psiCombustionModel::thermo() const +{ + return thermo_(); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModelNew.C b/src/combustionModels/psiCombustionModel/psiCombustionModelNew.C new file mode 100644 index 0000000000..28092b4a08 --- /dev/null +++ b/src/combustionModels/psiCombustionModel/psiCombustionModelNew.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "psiCombustionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::combustionModels::psiCombustionModel::New +( + const fvMesh& mesh +) +{ + const word combModelName + ( + IOdictionary + ( + IOobject + ( + "combustionProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("combustionModel") + ); + + Info<< "Selecting combustion model " << combModelName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(combModelName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "psiCombustionModel::New" + ) << "Unknown psiCombustionModel type " + << combModelName << endl << endl + << "Valid combustionModels are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + const label tempOpen = combModelName.find('<'); + + const word className = combModelName(0, tempOpen); + + return autoPtr(cstrIter()(className, mesh)); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModels.C b/src/combustionModels/psiCombustionModel/psiCombustionModels.C new file mode 100644 index 0000000000..6bbbb255a7 --- /dev/null +++ b/src/combustionModels/psiCombustionModel/psiCombustionModels.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "makeCombustionTypes.H" + +#include "psiCombustionModel.H" +#include "PaSR.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + makeCombustionTypes + ( + infinitelyFastChemistry, + psiCombustionModel + ); +} +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.C b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.C new file mode 100644 index 0000000000..f427737c8f --- /dev/null +++ b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "rhoChemistryCombustionModel.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(rhoChemistryCombustionModel, 0); + defineRunTimeSelectionTable(rhoChemistryCombustionModel, dictionary); + + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +rhoChemistryCombustionModel::rhoChemistryCombustionModel +( + const word& modelType, + const fvMesh& mesh +) +: + combustionModel(modelType, mesh), + pChemistry_(rhoChemistryModel::New(mesh)) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +rhoChemistryCombustionModel::~rhoChemistryCombustionModel() +{} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +bool rhoChemistryCombustionModel::read() +{ + if (combustionModel::read()) + { + return true; + } + else + { + return false; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.H b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.H new file mode 100644 index 0000000000..e288300e6d --- /dev/null +++ b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModel.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::rhoChemistryCombustionModel + +Description + Combustion models for compressibility-based thermodynamics + +SourceFiles + rhoChemistryCombustionModelI.H + rhoChemistryCombustionModel.C + rhoChemistryCombustionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rhoChemistryCombustionModel_H +#define rhoChemistryCombustionModel_H + +#include "combustionModel.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "rhoChemistryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + class rhoChemistryCombustionModel Declaration +\*---------------------------------------------------------------------------*/ + +class rhoChemistryCombustionModel +: + public combustionModel +{ + + // Private Member Functions + + //- Construct as copy (not implemented) + rhoChemistryCombustionModel(const rhoChemistryCombustionModel&); + + //- Disallow default bitwise assignment + void operator=(const rhoChemistryCombustionModel&); + + +protected: + + // Protected data + + //- Auto pointer to psiChemistry + autoPtr pChemistry_; + + +public: + + //- Runtime type information + TypeName("rhoChemistryCombustionModel"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + rhoChemistryCombustionModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh + ), + (modelType, mesh) + ); + + + // Constructors + + + //- Construct from components and thermo + rhoChemistryCombustionModel + ( + const word& modelType, + const fvMesh& mesh + ); + + + + //- Selector + static autoPtr New + ( + const fvMesh& mesh + ); + + + //- Destructor + virtual ~rhoChemistryCombustionModel(); + + + // Member Functions + + + //- Return access to the thermo package + inline rhoChemistryModel& pChemistry(); + + //- Return const access to the thermo package + inline const rhoChemistryModel& pChemistry() const; + + //- Return const access to rho + inline tmp rho() const; + + //- Return const access to rho + inline const hsReactionThermo& thermo() const; + + //- Return non const access to rho + inline hsReactionThermo& thermo(); + + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "rhoChemistryCombustionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelI.H b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelI.H new file mode 100644 index 0000000000..93c8d2ea8d --- /dev/null +++ b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelI.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::rhoChemistryModel& +Foam::combustionModels::rhoChemistryCombustionModel::pChemistry() +{ + return pChemistry_(); +} + +inline const Foam::rhoChemistryModel& +Foam::combustionModels::rhoChemistryCombustionModel:: +pChemistry() const +{ + return pChemistry_(); +} + +inline Foam::tmp +Foam::combustionModels::rhoChemistryCombustionModel::rho() const +{ + return pChemistry_->thermo().rho(); +} + +inline const Foam::hsReactionThermo& +Foam::combustionModels::rhoChemistryCombustionModel::thermo() const +{ + return pChemistry_->thermo(); +} + +inline Foam::hsReactionThermo& +Foam::combustionModels::rhoChemistryCombustionModel::thermo() +{ + return pChemistry_->thermo(); +} + +// ************************************************************************* // diff --git a/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C new file mode 100644 index 0000000000..4df4146f29 --- /dev/null +++ b/src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "rhoChemistryCombustionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::combustionModels::rhoChemistryCombustionModel::New +( + const fvMesh& mesh +) +{ + const word combModelName + ( + IOdictionary + ( + IOobject + ( + "combustionProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("combustionModel") + ); + + Info<< "Selecting combustion model " << combModelName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(combModelName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "rhoChemistryCombustionModel::New" + ) << "Unknown rhoChemistryCombustionModel type " + << combModelName << endl << endl + << "Valid combustionModels are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + const label tempOpen = combModelName.find('<'); + + const word className = combModelName(0, tempOpen); + + return autoPtr + (cstrIter()(className, mesh)); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/rhoCombustionModel/rhoCombustionModel.C b/src/combustionModels/rhoCombustionModel/rhoCombustionModel.C new file mode 100644 index 0000000000..beaebe6aa0 --- /dev/null +++ b/src/combustionModels/rhoCombustionModel/rhoCombustionModel.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "rhoCombustionModel.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ +namespace combustionModels +{ + defineTypeNameAndDebug(rhoCombustionModel, 0); + defineRunTimeSelectionTable(rhoCombustionModel, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +Foam::combustionModels::rhoCombustionModel::rhoCombustionModel +( + const word& modelType, + const fvMesh& mesh +) +: + combustionModel(modelType, mesh), + thermo_(hsReactionThermo::New(mesh)) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::combustionModels::rhoCombustionModel::~rhoCombustionModel() +{} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::combustionModels::rhoCombustionModel::rho() const +{ + return thermo_->rho(); +} + + +bool Foam::combustionModels::rhoCombustionModel::read() +{ + if (combustionModel::read()) + { + return true; + } + else + { + return false; + } +} + +// ************************************************************************* // diff --git a/src/combustionModels/rhoCombustionModel/rhoCombustionModel.H b/src/combustionModels/rhoCombustionModel/rhoCombustionModel.H new file mode 100644 index 0000000000..58e499dc8a --- /dev/null +++ b/src/combustionModels/rhoCombustionModel/rhoCombustionModel.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::rhoCombustionModel + +Description + Combustion models for rho-based thermodynamics + +SourceFiles + rhoCombustionModelI.H + rhoCombustionModel.C + rhoCombustionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rhoCombustionModel_H +#define rhoCombustionModel_H + +#include "combustionModel.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "hsReactionThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + class rhoCombustionModel Declaration +\*---------------------------------------------------------------------------*/ + +class rhoCombustionModel +: + public combustionModel +{ + + // Private Member Functions + + //- Construct as copy (not implemented) + rhoCombustionModel(const rhoCombustionModel&); + + //- Disallow default bitwise assignment + void operator=(const rhoCombustionModel&); + + +protected: + + // Protected data + + //- Thermo package + autoPtr thermo_; + + +public: + + //- Runtime type information + TypeName("rhoCombustionModel"); + + + //- Declare run-time constructor selection tables + declareRunTimeSelectionTable + ( + autoPtr, + rhoCombustionModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh + ), + (modelType, mesh) + ); + + + // Constructors + + + //- Construct from components and thermo + rhoCombustionModel + ( + const word& modelType, + const fvMesh& mesh + ); + + + + //- Selector + static autoPtr New + ( + const fvMesh& mesh + ); + + + //- Destructor + virtual ~rhoCombustionModel(); + + + // Member Functions + + // Access functions + + //- Access combustion dict + inline const dictionary& coeff() const; + + + //- Return access to the thermo package + inline hsReactionThermo& thermo(); + + //- Return const access to the thermo package + inline const hsReactionThermo& thermo() const; + + //- Return tmp of rho + virtual tmp rho() const; + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace combustionModels + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "rhoCombustionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/rhoCombustionModel/rhoCombustionModelI.H b/src/combustionModels/rhoCombustionModel/rhoCombustionModelI.H new file mode 100644 index 0000000000..23db3695c1 --- /dev/null +++ b/src/combustionModels/rhoCombustionModel/rhoCombustionModelI.H @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::hsReactionThermo& +Foam::combustionModels::rhoCombustionModel::thermo() +{ + return thermo_(); +} + +inline const Foam::hsReactionThermo& +Foam::combustionModels::rhoCombustionModel::thermo() const +{ + return thermo_(); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/rhoCombustionModel/rhoCombustionModelNew.C b/src/combustionModels/rhoCombustionModel/rhoCombustionModelNew.C new file mode 100644 index 0000000000..5496f68925 --- /dev/null +++ b/src/combustionModels/rhoCombustionModel/rhoCombustionModelNew.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ 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 "rhoCombustionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::combustionModels::rhoCombustionModel::New +( + const fvMesh& mesh +) +{ + const word combTypeName + ( + IOdictionary + ( + IOobject + ( + "combustionProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("combustionModel") + ); + + Info<< "Selecting combustion model " << combTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(combTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "rhoCombustionModel::New" + ) << "Unknown rhoCombustionModel type " + << combTypeName << endl << endl + << "Valid combustionModels are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + const label tempOpen = combTypeName.find('<'); + + const word className = combTypeName(0, tempOpen); + + return autoPtr (cstrIter()(className, mesh)); +} + + +// ************************************************************************* // diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C new file mode 100644 index 0000000000..b7ff05fb96 --- /dev/null +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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 "singleStepCombustion.H" +#include "fvmSup.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +singleStepCombustion +::singleStepCombustion +( + const word& modelType, const fvMesh& mesh +) +: + CombThermoType(modelType, mesh), + singleMixture_ + ( + dynamic_cast&>(this->thermo()) + ), + wFuel_ + ( + IOobject + ( + "wFuel", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh(), + dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template +singleStepCombustion +::~singleStepCombustion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +template +Foam::tmp +singleStepCombustion::R +( + const volScalarField& Y +) const +{ + const label specieI = this->thermo_->composition().species()[Y.name()]; + + const label fNorm = singleMixture_.specieProd()[specieI]; + + const volScalarField fres(singleMixture_.fres(specieI)); + + const volScalarField wSpecie + ( + wFuel_*singleMixture_.specieStoichCoeffs()[specieI] + / max(fNorm*(Y - fres), scalar(0.001)) + ); + + return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y); +} + + +template +Foam::tmp +singleStepCombustion< CombThermoType, ThermoType>::Sh() const +{ + const label fuelI = singleMixture_.fuelIndex(); + const volScalarField& YFuel = this->thermo_->composition().Y(fuelI); + + return -singleMixture_.qFuel()*(R(YFuel) & YFuel); +} + + +template +Foam::tmp +singleStepCombustion< CombThermoType, ThermoType>::dQ() const +{ + tmp tdQ + ( + new volScalarField + ( + IOobject + ( + "dQ", + this->mesh_.time().timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + if (this->active()) + { + volScalarField& dQ = tdQ(); + dQ.dimensionedInternalField() = this->mesh().V()*Sh()(); + } + return tdQ; +} + + +template +bool singleStepCombustion< CombThermoType, ThermoType>::read() +{ + if (CombThermoType::read()) + { + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H new file mode 100644 index 0000000000..32c4f952fc --- /dev/null +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + 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::combustionModels::singleStepCombustion + +Description + Base class for combustion models using singleStepReactingMixture. + +SourceFiles + singleStepCombustion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef singleStepCombustion_H +#define singleStepCombustion_H + +#include "singleStepReactingMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class singleStepCombustion Declaration +\*---------------------------------------------------------------------------*/ + +template +class singleStepCombustion +: + public CombThermoType +{ + +protected: + + // Protected data + + //- Reference to singleStepReactingMixture mixture + singleStepReactingMixture& singleMixture_; + + //- Fuel consumption rate + volScalarField wFuel_; + + +private: + + // Private Member Functions + + //- Disallow copy construct + singleStepCombustion(const singleStepCombustion&); + + //- Disallow default bitwise assignment + void operator=(const singleStepCombustion&); + + +public: + + + // Constructors + + //- Construct from components + singleStepCombustion + ( + const word& modelType, const fvMesh& mesh + ); + + + //- Destructor + virtual ~singleStepCombustion(); + + + // Member Functions + + // Evolution + + + //- Fuel consumption rate matrix + virtual tmp R(const volScalarField& Y) const; + + //- Heat release rate calculated from fuel consumption rate matrix + virtual tmp dQ() const; + + //- Sensible enthalpy source term + virtual tmp Sh() const; + + + // I-O + + //- Update properties from given dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#ifdef NoRepository +# include "singleStepCombustion.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/edgeMesh/edgeMesh.C b/src/edgeMesh/edgeMesh.C index 04f3d15da6..5958e1feb1 100644 --- a/src/edgeMesh/edgeMesh.C +++ b/src/edgeMesh/edgeMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,7 @@ void Foam::edgeMesh::calcPointEdges() const Foam::edgeMesh::edgeMesh() : + fileFormats::edgeFormatsCore(), points_(0), edges_(0), pointEdgesPtr_(NULL) @@ -160,6 +161,7 @@ Foam::edgeMesh::edgeMesh const edgeList& edges ) : + fileFormats::edgeFormatsCore(), points_(points), edges_(edges), pointEdgesPtr_(NULL) @@ -172,6 +174,7 @@ Foam::edgeMesh::edgeMesh const Xfer& edgeLst ) : + fileFormats::edgeFormatsCore(), points_(0), edges_(0), pointEdgesPtr_(NULL) diff --git a/src/edgeMesh/edgeMeshI.H b/src/edgeMesh/edgeMeshI.H index 50cf9047a3..9badb7d5b0 100644 --- a/src/edgeMesh/edgeMeshI.H +++ b/src/edgeMesh/edgeMeshI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ License inline Foam::edgeMesh::edgeMesh(const edgeMesh& em) : + fileFormats::edgeFormatsCore(), points_(em.points_), edges_(em.edges_), pointEdgesPtr_(NULL) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 360ecc6b07..e7c0a655c5 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -201,6 +201,7 @@ interpolation = interpolation/interpolation $(interpolation)/interpolation/interpolations.C $(interpolation)/interpolationCell/makeInterpolationCell.C +$(interpolation)/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C $(interpolation)/interpolationCellPoint/cellPointWeight/cellPointWeight.C $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C $(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C @@ -249,7 +250,7 @@ $(schemes)/quadraticLinearPureUpwindFit/quadraticLinearPureUpwindFit.C $(schemes)/linearPureUpwindFit/linearPureUpwindFit.C $(schemes)/linearUpwind/linearUpwind.C $(schemes)/linearUpwind/linearUpwindV.C -$(schemes)/quadraticUpwind/quadraticUpwind.C +$(schemes)/LUST/LUST.C limitedSchemes = $(surfaceInterpolation)/limitedSchemes $(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H index 02cd801cc0..7cc22e8cec 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::basicsourceList + Foam::basicSourceList Description List of explict sources diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 260fb328dc..19404c4f53 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -33,9 +33,9 @@ License namespace Foam { template<> - const char* Foam::NamedEnum + const char* NamedEnum < - Foam::fanPressureFvPatchScalarField::fanFlowDirection, + fanPressureFvPatchScalarField::fanFlowDirection, 2 >::names[] = { diff --git a/src/finiteVolume/fvMatrices/fvMatricesFwd.H b/src/finiteVolume/fvMatrices/fvMatricesFwd.H index b86b729041..d5d3403bed 100644 --- a/src/finiteVolume/fvMatrices/fvMatricesFwd.H +++ b/src/finiteVolume/fvMatrices/fvMatricesFwd.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,14 +21,8 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::fvMatrix - Description - A special matrix type and solver, designed for finite volume - solutions of scalar equations. - Face addressing is used to make all matrix assembly - and solution loops vectorise. + Forward declarations of fvMatrix specializations. \*---------------------------------------------------------------------------*/ diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index 773db6dad9..4763714898 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -25,7 +25,10 @@ Class Foam::fvMatrix Description - Finite-Volume matrix. + A special matrix type and solver, designed for finite volume + solutions of scalar equations. + Face addressing is used to make all matrix assembly + and solution loops vectorise. SourceFiles fvMatrix.C diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H index 4965e2ed10..dfab1cf255 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/MeshObjects/pureUpwindCFCCellToFaceStencilObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::upwindCFCCellToFaceStencilObject + Foam::pureUpwindCFCCellToFaceStencilObject Description diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C new file mode 100644 index 0000000000..cdc2c38aeb --- /dev/null +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "interpolationCellPatchConstrained.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // + +template +interpolationCellPatchConstrained::interpolationCellPatchConstrained +( + const GeometricField& psi +) +: + interpolation(psi) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Type interpolationCellPatchConstrained::interpolate +( + const vector& pt, + const label cellI, + const label faceI +) const +{ + if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces()) + { + // Use boundary value + const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh(); + label patchI = pbm.patchID()[faceI-this->psi_.mesh().nInternalFaces()]; + label patchFaceI = pbm[patchI].whichFace(faceI); + + return this->psi_.boundaryField()[patchI][patchFaceI]; + } + else + { + return this->psi_[cellI]; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/combustionModels/noCombustion/noCombustion.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H similarity index 60% rename from src/combustionModels/noCombustion/noCombustion.H rename to src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H index d36f4c11e3..814988a9f3 100644 --- a/src/combustionModels/noCombustion/noCombustion.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/interpolationCellPatchConstrained.H @@ -2,10 +2,11 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ 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 @@ -21,76 +22,76 @@ License along with OpenFOAM. If not, see . Class - Foam::combustionModel::noCombustion + Foam::interpolationCellPatchConstrained Description - Dummy combustion model for 'none' option - -SourceFiles - noCombustion.C + Uses the cell value for any point in the cell apart from a boundary face + where it uses the boundary value directly. + Note: will not work on an empty patch. \*---------------------------------------------------------------------------*/ -#ifndef noCombustion_H -#define noCombustion_H +#ifndef interpolationCellPatchConstrained_H +#define interpolationCellPatchConstrained_H -#include "combustionModel.H" +#include "interpolation.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace combustionModels -{ + +class fvMesh; /*---------------------------------------------------------------------------*\ - Class noCombustion Declaration + Class interpolationCellPatchConstrained Declaration \*---------------------------------------------------------------------------*/ -class noCombustion +template +class interpolationCellPatchConstrained : - public combustionModel + public interpolation { - // Private Member Functions - - //- Disallow copy construct - noCombustion(const noCombustion&); - - //- Disallow default bitwise assignment - void operator=(const noCombustion&); - public: //- Runtime type information - TypeName("none"); + TypeName("cellPatchConstrained"); // Constructors //- Construct from components - noCombustion + interpolationCellPatchConstrained ( - const dictionary& combustionProperties, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho + const GeometricField& psi ); - //- Destructor - virtual ~noCombustion(); + // Member Functions + + //- Interpolate field to the given point in the given cell + Type interpolate + ( + const vector& position, + const label cellI, + const label faceI = -1 + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace combustionModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "interpolationCellPatchConstrained.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/combustionModels/noCombustion/noCombustion.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C similarity index 57% rename from src/combustionModels/noCombustion/noCombustion.C rename to src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C index 4fc8c7d0c9..adae604e0e 100644 --- a/src/combustionModels/noCombustion/noCombustion.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPatchConstrained/makeInterpolationCellPatchConstrained.C @@ -2,10 +2,11 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ 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 @@ -22,45 +23,19 @@ License \*---------------------------------------------------------------------------*/ -#include "noCombustion.H" -#include "addToRunTimeSelectionTable.H" +#include "interpolationCellPatchConstrained.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace combustionModels -{ - defineTypeNameAndDebug(noCombustion, 0); - addToRunTimeSelectionTable - ( - combustionModel, - noCombustion, - dictionary - ); -}; -}; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +makeInterpolation(interpolationCellPatchConstrained); -Foam::combustionModels::noCombustion::noCombustion -( - const dictionary& combustionProps, - hsCombustionThermo& thermo, - const compressible::turbulenceModel& turbulence, - const surfaceScalarField& phi, - const volScalarField& rho -) -: - combustionModel(combustionProps, thermo, turbulence, phi, rho) -{} - - -// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // - -Foam::combustionModels::noCombustion::~noCombustion() -{} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H index 6b57454da7..0cb362fe1e 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPointWallModified/interpolationCellPointWallModified.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::interpolationCellPoint + Foam::interpolationCellPointWallModified Description Same as interpolationCellPoint, but if interpolating a wall face, uses diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H index 21def0d0bb..2e9bae32f5 100644 --- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H +++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::MapFvSurfaceField - Description Map Surface internal field on topology change. This is a partial template specialisation, see MapGeometricFields. diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H index ed1ce0f097..397408030c 100644 --- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H +++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,9 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::MapFvVolField - Description Map volume internal field on topology change. This is a partial template specialisation, see MapGeometricFields. diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.C similarity index 86% rename from src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.C rename to src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.C index 442e0d3e8b..c9df6716d7 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.C @@ -23,15 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "quadraticUpwind.H" +#include "LUST.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - //makeSurfaceInterpolationScheme(quadraticUpwind); - makeSurfaceInterpolationTypeScheme(quadraticUpwind, scalar); - makeSurfaceInterpolationTypeScheme(quadraticUpwind, vector); + //makeSurfaceInterpolationScheme(LUST); + makeSurfaceInterpolationTypeScheme(LUST, scalar); + makeSurfaceInterpolationTypeScheme(LUST, vector); } // ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.H similarity index 85% rename from src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.H rename to src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.H index a2fb36f7fb..864559a56a 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/quadraticUpwind/quadraticUpwind.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/LUST/LUST.H @@ -22,20 +22,24 @@ License along with OpenFOAM. If not, see . Class - quadraticUpwind + Foam::LUST Description - quadraticUpwind interpolation scheme class derived from linearUpwind and - returns blended linear/upwind weighting factors and also applies a explicit - gradient-based correction obtained from the linearUpwind scheme. + LUST: Linear-upwind stabilised transport. + + Interpolation scheme class derived from linearUpwind which returns blended + linear/linear-upwind weighting factors and also applies a explicit + gradient-based correction obtained from the linearUpwind scheme. The + blending-factor is set to 0.75 linear which optimises the balance between + accuracy and stability on a range of LES cases with a range of mesh quality. SourceFiles - quadraticUpwind.C + LUST.C \*---------------------------------------------------------------------------*/ -#ifndef quadraticUpwind_H -#define quadraticUpwind_H +#ifndef LUST_H +#define LUST_H #include "linearUpwind.H" @@ -45,33 +49,33 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class quadraticUpwind Declaration + Class LUST Declaration \*---------------------------------------------------------------------------*/ template -class quadraticUpwind +class LUST : public linearUpwind { // Private Member Functions //- Disallow default bitwise copy construct - quadraticUpwind(const quadraticUpwind&); + LUST(const LUST&); //- Disallow default bitwise assignment - void operator=(const quadraticUpwind&); + void operator=(const LUST&); public: //- Runtime type information - TypeName("quadraticUpwind"); + TypeName("LUST"); // Constructors //- Construct from mesh and Istream - quadraticUpwind + LUST ( const fvMesh& mesh, Istream& schemeData @@ -81,7 +85,7 @@ public: {} //- Construct from mesh, faceFlux and Istream - quadraticUpwind + LUST ( const fvMesh& mesh, const surfaceScalarField& faceFlux, diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C index 12946afadf..5d3b19fbf1 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.C @@ -25,6 +25,7 @@ License #include "pairPatchAgglomeration.H" #include "meshTools.H" +#include "unitConversion.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -53,7 +54,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() const bPatch& coarsePatch = patchLevels_[0]; forAll(coarsePatch.edges(), i) { - if(coarsePatch.isInternalEdge(i)) + if (coarsePatch.isInternalEdge(i)) { scalar edgeLength = coarsePatch.edges()[i].mag(coarsePatch.localPoints()); @@ -63,12 +64,12 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() if (eFaces.size() == 2) { scalar cosI = - coarsePatch.faceNormals()[eFaces[0]] & - coarsePatch.faceNormals()[eFaces[1]]; + coarsePatch.faceNormals()[eFaces[0]] + & coarsePatch.faceNormals()[eFaces[1]]; const edge edgeCommon = edge(eFaces[0], eFaces[1]); - if(facePairWeight_.found(edgeCommon)) + if (facePairWeight_.found(edgeCommon)) { facePairWeight_[edgeCommon] += edgeLength; } @@ -77,14 +78,7 @@ void Foam::pairPatchAgglomeration::setBasedEdgeWeights() facePairWeight_.insert(edgeCommon, edgeLength); } - if - ( - cosI < - Foam::cos - ( - featureAngle_*constant::mathematical::pi/180.0 - ) - ) + if (cosI < Foam::cos(degToRad(featureAngle_))) { facePairWeight_[edgeCommon] = -1.0; } @@ -109,11 +103,8 @@ void Foam::pairPatchAgglomeration::setEdgeWeights const bPatch& coarsePatch = patchLevels_[fineLevelIndex]; const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex]; - const label nCoarseI = max(fineToCoarse)+1; - labelListList coarseToFine - ( - invertOneToMany(nCoarseI, fineToCoarse) - ); + const label nCoarseI = max(fineToCoarse) + 1; + labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse)); HashSet > fineFeaturedFaces(coarsePatch.nEdges()/10); @@ -138,7 +129,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights forAll(coarsePatch.edges(), i) { - if(coarsePatch.isInternalEdge(i)) + if (coarsePatch.isInternalEdge(i)) { scalar edgeLength = coarsePatch.edges()[i].mag(coarsePatch.localPoints()); @@ -148,7 +139,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights if (eFaces.size() == 2) { const edge edgeCommon = edge(eFaces[0], eFaces[1]); - if(facePairWeight_.found(edgeCommon)) + if (facePairWeight_.found(edgeCommon)) { facePairWeight_[edgeCommon] += edgeLength; } @@ -220,11 +211,13 @@ Foam::pairPatchAgglomeration::pairPatchAgglomeration setBasedEdgeWeights(); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::pairPatchAgglomeration::~pairPatchAgglomeration() {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const Foam::bPatch& Foam::pairPatchAgglomeration::patchLevel @@ -259,8 +252,15 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch { if (min(fineToCoarse) == -1) { - FatalErrorIn("pairPatchAgglomeration::agglomeratePatch") - << "min(fineToCoarse) == -1" << exit(FatalError); + FatalErrorIn + ( + "pairPatchAgglomeration::agglomeratePatch" + "(" + "const bPatch&, " + "const labelList&, " + "const label" + ")" + ) << "min(fineToCoarse) == -1" << exit(FatalError); } if (fineToCoarse.size() != patch.size()) @@ -268,7 +268,11 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch FatalErrorIn ( "pairPatchAgglomeration::agglomeratePatch" - "(const label fineLevelIndex)" + "(" + "const bPatch&, " + "const labelList&, " + "const label" + ")" ) << "restrict map does not correspond to fine level. " << endl << " Sizes: restrictMap: " << fineToCoarse.size() << " nEqns: " << patch.size() @@ -279,10 +283,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch List patchFaces(nCoarseI); // Patch faces per agglomeration - labelListList coarseToFine - ( - invertOneToMany(nCoarseI, fineToCoarse) - ); + labelListList coarseToFine(invertOneToMany(nCoarseI, fineToCoarse)); for (label coarseI = 0; coarseI < nCoarseI; coarseI++) { @@ -351,7 +352,7 @@ void Foam::pairPatchAgglomeration:: agglomerate() tmp finalAgglomPtr(new labelField(patch.size())); bool agglomOK = false; - while (!agglomOK) + while (!agglomOK && patch.size()) { finalAgglomPtr = agglomerateOneLevel ( @@ -371,7 +372,7 @@ void Foam::pairPatchAgglomeration:: agglomerate() restrictAddressing_.set(nCreatedLevels, finalAgglomPtr); mapBaseToTopAgglom(nCreatedLevels); - if(!continueAgglomerating(nCoarseCells)) + if (!continueAgglomerating(nCoarseCells)) { break; } @@ -407,7 +408,7 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel nCoarseCells = 0; - forAll (faceFaces, facei) + forAll(faceFaces, facei) { const labelList& fFaces = faceFaces[facei]; @@ -425,8 +426,8 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel if ( facePairWeight_[edgeCommon] > maxFaceWeight - && coarseCellMap[faceNeig] < 0 - && facePairWeight_[edgeCommon] != -1.0 + && coarseCellMap[faceNeig] < 0 + && facePairWeight_[edgeCommon] != -1.0 ) { // Match found. Pick up all the necessary data @@ -472,7 +473,8 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel coarseCellMap[facei] = coarseCellMap[clusterMatchFaceNo]; } else - {// if not create single-cell "clusters" for each + { + // if not create single-cell "clusters" for each coarseCellMap[facei] = nCoarseCells; nCoarseCells ++; } @@ -499,6 +501,7 @@ Foam::tmp Foam::pairPatchAgglomeration::agglomerateOneLevel return tcoarseCellMap; } + void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) { label prevLevel = curLevel - 1; @@ -522,4 +525,6 @@ void Foam::pairPatchAgglomeration::combineLevels(const label curLevel) patchLevels_.set(prevLevel, patchLevels_.set(curLevel, NULL)); } + + // ************************************************************************* // diff --git a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H index ed66673bd7..26fe7984fa 100644 --- a/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H +++ b/src/fvAgglomerationMethods/pairPatchAgglomeration/pairPatchAgglomeration.H @@ -148,13 +148,13 @@ public: // Destructor - ~pairPatchAgglomeration(); + ~pairPatchAgglomeration(); // Member Functions //- Agglomerate patch - void agglomerate(); + void agglomerate(); // Access @@ -200,7 +200,6 @@ public: const Field& cf, const label coarseLevelIndex ) const; - }; diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H index 1f0d7a1601..4f3f84bc69 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::displacementFvMotionSolver.H + Foam::displacementFvMotionSolver Description Base class for fvMotionSolvers which calculate displacement. diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index b7d39f61f4..e55232a2f4 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -44,7 +44,6 @@ SourceFiles #include "indexedOctree.H" #include "treeDataCell.H" #include "tetPointRef.H" -#include "polyMeshTetDecomposition.H" #include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -194,7 +193,7 @@ public: void trackingRescue() const { nTrackingRescues_++; - if (cloud::debug && nTrackingRescues_ % size() == 0) + if (cloud::debug && size() && (nTrackingRescues_ % size() == 0)) { Pout<< " " << nTrackingRescues_ << " tracking rescues " << endl; diff --git a/src/lagrangian/basic/particle/particleI.H b/src/lagrangian/basic/particle/particleI.H index 6107df0c4e..a9246510f5 100644 --- a/src/lagrangian/basic/particle/particleI.H +++ b/src/lagrangian/basic/particle/particleI.H @@ -514,6 +514,16 @@ inline void Foam::particle::crossEdgeConnectedFace { continue; } + else if (f == pFaces[fI]) + { + // This is a necessary condition if using duplicate baffles + // (so coincident faces). We need to make sure we don't cross into + // the face with the same vertices since we might enter a tracking + // loop where it never exits. This test should be cheap + // for most meshes so can be left in for 'normal' meshes. + + continue; + } else { //Found edge on other face diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index cb58c21653..80009d44c5 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -738,7 +738,7 @@ void Foam::particle::hitWallFaces { // Get the decomposition of this wall face - const List& faceTetIs = + const List faceTetIs = polyMeshTetDecomposition::faceTetIndices(mesh_, fI, cellI_); const Foam::face& f = pFaces[fI]; diff --git a/src/lagrangian/coalCombustion/coalCloud/coalCloud.H b/src/lagrangian/coalCombustion/coalCloud/coalCloud.H index e3df30011e..eac53eccf7 100644 --- a/src/lagrangian/coalCombustion/coalCloud/coalCloud.H +++ b/src/lagrangian/coalCombustion/coalCloud/coalCloud.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - CoalCloud + coalCloud Description Cloud class to introduce coal parcels diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index b23817d98e..b45f3cae8b 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -29,6 +29,7 @@ License #include "InflowBoundaryModel.H" #include "constants.H" #include "zeroGradientFvPatchFields.H" +#include "polyMeshTetDecomposition.H" using namespace Foam::constant; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 42467d15d2..1a28edcaeb 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -609,6 +609,8 @@ void Foam::KinematicCloud::preEvolve() pAmbient_ = constProps_.dict().template lookupOrDefault("pAmbient", pAmbient_); + + functions_.preEvolve(); } diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H index 0289d1ca0f..625e0784c7 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/basicReactingMultiphaseParcel.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::BasicReactingMultiphaseParcel + Foam::basicReactingMultiphaseParcel Description Definition of basic reacting parcel diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H index 13697f2092..9c0e8d2ec5 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelPatchInteractionModels.H @@ -32,6 +32,7 @@ License #include "NoInteraction.H" #include "Rebound.H" #include "StandardWallInteraction.H" +#include "MultiInteraction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,7 +43,8 @@ License makePatchInteractionModelType(LocalInteraction, CloudType); \ makePatchInteractionModelType(NoInteraction, CloudType); \ makePatchInteractionModelType(Rebound, CloudType); \ - makePatchInteractionModelType(StandardWallInteraction, CloudType); + makePatchInteractionModelType(StandardWallInteraction, CloudType); \ + makePatchInteractionModelType(MultiInteraction, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index ba7e869816..c7408718bc 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -74,6 +74,13 @@ Foam::CloudFunctionObject::~CloudFunctionObject() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::CloudFunctionObject::preEvolve() +{ + // do nothing +} + + template void Foam::CloudFunctionObject::postEvolve() { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H index 6a2b05d866..9708b92594 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H @@ -123,6 +123,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-evolve hook virtual void postEvolve(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C index 639276e7cd..bcfaa80fa9 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C @@ -107,6 +107,16 @@ Foam::CloudFunctionObjectList::~CloudFunctionObjectList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::CloudFunctionObjectList::preEvolve() +{ + forAll(*this, i) + { + this->operator[](i).preEvolve(); + } +} + + template void Foam::CloudFunctionObjectList::postEvolve() { diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H index dcc27143ab..d1e430e2ca 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H @@ -103,6 +103,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-evolve hook virtual void postEvolve(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index f02eb29076..3deca9409c 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -95,6 +95,19 @@ Foam::ParticleTracks::~ParticleTracks() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::ParticleTracks::preEvolve() +{ + if (!cloudPtr_.valid()) + { + cloudPtr_.reset + ( + this->owner().cloneBare(this->owner().name() + "Tracks").ptr() + ); + } +} + + template void Foam::ParticleTracks::postPatch(const parcelType&, const label) {} @@ -111,10 +124,10 @@ void Foam::ParticleTracks::postFace(const parcelType& p) { if (!cloudPtr_.valid()) { - cloudPtr_.reset + FatalErrorIn ( - this->owner().cloneBare(this->owner().name() + "Tracks").ptr() - ); + "Foam::ParticleTracks::postFace(const parcelType&)" + )<< "Cloud storage not allocated" << abort(FatalError); } hitTableType::iterator iter = diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H index 283d03d7cd..0aee5d57f2 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H @@ -136,6 +136,9 @@ public: // Evaluation + //- Pre-evolve hook + virtual void preEvolve(); + //- Post-patch hook virtual void postPatch(const parcelType& p, const label patchI); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index e8844a5261..90ed4afcbf 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -130,11 +130,11 @@ Foam::ConeNozzleInjection::ConeNozzleInjection ( readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -208,7 +208,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); } @@ -227,7 +227,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection injectorCell_(im.injectorCell_), direction_(im.direction_), parcelsPerSecond_(im.parcelsPerSecond_), - volumeFlowRate_(im.volumeFlowRate_().clone().ptr()), + flowRateProfile_(im.flowRateProfile_().clone().ptr()), thetaInner_(im.thetaInner_().clone().ptr()), thetaOuter_(im.thetaOuter_().clone().ptr()), sizeDistribution_(im.sizeDistribution_().clone().ptr()), @@ -283,7 +283,7 @@ Foam::scalar Foam::ConeNozzleInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -405,7 +405,7 @@ void Foam::ConeNozzleInjection::setProperties scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_; scalar massFlowRate = this->massTotal() - *volumeFlowRate_().value(t) + *flowRateProfile_().value(t) /this->volumeTotal(); scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai)); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H index 46f876acf8..189390febe 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H @@ -131,8 +131,8 @@ private: //- Number of parcels to introduce per second [] const label parcelsPerSecond_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3/s] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Inner cone angle relative to SOI [deg] const autoPtr > thetaInner_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.H index e7adc61c00..2c3ae0c4fd 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,6 +22,7 @@ License along with OpenFOAM. If not, see . Class + kinematicParcelInjectionDataIOList Description diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Drag/NonSphereDrag/NonSphereDragForce.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Drag/NonSphereDrag/NonSphereDragForce.H index f8a18529f3..a03372c080 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Drag/NonSphereDrag/NonSphereDragForce.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/Drag/NonSphereDrag/NonSphereDragForce.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::NonSphereDrag + Foam::NonSphereDragForce Description Drag model for non-spherical particles. diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C new file mode 100644 index 0000000000..9a18036797 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.C @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "MultiInteraction.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +bool Foam::MultiInteraction::read(const dictionary& dict) +{ + // Count dictionaries + + Info<< "Patch interaction model " << typeName << nl + << "Executing in turn " << endl; + + label nModels = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + Info<< " " << iter().name() << endl; + + nModels++; + } + } + + models_.setSize(nModels); + nModels = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + models_.set + ( + nModels++, + PatchInteractionModel::New + ( + iter().dict(), + this->owner() + ) + ); + } + } + + oneInteractionOnly_ = Switch(dict.lookup("oneInteractionOnly")); + + if (oneInteractionOnly_) + { + Info<< "Stopping upon first model that interacts with particle." + << nl << endl; + } + else + { + Info<< "Allowing multiple models to interact." + << nl << endl; + } + + return true; +} + + +// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // + +template +Foam::MultiInteraction::MultiInteraction +( + const dictionary& dict, + CloudType& cloud +) +: + PatchInteractionModel(dict, cloud, typeName) +{ + read(this->coeffDict()); +} + + +template +Foam::MultiInteraction::MultiInteraction +( + const MultiInteraction& pim +) +: + PatchInteractionModel(pim), + oneInteractionOnly_(pim.oneInteractionOnly_), + models_(pim.models_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::MultiInteraction::~MultiInteraction() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +bool Foam::MultiInteraction::active() const +{ + forAll(models_, i) + { + if (models_[i].active()) + { + return true; + } + } + return false; +} + + +template +bool Foam::MultiInteraction::correct +( + typename CloudType::parcelType& p, + const polyPatch& pp, + bool& keepParticle, + const scalar trackFraction, + const tetIndices& tetIs +) +{ + label origFacei = p.face(); + label patchi = pp.index(); + + bool interacted = false; + + forAll(models_, i) + { + bool myInteracted = models_[i].correct + ( + p, + this->owner().pMesh().boundaryMesh()[patchi], + keepParticle, + trackFraction, + tetIs + ); + + if (myInteracted && oneInteractionOnly_) + { + break; + } + + interacted = (interacted || myInteracted); + + + // Check if perhaps the interaction model has changed patches + // (CoincidentBaffleInteraction can do this) + + if (p.face() != origFacei) + { + origFacei = p.face(); + patchi = p.patch(p.face()); + + // Interaction model has moved particle off wall? + if (patchi == -1) + { + break; + } + } + } + + return interacted; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H new file mode 100644 index 0000000000..b5d8f00a47 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/MultiInteraction/MultiInteraction.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::MultiInteraction + +Description + Runs multiple patch interaction models in turn. Takes dictionary + where all the subdictionaries are the interaction models. + + // Exit upon first successful interaction or continue doing other + // models. Returned nteraction status will be true if there has been any + // interaction (so logical or) + oneInteractionOnly true; + + model1 + { + patchInteractionModel coincidentBaffleInteraction; + coincidentBaffleInteractionCoeffs + { + coincidentPatches + ( + (pipetteWall_A pipetteCyclic_half0) + (pipetteWall_B pipetteCyclic_half1) + ); + } + } + model2 + { + patchInteractionModel localInteraction; + localInteractionCoeffs + { + patches + ( + cWall + { + type rebound; + } + pipetteWall_A + { + type rebound; + } + pipetteWall_B + { + type rebound; + } + ); + } + } + + +\*---------------------------------------------------------------------------*/ + +#ifndef MultiInteraction_H +#define MultiInteraction_H + +#include "PatchInteractionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class MultiInteraction Declaration +\*---------------------------------------------------------------------------*/ + +template +class MultiInteraction +: + public PatchInteractionModel +{ + // Private data + + Switch oneInteractionOnly_; + + //- Submodels + PtrList > models_; + + + // Private Member Functions + + //- Read settings + bool read(const dictionary&); + +public: + + //- Runtime type information + TypeName("multiInteraction"); + + + // Constructors + + //- Construct from dictionary + MultiInteraction(const dictionary& dict, CloudType& cloud); + + //- Construct copy from owner cloud and patch interaction model + MultiInteraction(const MultiInteraction& pim); + + //- Construct and return a clone using supplied owner cloud + virtual autoPtr > clone() const + { + return autoPtr > + ( + new MultiInteraction(*this) + ); + } + + + //- Destructor + virtual ~MultiInteraction(); + + + // Member Functions + + //- Flag to indicate whether model activates patch interaction model + virtual bool active() const; + + //- Apply velocity correction + // Returns true if particle remains in same cell + virtual bool correct + ( + typename CloudType::parcelType& p, + const polyPatch& pp, + bool& keepParticle, + const scalar trackFraction, + const tetIndices& tetIs + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "MultiInteraction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.H b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.H index c93bde5a43..c47b7f37e6 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.H +++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,6 +22,7 @@ License along with OpenFOAM. If not, see . Class + Foam::reactingParcelInjectionDataIOList Description diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.H index e0410515b1..97a171f2f9 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,6 +22,7 @@ License along with OpenFOAM. If not, see . Class + reactingMultiphaseParcelInjectionDataIOList Description diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.H b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.H index 76d39e5b0c..25dae5d66d 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,6 +22,7 @@ License along with OpenFOAM. If not, see . Class + thermoParcelInjectionDataIOList Description diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.H b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.H index bca4726188..2652158fef 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.H +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::pairPotentials::electrostatic + Foam::pairPotentials::coulomb Description diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.H b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.H index 88fbdc8902..db7dfdd6a7 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.H +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::pairPotentials::electrostatic + Foam::pairPotentials::dampedCoulomb Description diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 03c29aefd3..a7ec879794 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -744,7 +744,8 @@ void Foam::autoRefineDriver::doRefine 100 // maxIter ); - // Introduce baffles at surface intersections + // Introduce baffles at surface intersections. Remove sections unreachable + // from keepPoint. baffleAndSplitMesh(refineParams, prepareForSnapping, motionDict); // Mesh is at its finest. Do optional zoning. diff --git a/src/meshTools/momentOfInertia/momentOfInertia.C b/src/meshTools/momentOfInertia/momentOfInertia.C index 8dc1a53d61..469f9c8ce8 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.C +++ b/src/meshTools/momentOfInertia/momentOfInertia.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2007-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "momentOfInertia.H" +#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/meshTools/momentOfInertia/momentOfInertia.H b/src/meshTools/momentOfInertia/momentOfInertia.H index bb5ffef6a8..2366a6132c 100644 --- a/src/meshTools/momentOfInertia/momentOfInertia.H +++ b/src/meshTools/momentOfInertia/momentOfInertia.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2007-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ SourceFiles #include "triFaceList.H" #include "triSurface.H" #include "polyMesh.H" -#include "polyMeshTetDecomposition.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.C b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C index 801d557b7a..309498d583 100644 --- a/src/meshTools/searchableSurface/closedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,11 @@ addToRunTimeSelectionTable(searchableSurface, closedTriSurfaceMesh, dict); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::closedTriSurfaceMesh::closedTriSurfaceMesh(const IOobject& io, const triSurface& s) +Foam::closedTriSurfaceMesh::closedTriSurfaceMesh +( + const IOobject& io, + const triSurface& s +) : triSurfaceMesh(io, s) {} diff --git a/src/meshTools/searchableSurface/closedTriSurfaceMesh.H b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H index 84e160a410..ec729d1aa3 100644 --- a/src/meshTools/searchableSurface/closedTriSurfaceMesh.H +++ b/src/meshTools/searchableSurface/closedTriSurfaceMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/postProcessing/functionObjects/IO/controlDict b/src/postProcessing/functionObjects/IO/controlDict index 11ecd9b106..d0fa908273 100644 --- a/src/postProcessing/functionObjects/IO/controlDict +++ b/src/postProcessing/functionObjects/IO/controlDict @@ -14,6 +14,10 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// So we get a decent warning if we have multiple functionObject entries +// with the same name. +#inputMode error; + application icoFoam; startFrom startTime; @@ -56,11 +60,16 @@ functions // Where to load it from functionObjectLibs ("libIOFunctionObjects.so"); + // Optional mesh region to operate on. Only one partialWrite per + // region allowed. + region wallFilmRegion; + // Execute upon outputTime outputControl outputTime; - // Objects to write every outputTime - objectNames (p); + // Objects (fields or lagrangian fields in any of the clouds) + // to write every outputTime + objectNames (p positions nParticle); // Write as normal every writeInterval'th outputTime. writeInterval 3; } diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C index 1ea7ae253d..431c1febd9 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C @@ -28,6 +28,7 @@ License #include "Time.H" #include "IOobjectList.H" #include "polyMesh.H" +#include "cloud.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -132,7 +133,12 @@ void Foam::partialWrite::write() IOobjectList objects(obr_, obr_.time().timeName()); - forAllConstIter(HashPtrTable, objects, iter) + if (debug) + { + Pout<< "For region:" << obr_.name() << endl; + } + + forAllConstIter(IOobjectList, objects, iter) { if (!objectNames_.found(iter()->name())) { @@ -147,6 +153,47 @@ void Foam::partialWrite::write() rm(f); } } + + // Do the lagrangian files as well. + fileNameList cloudDirs + ( + readDir + ( + obr_.time().timePath()/dbDir/cloud::prefix, + fileName::DIRECTORY + ) + ); + forAll(cloudDirs, i) + { + if (debug) + { + Pout<< "For cloud:" << cloudDirs[i] << endl; + } + + IOobjectList sprayObjs + ( + obr_, + obr_.time().timeName(), + cloud::prefix/cloudDirs[i] + ); + forAllConstIter(IOobjectList, sprayObjs, iter) + { + if (!objectNames_.found(iter()->name())) + { + const fileName f = + obr_.time().timePath() + /dbDir + /cloud::prefix + /cloudDirs[i] + /iter()->name(); + if (debug) + { + Pout<< " rm " << f << endl; + } + rm(f); + } + } + } } } } diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H index 76b3f82bf3..2eb4612913 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::streamLineCloud + Foam::streamLineParticleCloud Description A Cloud of streamLine particles diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index bd699e05ae..df40e55b1e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -60,6 +60,28 @@ void Foam::regionModels::regionModel::constructMeshObjects() } +void Foam::regionModels::regionModel::constructMeshObjects +( + const dictionary& dict +) +{ + // construct region mesh + regionMeshPtr_.reset + ( + new fvMesh + ( + IOobject + ( + dict.lookup("regionName"), + time_.timeName(), + time_, + IOobject::MUST_READ + ) + ) + ); +} + + void Foam::regionModels::regionModel::initialise() { if (debug) @@ -148,6 +170,26 @@ bool Foam::regionModels::regionModel::read() } +bool Foam::regionModels::regionModel::read(const dictionary& dict) +{ + if (active_) + { + if (const dictionary* dictPtr = dict.subDictPtr(modelName_ + "Coeffs")) + { + coeffs_ <<= *dictPtr; + } + + infoOutput_.readIfPresent("infoOutput", dict); + + return true; + } + else + { + return false; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) @@ -219,6 +261,52 @@ Foam::regionModels::regionModel::regionModel } +Foam::regionModels::regionModel::regionModel +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + IOdictionary + ( + IOobject + ( + regionType, + mesh.time().constant(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + true + ), + dict + ), + primaryMesh_(mesh), + time_(mesh.time()), + active_(dict.lookup("active")), + infoOutput_(false), + modelName_(modelName), + regionMeshPtr_(NULL), + coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), + primaryPatchIDs_(), + intCoupledPatchIDs_(), + mappedPatches_() +{ + if (active_) + { + constructMeshObjects(dict); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel::~regionModel() @@ -254,7 +342,7 @@ void Foam::regionModels::regionModel::evolve() << regionMesh().name() << endl; // Update any input information - read(); + //read(); // Pre-evolve preEvolveRegion(); diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 01300671d9..9caf929e2e 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -76,6 +76,9 @@ private: //- Construct region mesh and fields void constructMeshObjects(); + //- Construct region mesh and dictionary + void constructMeshObjects(const dictionary& dict); + //- Initialise the region void initialise(); @@ -123,6 +126,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + public: @@ -144,6 +150,17 @@ public: bool readFields = true ); + //- Construct from mesh and name and dict + regionModel + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel(); @@ -162,6 +179,9 @@ public: //- Return the active flag inline const Switch& active() const; + //- Return the information flag + inline const Switch& infoOutput() const; + //- Return the model name inline const word& modelName() const; diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H index d99b156bf6..bf543c7b4b 100644 --- a/src/regionModels/regionModel/regionModel/regionModelI.H +++ b/src/regionModels/regionModel/regionModel/regionModelI.H @@ -46,6 +46,12 @@ inline const Foam::Switch& Foam::regionModels::regionModel::active() const } +inline const Foam::Switch& Foam::regionModels::regionModel::infoOutput() const +{ + return infoOutput_; +} + + inline const Foam::word& Foam::regionModels::regionModel::modelName() const { return modelName_; diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.C b/src/regionModels/regionModel/regionModel1D/regionModel1D.C index 3902a689a7..2266ffc655 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.C +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.C @@ -159,6 +159,21 @@ bool Foam::regionModels::regionModel1D::read() } +bool Foam::regionModels::regionModel1D::read(const dictionary& dict) +{ + if (regionModel::read(dict)) + { + moveMesh_.readIfPresent("moveMesh", dict); + + return true; + } + else + { + return false; + } +} + + Foam::tmp Foam::regionModels::regionModel1D::moveMesh ( const scalarList& deltaV, @@ -301,6 +316,35 @@ Foam::regionModels::regionModel1D::regionModel1D } +Foam::regionModels::regionModel1D::regionModel1D +( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields +) +: + regionModel(mesh, regionType, modelName, dict, readFields), + boundaryFaceFaces_(regionMesh().nCells()), + boundaryFaceCells_(regionMesh().nCells()), + boundaryFaceOppositeFace_(regionMesh().nCells()), + nLayers_(0), + nMagSfPtr_(NULL), + moveMesh_(false) +{ + if (active_) + { + constructMeshObjects(); + initialise(); + + if (readFields) + { + read(dict); + } + } +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::regionModels::regionModel1D::~regionModel1D() diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.H b/src/regionModels/regionModel/regionModel1D/regionModel1D.H index 7d51d3ef36..eb7304d704 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.H +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.H @@ -105,6 +105,9 @@ protected: //- Read control parameters from dictionary virtual bool read(); + //- Read control parameters from dictionary + virtual bool read(const dictionary& dict); + //- Move mesh points according to change in cell volumes // Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged tmp moveMesh @@ -134,6 +137,17 @@ public: bool readFields = true ); + //- Construct from mesh, region type and name and dict + regionModel1D + ( + const fvMesh& mesh, + const word& regionType, + const word& modelName, + const dictionary& dict, + bool readFields = true + ); + + //- Destructor virtual ~regionModel1D(); diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 26bad8f390..7fe71e4ead 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C @@ -62,12 +62,12 @@ bool noFilm::read() noFilm::noFilm ( - const word&, + const word& modelType, const fvMesh& mesh, - const dimensionedVector& + const dimensionedVector& g ) : - surfaceFilmModel(mesh) + surfaceFilmModel(modelType, mesh, g) {} diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C index bfded1d8fa..f595568ce5 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C @@ -28,17 +28,19 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum -< - Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType, - 2 ->::names[] = +namespace Foam { - "constant", - "singleComponent" -}; - + template<> + const char* NamedEnum + < + regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelType, + 2 + >::names[] = + { + "constant", + "singleComponent" + }; +} const Foam::NamedEnum < @@ -48,7 +50,7 @@ const Foam::NamedEnum Foam::regionModels::surfaceFilmModels::surfaceFilmModel::thermoModelTypeNames_; -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { @@ -81,14 +83,6 @@ bool surfaceFilmModel::read() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -surfaceFilmModel::surfaceFilmModel(const fvMesh& mesh) -: - singleLayerRegion(mesh), - g_(vector::zero), - thermoModel_(tmConstant) -{} - - surfaceFilmModel::surfaceFilmModel ( const word& modelType, diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 1e26c9db9c..00a4814695 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H @@ -130,9 +130,6 @@ public: // Constructors - //- Construct null - surfaceFilmModel(const fvMesh& mesh); - //- Construct from type name, mesh and gravity vector surfaceFilmModel ( diff --git a/src/regionModels/thermoBaffleModels/Make/files b/src/regionModels/thermoBaffleModels/Make/files index 1a0352a4bf..41bb7d03db 100644 --- a/src/regionModels/thermoBaffleModels/Make/files +++ b/src/regionModels/thermoBaffleModels/Make/files @@ -3,5 +3,7 @@ thermoBaffleModel/thermoBaffleModelNew.C thermoBaffle2D/thermoBaffle2D.C noThermo/noThermo.C +derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C + LIB = $(FOAM_LIBBIN)/libthermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C new file mode 100644 index 0000000000..a78bb2c311 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.C @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "temperatureThermoBaffleFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF), + owner_(false), + baffle_(), + solidThermoType_("undefined") +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField + ( + ptf, + p, + iF, + mapper + ), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(p, iF, dict), + owner_(false), + baffle_(), + solidThermoType_() +{ + if (!isA(patch().patch())) + { + FatalErrorIn + ( + "temperatureThermoBaffleFvPatchScalarField::" + "temperatureThermoBaffleFvPatchScalarField\n" + "(\n" + " const fvPatch& p,\n" + " const DimensionedField& iF,\n" + " const dictionary& dict\n" + ")\n" + ) << "\n patch type '" << patch().type() + << "' not type '" << directMappedPatchBase::typeName << "'" + << "\n for patch " << patch().name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalError); + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + typedef regionModels::thermoBaffleModels::thermoBaffleModel baffle; + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && !thisMesh.foundObject("thermoBaffle") + && !owner_ + ) + { + Info << "Creating thermal baffle..." << endl; + baffle_.reset(baffle::New(thisMesh, dict).ptr()); + owner_ = true; + dict.lookup("thermoType") >> solidThermoType_; + } +} + + +temperatureThermoBaffleFvPatchScalarField:: +temperatureThermoBaffleFvPatchScalarField +( + const temperatureThermoBaffleFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField(ptf, iF), + owner_(ptf.owner_), + baffle_(ptf.baffle_), + solidThermoType_(ptf.solidThermoType_) +{} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +void temperatureThermoBaffleFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + mixedFvPatchScalarField::autoMap(m); +} + + +void temperatureThermoBaffleFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + mixedFvPatchScalarField::rmap(ptf, addr); +} + + +void temperatureThermoBaffleFvPatchScalarField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if + ( + thisMesh.name() == polyMesh::defaultRegion + && owner_ + ) + { + baffle_->evolve(); + } + + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(); +} + + +void temperatureThermoBaffleFvPatchScalarField::write(Ostream& os) const +{ + turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write(os); + + const fvMesh& thisMesh = patch().boundaryMesh().mesh(); + + if (thisMesh.name() == polyMesh::defaultRegion && owner_) + { + os.writeKeyword("thermoBaffleModel") << baffle_->modelName() + << token::END_STATEMENT << nl; + + os.writeKeyword("regionName") << baffle_->regionMesh().name() + << token::END_STATEMENT << nl; + + os.writeKeyword("infoOutput") << baffle_->infoOutput() + << token::END_STATEMENT << nl; + + os.writeKeyword("active") << baffle_->active() + << token::END_STATEMENT << nl; + + os.writeKeyword(word(baffle_->modelName() + "coeffs")); + + os << baffle_->coeffs() << nl; + + os.writeKeyword("thermoType") << solidThermoType_ + << token::END_STATEMENT << nl; + + os.writeKeyword(word(solidThermoType_ + "Coeffs")) << nl; + + os << indent << '{' << nl + << indent << baffle_->thermo() << nl + << indent << '}' << nl; + } +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + temperatureThermoBaffleFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H new file mode 100644 index 0000000000..2d61bf09c6 --- /dev/null +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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::temperatureThermoBaffleFvPatchScalarField + +Description + Thermal bounday applied to both sides of the thermal baffle region and + in the primary region. + The primary region creates and evolves the thermal baffle heat transfer + equation. The solid thermo and baffle dictionaries are located on the + primary region. + + type compressible::temperatureThermoBaffle; + + // Coupled BC. + neighbourFieldName T; + K basicThermo; + KName none; + + + // Thermo baffle model + thermoBaffleModel thermoBaffle2D; + regionName baffleRegion; + infoOutput yes; + active yes; + thermoBaffle2DCoeffs + { + } + + + // Solid thermo + thermoType constSolidThermo; + + constSolidThermoCoeffs + { + //- thermo properties + rho rho [1 -3 0 0 0 0 0] 80; + Cp Cp [0 2 -2 -1 0 0 0] 15; + K K [1 1 -3 -1 0 0 0] 0.01; + + //- radiative properties + kappa kappa [0 -1 0 0 0 0 0] 0; + sigmaS sigmaS [0 -1 0 0 0 0 0] 0; + emissivity emissivity [0 0 0 0 0 0 0] 1; + + //- chemical properties + Hf Hf [0 2 -2 0 0 0 0] 0; + } + + value uniform 300; + + +SourceFiles + temperatureThermoBaffleFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef temperatureThermoBaffleFvPatchScalarField_H +#define temperatureThermoBaffleFvPatchScalarField_H + + +#include "autoPtr.H" +#include "regionModel.H" +#include "thermoBaffleModel.H" +#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class temperatureThermoBaffleFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class temperatureThermoBaffleFvPatchScalarField +: + public turbulentTemperatureCoupledBaffleMixedFvPatchScalarField +{ + // Private data + + //- Is the baffle owner + bool owner_; + + //- Thermal baffle + autoPtr baffle_; + + //- Solid thermo type + word solidThermoType_; + + +public: + + //- Runtime type information + TypeName("compressible::temperatureThermoBaffle"); + + + // Constructors + + //- Construct from patch and internal field + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + temperatureThermoBaffleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // temperatureThermoBaffleFvPatchScalarField onto a new patch + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + temperatureThermoBaffleFvPatchScalarField + ( + const temperatureThermoBaffleFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new temperatureThermoBaffleFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C index 32b8e32e04..841cfba283 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.C +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.C @@ -127,6 +127,14 @@ const volScalarField& noThermo::T() const } +const basicSolidThermo& noThermo::thermo() const +{ + FatalErrorIn("const volScalarField& noThermo::T() const") + << "T field not available for " << type() << abort(FatalError); + return reinterpret_cast(null); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H index 387241cca4..fa4f7f289c 100644 --- a/src/regionModels/thermoBaffleModels/noThermo/noThermo.H +++ b/src/regionModels/thermoBaffleModels/noThermo/noThermo.H @@ -92,6 +92,13 @@ public: // Member Functions + + // Thermo properties + + //- Return const reference to the basicSolidThermo + virtual const basicSolidThermo& thermo() const; + + // Fields //- Return the film specific heat capacity [J/kg/K] diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C index 0cf810afc1..c77ac867d7 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.C @@ -46,6 +46,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffle2D, 0); addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, mesh); +addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -90,8 +91,8 @@ void thermoBaffle2D::solveEnergy() volScalarField K("K", thermo_->K()); - //If region is one-dimension variable thickness can be used. - if (oneD_) + //If region is one-dimension variable thickness + if (oneD_ && !constantThickness_) { // Scale K and rhoCp and fill Q in the internal baffle region. const label patchI = intCoupledPatchIDs_[0]; @@ -136,6 +137,60 @@ void thermoBaffle2D::solveEnergy() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffle2D::thermoBaffle2D +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + thermoBaffleModel(modelType, mesh, dict), + nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))), + thermo_(basicSolidThermo::New(regionMesh(), dict)), + T_(thermo_->T()), + Qs_ + ( + IOobject + ( + "Qs", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimArea/dimTime, + pTraits::zero + ) + ), + Q_ + ( + IOobject + ( + "Q", + regionMesh().time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimVolume/dimTime, + pTraits::zero + ) + ) +{ + init(); + thermo_->correct(); +} + + thermoBaffle2D::thermoBaffle2D ( const word& modelType, @@ -183,26 +238,7 @@ thermoBaffle2D::thermoBaffle2D ) ) { - if (oneD_) - { - label patchI = intCoupledPatchIDs_[0]; - const label Qsb = Qs_.boundaryField()[patchI].size(); - if (Qsb!= thickness_.size()) - { - FatalErrorIn - ( - "thermoBaffle2D::thermoBaffle2D" - "(" - " const word& modelType," - " const fvMesh& mesh" - ")" - ) << "the boundary field of Qs is " - << Qsb << " and " << nl - << "the field 'thickness' is " << thickness_.size() << nl - << exit(FatalError); - } - } - + init(); thermo_->correct(); } @@ -215,6 +251,31 @@ thermoBaffle2D::~thermoBaffle2D() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +void thermoBaffle2D::init() +{ + if (oneD_ && !constantThickness_) + { + label patchI = intCoupledPatchIDs_[0]; + const label Qsb = Qs_.boundaryField()[patchI].size(); + if (Qsb!= thickness_.size()) + { + FatalErrorIn + ( + "thermoBaffle2D::thermoBaffle2D" + "(" + " const word& modelType," + " const fvMesh& mesh," + " const dictionary& dict" + ")" + ) << "the boundary field of Qs is " + << Qsb << " and " << nl + << "the field 'thickness' is " << thickness_.size() << nl + << exit(FatalError); + } + } +} + + void thermoBaffle2D::preEvolveRegion() {} @@ -258,6 +319,12 @@ const volScalarField& thermoBaffle2D::T() const } +const basicSolidThermo& thermoBaffle2D::thermo() const +{ + return thermo_; +} + + void thermoBaffle2D::info() const { Info<< indent << "min/max(T) = " << min(T_).value() << ", " diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H index 8cd28b76e5..1b66813be8 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2D.H @@ -37,7 +37,6 @@ SourceFiles #define thermoBaffle2D_H #include "thermoBaffleModel.H" -#include "basicSolidThermo.H" #include "volFieldsFwd.H" @@ -69,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffle2D&); + //- Initialize thermoBaffle2D + void init(); + protected: @@ -106,7 +108,7 @@ protected: // Equations //- Solve energy equation - virtual void solveEnergy(); + void solveEnergy(); public: @@ -120,6 +122,16 @@ public: //- Construct from components thermoBaffle2D(const word& modelType, const fvMesh& mesh); + //- Construct from components and dict + thermoBaffle2D + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + + ); + + //- Destructor virtual ~thermoBaffle2D(); @@ -130,7 +142,7 @@ public: // Thermo properties //- Return const reference to the basicSolidThermo - inline const basicSolidThermo& thermo() const; + virtual const basicSolidThermo& thermo() const; // Fields @@ -176,10 +188,10 @@ public: // Evolution - //- Pre-evolve film + //- Pre-evolve thermal baffle virtual void preEvolveRegion(); - //- Evolve the film equations + //- Evolve the thermal baffle virtual void evolveRegion(); diff --git a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H index 0e3978da3c..227a25975b 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffle2D/thermoBaffle2DI.H @@ -38,11 +38,6 @@ namespace thermoBaffleModels // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline const basicSolidThermo& thermoBaffle2D::thermo() const -{ - return thermo_; -} - inline tmp thermoBaffle2D::hs ( diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C index 901e8c1600..0ca4856fe6 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.C @@ -41,6 +41,7 @@ namespace thermoBaffleModels defineTypeNameAndDebug(thermoBaffleModel, 0); defineRunTimeSelectionTable(thermoBaffleModel, mesh); +defineRunTimeSelectionTable(thermoBaffleModel, dictionary); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -52,23 +53,7 @@ bool thermoBaffleModel::read() } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) -: - regionModel1D(mesh), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) -{} - - -thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) -: - regionModel1D(mesh, "thermoBaffle", modelType), - thickness_(), - delta_("delta", dimLength, 0.0), - oneD_(false) +void thermoBaffleModel::init() { if (active_) { @@ -86,7 +71,14 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) label nFaces = 0; forAll (rbm, patchi) { - if (rbm[patchi].size() && isA(rbm[patchi])) + if ( + rbm[patchi].size() + && + ( + isA(rbm[patchi]) + || isA(rbm[patchi]) + ) + ) { nFaces += rbm[patchi].size(); } @@ -108,7 +100,11 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) const label patchI = intCoupledPatchIDs_[i]; const polyPatch& pp = rbm[patchI]; - if (!isA(pp) && oneD_) + if ( + !isA(pp) + && oneD_ + && !constantThickness_ + ) { FatalErrorIn ( @@ -120,7 +116,8 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) ) << "\n patch type '" << pp.type() << "' not type '" << directMappedVariableThicknessWallPolyPatch::typeName - << "'. This is necessary for 1D solution" + << "'. This is necessary for 1D solution " + << " and variable thickness" << "\n for patch. " << pp.name() << exit(FatalError); } @@ -142,7 +139,7 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } } - if (oneD_) + if (oneD_ && !constantThickness_) { const label patchI = intCoupledPatchIDs_[0]; const polyPatch& pp = rbm[patchI]; @@ -192,6 +189,48 @@ thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh) +: + regionModel1D(mesh), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(true) +{} + + +thermoBaffleModel::thermoBaffleModel +( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + +) +: + regionModel1D(mesh, "thermoBaffle", modelType, dict, true), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(dict.lookupOrDefault("constantThickness", true)) +{ + init(); +} + + +thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh) +: + regionModel1D(mesh, "thermoBaffle", modelType), + thickness_(), + delta_("delta", dimLength, 0.0), + oneD_(false), + constantThickness_(lookupOrDefault("constantThickness", true)) +{ + init(); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // thermoBaffleModel::~thermoBaffleModel() diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H index 1a20d9222b..cee13d8e68 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModel.H @@ -38,6 +38,7 @@ SourceFiles #include "scalarIOField.H" #include "autoPtr.H" #include "volFieldsFwd.H" +#include "basicSolidThermo.H" #include "regionModel1D.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,6 +68,9 @@ private: //- Disallow default bitwise assignment void operator=(const thermoBaffleModel&); + //- Initialize thermal Baffle + void init(); + protected: @@ -75,12 +79,15 @@ protected: //- Baffle physical thickness scalarField thickness_; - //- Baffle geometric thickness + //- Baffle mesh thickness dimensionedScalar delta_; //- Is it one dimension bool oneD_; + //- Is thickness constant + bool constantThickness_; + // Protected Member Functions @@ -94,7 +101,7 @@ public: TypeName("thermoBaffleModel"); - // Declare runtime constructor selection table + // Declare runtime constructor selection tables declareRunTimeSelectionTable ( @@ -108,6 +115,20 @@ public: (modelType, mesh) ); + declareRunTimeSelectionTable + ( + autoPtr, + thermoBaffleModel, + dictionary, + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ), + (modelType, mesh, dict) + ); + + // Constructors //- Construct null from mesh @@ -116,12 +137,27 @@ public: //- Construct from type name and mesh thermoBaffleModel(const word& modelType, const fvMesh& mesh); + //- Construct from type name and mesh and dict + thermoBaffleModel + ( + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + // Selectors //- Return a reference to the selected model static autoPtr New(const fvMesh& mesh); + //- Return a reference to the selected model using dictionary + static autoPtr New + ( + const fvMesh& mesh, + const dictionary& dict + ); + //- Destructor virtual ~thermoBaffleModel(); @@ -129,8 +165,11 @@ public: // Member Functions + // Access + //- Return solid thermo + virtual const basicSolidThermo& thermo() const = 0; //- Return thickness const scalarField& thickness() const @@ -150,6 +189,12 @@ public: return oneD_; } + //- Return if region has constant thickness + bool constantThickness() const + { + return constantThickness_; + } + // Fields diff --git a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C index 976b478e33..15dcb296a1 100644 --- a/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C +++ b/src/regionModels/thermoBaffleModels/thermoBaffleModel/thermoBaffleModelNew.C @@ -76,6 +76,35 @@ autoPtr thermoBaffleModel::New(const fvMesh& mesh) } +autoPtr thermoBaffleModel::New +( + const fvMesh& mesh, + const dictionary& dict +) +{ + + word modelType = dict.lookup("thermoBaffleModel"); + + Info<< "Selecting baffle model " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + + FatalErrorIn("thermoBaffleModel::New(const fvMesh&,const dictionary&)") + << "Unknown thermoBaffleModel type " << modelType + << nl << nl + << "Valid thermoBaffleModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(modelType, mesh, dict)); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace thermoBaffleModels diff --git a/src/sampling/Make/files b/src/sampling/Make/files index ddf46a17e8..0c679f52d8 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -5,6 +5,7 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/cloud/cloudSet.C sampledSet/coordSet/coordSet.C +sampledSet/patchCloud/patchCloudSet.C sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C sampledSet/midPoint/midPointSet.C diff --git a/src/sampling/sampledSet/patchCloud/patchCloudSet.C b/src/sampling/sampledSet/patchCloud/patchCloudSet.C new file mode 100644 index 0000000000..85877da3b8 --- /dev/null +++ b/src/sampling/sampledSet/patchCloud/patchCloudSet.C @@ -0,0 +1,322 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ 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 "patchCloudSet.H" +#include "polyMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "pointIndexHit.H" +#include "Tuple2.H" +#include "treeBoundBox.H" +#include "indexedOctree.H" +#include "treeDataFace.H" +#include "Time.H" +#include "meshTools.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(patchCloudSet, 0); + addToRunTimeSelectionTable(sampledSet, patchCloudSet, word); + + + //- Helper class for finding nearest + // Nearest: + // - point+local index + // - sqr(distance) + // - processor + typedef Tuple2 > nearInfo; + + class nearestEqOp + { + + public: + + void operator()(nearInfo& x, const nearInfo& y) const + { + if (y.first().hit()) + { + if (!x.first().hit()) + { + x = y; + } + else if (y.second().first() < x.second().first()) + { + x = y; + } + } + } + }; +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::patchCloudSet::calcSamples +( + DynamicList& samplingPts, + DynamicList