diff --git a/applications/solvers/combustion/chemFoam/chemFoam.C b/applications/solvers/combustion/chemFoam/chemFoam.C index d5038d1f69ec3f55937acd3034285dd588fa9335..4183045a1039445b8f5c8be418e7627d6ea92992 100644 --- a/applications/solvers/combustion/chemFoam/chemFoam.C +++ b/applications/solvers/combustion/chemFoam/chemFoam.C @@ -69,14 +69,9 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "solveChemistry.H" - - { - #include "YEqn.H" - - #include "hEqn.H" - - #include "pEqn.H" - } + #include "YEqn.H" + #include "hEqn.H" + #include "pEqn.H" #include "output.H" diff --git a/applications/solvers/combustion/chemFoam/hEqn.H b/applications/solvers/combustion/chemFoam/hEqn.H index 2478e6017c862af347aa97d5daf694e5799b31d4..4dd593ea9ec1431bafe59783e0e4135d36682233 100644 --- a/applications/solvers/combustion/chemFoam/hEqn.H +++ b/applications/solvers/combustion/chemFoam/hEqn.H @@ -9,4 +9,6 @@ { h[0] = h0 + integratedHeat; } + + thermo.correct(); } diff --git a/applications/solvers/combustion/chemFoam/pEqn.H b/applications/solvers/combustion/chemFoam/pEqn.H index 13f3d603ae7375fe6719e3fd0131f3fdad117270..a919ff198c3181364cbbcef70a72d1e7abf105ee 100644 --- a/applications/solvers/combustion/chemFoam/pEqn.H +++ b/applications/solvers/combustion/chemFoam/pEqn.H @@ -1,5 +1,4 @@ { - thermo.correct(); rho = thermo.rho(); if (constProp == "volume") { diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 557017ccad4c7254298b1cc13622623b11d846d0..a0bd72c3b4b73d2d0a28a80acb40f7a95d7ec863 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -60,14 +60,9 @@ int main(int argc, char *argv[]) #include "createFluidMeshes.H" #include "createSolidMeshes.H" - #include "createPorousFluidRegions.H" - #include "createPorousSolidMeshes.H" #include "createFluidFields.H" #include "createSolidFields.H" - #include "createPorousFluidFields.H" - #include "createPorousSolidFields.H" - #include "initContinuityErrs.H" #include "readTimeControls.H" @@ -116,24 +111,6 @@ int main(int argc, char *argv[]) #include "solveFluid.H" } - forAll(porousFluidRegions, i) - { - Info<< "\nSolving for fluid porous region " - << porousFluidRegions[i].name() << endl; - #include "setPorousFluidFields.H" - #include "readPorousFluidRegionPIMPLEControls.H" - #include "solvePorousFluid.H" - } - - forAll(porousSolidRegions, i) - { - Info<< "\nSolving for porous solid region " - << porousSolidRegions[i].name() << endl; - #include "setPorousRegionSolidFields.H" - #include "readPorousSolidMultiRegionPIMPLEControls.H" - #include "solvePorousSolid.H" - } - forAll(solidRegions, i) { Info<< "\nSolving for solid region " diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options index d5c1e47394af7f6b76f040c6455916a661561d92..7418bfd694eb28a52412869885e3df3a350abaae 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options @@ -1,8 +1,7 @@ EXE_INC = \ -Ifluid \ -Isolid \ - -I./porousFluid \ - -I./porousSolid \ + -I../solid \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/cfdTools \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 2f4b801cb398d5002de1ca0ec748199efc80eccf..45861220061db63a2bb6d2fe75671e8addec2b49 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -50,13 +50,9 @@ int main(int argc, char *argv[]) #include "createFluidMeshes.H" #include "createSolidMeshes.H" - #include "createPorousFluidRegions.H" - #include "createPorousSolidMeshes.H" #include "createFluidFields.H" #include "createSolidFields.H" - #include "createPorousFluidFields.H" - #include "createPorousSolidFields.H" #include "initContinuityErrs.H" @@ -74,24 +70,6 @@ int main(int argc, char *argv[]) #include "solveFluid.H" } - forAll(porousFluidRegions, i) - { - Info<< "\nSolving for fluid porous region " - << porousFluidRegions[i].name() << endl; - #include "setPorousFluidFields.H" - #include "readPorousFluidRegionSIMPLEControls.H" - #include "solvePorousFluid.H" - } - - forAll(porousSolidRegions, i) - { - Info<< "\nSolving for porous solid region " - << porousSolidRegions[i].name() << endl; - #include "setPorousRegionSolidFields.H" - #include "readPorousSolidMultiRegionSIMPLEControls.H" - #include "solvePorousSolid.H" - } - forAll(solidRegions, i) { Info<< "\nSolving for solid region " diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/UPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/UPorousFluidEqn.H deleted file mode 100644 index 4c1081f5d49d0ff82145543cd69ccad1fe302452..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/UPorousFluidEqn.H +++ /dev/null @@ -1,11 +0,0 @@ - // Solve the Momentum equation - tmp<fvVectorMatrix> porousUEqn - ( - fvm::div(porousPhi, porousU) - + turbPorous.divDevRhoReff(porousU) - + porousSources(porousRho, porousU) - ); - - porousUEqn().relax(); - - solve(porousUEqn() == -fvc::grad(porousP)); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidFields.H deleted file mode 100644 index 00762909f3f60e2db51259074cd244908964da01..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidFields.H +++ /dev/null @@ -1,181 +0,0 @@ - // Initialise porous field pointer lists - PtrList<rhoThermo> thermoPorous(porousFluidRegions.size()); - PtrList<volScalarField> rhoPorous(porousFluidRegions.size()); - PtrList<volScalarField> kappaPorous(porousFluidRegions.size()); - PtrList<volVectorField> UPorous(porousFluidRegions.size()); - PtrList<surfaceScalarField> phiPorous(porousFluidRegions.size()); - PtrList<compressible::turbulenceModel> turbulencePorous - ( - porousFluidRegions.size() - ); - PtrList<volScalarField> pPorous(porousFluidRegions.size()); - - List<scalar> initialMassFluidPorous(porousFluidRegions.size()); - List<label> pRefCellFluidPorous(porousFluidRegions.size(),0); - List<scalar> pRefValueFluidPorous(porousFluidRegions.size(),0.0); - - PtrList<dimensionedScalar> rhoMaxPorous(fluidRegions.size()); - PtrList<dimensionedScalar> rhoMinPorous(fluidRegions.size()); - - PtrList<IObasicSourceList> heatPorousSources - ( - porousFluidRegions.size() - ); - - forAll(porousFluidRegions, i) - { - Info<< "Reading fluid mesh thermophysical properties for porous " - << porousFluidRegions[i].name() << nl << endl; - - Info<< " Adding to thermoFluid porous\n" << endl; - - thermoPorous.set - ( - i, - rhoThermo::New(porousFluidRegions[i]).ptr() - ); - - Info<< " Adding to rhoPorous\n" << endl; - rhoPorous.set - ( - i, - new volScalarField - ( - IOobject - ( - "rho", - runTime.timeName(), - porousFluidRegions[i], - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermoPorous[i].rho() - ) - ); - - Info<< " Adding to UPorous\n" << endl; - UPorous.set - ( - i, - new volVectorField - ( - IOobject - ( - "U", - runTime.timeName(), - porousFluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousFluidRegions[i] - ) - ); - - Info<< " Adding to phiPorous\n" << endl; - phiPorous.set - ( - i, - new surfaceScalarField - ( - IOobject - ( - "phi", - runTime.timeName(), - porousFluidRegions[i], - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - linearInterpolate(rhoPorous[i]*UPorous[i]) - & porousFluidRegions[i].Sf() - ) - ); - - Info<< " Adding turbulence to porous\n" << endl; - turbulencePorous.set - ( - i, - compressible::turbulenceModel::New - ( - rhoPorous[i], - UPorous[i], - phiPorous[i], - thermoPorous[i] - ).ptr() - ); - - Info<< " Adding to kappaFluid\n" << endl; - kappaPorous.set - ( - i, - new volScalarField - ( - IOobject - ( - "kappaPorous", - runTime.timeName(), - porousFluidRegions[i], - IOobject::NO_READ, - IOobject::NO_WRITE - ), - thermoPorous[i].Cp()*thermoPorous[i].alpha() - ) - ); - - pPorous.set - ( - i, - new volScalarField - ( - IOobject - ( - "p", - runTime.timeName(), - porousFluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousFluidRegions[i] - ) - ); - - setRefCell - ( - thermoPorous[i].p(), - pPorous[i], - porousFluidRegions[i].solutionDict().subDict("SIMPLE"), - pRefCellFluidPorous[i], - pRefValueFluidPorous[i] - ); - - rhoMaxPorous.set - ( - i, - new dimensionedScalar - ( - porousFluidRegions[i].solutionDict().subDict("SIMPLE").lookup - ( - "rhoMax" - ) - ) - ); - - rhoMinPorous.set - ( - i, - new dimensionedScalar - ( - porousFluidRegions[i].solutionDict().subDict("SIMPLE").lookup - ( - "rhoMin" - ) - ) - ); - - heatPorousSources.set - ( - i, - new IObasicSourceList(porousFluidRegions[i]) - ); - } - - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidRegions.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidRegions.H deleted file mode 100644 index a414d8a9724f85d9d29f85b8b0e43554763e9c04..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/createPorousFluidRegions.H +++ /dev/null @@ -1,25 +0,0 @@ - const wordList porousFluidNames(rp["porousFluid"]); - - PtrList<fvMesh> porousFluidRegions(porousFluidNames.size()); - - forAll (porousFluidNames, iPorous) - { - const word porousFluidName = porousFluidNames[iPorous]; - Info<< "Create porous fluid region " << porousFluidName - << nl << endl; - - porousFluidRegions.set - ( - iPorous, - new fvMesh - ( - IOobject - ( - porousFluidName, - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/hPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/hPorousFluidEqn.H deleted file mode 100644 index fcc8b054a2e658615090961e7a94ae6628ddebd3..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/hPorousFluidEqn.H +++ /dev/null @@ -1,19 +0,0 @@ -{ - fvScalarMatrix hPorousEqn - ( - fvm::div(porousPhi, porousH) - - fvm::laplacian(turbPorous.alphaEff(), porousH) - == - - fvc::div(porousPhi, 0.5*magSqr(porousU), "div(phi,K)") - + porousSources(porousRho, porousH) - ); - - hPorousEqn.relax(); - hPorousEqn.solve(); - - porousThermo.correct(); - - Info<< "Min/max in the porous T:" - << min(porousThermo.T()).value() << ' ' - << max(porousThermo.T()).value() << endl; -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/pPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/pPorousFluidEqn.H deleted file mode 100644 index 9051805b87d2ef3ac383200a1d7940fcd800f4cc..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/pPorousFluidEqn.H +++ /dev/null @@ -1,53 +0,0 @@ -porousRho = porousThermo.rho(); -porousRho = max(porousRho, rhoMin); -porousRho = min(porousRho, rhoMax); -porousRho.relax(); - -volScalarField rAUPorous(1.0/porousUEqn().A()); - -porousU = rAUPorous*porousUEqn().H(); -porousUEqn.clear(); - -bool closedVolume = false; - -porousPhi = - fvc::interpolate(porousRho) - *(fvc::interpolate(porousU) & porousMesh.Sf()); - -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) -{ - fvScalarMatrix pEqn - ( - fvm::laplacian(porousRho*rAUPorous, porousP) == fvc::div(porousPhi) - ); - - pEqn.setReference(pRefCell, pRefValue); - - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - porousPhi -= pEqn.flux(); - - } -} - -porousP.relax(); - -porousU -= rAUPorous*fvc::grad(porousP); -porousU.correctBoundaryConditions(); - -if (closedVolume) -{ - porousP += (initialMass - fvc::domainIntegrate(porousPsi*porousP)) - /fvc::domainIntegrate(porousPsi); -} - -porousRho = porousThermo.rho(); -porousRho = max(porousRho, rhoMin); -porousRho = min(porousRho, rhoMax); -porousRho.relax(); - -Info<< "rho max/min : " - << max(porousRho).value() << " " - << min(porousRho).value() << endl; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/readPorousFluidRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/readPorousFluidRegionSIMPLEControls.H deleted file mode 100644 index 615524b0755d5a189ca78a8b88cf5c95a397b957..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/readPorousFluidRegionSIMPLEControls.H +++ /dev/null @@ -1,4 +0,0 @@ - const dictionary& simple = porousMesh.solutionDict().subDict("SIMPLE"); - - const int nNonOrthCorr = - simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/setPorousFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/setPorousFluidFields.H deleted file mode 100644 index 5b3d004372aacaa62c65a0c8c2b7678385cf187b..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/setPorousFluidFields.H +++ /dev/null @@ -1,28 +0,0 @@ - const fvMesh& porousMesh = porousFluidRegions[i]; - - rhoThermo& porousThermo = thermoPorous[i]; - volScalarField& porousRho = rhoPorous[i]; - - volVectorField& porousU = UPorous[i]; - surfaceScalarField& porousPhi = phiPorous[i]; - - compressible::turbulenceModel& turbPorous = turbulencePorous[i]; - - volScalarField& porousP = porousThermo.p(); - const volScalarField& porousPsi = porousThermo.psi(); - volScalarField& porousH = porousThermo.he(); - - const dimensionedScalar initialMass - ( - "initialMass", - dimMass, - initialMassFluidPorous[i] - ); - - IObasicSourceList& porousSources = heatPorousSources[i]; - - const label pRefCell = pRefCellFluidPorous[i]; - const scalar pRefValue = pRefValueFluidPorous[i]; - - const scalar rhoMax = rhoMaxPorous[i].value(); - const scalar rhoMin = rhoMinPorous[i].value(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/solvePorousFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/solvePorousFluid.H deleted file mode 100644 index 635b3ef1546746463e6949fde0a6fb1235cfefee..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousFluid/solvePorousFluid.H +++ /dev/null @@ -1,11 +0,0 @@ -// Pressure-velocity SIMPLE corrector - - porousP.storePrevIter(); - porousRho.storePrevIter(); - { - #include "UPorousFluidEqn.H" - #include "hPorousFluidEqn.H" - #include "pPorousFluidEqn.H" - } - - turbPorous.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidFields.H deleted file mode 100644 index ab7ed2493565f77f0f262485bd8bbad4f759e122..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidFields.H +++ /dev/null @@ -1,43 +0,0 @@ - // Initialise solid field pointer lists - PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size()); - PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size()); - PtrList<volScalarField> betavSolid(porousSolidRegions.size()); - - // Populate solid field pointer lists - forAll(porousSolidRegions, i) - { - Info<< "*** Reading porous solid mesh thermophysical " - << "properties for region " - << porousSolidRegions[i].name() << nl << endl; - - Info<< " Adding to thermos\n" << endl; - porousSolidThermos.set - ( - i, - solidThermo::New(porousSolidRegions[i]) - ); - Info<< " Adding sources\n" << endl; - solidHeatSources.set - ( - i, - new IObasicSourceList(porousSolidRegions[i]) - ); - - Info<< " Adding to betavSolid\n" << endl; - betavSolid.set - ( - i, - new volScalarField - ( - IOobject - ( - "betavSolid", - runTime.timeName(), - porousSolidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousSolidRegions[i] - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidMeshes.H deleted file mode 100644 index fa61f55af4f0ca9f1a4a2949a241090fc9e4f872..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/createPorousSolidMeshes.H +++ /dev/null @@ -1,24 +0,0 @@ - const wordList porousSolidNames(rp["porousSolid"]); - - PtrList<fvMesh> porousSolidRegions(porousSolidNames.size()); - - forAll(porousSolidNames, i) - { - Info<< "Create solid mesh for region " << porousSolidNames[i] - << " for time = " << runTime.timeName() << nl << endl; - - porousSolidRegions.set - ( - i, - new fvMesh - ( - IOobject - ( - porousSolidNames[i], - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/readPorousSolidMultiRegionSIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/readPorousSolidMultiRegionSIMPLEControls.H deleted file mode 100644 index 4255ceb03341034f92618724e0d99903a87cdf0f..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/readPorousSolidMultiRegionSIMPLEControls.H +++ /dev/null @@ -1,4 +0,0 @@ - const dictionary& simple = mesh.solutionDict().subDict("SIMPLE"); - - const int nNonOrthCorr = - simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/setPorousRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/setPorousRegionSolidFields.H deleted file mode 100644 index 93378bed004983a2f8bfbc772c0e8386f5756def..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/setPorousRegionSolidFields.H +++ /dev/null @@ -1,23 +0,0 @@ - const fvMesh& mesh = porousSolidRegions[i]; - - solidThermo& thermo = porousSolidThermos[i]; - const volScalarField& betav = betavSolid[i]; - - tmp<volScalarField> trho = thermo.rho(); - const volScalarField& rho = trho(); - - tmp<volScalarField> tcp = thermo.Cp(); - const volScalarField& cp = tcp(); - - tmp<volScalarField> tkappa = thermo.kappa(); - //tmp<volSymmTensorField> tkappa = thermo.directionalKappa()*betav; - - const volScalarField& kappa = tkappa(); - //const volSymmTensorField& K = tK(); - - tmp<volScalarField> talpha = thermo.alpha(); - const volScalarField& alpha = talpha(); - - volScalarField& h = thermo.he(); - - IObasicSourceList& sources = solidHeatSources[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solidPorousRegionDiffusionNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solidPorousRegionDiffusionNo.H deleted file mode 100644 index 77dc6f04bf44ba748359c2f8bf3267307416b650..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solidPorousRegionDiffusionNo.H +++ /dev/null @@ -1,18 +0,0 @@ - scalar DiNum = -GREAT; - - forAll(solidRegions, i) - { -# include "setRegionSolidFields.H" - - DiNum = max - ( - solidRegionDiffNo - ( - solidRegions[i], - runTime, - rho*cp, - K - ), - DiNum - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solvePorousSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solvePorousSolid.H deleted file mode 100644 index 6546d4235d194a206b7ee3e93fc32501df2535dd..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/porousSolid/solvePorousSolid.H +++ /dev/null @@ -1,17 +0,0 @@ -{ - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - tmp<fvScalarMatrix> hEqn - ( - - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") - + sources(rho, h) - ); - - hEqn().relax(); - hEqn().solve(); - } -} - -thermo.correct(); - -Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidFields.H deleted file mode 100644 index b435b88d7fc2c52f65a7c0793e2c9d800c760b12..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidFields.H +++ /dev/null @@ -1,20 +0,0 @@ - // Initialise solid field pointer lists - PtrList<solidThermo> thermos(solidRegions.size()); - PtrList<radiation::radiationModel> radiations(solidRegions.size()); - - // Populate solid field pointer lists - forAll(solidRegions, i) - { - Info<< "*** Reading solid mesh thermophysical properties for region " - << solidRegions[i].name() << nl << endl; - - Info<< " Adding to thermos\n" << endl; - thermos.set - ( - i, - solidThermo::New(solidRegions[i]) - ); - - Info<< " Adding to radiations\n" << endl; - radiations.set(i, radiation::radiationModel::New(thermos[i].T())); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidMeshes.H deleted file mode 100644 index f2f2eea5ae8e2e33254d7d935fc027a91ffaa510..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/createSolidMeshes.H +++ /dev/null @@ -1,24 +0,0 @@ - const wordList solidsNames(rp["solid"]); - - PtrList<fvMesh> solidRegions(solidsNames.size()); - - forAll(solidsNames, i) - { - Info<< "Create solid mesh for region " << solidsNames[i] - << " for time = " << runTime.timeName() << nl << endl; - - solidRegions.set - ( - i, - new fvMesh - ( - IOobject - ( - solidsNames[i], - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H deleted file mode 100644 index 78c937d29e18a1d2c50604a659ff3fe9ce3a7da4..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H +++ /dev/null @@ -1,18 +0,0 @@ - fvMesh& mesh = solidRegions[i]; - solidThermo& thermo = thermos[i]; - const radiation::radiationModel& radiation = radiations[i]; - - tmp<volScalarField> trho = thermo.rho(); - const volScalarField& rho = trho(); - - tmp<volScalarField> tcp = thermo.Cp(); - const volScalarField& cp = tcp(); - - tmp<volScalarField> tkappa = thermo.kappa(); - //tmp<volSymmTensorField> tkappa = thermo.directionalkappa(); - const volScalarField& kappa = tkappa(); - - tmp<volScalarField> talpha = thermo.alpha(); - const volScalarField& alpha = talpha(); - - volScalarField& h = thermo.he(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H index bbbe98ca9ce55a2093257d6bb51345013f1c3fbd..a0905d3e4fd9802351c800ae4b96ae52d70885c1 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H @@ -3,7 +3,8 @@ { fvScalarMatrix hEqn ( - -fvm::laplacian(alpha, h) + - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") + + sources(rho, h) ); hEqn.relax(); hEqn.solve(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H index 313a11a9c99fa9a8a045524a25963d320c312bdb..fa5feefbb4beba6e440298d46723e06734d8f0c0 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleMultiRegionCourantNo.H @@ -14,7 +14,7 @@ CoNum ); } - +/* forAll (porousFluidRegions, porousI) { CoNum = max @@ -29,3 +29,4 @@ CoNum ); } +*/ \ No newline at end of file diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/UPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/UPorousFluidEqn.H deleted file mode 100644 index 2de604e0b0d5971550c0a82566f20e10e4e10a61..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/UPorousFluidEqn.H +++ /dev/null @@ -1,24 +0,0 @@ - -// Solve the Momentum equation - tmp<fvVectorMatrix> porousUEqn - ( - fvm::ddt(porousRho, porousU) - + fvm::div(porousPhi, porousU) - + turbPorous.divDevRhoReff(porousU) - + porousSources(porousRho, porousU) - ); - - porousUEqn().relax(); - - volScalarField rAUPorous(1.0/porousUEqn().A()); - - if (momentumPredictor) - { - solve(porousUEqn() == -fvc::grad(porousP)); - } - else - { - porousU = rAUPorous*(porousUEqn().H() - fvc::grad(porousP)); - porousU.correctBoundaryConditions(); - } - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidFields.H deleted file mode 100644 index 7880fe21ba90be820f519a440b8d91f70f49e83b..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidFields.H +++ /dev/null @@ -1,147 +0,0 @@ - // Initialise porous field pointer lists - PtrList<rhoThermo> thermoPorous(porousFluidRegions.size()); - PtrList<volScalarField> rhoPorous(porousFluidRegions.size()); - PtrList<volVectorField> UPorous(porousFluidRegions.size()); - PtrList<surfaceScalarField> phiPorous(porousFluidRegions.size()); - PtrList<volScalarField> KPorous(porousFluidRegions.size()); - PtrList<volScalarField> dpdtPorous(fluidRegions.size()); - - PtrList<compressible::turbulenceModel> turbulencePorous - ( - porousFluidRegions.size() - ); - PtrList<volScalarField> pPorous(porousFluidRegions.size()); - - PtrList<IObasicSourceList> heatPorousSources - ( - porousFluidRegions.size() - ); - - forAll(porousFluidRegions, i) - { - Info<< "Reading fluid mesh thermophysical properties for porous " - << porousFluidRegions[i].name() << nl << endl; - - Info<< " Adding to thermoFluid porous\n" << endl; - - thermoPorous.set - ( - i, - rhoThermo::New(porousFluidRegions[i]).ptr() - ); - - Info<< " Adding to rhoPorous\n" << endl; - rhoPorous.set - ( - i, - new volScalarField - ( - IOobject - ( - "rho", - runTime.timeName(), - porousFluidRegions[i], - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermoPorous[i].rho() - ) - ); - - Info<< " Adding to UPorous\n" << endl; - UPorous.set - ( - i, - new volVectorField - ( - IOobject - ( - "U", - runTime.timeName(), - porousFluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousFluidRegions[i] - ) - ); - - Info<< " Adding to phiPorous\n" << endl; - phiPorous.set - ( - i, - new surfaceScalarField - ( - IOobject - ( - "phi", - runTime.timeName(), - porousFluidRegions[i], - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - linearInterpolate(rhoPorous[i]*UPorous[i]) - & porousFluidRegions[i].Sf() - ) - ); - - Info<< " Adding turbulence to porous\n" << endl; - turbulencePorous.set - ( - i, - compressible::turbulenceModel::New - ( - rhoPorous[i], - UPorous[i], - phiPorous[i], - thermoPorous[i] - ).ptr() - ); - - Info<< " Adding to KPorous\n" << endl; - KPorous.set - ( - i, - new volScalarField - ( - "KPorous", - 0.5*magSqr(UPorous[i]) - ) - ); - - Info<< " Adding to dpdtPorous\n" << endl; - dpdtPorous.set - ( - i, - new volScalarField - ( - "dpdtPorous", - fvc::ddt(thermoPorous[i].p()) - ) - ); - - pPorous.set - ( - i, - new volScalarField - ( - IOobject - ( - "p", - runTime.timeName(), - porousFluidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousFluidRegions[i] - ) - ); - - heatPorousSources.set - ( - i, - new IObasicSourceList(porousFluidRegions[i]) - ); - } - - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidRegions.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidRegions.H deleted file mode 100644 index a414d8a9724f85d9d29f85b8b0e43554763e9c04..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/createPorousFluidRegions.H +++ /dev/null @@ -1,25 +0,0 @@ - const wordList porousFluidNames(rp["porousFluid"]); - - PtrList<fvMesh> porousFluidRegions(porousFluidNames.size()); - - forAll (porousFluidNames, iPorous) - { - const word porousFluidName = porousFluidNames[iPorous]; - Info<< "Create porous fluid region " << porousFluidName - << nl << endl; - - porousFluidRegions.set - ( - iPorous, - new fvMesh - ( - IOobject - ( - porousFluidName, - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/hPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/hPorousFluidEqn.H deleted file mode 100644 index 6bf056496697f28b3e4e44d36e651fb07ace74b8..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/hPorousFluidEqn.H +++ /dev/null @@ -1,21 +0,0 @@ -{ - fvScalarMatrix hPorousEqn - ( - fvm::ddt(porousRho, porousH) - + fvm::div(porousPhi, porousH) - - fvm::laplacian(turbPorous.alphaEff(), porousH) - == - porousdpdt - - (fvc::ddt(porousRho, porousK) + fvc::div(porousPhi, porousK)) - + porousSources(porousRho, porousH) - ); - - hPorousEqn.relax(); - hPorousEqn.solve(); - - porousThermo.correct(); - - Info<< "Min/max in the porous T:" - << min(porousThermo.T()).value() << ' ' - << max(porousThermo.T()).value() << endl; -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/pPorousFluidEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/pPorousFluidEqn.H deleted file mode 100644 index 4257680be350d8ff36847bdec389acd5c246c04c..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/pPorousFluidEqn.H +++ /dev/null @@ -1,63 +0,0 @@ -porousRho = porousThermo.rho(); - -porousU = rAUPorous*porousUEqn().H(); - -if (nCorr <= 1) -{ - porousUEqn.clear(); -} - -porousPhi = - fvc::interpolate(porousRho)* - ( - (fvc::interpolate(porousU) & porousMesh.Sf()) - + fvc::ddtPhiCorr(rAUPorous, porousRho, porousU, porousPhi) - ); - -for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) -{ - // Pressure corrector - fvScalarMatrix pEqn - ( - fvm::ddt(porousPsi, porousP) - + fvc::div(porousPhi) - - fvm::laplacian(porousRho*rAUPorous, porousP) - ); - - pEqn.solve - ( - porousMesh.solver - ( - porousP.select - ( - oCorr == nOuterCorr-1 - && corr == nCorr-1 - && nonOrth == nNonOrthCorr - ) - ) - ); - - if (nonOrth == nNonOrthCorr) - { - porousPhi += pEqn.flux(); - } -} - -solve(fvm::ddt(porousRho) + fvc::div(porousPhi)); - -// Explicitly relax pressure for momentum corrector -porousP.relax(); - -// Recalculate density from the relaxed pressure -porousRho = porousThermo.rho(); - - -porousU -= rAUPorous*fvc::grad(porousP); -porousU.correctBoundaryConditions(); -porousK = 0.5*magSqr(porousU); - -// Update pressure time derivative if needed -if (porousThermo.dpdt()) -{ - porousdpdt = fvc::ddt(porousP); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/readPorousFluidRegionPIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/readPorousFluidRegionPIMPLEControls.H deleted file mode 100644 index 395ee383eb2613a95b8cddd9332466933edf21c5..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/readPorousFluidRegionPIMPLEControls.H +++ /dev/null @@ -1,11 +0,0 @@ - const dictionary& pimple = porousMesh.solutionDict().subDict("PIMPLE"); - - const int nCorr = - pimple.lookupOrDefault<int>("nCorrectors", 1); - - const int nNonOrthCorr = - pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0); - - const bool momentumPredictor = - pimple.lookupOrDefault("momentumPredictor", true); - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/setPorousFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/setPorousFluidFields.H deleted file mode 100644 index 36b7b231ffbae7d17037a82a3ec9f700d44730e9..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/setPorousFluidFields.H +++ /dev/null @@ -1,17 +0,0 @@ - fvMesh& porousMesh = porousFluidRegions[i]; - - rhoThermo& porousThermo = thermoPorous[i]; - volScalarField& porousRho = rhoPorous[i]; - - volVectorField& porousU = UPorous[i]; - surfaceScalarField& porousPhi = phiPorous[i]; - - compressible::turbulenceModel& turbPorous = turbulencePorous[i]; - volScalarField& porousK = KPorous[i]; - volScalarField& porousdpdt = dpdtPorous[i]; - - volScalarField& porousP = porousThermo.p(); - const volScalarField& porousPsi = porousThermo.psi(); - volScalarField& porousH = porousThermo.he(); - - IObasicSourceList& porousSources = heatPorousSources[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/solvePorousFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/solvePorousFluid.H deleted file mode 100644 index d0f9168b86e22958717686a08eb5fc59007853fd..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousFluid/solvePorousFluid.H +++ /dev/null @@ -1,28 +0,0 @@ -if (finalIter) -{ - porousMesh.data::add("finalIteration", true); -} - -if (oCorr == 0) -{ - solve(fvm::ddt(porousRho) + fvc::div(porousPhi)); -} - -#include "UPorousFluidEqn.H" - -#include "hPorousFluidEqn.H" - -// --- PISO loop -for (int corr=0; corr<nCorr; corr++) -{ - #include "pPorousFluidEqn.H" -} - -turbPorous.correct(); - -porousRho = porousThermo.rho(); - -if (finalIter) -{ - porousMesh.data::remove("finalIteration"); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidFields.H deleted file mode 100644 index ab7ed2493565f77f0f262485bd8bbad4f759e122..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidFields.H +++ /dev/null @@ -1,43 +0,0 @@ - // Initialise solid field pointer lists - PtrList<solidThermo> porousSolidThermos(porousSolidRegions.size()); - PtrList<IObasicSourceList> solidHeatSources(porousSolidRegions.size()); - PtrList<volScalarField> betavSolid(porousSolidRegions.size()); - - // Populate solid field pointer lists - forAll(porousSolidRegions, i) - { - Info<< "*** Reading porous solid mesh thermophysical " - << "properties for region " - << porousSolidRegions[i].name() << nl << endl; - - Info<< " Adding to thermos\n" << endl; - porousSolidThermos.set - ( - i, - solidThermo::New(porousSolidRegions[i]) - ); - Info<< " Adding sources\n" << endl; - solidHeatSources.set - ( - i, - new IObasicSourceList(porousSolidRegions[i]) - ); - - Info<< " Adding to betavSolid\n" << endl; - betavSolid.set - ( - i, - new volScalarField - ( - IOobject - ( - "betavSolid", - runTime.timeName(), - porousSolidRegions[i], - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - porousSolidRegions[i] - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidMeshes.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidMeshes.H deleted file mode 100644 index fa61f55af4f0ca9f1a4a2949a241090fc9e4f872..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/createPorousSolidMeshes.H +++ /dev/null @@ -1,24 +0,0 @@ - const wordList porousSolidNames(rp["porousSolid"]); - - PtrList<fvMesh> porousSolidRegions(porousSolidNames.size()); - - forAll(porousSolidNames, i) - { - Info<< "Create solid mesh for region " << porousSolidNames[i] - << " for time = " << runTime.timeName() << nl << endl; - - porousSolidRegions.set - ( - i, - new fvMesh - ( - IOobject - ( - porousSolidNames[i], - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/readPorousSolidMultiRegionPIMPLEControls.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/readPorousSolidMultiRegionPIMPLEControls.H deleted file mode 100644 index e23883c5fae11f298e0459feaacacc4c73af8dbe..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/readPorousSolidMultiRegionPIMPLEControls.H +++ /dev/null @@ -1,4 +0,0 @@ - const dictionary& pimple = mesh.solutionDict().subDict("PIMPLE"); - - int nNonOrthCorr = - pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/setPorousRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/setPorousRegionSolidFields.H deleted file mode 100644 index 6a61baae02983ef7743404e170c04604d800172a..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/setPorousRegionSolidFields.H +++ /dev/null @@ -1,26 +0,0 @@ - fvMesh& mesh = porousSolidRegions[i]; - - solidThermo& thermo = porousSolidThermos[i]; - const volScalarField& betav = betavSolid[i]; - - tmp<volScalarField> trho = thermo.rho(); - const volScalarField& rho = trho(); - - tmp<volScalarField> tcp = thermo.Cp(); - const volScalarField& cp = tcp(); - - tmp<volScalarField> tkappa = thermo.kappa(); - //tmp<volSymmTensorField> tkappa = thermo.directionalKappa()*betav; - - const volScalarField& kappa = tkappa(); - //const volSymmTensorField& K = tK(); - - //tmp<volScalarField> trhoCp = cp*rho; - //const volScalarField& rhoCp = trhoCp(); - - tmp<volScalarField> talpha = thermo.alpha(); - const volScalarField& alpha = talpha(); - - volScalarField& h = thermo.he(); - - IObasicSourceList& sources = solidHeatSources[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solidPorousRegionDiffusionNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solidPorousRegionDiffusionNo.H deleted file mode 100644 index 77dc6f04bf44ba748359c2f8bf3267307416b650..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solidPorousRegionDiffusionNo.H +++ /dev/null @@ -1,18 +0,0 @@ - scalar DiNum = -GREAT; - - forAll(solidRegions, i) - { -# include "setRegionSolidFields.H" - - DiNum = max - ( - solidRegionDiffNo - ( - solidRegions[i], - runTime, - rho*cp, - K - ), - DiNum - ); - } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solvePorousSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solvePorousSolid.H deleted file mode 100644 index 4a0b390555fa8ce29fb619e14bd011eb804e9cda..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/porousSolid/solvePorousSolid.H +++ /dev/null @@ -1,28 +0,0 @@ -if (finalIter) -{ - mesh.data::add("finalIteration", true); -} - -{ - for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) - { - tmp<fvScalarMatrix> hEqn - ( - fvm::ddt(betav*rho, h) - - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") - + sources(rho, h) - ); - - hEqn().relax(); - hEqn().solve(mesh.solver(h.select(finalIter))); - } -} - -thermo.correct(); - -Info<< "Min/max T:" << min(thermo.T()) << ' ' << max(thermo.T()) << endl; - -if (finalIter) -{ - mesh.data::remove("finalIteration"); -} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H index 2a543a4d6f121f078644362952aca39fe70ac6ea..8edfe413bbb0d5f62af0361915b7d565871d1c10 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H @@ -1,6 +1,8 @@ // Initialise solid field pointer lists PtrList<solidThermo> thermos(solidRegions.size()); PtrList<radiation::radiationModel> radiations(solidRegions.size()); + PtrList<IObasicSourceList> solidHeatSources(solidRegions.size()); + PtrList<volScalarField> betavSolid(solidRegions.size()); // Populate solid field pointer lists forAll(solidRegions, i) @@ -13,4 +15,49 @@ Info<< " Adding to radiations\n" << endl; radiations.set(i, radiation::radiationModel::New(thermos[i].T())); + + Info<< " Adding sources\n" << endl; + solidHeatSources.set + ( + i, + new IObasicSourceList(solidRegions[i]) + ); + + IOobject betavSolidIO + ( + "betavSolid", + runTime.timeName(), + solidRegions[i], + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ); + + if (betavSolidIO.headerOk()) + { + betavSolid.set + ( + i, + new volScalarField(betavSolidIO, solidRegions[i]) + ); + } + else + { + betavSolid.set + ( + i, + new volScalarField + ( + IOobject + ( + "betavSolid", + runTime.timeName(), + solidRegions[i], + IOobject::NO_READ, + IOobject::NO_WRITE + ), + solidRegions[i], + dimensionedScalar("1", dimless, scalar(1.0)) + ) + ); + } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index 788383e5ecbe6d6ddb897eb0c53a04217a482d40..7e95615b14e17b0aa8eca100d6e7b412efb73235 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -14,3 +14,7 @@ const volScalarField& kappa = tkappa(); volScalarField& h = thermo.he(); + + const volScalarField& betav = betavSolid[i]; + + IObasicSourceList& sources = solidHeatSources[i]; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 007be97b891219d9bfe836adff424deb56e9419c..a04750cf17ac37a98c582ff3fd3a5ea8a103944e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -8,8 +8,9 @@ if (finalIter) { tmp<fvScalarMatrix> hEqn ( - fvm::ddt(rho, h) - - fvm::laplacian(alpha, h) + fvm::ddt(betav*rho, h) + - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") + + sources(rho, h) ); hEqn().relax(); hEqn().solve(mesh.solver(h.select(finalIter))); diff --git a/applications/test/thermoMixture/Make/files b/applications/test/thermoMixture/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..ffef7378665cd74330018264bc677108eeafc167 --- /dev/null +++ b/applications/test/thermoMixture/Make/files @@ -0,0 +1,3 @@ +Test-thermoMixture.C + +EXE = $(FOAM_USER_APPBIN)/Test-thermoMixture diff --git a/applications/test/thermoMixture/Make/options b/applications/test/thermoMixture/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..98bf79aaa43cfb1f965a7c6477a54d0db7c645a4 --- /dev/null +++ b/applications/test/thermoMixture/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + +EXE_LIBS = \ + -lspecie diff --git a/src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.C b/applications/test/thermoMixture/Test-thermoMixture.C similarity index 53% rename from src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.C rename to applications/test/thermoMixture/Test-thermoMixture.C index f9ea16c03bdd6986c8d99e89bb8403f3bd2d12fa..1a2883cb0acfa6ad58145d54c1cda2b2d4b61202 100644 --- a/src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.C +++ b/applications/test/thermoMixture/Test-thermoMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,48 +21,59 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. +Application + ThermoMixture + +Description + \*---------------------------------------------------------------------------*/ -#include "pureSolidMixture.H" -#include "fvMesh.H" +#include "dictionary.H" +#include "IFstream.H" +#include "specie.H" +#include "perfectGas.H" +#include "hConstThermo.H" +#include "sensibleEnthalpy.H" +#include "thermo.H" +#include "constTransport.H" + +using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: -namespace Foam +int main(int argc, char *argv[]) { + typedef constTransport + < + species::thermo + < + hConstThermo<perfectGas<specie> >, + sensibleEnthalpy + > + > ThermoType; -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + dictionary dict(IFstream("thermoDict")()); -template<class ThermoType> -pureSolidMixture<ThermoType>::pureSolidMixture -( - const dictionary& thermoDict, - const fvMesh& mesh -) -: - basicMixture(thermoDict, mesh), - mixture_(thermoDict.subDict("mixture")) -{} + ThermoType t1(dict.subDict("specie1")); + ThermoType t2(dict.subDict("specie2")); + Info<< "Checking Cp of mixture of hConstThermo" << endl; -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + Info<< "W 1, 2, (1 + 2) = " << t1.W() << " " << t2.W() << " " + << (t1 + t2).W() << endl; -template<class ThermoType> -pureSolidMixture<ThermoType>::~pureSolidMixture() -{} + Info<< "Cp 1, 2, 1 + 2 = " << t1.cp(1, 1) << " " << t2.cp(1, 1) << " " + << (t1 + t2).cp(1, 1) << endl; + ThermoType t3(t1); + t3 += t2; + Info<< "Cp (1 += 2) = " << t3.cp(1, 1) << endl; -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + Info<< "\nEnd\n" << endl; -template<class ThermoType> -void pureSolidMixture<ThermoType>::read(const dictionary& thermoDict) -{ - mixture_ = ThermoType(thermoDict.subDict("mixture")); + return 0; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/test/thermoMixture/thermoDict b/applications/test/thermoMixture/thermoDict new file mode 100644 index 0000000000000000000000000000000000000000..426ae0a9f37779ec9f162a2738ac3899b0477e87 --- /dev/null +++ b/applications/test/thermoMixture/thermoDict @@ -0,0 +1,43 @@ +specie1 +{ + specie + { + nMoles 1; + molWeight 1; + } + + thermodynamics + { + Cp 1; + Cv 1; + Hf 0; + } + + transport + { + mu 1; + Pr 1; + } +} + +specie2 +{ + specie + { + nMoles 1; + molWeight 0.5; + } + + thermodynamics + { + Cp 2; + Cv 2; + Hf 0; + } + + transport + { + mu 1; + Pr 1; + } +} diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index f0cc40a8e4867cc7d1de6408832d6360006e9985..050204d8a8718a798f844e14f98b2344ade54800 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -96,20 +96,29 @@ castellatedMeshControls // refinement. nCellsBetweenLevels 1; + // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by explicitly provided // edges. // This is a featureEdgeMesh, read from constant/triSurface for now. + // Specify 'levels' in the same way as the 'distance' mode in the + // refinementRegions (see below). The old specification + // level 2; + // is equivalent to + // levels ((0 2)); + features ( //{ // file "someLine.eMesh"; - // level 2; + // //level 2; + // levels ((0.0 2) (1.0 3)); //} ); + // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -178,7 +187,7 @@ castellatedMeshControls // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in - // descending order. + // increasing order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. @@ -217,37 +226,37 @@ castellatedMeshControls // Settings for the snapping. snapControls { - //- Number of patch smoothing iterations before finding correspondence - // to surface + // Number of patch smoothing iterations before finding correspondence + // to surface nSmoothPatch 3; - //- Maximum relative distance for points to be attracted by surface. - // True distance is this factor times local maximum edge length. + // Maximum relative distance for points to be attracted by surface. + // True distance is this factor times local maximum edge length. // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance) tolerance 2.0; - //- Number of mesh displacement relaxation iterations. + // Number of mesh displacement relaxation iterations. nSolveIter 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Feature snapping - //- Number of feature edge snapping iterations. - // Leave out altogether to disable. + // Number of feature edge snapping iterations. + // Leave out altogether to disable. nFeatureSnapIter 10; - //- Detect (geometric only) features by sampling the surface - // (default=false). + // Detect (geometric only) features by sampling the surface + // (default=false). implicitFeatureSnap false; - //- Use castellatedMeshControls::features (default = true) + // Use castellatedMeshControls::features (default = true) explicitFeatureSnap true; - //- Detect features between multiple surfaces - // (only for explicitFeatureSnap, default = false) + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) multiRegionFeatureSnap false; } @@ -258,9 +267,43 @@ addLayersControls // size of the refined cell outside layer (true) or absolute sizes (false). relativeSizes true; + // Layer thickness specification. This can be specified in one of four ways + // - expansionRatio and finalLayerThickness (cell nearest internal mesh) + // - expansionRatio and firstLayerThickness (cell on surface) + // - overall thickness and firstLayerThickness + // - overall thickness and finalLayerThickness + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of the layer furthest away from the wall. + // If relativeSizes this is relative to undistorted size of cell + // outside layer. + finalLayerThickness 0.3; + + // Wanted thickness of the layer next to the wall. + // If relativeSizes this is relative to undistorted size of cell + // outside layer. + //firstLayerThickness 0.3; + + // Wanted overall thickness of layers. + // If relativeSizes this is relative to undistorted size of cell + // outside layer. + //thickness 0.5 + + + // Minimum overall thickness of total layers. If for any reason layer + // cannot be above minThickness do not add layer. + // If relativeSizes this is relative to undistorted size of cell + // outside layer.. + minThickness 0.25; + + // Per final patch (so not geometry!) the layer information // Note: This behaviour changed after 21x. Any non-mentioned patches - // now slide unless nSurfaceLayers is explicitly mentioned to be 0. + // now slide unless: + // - nSurfaceLayers is explicitly mentioned to be 0. + // - angle to nearest surface < slipFeatureAngle (see below) layers { sphere.stl_firstSolid @@ -272,9 +315,9 @@ addLayersControls { nSurfaceLayers 1; // Per patch layer data - expansionRatio 1.3; + expansionRatio 1.3; finalLayerThickness 0.3; - minThickness 0.1; + minThickness 0.1; } // Disable any mesh shrinking and layer addition on any point of @@ -285,41 +328,24 @@ addLayersControls } } - // Expansion factor for layer mesh - expansionRatio 1.0; - - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. - finalLayerThickness 0.3; - - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. - // See relativeSizes parameter. - minThickness 0.25; - - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // make straight angle. featureAngle 60; - //- At non-patched sides allow mesh to slip if extrusion direction makes - // angle larger than slipFeatureAngle. + // At non-patched sides allow mesh to slip if extrusion direction makes + // angle larger than slipFeatureAngle. slipFeatureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals @@ -365,51 +391,51 @@ addLayersControls // where to undo. meshQualityControls { - //- Maximum non-orthogonality allowed. Set to 180 to disable. + // Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 65; - //- Max skewness allowed. Set to <0 to disable. + // Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 4; - //- Max concaveness allowed. Is angle (in degrees) below which concavity - // is allowed. 0 is straight face, <0 would be convex face. - // Set to 180 to disable. + // Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. maxConcave 80; - //- Minimum pyramid volume. Is absolute volume of cell pyramid. - // Set to a sensible fraction of the smallest cell volume expected. - // Set to very negative number (e.g. -1E30) to disable. + // Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. minVol 1e-13; - //- Minimum quality of the tet formed by the face-centre - // and variable base point minimum decomposition triangles and - // the cell centre. This has to be a positive number for tracking - // to work. Set to very negative number (e.g. -1E30) to - // disable. - // <0 = inside out tet, - // 0 = flat tet - // 1 = regular tet + // Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. This has to be a positive number for tracking + // to work. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet minTetQuality 1e-9; - //- Minimum face area. Set to <0 to disable. + // Minimum face area. Set to <0 to disable. minArea -1; - //- Minimum face twist. Set to <-1 to disable. dot product of face normal - //- and face centre triangles normal + // Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal minTwist 0.05; - //- minimum normalised cell determinant - //- 1 = hex, <= 0 = folded or flattened illegal cell + // minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; - //- minFaceWeight (0 -> 0.5) + // minFaceWeight (0 -> 0.5) minFaceWeight 0.05; - //- minVolRatio (0 -> 1) + // minVolRatio (0 -> 1) minVolRatio 0.01; - //must be >0 for Fluent compatibility + // must be >0 for Fluent compatibility minTriangleTwist -1; //- if >0 : preserve single cells with all points on the surface if the @@ -420,9 +446,9 @@ meshQualityControls // Advanced - //- Number of error distribution iterations + // Number of error distribution iterations nSmoothScale 4; - //- amount to scale back displacement at error points + // amount to scale back displacement at error points errorReduction 0.75; // Optional : some meshing phases allow usage of relaxed rules. diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 7a9b6f7f0a2bedd8171ec9d1ab172295a5672e5f..58bdc7c59cee694920619d7192288cf813c7fed6 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -90,6 +90,8 @@ fields // uniform: extra number of sampling points // polyLine, cloud: list of coordinates // patchCloud: list of coordinates and set of patches to look for nearest +// patchSeed: random sampling on set of patches. Points slightly off +// face centre. sets ( lineX1 @@ -135,6 +137,15 @@ sets maxDistance 0.1; // maximum distance to search patches (".*Wall.*"); } + + patchSeed + { + patches (".*Wall.*"); + // Number of points to seed. Divided amongst all processors according + // to fraction of patches they hold. + maxPoints 100; + } + ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 2da0382671a24ec3d04a7cbcb87ce9bb2eb4a98a..b08cccbb85c77cc5ccded24f6617f607d82946fc 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -318,7 +318,6 @@ void Foam::autoLayerDriver::handleNonManifolds } } - Info<< "Set displacement to zero for all " << nNonManif << " non-manifold points" << endl; } @@ -443,86 +442,6 @@ void Foam::autoLayerDriver::handleFeatureAngle } -//Foam::tmp<Foam::scalarField> Foam::autoLayerDriver::undistortedEdgeLength -//( -// const indirectPrimitivePatch& pp, -// const bool relativeSizes, -// const bool faceSize -//) -//{ -// const fvMesh& mesh = meshRefiner_.mesh(); -// -// tmp<scalarField> tfld(new scalarField()); -// scalarField& fld = tfld(); -// -// if (faceSize) -// { -// fld.setSize(pp.size()); -// } -// else -// { -// fld.setSize(pp.nPoints()); -// } -// -// -// if (relativeSizes) -// { -// const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength(); -// const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel(); -// -// if (faceSize) -// { -// forAll(pp, i) -// { -// label faceI = pp.addressing()[i]; -// label ownLevel = cellLevel[mesh.faceOwner()[faceI]]; -// fld[i] = edge0Len/(1<<ownLevel); -// } -// } -// else -// { -// // Determine per point the max cell level of connected cells -// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// labelList maxPointLevel(pp.nPoints(), labelMin); -// -// forAll(pp, i) -// { -// label faceI = pp.addressing()[i]; -// label ownLevel = cellLevel[mesh.faceOwner()[faceI]]; -// -// const face& f = pp.localFaces()[i]; -// forAll(f, fp) -// { -// maxPointLevel[f[fp]] = -// max(maxPointLevel[f[fp]], ownLevel); -// } -// } -// -// syncTools::syncPointList -// ( -// mesh, -// pp.meshPoints(), -// maxPointLevel, -// maxEqOp<label>(), -// labelMin // null value -// ); -// -// -// forAll(maxPointLevel, pointI) -// { -// // Find undistorted edge size for this level. -// fld[i] = edge0Len/(1<<maxPointLevel[pointI]); -// } -// } -// } -// else -// { -// // Use actual cell size -// } -//} - - // No extrusion on cells with warped faces. Calculates the thickness of the // layer and compares it to the space the warped face takes up. Disables // extrusion if layer thickness is more than faceRatio of the thickness of @@ -702,7 +621,6 @@ void Foam::autoLayerDriver::handleWarpedFaces //} -// No extrusion on faces with differing number of layers for points void Foam::autoLayerDriver::setNumLayers ( const labelList& patchToNLayers, @@ -865,15 +783,6 @@ Foam::autoLayerDriver::makeLayerDisplacementField } -//Pout<< "*** makeLayerDisplacementField : boundary conditions:" << endl; -//forAll(patchFieldTypes, patchI) -//{ -// Pout<< "\t" << patchI << " name:" << pointPatches[patchI].name() -// << " type:" << patchFieldTypes[patchI] -// << " nLayers:" << numLayers[patchI] -// << endl; -//} - const polyMesh& mesh = pMesh(); // Note: time().timeName() instead of meshRefinement::timeName() since @@ -1053,11 +962,10 @@ void Foam::autoLayerDriver::determineSidePatches patchDict.add("nFaces", 0); patchDict.add("startFace", mesh.nFaces()); - Pout<< "Adding patch " << patchI - << " name:" << name - << " between " << Pstream::myProcNo() - << " and " << nbrProcI - << endl; + //Pout<< "Adding patch " << patchI + // << " name:" << name + // << " between " << Pstream::myProcNo() + // << " and " << nbrProcI << endl; label procPatchI = meshRefiner_.appendPatch ( @@ -1090,12 +998,7 @@ void Foam::autoLayerDriver::calculateLayerThickness ( const indirectPrimitivePatch& pp, const labelList& patchIDs, - const scalarField& patchExpansionRatio, - - const bool relativeSizes, - const scalarField& patchFinalLayerThickness, - const scalarField& patchMinThickness, - + const layerParameters& layerParams, const labelList& cellLevel, const labelList& patchNLayers, const scalar edge0Len, @@ -1111,12 +1014,13 @@ void Foam::autoLayerDriver::calculateLayerThickness // Rework patch-wise layer parameters into minimum per point // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Note: only layer parameters consistent with layer specification + // method (see layerParameters) will be correct. + scalarField firstLayerThickness(pp.nPoints(), GREAT); + scalarField finalLayerThickness(pp.nPoints(), GREAT); + scalarField totalThickness(pp.nPoints(), GREAT); + scalarField expRatio(pp.nPoints(), GREAT); - // Reuse input fields - expansionRatio.setSize(pp.nPoints()); - expansionRatio = GREAT; - thickness.setSize(pp.nPoints()); - thickness = GREAT; minThickness.setSize(pp.nPoints()); minThickness = GREAT; @@ -1130,20 +1034,30 @@ void Foam::autoLayerDriver::calculateLayerThickness { label ppPointI = pp.meshPointMap()[meshPoints[patchPointI]]; - expansionRatio[ppPointI] = min + firstLayerThickness[ppPointI] = min ( - expansionRatio[ppPointI], - patchExpansionRatio[patchI] + firstLayerThickness[ppPointI], + layerParams.firstLayerThickness()[patchI] ); - thickness[ppPointI] = min + finalLayerThickness[ppPointI] = min ( - thickness[ppPointI], - patchFinalLayerThickness[patchI] + finalLayerThickness[ppPointI], + layerParams.finalLayerThickness()[patchI] + ); + totalThickness[ppPointI] = min + ( + totalThickness[ppPointI], + layerParams.thickness()[patchI] + ); + expRatio[ppPointI] = min + ( + expRatio[ppPointI], + layerParams.expansionRatio()[patchI] ); minThickness[ppPointI] = min ( minThickness[ppPointI], - patchMinThickness[patchI] + layerParams.minThickness()[patchI] ); } } @@ -1152,7 +1066,7 @@ void Foam::autoLayerDriver::calculateLayerThickness ( mesh, pp.meshPoints(), - expansionRatio, + firstLayerThickness, minEqOp<scalar>(), GREAT // null value ); @@ -1160,7 +1074,23 @@ void Foam::autoLayerDriver::calculateLayerThickness ( mesh, pp.meshPoints(), - thickness, + finalLayerThickness, + minEqOp<scalar>(), + GREAT // null value + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + totalThickness, + minEqOp<scalar>(), + GREAT // null value + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + expRatio, minEqOp<scalar>(), GREAT // null value ); @@ -1182,14 +1112,18 @@ void Foam::autoLayerDriver::calculateLayerThickness // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // by multiplying with the internal cell size. - if (relativeSizes) + if (layerParams.relativeSizes()) { - if (min(patchMinThickness) < 0 || max(patchMinThickness) > 2) + if + ( + min(layerParams.minThickness()) < 0 + || max(layerParams.minThickness()) > 2 + ) { FatalErrorIn("calculateLayerThickness(..)") << "Thickness should be factor of local undistorted cell size." << " Valid values are [0..2]." << nl - << " minThickness:" << patchMinThickness + << " minThickness:" << layerParams.minThickness() << exit(FatalError); } @@ -1225,38 +1159,114 @@ void Foam::autoLayerDriver::calculateLayerThickness { // Find undistorted edge size for this level. scalar edgeLen = edge0Len/(1<<maxPointLevel[pointI]); - thickness[pointI] *= edgeLen; + firstLayerThickness[pointI] *= edgeLen; + finalLayerThickness[pointI] *= edgeLen; + totalThickness[pointI] *= edgeLen; minThickness[pointI] *= edgeLen; } } - // Rework thickness (of final layer) into overall thickness of all layers - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Rework thickness parameters into overall thickness + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - forAll(thickness, pointI) + forAll(firstLayerThickness, pointI) { - // Calculate layer thickness based on expansion ratio - // and final layer height - if (expansionRatio[pointI] == 1) + thickness[pointI] = layerParams.layerThickness + ( + patchNLayers[pointI], + firstLayerThickness[pointI], + finalLayerThickness[pointI], + totalThickness[pointI], + expRatio[pointI] + ); + + expansionRatio[pointI] = layerParams.layerExpansionRatio + ( + patchNLayers[pointI], + firstLayerThickness[pointI], + finalLayerThickness[pointI], + totalThickness[pointI], + expRatio[pointI] + ); + } + + //Info<< "calculateLayerThickness : min:" << gMin(thickness) + // << " max:" << gMax(thickness) << endl; + + // Print a bit + { + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + // Find maximum length of a patch name, for a nicer output + label maxPatchNameLen = 0; + forAll(patchIDs, i) { - thickness[pointI] *= patchNLayers[pointI]; + label patchI = patchIDs[i]; + word patchName = patches[patchI].name(); + maxPatchNameLen = max(maxPatchNameLen, label(patchName.size())); } - else + + Info<< nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" + << setw(0) << " faces layers avg thickness[m]" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << " " + << setw(0) << " near-wall overall" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "-----" + << setw(0) << " ----- ------ --------- -------" << endl; + + forAll(patchIDs, i) { + label patchI = patchIDs[i]; - scalar invExpansion = 1.0 / expansionRatio[pointI]; - label nLay = patchNLayers[pointI]; - thickness[pointI] *= - (1.0 - pow(invExpansion, nLay)) - / (1.0 - invExpansion); - } - } + const labelList& meshPoints = patches[patchI].meshPoints(); + scalar sumThickness = 0; + scalar sumNearWallThickness = 0; - //Info<< "calculateLayerThickness : min:" << gMin(thickness) - // << " max:" << gMax(thickness) << endl; + forAll(meshPoints, patchPointI) + { + label ppPointI = pp.meshPointMap()[meshPoints[patchPointI]]; + + sumThickness += thickness[ppPointI]; + sumNearWallThickness += layerParams.firstLayerThickness + ( + patchNLayers[ppPointI], + firstLayerThickness[ppPointI], + finalLayerThickness[ppPointI], + thickness[ppPointI], + expansionRatio[ppPointI] + ); + } + + label totNPoints = returnReduce(meshPoints.size(), sumOp<label>()); + + // For empty patches, totNPoints is 0. + scalar avgThickness = 0; + scalar avgNearWallThickness = 0; + + if (totNPoints > 0) + { + avgThickness = + returnReduce(sumThickness, sumOp<scalar>()) + / totNPoints; + avgNearWallThickness = + returnReduce(sumNearWallThickness, sumOp<scalar>()) + / totNPoints; + } + + Info<< setf(ios_base::left) << setw(maxPatchNameLen) + << patches[patchI].name() << setprecision(3) + << " " << setw(8) + << returnReduce(patches[patchI].size(), sumOp<scalar>()) + << " " << setw(6) << layerParams.numLayers()[patchI] + << " " << setw(8) << avgNearWallThickness + << " " << setw(8) << avgThickness + << endl; + } + Info<< endl; + } } @@ -2618,7 +2628,8 @@ void Foam::autoLayerDriver::addLayers const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength(); const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel(); - // Determine (wanted) point-wise layer thickness and expansion ratio + // Determine (wanted) point-wise overall layer thickness and expansion + // ratio scalarField thickness(pp().nPoints()); scalarField minThickness(pp().nPoints()); scalarField expansionRatio(pp().nPoints()); @@ -2626,12 +2637,7 @@ void Foam::autoLayerDriver::addLayers ( pp, meshMover().adaptPatchIDs(), - layerParams.expansionRatio(), - - layerParams.relativeSizes(), // thickness relative to cellsize? - layerParams.finalLayerThickness(), // wanted thicknes - layerParams.minThickness(), // minimum thickness - + layerParams, cellLevel, patchNLayers, edge0Len, @@ -2642,87 +2648,6 @@ void Foam::autoLayerDriver::addLayers ); - // Print a bit - { - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - - // Find maximum length of a patch name, for a nicer output - label maxPatchNameLen = 0; - forAll(meshMover().adaptPatchIDs(), i) - { - label patchI = meshMover().adaptPatchIDs()[i]; - word patchName = patches[patchI].name(); - maxPatchNameLen = max(maxPatchNameLen, label(patchName.size())); - } - - Info<< nl - << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" - << setw(0) << " faces layers avg thickness[m]" << nl - << setf(ios_base::left) << setw(maxPatchNameLen) << " " - << setw(0) << " near-wall overall" << nl - << setf(ios_base::left) << setw(maxPatchNameLen) << "-----" - << setw(0) << " ----- ------ --------- -------" << endl; - - forAll(meshMover().adaptPatchIDs(), i) - { - label patchI = meshMover().adaptPatchIDs()[i]; - - const labelList& meshPoints = patches[patchI].meshPoints(); - - scalar sumThickness = 0; - scalar sumNearWallThickness = 0; - - forAll(meshPoints, patchPointI) - { - label ppPointI = pp().meshPointMap()[meshPoints[patchPointI]]; - - sumThickness += thickness[ppPointI]; - - label nLay = patchNLayers[ppPointI]; - if (nLay > 0) - { - if (expansionRatio[ppPointI] == 1) - { - sumNearWallThickness += thickness[ppPointI]/nLay; - } - else - { - scalar s = - (1.0-pow(expansionRatio[ppPointI], nLay)) - / (1.0-expansionRatio[ppPointI]); - sumNearWallThickness += thickness[ppPointI]/s; - } - } - } - - label totNPoints = returnReduce(meshPoints.size(), sumOp<label>()); - - // For empty patches, totNPoints is 0. - scalar avgThickness = 0; - scalar avgNearWallThickness = 0; - - if (totNPoints > 0) - { - avgThickness = - returnReduce(sumThickness, sumOp<scalar>()) - / totNPoints; - avgNearWallThickness = - returnReduce(sumNearWallThickness, sumOp<scalar>()) - / totNPoints; - } - - Info<< setf(ios_base::left) << setw(maxPatchNameLen) - << patches[patchI].name() << setprecision(3) - << " " << setw(8) - << returnReduce(patches[patchI].size(), sumOp<scalar>()) - << " " << setw(6) << layerParams.numLayers()[patchI] - << " " << setw(8) << avgNearWallThickness - << " " << setw(8) << avgThickness - << endl; - } - Info<< endl; - } - // Calculate wall to medial axis distance for smoothing displacement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2958,8 +2883,8 @@ void Foam::autoLayerDriver::addLayers // Determine per point/per face number of layers to extrude. Also // handles the slow termination of layers when going switching layers - labelList nPatchPointLayers(pp().nPoints(),-1); - labelList nPatchFaceLayers(pp().localFaces().size(),-1); + labelList nPatchPointLayers(pp().nPoints(), -1); + labelList nPatchFaceLayers(pp().size(), -1); setupLayerInfoTruncation ( meshMover(), @@ -2970,31 +2895,22 @@ void Foam::autoLayerDriver::addLayers nPatchFaceLayers ); - // Calculate displacement for first layer for addPatchLayer. - // (first layer = layer of cells next to the original mesh) - vectorField firstDisp(patchNLayers.size(), vector::zero); + // Calculate displacement for final layer for addPatchLayer. + // (layer of cells next to the original mesh) + vectorField finalDisp(patchNLayers.size(), vector::zero); forAll(nPatchPointLayers, i) { - if (nPatchPointLayers[i] > 0) - { - if (expansionRatio[i] == 1.0) - { - firstDisp[i] = patchDisp[i]/nPatchPointLayers[i]; - } - else - { - label nLay = nPatchPointLayers[i]; - scalar h = - pow(expansionRatio[i], nLay - 1) - * (1.0 - expansionRatio[i]) - / (1.0 - pow(expansionRatio[i], nLay)); - firstDisp[i] = h*patchDisp[i]; - } - } + scalar ratio = layerParams.finalLayerThicknessRatio + ( + nPatchPointLayers[i], + expansionRatio[i] + ); + finalDisp[i] = ratio*patchDisp[i]; } - const scalarField invExpansionRatio(1.0 / expansionRatio); + + const scalarField invExpansionRatio(1.0/expansionRatio); // Add topo regardless of whether extrudeStatus is extruderemove. // Not add layer if patchDisp is zero. @@ -3009,7 +2925,7 @@ void Foam::autoLayerDriver::addLayers labelList(0), // exposed patchIDs, not used for adding layers nPatchFaceLayers, // layers per face nPatchPointLayers, // layers per point - firstDisp, // thickness of layer nearest internal mesh + finalDisp, // thickness of layer nearest internal mesh meshMod ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H index f0a2f5d377ddc8ffd13213e30907c1f7ee40a7dc..272f1af09e8fd06083b641412c5fd356377991af 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H @@ -237,12 +237,7 @@ class autoLayerDriver ( const indirectPrimitivePatch& pp, const labelList& patchIDs, - - const scalarField& patchExpansionRatio, - const bool relativeSizes, - const scalarField& patchFinalLayerThickness, - const scalarField& patchMinThickness, - + const layerParameters& layerParams, const labelList& cellLevel, const labelList& patchNLayers, const scalar edge0Len, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 985bcfd103b4289ac77ddff1410c72f66f24eb43..dfd769fd15002f3474084f4c40bcf11733593c88 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -97,6 +97,7 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine refineParams.curvature(), true, // featureRefinement + false, // featureDistanceRefinement false, // internalRefinement false, // surfaceRefinement false, // curvatureRefinement @@ -207,6 +208,7 @@ Foam::label Foam::autoRefineDriver::surfaceOnlyRefine refineParams.curvature(), false, // featureRefinement + false, // featureDistanceRefinement false, // internalRefinement true, // surfaceRefinement true, // curvatureRefinement @@ -368,6 +370,7 @@ Foam::label Foam::autoRefineDriver::shellRefine refineParams.curvature(), false, // featureRefinement + true, // featureDistanceRefinement true, // internalRefinement false, // surfaceRefinement false, // curvatureRefinement diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index e358ba4ffa4d04a5ea96f1571d9286feb790ab31..54a78f477c6a5e7170572da5c8867654c564c543 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -1406,9 +1406,10 @@ void Foam::autoSnapDriver::doSnap adaptPatchIDs ) ); + indirectPrimitivePatch& pp = ppPtr(); // Distance to attract to nearest feature on surface - const scalarField snapDist(calcSnapDistance(snapParams, ppPtr())); + const scalarField snapDist(calcSnapDistance(snapParams, pp)); // Construct iterative mesh mover. @@ -1420,7 +1421,7 @@ void Foam::autoSnapDriver::doSnap motionSmoother meshMover ( mesh, - ppPtr(), + pp, adaptPatchIDs, meshRefinement::makeDisplacementField(pMesh, adaptPatchIDs), motionDict @@ -1475,7 +1476,7 @@ void Foam::autoSnapDriver::doSnap } // Check for displacement being outwards. - outwardsDisplacement(ppPtr(), disp); + outwardsDisplacement(pp, disp); // Set initial distribution of displacement field (on patches) // from patchDisp and make displacement consistent with b.c. @@ -1489,8 +1490,8 @@ void Foam::autoSnapDriver::doSnap ( mesh.time().path() / "patchDisplacement_" + name(iter) + ".obj", - ppPtr().localPoints(), - ppPtr().localPoints() + disp + pp.localPoints(), + pp.localPoints() + disp ); } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index bd5dd86188fa9e64b467d600257b569679e63a77..7cf1e79f6121a963dc5ccdf108ac05e0bd7f75d9 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -141,14 +141,6 @@ class autoSnapDriver vectorField& pointSurfaceNormal, vectorField& pointRotation ) const; - //void calcNearestFace - //( - // const label iter, - // const indirectPrimitivePatch& pp, - // vectorField& faceDisp, - // vectorField& faceSurfaceNormal, - // vectorField& faceRotation - //) const; void calcNearestFace ( const label iter, @@ -158,15 +150,19 @@ class autoSnapDriver labelList& faceSurfaceRegion, vectorField& faceRotation ) const; - void interpolateFaceToPoint + void calcNearestFacePointProperties ( const label iter, const indirectPrimitivePatch& pp, - const List<List<point> >& pointFaceDisp, - const List<List<point> >& pointFaceRotation, - const List<List<point> >& pointFaceCentres, - vectorField& patchDisp - //vectorField& patchRotationDisp + + const vectorField& faceDisp, + const vectorField& faceSurfaceNormal, + const labelList& faceSurfaceRegion, + + List<List<point> >& pointFaceSurfNormals, + List<List<point> >& pointFaceDisp, + List<List<point> >& pointFaceCentres, + List<labelList>& pointFacePatchID ) const; void correctAttraction ( @@ -276,6 +272,7 @@ class autoSnapDriver ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch&, const scalarField&, @@ -339,6 +336,7 @@ class autoSnapDriver ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch& pp, const scalarField& snapDist, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index 8bcd9c6270a22ae42ce171a63d8f50000919204e..f32d9ce4bd3a775e76bac478a361c1a96d6aab16 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -321,7 +321,7 @@ void Foam::autoSnapDriver::calcNearestFace const indirectPrimitivePatch& pp, vectorField& faceDisp, vectorField& faceSurfaceNormal, - labelList& faceSurfaceRegion, + labelList& faceSurfaceGlobalRegion, vectorField& faceRotation ) const { @@ -333,8 +333,8 @@ void Foam::autoSnapDriver::calcNearestFace faceDisp = vector::zero; faceSurfaceNormal.setSize(pp.size()); faceSurfaceNormal = vector::zero; - faceSurfaceRegion.setSize(pp.size()); - faceSurfaceRegion = -1; + faceSurfaceGlobalRegion.setSize(pp.size()); + faceSurfaceGlobalRegion = -1; // Divide surfaces into zoned and unzoned labelList zonedSurfaces = surfaces.getNamedSurfaces(); @@ -419,7 +419,7 @@ void Foam::autoSnapDriver::calcNearestFace label faceI = ppFaces[hitI]; faceDisp[faceI] = hitInfo[hitI].hitPoint() - fc[hitI]; faceSurfaceNormal[faceI] = hitNormal[hitI]; - faceSurfaceRegion[faceI] = surfaces.globalRegion + faceSurfaceGlobalRegion[faceI] = surfaces.globalRegion ( hitSurface[hitI], hitRegion[hitI] @@ -477,7 +477,11 @@ void Foam::autoSnapDriver::calcNearestFace label faceI = ppFaces[hitI]; faceDisp[faceI] = hitInfo[hitI].hitPoint() - fc[hitI]; faceSurfaceNormal[faceI] = hitNormal[hitI]; - faceSurfaceRegion[faceI] = hitRegion[hitI]; + faceSurfaceGlobalRegion[faceI] = surfaces.globalRegion + ( + hitSurface[hitI], + hitRegion[hitI] + ); } } @@ -517,6 +521,169 @@ void Foam::autoSnapDriver::calcNearestFace } +// Collect (possibly remote) per point data of all surrounding faces +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// - faceSurfaceNormal +// - faceDisp +// - faceCentres&faceNormal +void Foam::autoSnapDriver::calcNearestFacePointProperties +( + const label iter, + const indirectPrimitivePatch& pp, + + const vectorField& faceDisp, + const vectorField& faceSurfaceNormal, + const labelList& faceSurfaceGlobalRegion, + + List<List<point> >& pointFaceSurfNormals, + List<List<point> >& pointFaceDisp, + List<List<point> >& pointFaceCentres, + List<labelList>& pointFacePatchID +) const +{ + const fvMesh& mesh = meshRefiner_.mesh(); + + // For now just get all surrounding face data. Expensive - should just + // store and sync data on coupled points only + // (see e.g PatchToolsNormals.C) + + pointFaceSurfNormals.setSize(pp.nPoints()); + pointFaceDisp.setSize(pp.nPoints()); + pointFaceCentres.setSize(pp.nPoints()); + pointFacePatchID.setSize(pp.nPoints()); + + // Fill local data + forAll(pp.pointFaces(), pointI) + { + const labelList& pFaces = pp.pointFaces()[pointI]; + List<point>& pNormals = pointFaceSurfNormals[pointI]; + pNormals.setSize(pFaces.size()); + List<point>& pDisp = pointFaceDisp[pointI]; + pDisp.setSize(pFaces.size()); + List<point>& pFc = pointFaceCentres[pointI]; + pFc.setSize(pFaces.size()); + labelList& pFid = pointFacePatchID[pointI]; + pFid.setSize(pFaces.size()); + + forAll(pFaces, i) + { + label faceI = pFaces[i]; + pNormals[i] = faceSurfaceNormal[faceI]; + pDisp[i] = faceDisp[faceI]; + pFc[i] = pp.faceCentres()[faceI]; + //label meshFaceI = pp.addressing()[faceI]; + //pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI); + pFid[i] = globalToPatch_[faceSurfaceGlobalRegion[faceI]]; + } + } + + + // Collect additionally 'normal' boundary faces for boundaryPoints of pp + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // points on the boundary of pp should pick up non-pp normals + // as well for the feature-reconstruction to behave correctly. + // (the movement is already constrained outside correctly so it + // is only that the unconstrained attraction vector is calculated + // correctly) + { + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + labelList patchID(pbm.patchID()); + + // Unmark all non-coupled boundary faces + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (pp.coupled() || isA<emptyPolyPatch>(pp)) + { + forAll(pp, i) + { + label meshFaceI = pp.start()+i; + patchID[meshFaceI-mesh.nInternalFaces()] = -1; + } + } + } + + // Remove any meshed faces + forAll(pp.addressing(), i) + { + label meshFaceI = pp.addressing()[i]; + patchID[meshFaceI-mesh.nInternalFaces()] = -1; + } + + // See if pp point uses any non-meshed boundary faces + + const labelList& boundaryPoints = pp.boundaryPoints(); + forAll(boundaryPoints, i) + { + label pointI = boundaryPoints[i]; + label meshPointI = pp.meshPoints()[pointI]; + const point& pt = mesh.points()[meshPointI]; + const labelList& pFaces = mesh.pointFaces()[meshPointI]; + + List<point>& pNormals = pointFaceSurfNormals[pointI]; + List<point>& pDisp = pointFaceDisp[pointI]; + List<point>& pFc = pointFaceCentres[pointI]; + labelList& pFid = pointFacePatchID[pointI]; + + forAll(pFaces, i) + { + label meshFaceI = pFaces[i]; + if (!mesh.isInternalFace(meshFaceI)) + { + label patchI = patchID[meshFaceI-mesh.nInternalFaces()]; + + if (patchI != -1) + { + vector fn = mesh.faceAreas()[meshFaceI]; + pNormals.append(fn/mag(fn)); + pDisp.append(mesh.faceCentres()[meshFaceI]-pt); + pFc.append(mesh.faceCentres()[meshFaceI]); + pFid.append(patchI); + } + } + } + } + } + + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceSurfNormals, + listPlusEqOp<point>(), + List<point>(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceDisp, + listPlusEqOp<point>(), + List<point>(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFaceCentres, + listPlusEqOp<point>(), + List<point>(), + listTransform() + ); + syncTools::syncPointList + ( + mesh, + pp.meshPoints(), + pointFacePatchID, + listPlusEqOp<label>(), + List<label>() + ); +} + + // Gets passed in offset to nearest point on feature edge. Calculates // if the point has a different number of faces on either side of the feature // and if so attracts the point to that non-dominant plane. @@ -580,56 +747,7 @@ Foam::pointIndexHit Foam::autoSnapDriver::findMultiPatchPoint } return pointIndexHit(false, vector::zero, labelMax); } -////XXXXXXXX -//void Foam::autoSnapDriver::attractMultiPatchPoint -//( -// const label iter, -// const scalar featureCos, -// -// const indirectPrimitivePatch& pp, -// const scalarField& snapDist, -// const label pointI, -// -// const List<List<point> >& pointFaceSurfNormals, -// const labelListList& pointFaceSurfaceRegion, -// const List<List<point> >& pointFaceDisp, -// const List<List<point> >& pointFaceCentres, -// const labelListList& pointFacePatchID, -// -// vector& patchAttraction, -// pointConstraint& patchConstraint -//) const -//{ -// // Collect -// -// ); -// -// if -// ( -// (constraint.first() > patchConstraints[pointI].first()) -// || (magSqr(attraction) < magSqr(patchAttraction[pointI])) -// ) -// { -// patchAttraction[pointI] = attraction; -// patchConstraints[pointI] = constraint; -// -// // Check the number of directions -// if (patchConstraints[pointI].first() == 1) -// { -// // Flat surface. Check for different patchIDs -// pointIndexHit multiPatchPt -// ( -// findMultiPatchPoint -// ( -// pt, -// pointFacePatchID[pointI], -// pointFaceCentres[pointI] -// ) -// ); -// if (multiPatchPt.hit()) -// { -// // Behave like when having two surface normals so -////XXXXXXXX + void Foam::autoSnapDriver::binFeatureFace ( @@ -1361,6 +1479,7 @@ void Foam::autoSnapDriver::determineFeatures ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch& pp, const scalarField& snapDist, @@ -1464,69 +1583,72 @@ void Foam::autoSnapDriver::determineFeatures if (patchConstraints[pointI].first() == 1) { // Flat surface. Check for different patchIDs - pointIndexHit multiPatchPt - ( - findMultiPatchPoint - ( - pt, - pointFacePatchID[pointI], - pointFaceCentres[pointI] - ) - ); - if (multiPatchPt.hit()) + if (multiRegionFeatureSnap) { - // Behave like when having two surface normals so - // attract to nearest feature edge (with a guess for - // the multipatch point as starting point) - label featI = -1; - pointIndexHit nearInfo = findNearFeatureEdge + pointIndexHit multiPatchPt ( - pp, - snapDist, - pointI, - multiPatchPt.hitPoint(), //estimatedPt + findMultiPatchPoint + ( + pt, + pointFacePatchID[pointI], + pointFaceCentres[pointI] + ) + ); + if (multiPatchPt.hit()) + { + // Behave like when having two surface normals so + // attract to nearest feature edge (with a guess for + // the multipatch point as starting point) + label featI = -1; + pointIndexHit nearInfo = findNearFeatureEdge + ( + pp, + snapDist, + pointI, + multiPatchPt.hitPoint(), //estimatedPt - featI, - edgeAttractors, - edgeConstraints, + featI, + edgeAttractors, + edgeConstraints, - patchAttraction, - patchConstraints - ); + patchAttraction, + patchConstraints + ); - if (nearInfo.hit()) - { - // Dump - if (featureEdgeStr.valid()) + if (nearInfo.hit()) { - meshTools::writeOBJ(featureEdgeStr(), pt); - featureEdgeVertI++; - meshTools::writeOBJ - ( - featureEdgeStr(), - nearInfo.hitPoint() - ); - featureEdgeVertI++; - featureEdgeStr() - << "l " << featureEdgeVertI-1 << ' ' - << featureEdgeVertI << nl; + // Dump + if (featureEdgeStr.valid()) + { + meshTools::writeOBJ(featureEdgeStr(), pt); + featureEdgeVertI++; + meshTools::writeOBJ + ( + featureEdgeStr(), + nearInfo.hitPoint() + ); + featureEdgeVertI++; + featureEdgeStr() + << "l " << featureEdgeVertI-1 << ' ' + << featureEdgeVertI << nl; + } } - } - else - { - if (missedEdgeStr.valid()) + else { - meshTools::writeOBJ(missedEdgeStr(), pt); - missedVertI++; - meshTools::writeOBJ - ( - missedEdgeStr(), - nearInfo.missPoint() - ); - missedVertI++; - missedEdgeStr() - << "l " << missedVertI-1 << ' ' - << missedVertI << nl; + if (missedEdgeStr.valid()) + { + meshTools::writeOBJ(missedEdgeStr(), pt); + missedVertI++; + meshTools::writeOBJ + ( + missedEdgeStr(), + nearInfo.missPoint() + ); + missedVertI++; + missedEdgeStr() + << "l " << missedVertI-1 << ' ' + << missedVertI << nl; + } } } } @@ -1645,6 +1767,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges ( const label iter, const scalar featureCos, + const bool multiRegionFeatureSnap, const indirectPrimitivePatch& pp, const scalarField& snapDist, @@ -1697,6 +1820,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges ( iter, featureCos, + multiRegionFeatureSnap, pp, snapDist, @@ -2131,6 +2255,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges //MEJ: any faces that have multi-patch points only keep the multi-patch // points. The other points on the face will be dragged along // (hopefully) + if (multiRegionFeatureSnap) { autoPtr<OFstream> multiPatchStr; if (debug&meshRefinement::OBJINTERSECTIONS) @@ -2536,10 +2661,12 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature { const Switch implicitFeatureAttraction = snapParams.implicitFeatureSnap(); const Switch explicitFeatureAttraction = snapParams.explicitFeatureSnap(); + const Switch multiRegionFeatureSnap = snapParams.multiRegionFeatureSnap(); Info<< "Overriding displacement on features :" << nl - << " implicit features : " << implicitFeatureAttraction << nl - << " explicit features : " << explicitFeatureAttraction << nl + << " implicit features : " << implicitFeatureAttraction << nl + << " explicit features : " << explicitFeatureAttraction << nl + << " multi-patch features : " << multiRegionFeatureSnap << nl << endl; @@ -2547,6 +2674,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature const pointField& localPoints = pp.localPoints(); const fvMesh& mesh = meshRefiner_.mesh(); + // Displacement and orientation per pp face // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2554,7 +2682,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature vectorField faceDisp(pp.size(), vector::zero); // normal of surface at point on surface vectorField faceSurfaceNormal(pp.size(), vector::zero); - labelList faceSurfaceRegion(pp.size(), -1); + labelList faceSurfaceGlobalRegion(pp.size(), -1); vectorField faceRotation(pp.size(), vector::zero); calcNearestFace @@ -2563,7 +2691,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature pp, faceDisp, faceSurfaceNormal, - faceSurfaceRegion, + faceSurfaceGlobalRegion, faceRotation ); @@ -2587,158 +2715,25 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // - faceSurfaceNormal // - faceDisp - // - faceRotation // - faceCentres&faceNormal - - // For now just get all surrounding face data. Expensive - should just - // store and sync data on coupled points only - // (see e.g PatchToolsNormals.C) - List<List<point> > pointFaceSurfNormals(pp.nPoints()); List<List<point> > pointFaceDisp(pp.nPoints()); - //List<List<point> > pointFaceRotation(pp.nPoints()); List<List<point> > pointFaceCentres(pp.nPoints()); List<labelList> pointFacePatchID(pp.nPoints()); - // Fill local data - forAll(pp.pointFaces(), pointI) - { - const labelList& pFaces = pp.pointFaces()[pointI]; - List<point>& pNormals = pointFaceSurfNormals[pointI]; - pNormals.setSize(pFaces.size()); - List<point>& pDisp = pointFaceDisp[pointI]; - pDisp.setSize(pFaces.size()); - //List<point>& pRot = pointFaceRotation[pointI]; - //pRot.setSize(pFaces.size()); - List<point>& pFc = pointFaceCentres[pointI]; - pFc.setSize(pFaces.size()); - labelList& pFid = pointFacePatchID[pointI]; - pFid.setSize(pFaces.size()); - - forAll(pFaces, i) - { - label faceI = pFaces[i]; - pNormals[i] = faceSurfaceNormal[faceI]; - pDisp[i] = faceDisp[faceI]; - //pRot[i] = faceRotation[faceI]; - pFc[i] = pp.faceCentres()[faceI]; - label meshFaceI = pp.addressing()[faceI]; - pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI); - } - } - - - // Collect additionally 'normal' boundary faces for boundaryPoints of pp - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // points on the boundary of pp should pick up non-pp normals - // as well for the feature-reconstruction to behave correctly. - // (the movement is already constrained outside correctly so it - // is only that the unconstrained attraction vector is calculated - // correctly) - { - const polyBoundaryMesh& pbm = mesh.boundaryMesh(); - labelList patchID(pbm.patchID()); - - // Unmark all non-coupled boundary faces - forAll(pbm, patchI) - { - const polyPatch& pp = pbm[patchI]; - - if (pp.coupled() || isA<emptyPolyPatch>(pp)) - { - forAll(pp, i) - { - label meshFaceI = pp.start()+i; - patchID[meshFaceI-mesh.nInternalFaces()] = -1; - } - } - } - - // Remove any meshed faces - forAll(pp.addressing(), i) - { - label meshFaceI = pp.addressing()[i]; - patchID[meshFaceI-mesh.nInternalFaces()] = -1; - } - - // See if pp point uses any non-meshed boundary faces - - const labelList& boundaryPoints = pp.boundaryPoints(); - forAll(boundaryPoints, i) - { - label pointI = boundaryPoints[i]; - label meshPointI = pp.meshPoints()[pointI]; - const point& pt = mesh.points()[meshPointI]; - const labelList& pFaces = mesh.pointFaces()[meshPointI]; - - List<point>& pNormals = pointFaceSurfNormals[pointI]; - List<point>& pDisp = pointFaceDisp[pointI]; - List<point>& pFc = pointFaceCentres[pointI]; - labelList& pFid = pointFacePatchID[pointI]; - - forAll(pFaces, i) - { - label meshFaceI = pFaces[i]; - if (!mesh.isInternalFace(meshFaceI)) - { - label patchI = patchID[meshFaceI-mesh.nInternalFaces()]; + calcNearestFacePointProperties + ( + iter, + pp, - if (patchI != -1) - { - vector fn = mesh.faceAreas()[meshFaceI]; - pNormals.append(fn/mag(fn)); - pDisp.append(mesh.faceCentres()[meshFaceI]-pt); - pFc.append(mesh.faceCentres()[meshFaceI]); - pFid.append(patchI); - } - } - } - } - } + faceDisp, + faceSurfaceNormal, + faceSurfaceGlobalRegion, - syncTools::syncPointList - ( - mesh, - pp.meshPoints(), pointFaceSurfNormals, - listPlusEqOp<point>(), - List<point>(), - listTransform() - ); - syncTools::syncPointList - ( - mesh, - pp.meshPoints(), pointFaceDisp, - listPlusEqOp<point>(), - List<point>(), - listTransform() - ); - //syncTools::syncPointList - //( - // mesh, - // pp.meshPoints(), - // pointFaceRotation, - // listPlusEqOp<point>(), - // List<point>(), - // listTransform() - //); - syncTools::syncPointList - ( - mesh, - pp.meshPoints(), pointFaceCentres, - listPlusEqOp<point>(), - List<point>(), - listTransform() - ); - syncTools::syncPointList - ( - mesh, - pp.meshPoints(), - pointFacePatchID, - listPlusEqOp<label>(), - List<label>() + pointFacePatchID ); @@ -2793,6 +2788,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature ( iter, featureCos, + multiRegionFeatureSnap, pp, snapDist, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index cfc9b3703c3b1a94751c36e6a081ba74c0467d8c..6574ad9cbd88f9ac84769eca3eb87f2eff793750 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -34,6 +34,72 @@ License const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90; +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::layerParameters::layerExpansionRatio +( + const label n, + const scalar totalOverFirst +) const +{ + if (n <= 1) + { + return 1.0; + } + + //scalar totalOverFirst = totalThickness/firstLayerThickess; + + const label maxIters = 10; + const scalar tol = 1e-8; + + + if (mag(n-totalOverFirst) < tol) + { + return 1.0; + } + + // Calculate the bounds of the solution + scalar minR; + scalar maxR; + + if (totalOverFirst < n) + { + minR = 0.0; + maxR = pow(totalOverFirst/n, 1/(n-1)); + } + else + { + minR = pow(totalOverFirst/n, 1/(n-1)); + maxR = totalOverFirst/(n - 1); + } + + //Info<< "Solution bounds = (" << minR << ", " << maxR << ")" << nl << endl; + + // Starting guess + scalar r = 0.5*(minR + maxR); + + for (label i = 0; i < maxIters; ++i) + { + const scalar prevr = r; + + const scalar fx = pow(r, n) - totalOverFirst*r - (1 - totalOverFirst); + const scalar dfx = n*pow(r, n - 1) - totalOverFirst; + + r -= fx/dfx; + + const scalar error = mag(r - prevr); + + //Info<< i << " " << r << " Error = " << error << endl; + + if (error < tol) + { + break; + } + } + return r; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from dictionary @@ -44,17 +110,12 @@ Foam::layerParameters::layerParameters ) : numLayers_(boundaryMesh.size(), -1), - expansionRatio_ - ( - boundaryMesh.size(), - readScalar(dict.lookup("expansionRatio")) - ), relativeSizes_(dict.lookup("relativeSizes")), - finalLayerThickness_ - ( - boundaryMesh.size(), - readScalar(dict.lookup("finalLayerThickness")) - ), + layerSpec_(ILLEGAL), + firstLayerThickness_(boundaryMesh.size(), -123), + finalLayerThickness_(boundaryMesh.size(), -123), + thickness_(boundaryMesh.size(), -123), + expansionRatio_(boundaryMesh.size(), -123), minThickness_ ( boundaryMesh.size(), @@ -103,24 +164,108 @@ Foam::layerParameters::layerParameters nRelaxedIter_(labelMax), additionalReporting_(dict.lookupOrDefault("additionalReporting", false)) { - if (nGrow_ > 0) + // Detect layer specification mode + + label nSpec = 0; + + bool haveFirst = dict.found("firstLayerThickness"); + if (haveFirst) { - WarningIn("layerParameters::layerParameters(..)") - << "The nGrow parameter effect has changed with respect to 1.6.x." - << endl - << "Please set nGrow=0 for 1.6.x behaviour." + firstLayerThickness_ = scalarField + ( + boundaryMesh.size(), + readScalar(dict.lookup("firstLayerThickness")) + ); + nSpec++; + } + bool haveFinal = dict.found("finalLayerThickness"); + if (haveFinal) + { + finalLayerThickness_ = scalarField + ( + boundaryMesh.size(), + readScalar(dict.lookup("finalLayerThickness")) + ); + nSpec++; + } + bool haveTotal = dict.found("thickness"); + if (haveTotal) + { + thickness_ = scalarField + ( + boundaryMesh.size(), + readScalar(dict.lookup("thickness")) + ); + nSpec++; + } + bool haveExp = dict.found("expansionRatio"); + if (haveExp) + { + expansionRatio_ = scalarField + ( + boundaryMesh.size(), + readScalar(dict.lookup("expansionRatio")) + ); + nSpec++; + } + + + if (haveFirst && haveTotal) + { + layerSpec_ = FIRST_AND_TOTAL; + Info<< "Layer thickness specified as first layer and overall thickness." << endl; } + else if (haveFirst && haveExp) + { + layerSpec_ = FIRST_AND_EXPANSION; + Info<< "Layer thickness specified as first layer and expansion ratio." + << endl; + } + else if (haveFinal && haveTotal) + { + layerSpec_ = FINAL_AND_TOTAL; + Info<< "Layer thickness specified as final layer and overall thickness." + << endl; + } + else if (haveFinal && haveExp) + { + layerSpec_ = FINAL_AND_EXPANSION; + Info<< "Layer thickness specified as final layer and expansion ratio." + << endl; + } + + + if (layerSpec_ == ILLEGAL || nSpec != 2) + { + FatalIOErrorIn + ( + "layerParameters::layerParameters" + "(const dictionary&, const polyBoundaryMesh&)", + dict + ) << "Over- or underspecified layer thickness." + << " Please specify" << nl + << " first layer thickness ('firstLayerThickness')" + << " and overall thickness ('thickness') or" << nl + << " first layer thickness ('firstLayerThickness')" + << " and expansion ratio ('expansionRatio') or" << nl + << " final layer thickness ('finalLayerThickness')" + << " and expansion ratio ('expansionRatio') or" << nl + << " final layer thickness ('finalLayerThickness')" + << " and overall thickness ('thickness')" + << exit(FatalIOError); + } + dict.readIfPresent("nRelaxedIter", nRelaxedIter_); if (nLayerIter_ < 0 || nRelaxedIter_ < 0) { - FatalErrorIn("layerParameters::layerParameters(..)") + FatalIOErrorIn("layerParameters::layerParameters(..)", dict) << "Layer iterations should be >= 0." << endl << "nLayerIter:" << nLayerIter_ << " nRelaxedIter:" << nRelaxedIter_ - << exit(FatalError); + << exit(FatalIOError); } @@ -130,7 +275,7 @@ Foam::layerParameters::layerParameters { if (iter().isDict()) { - const word& key = iter().keyword(); + const keyType& key = iter().keyword(); const labelHashSet patchIDs ( boundaryMesh.patchSet(List<wordRe>(1, key)) @@ -154,16 +299,69 @@ Foam::layerParameters::layerParameters numLayers_[patchI] = readLabel(layerDict.lookup("nSurfaceLayers")); - layerDict.readIfPresent - ( - "expansionRatio", - expansionRatio_[patchI] - ); - layerDict.readIfPresent - ( - "finalLayerThickness", - finalLayerThickness_[patchI] - ); + switch (layerSpec_) + { + case FIRST_AND_TOTAL: + layerDict.readIfPresent + ( + "firstLayerThickness", + firstLayerThickness_[patchI] + ); + layerDict.readIfPresent + ( + "thickness", + thickness_[patchI] + ); + break; + + case FIRST_AND_EXPANSION: + layerDict.readIfPresent + ( + "firstLayerThickness", + firstLayerThickness_[patchI] + ); + layerDict.readIfPresent + ( + "expansionRatio", + expansionRatio_[patchI] + ); + break; + + case FINAL_AND_TOTAL: + layerDict.readIfPresent + ( + "finalLayerThickness", + finalLayerThickness_[patchI] + ); + layerDict.readIfPresent + ( + "thickness", + thickness_[patchI] + ); + break; + + case FINAL_AND_EXPANSION: + layerDict.readIfPresent + ( + "finalLayerThickness", + finalLayerThickness_[patchI] + ); + layerDict.readIfPresent + ( + "expansionRatio", + expansionRatio_[patchI] + ); + break; + + default: + FatalIOErrorIn + ( + "layerParameters::layerParameters(..)", + dict + ) << "problem." << exit(FatalIOError); + break; + } + layerDict.readIfPresent ( "minThickness", @@ -176,4 +374,190 @@ Foam::layerParameters::layerParameters } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::scalar Foam::layerParameters::layerThickness +( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio +) const +{ + switch (layerSpec_) + { + case FIRST_AND_TOTAL: + case FINAL_AND_TOTAL: + { + return totalThickness; + } + break; + + case FIRST_AND_EXPANSION: + { + if (mag(expansionRatio-1) < SMALL) + { + return firstLayerThickess * nLayers; + } + else + { + return firstLayerThickess * + (1.0 - pow(expansionRatio, nLayers)) + / (1.0 - expansionRatio); + } + } + break; + + case FINAL_AND_EXPANSION: + { + if (mag(expansionRatio-1) < SMALL) + { + return finalLayerThickess * nLayers; + } + else + { + scalar invExpansion = 1.0 / expansionRatio; + return finalLayerThickess * + (1.0 - pow(invExpansion, nLayers)) + / (1.0 - invExpansion); + } + } + break; + + default: + { + FatalErrorIn("layerParameters::layerThickness(..)") + << "Illegal thickness specification " << layerSpec_ + << exit(FatalError); + return -VGREAT; + } + } +} + + +Foam::scalar Foam::layerParameters::layerExpansionRatio +( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio +) const +{ + switch (layerSpec_) + { + case FIRST_AND_EXPANSION: + case FINAL_AND_EXPANSION: + { + return expansionRatio; + } + break; + + case FIRST_AND_TOTAL: + { + return layerExpansionRatio + ( + nLayers, + totalThickness/firstLayerThickess + ); + } + break; + + case FINAL_AND_TOTAL: + { + return + 1.0 + / layerExpansionRatio + ( + nLayers, + totalThickness/finalLayerThickess + ); + } + break; + + default: + { + FatalErrorIn("layerParameters::layerThickness(..)") + << "Illegal thickness specification" << exit(FatalError); + return -VGREAT; + } + } +} + + +Foam::scalar Foam::layerParameters::firstLayerThickness +( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio +) const +{ + switch (layerSpec_) + { + case FIRST_AND_EXPANSION: + case FIRST_AND_TOTAL: + { + return firstLayerThickess; + } + + case FINAL_AND_EXPANSION: + { + return finalLayerThickess*pow(1.0/expansionRatio, nLayers-1); + } + break; + + case FINAL_AND_TOTAL: + { + scalar r = layerExpansionRatio + ( + nLayers, + firstLayerThickess, + finalLayerThickess, + totalThickness, + expansionRatio + ); + return finalLayerThickess/pow(r, nLayers-1); + } + break; + + default: + { + FatalErrorIn("layerParameters::layerThickness(..)") + << "Illegal thickness specification" << exit(FatalError); + return -VGREAT; + } + } +} + + +Foam::scalar Foam::layerParameters::finalLayerThicknessRatio +( + const label nLayers, + const scalar expansionRatio +) const +{ + if (nLayers > 0) + { + if (mag(expansionRatio-1) < SMALL) + { + return 1.0/nLayers; + } + else + { + return + pow(expansionRatio, nLayers - 1) + * (1.0 - expansionRatio) + / (1.0 - pow(expansionRatio, nLayers)); + } + } + else + { + return 0.0; + } +} + + // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H index 5298006b04f4ea9cb72c308b681dcb715c51fe0d..2578c44b687459cadb2daf8e11798fae1b069a7d 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H @@ -55,6 +55,27 @@ class refinementSurfaces; class layerParameters { +public: + + // Public data types + + //- Enumeration defining the layer specification: + // - first and total thickness specified + // - first and expansion ratio specified + // - final and total thickness specified + // - final and expansion ratio specified + enum layerSpecification + { + ILLEGAL, + FIRST_AND_TOTAL, + FIRST_AND_EXPANSION, + FINAL_AND_TOTAL, + FINAL_AND_EXPANSION + }; + + +private: + // Static data members //- Default angle for faces to be convcave @@ -68,12 +89,21 @@ class layerParameters //- How many layers to add. labelList numLayers_; - scalarField expansionRatio_; - + //- Are sizes relative to local cell size Switch relativeSizes_; - scalarField finalLayerThickness_; + //- How thickness is specified. + layerSpecification layerSpec_; + + scalarField firstLayerThickness_; + scalarField finalLayerThickness_; + + scalarField thickness_; + + scalarField expansionRatio_; + + //- Minimum total thickness scalarField minThickness_; @@ -111,6 +141,14 @@ class layerParameters // Private Member Functions + //- Calculate expansion ratio from overall size v.s. thickness of + // first layer. + scalar layerExpansionRatio + ( + const label n, + const scalar totalOverFirst + ) const; + //- Disallow default bitwise copy construct layerParameters(const layerParameters&); @@ -128,154 +166,209 @@ public: // Member Functions - // Access - - // Per patch information - - //- How many layers to add. - // -1 : no specification. Assume 0 layers but allow sliding - // to make layers - // 0 : specified to have 0 layers. No sliding allowed. - // >0 : number of layers - const labelList& numLayers() const - { - return numLayers_; - } - - // Expansion factor for layer mesh - const scalarField& expansionRatio() const - { - return expansionRatio_; - } - - //- Are size parameters relative to inner cell size or - // absolute distances. - bool relativeSizes() const - { - return relativeSizes_; - } - - //- Wanted thickness of final added cell layer. If multiple - // layers is the thickness of the layer furthest away - // from the wall (i.e. nearest the original mesh) - // If relativeSize() this number is relative to undistorted - // size of the cell outside layer. - const scalarField& finalLayerThickness() const - { - return finalLayerThickness_; - } - - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // If relativeSize() this number is relative to undistorted - // size of the cell outside layer. - const scalarField& minThickness() const - { - return minThickness_; - } - - - scalar featureAngle() const - { - return featureAngle_; - } - - //- At non-patched sides allow mesh to slip if extrusion - // direction makes angle larger than slipFeatureAngle. - scalar slipFeatureAngle() const - { - return slipFeatureAngle_; - } - - scalar concaveAngle() const - { - return concaveAngle_; - } - - //- If points get not extruded do nGrow layers of connected faces - // that are not grown. Is used to not do layers at all close to - // features. - label nGrow() const - { - return nGrow_; - } + // Per patch information - //- Number of smoothing iterations of surface normals - label nSmoothSurfaceNormals() const + //- How many layers to add. + // -1 : no specification. Assume 0 layers but allow sliding + // to make layers + // 0 : specified to have 0 layers. No sliding allowed. + // >0 : number of layers + const labelList& numLayers() const { - return nSmoothSurfaceNormals_; + return numLayers_; } - //- Number of smoothing iterations of interior mesh movement - // direction - label nSmoothNormals() const + //- Are size parameters relative to inner cell size or + // absolute distances. + bool relativeSizes() const { - return nSmoothNormals_; + return relativeSizes_; } - //- Stop layer growth on highly warped cells - scalar maxFaceThicknessRatio() const + // Expansion factor for layer mesh + const scalarField& expansionRatio() const { - return maxFaceThicknessRatio_; + return expansionRatio_; } - scalar layerTerminationCos() const + //- Wanted thickness of the layer furthest away + // from the wall (i.e. nearest the original mesh). + // If relativeSize() this number is relative to undistorted + // size of the cell outside layer. + const scalarField& finalLayerThickness() const { - return layerTerminationCos_; + return finalLayerThickness_; } - //- Smooth layer thickness over surface patches - label nSmoothThickness() const + //- Wanted thickness of the layer nearest to the wall. + // If relativeSize() this number is relative to undistorted + // size of the cell outside layer. + const scalarField& firstLayerThickness() const { - return nSmoothThickness_; + return firstLayerThickness_; } - //- Reduce layer growth where ratio thickness to medial - // distance is large - scalar maxThicknessToMedialRatio() const + //- Wanted overall thickness of all layers. + // If relativeSize() this number is relative to undistorted + // size of the cell outside layer. + const scalarField& thickness() const { - return maxThicknessToMedialRatio_; + return thickness_; } - //- Angle used to pick up medial axis points - scalar minMedianAxisAngleCos() const + //- Minimum overall thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // If relativeSize() this number is relative to undistorted + // size of the cell outside layer. + const scalarField& minThickness() const { - return minMedianAxisAngleCos_; + return minThickness_; } - //- Create buffer region for new layer terminations - label nBufferCellsNoExtrude() const - { - return nBufferCellsNoExtrude_; - } - label nSnap() const + scalar featureAngle() const + { + return featureAngle_; + } + + //- At non-patched sides allow mesh to slip if extrusion + // direction makes angle larger than slipFeatureAngle. + scalar slipFeatureAngle() const + { + return slipFeatureAngle_; + } + + scalar concaveAngle() const + { + return concaveAngle_; + } + + //- If points get not extruded do nGrow layers of connected faces + // that are not grown. Is used to not do layers at all close to + // features. + label nGrow() const + { + return nGrow_; + } + + //- Number of smoothing iterations of surface normals + label nSmoothSurfaceNormals() const + { + return nSmoothSurfaceNormals_; + } + + //- Number of smoothing iterations of interior mesh movement + // direction + label nSmoothNormals() const + { + return nSmoothNormals_; + } + + //- Stop layer growth on highly warped cells + scalar maxFaceThicknessRatio() const + { + return maxFaceThicknessRatio_; + } + + scalar layerTerminationCos() const + { + return layerTerminationCos_; + } + + //- Smooth layer thickness over surface patches + label nSmoothThickness() const + { + return nSmoothThickness_; + } + + //- Reduce layer growth where ratio thickness to medial + // distance is large + scalar maxThicknessToMedialRatio() const + { + return maxThicknessToMedialRatio_; + } + + //- Angle used to pick up medial axis points + scalar minMedianAxisAngleCos() const + { + return minMedianAxisAngleCos_; + } + + //- Create buffer region for new layer terminations + label nBufferCellsNoExtrude() const + { + return nBufferCellsNoExtrude_; + } + + label nSnap() const + { + return nSnap_; + } + + const Switch& additionalReporting() const + { + return additionalReporting_; + } + + + // Overall + + //- Number of overall layer addition iterations + label nLayerIter() const { - return nSnap_; + return nLayerIter_; } - const Switch& additionalReporting() const + //- Number of iterations after which relaxed motion rules + // are to be used. + label nRelaxedIter() const { - return additionalReporting_; + return nRelaxedIter_; } - // Overall - - //- Number of overall layer addition iterations - label nLayerIter() const - { - return nLayerIter_; - } - - //- Number of iterations after which relaxed motion rules - // are to be used. - label nRelaxedIter() const - { - return nRelaxedIter_; - } - - + // Helper + + //- Determine overall thickness. Uses two of the four parameters + // according to the layerSpecification + scalar layerThickness + ( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio + ) const; + + //- Determine expansion ratio. Uses two of the four parameters + // according to the layerSpecification + scalar layerExpansionRatio + ( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio + ) const; + + //- Determine first layer (near-wall) thickness. Uses two of the + // four parameters according to the layerSpecification + scalar firstLayerThickness + ( + const label nLayers, + const scalar firstLayerThickess, + const scalar finalLayerThickess, + const scalar totalThickness, + const scalar expansionRatio + ) const; + + //- Determine ratio of final layer thickness to + // overall layer thickness + scalar finalLayerThicknessRatio + ( + const label nLayers, + const scalar expansionRatio + ) const; }; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C index b9d6f3b0c6bcb2771130e4c3c3fcd962c1fde4a0..77bff601870e835f49db1f33c27017047c517484 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C @@ -36,7 +36,11 @@ Foam::snapParameters::snapParameters(const dictionary& dict) nSnap_(readLabel(dict.lookup("nRelaxIter"))), nFeatureSnap_(dict.lookupOrDefault("nFeatureSnapIter", -1)), explicitFeatureSnap_(dict.lookupOrDefault("explicitFeatureSnap", true)), - implicitFeatureSnap_(dict.lookupOrDefault("implicitFeatureSnap", false)) + implicitFeatureSnap_(dict.lookupOrDefault("implicitFeatureSnap", false)), + multiRegionFeatureSnap_ + ( + dict.lookupOrDefault("multiRegionFeatureSnap", false) + ) {} diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H index 8103cd4082dac4c468603a86eff1d4c5d9a320f6..294d0de55d5538df2e9557262be482eb1d9b1157 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H @@ -68,6 +68,8 @@ class snapParameters const Switch implicitFeatureSnap_; + const Switch multiRegionFeatureSnap_; + // Private Member Functions @@ -134,6 +136,11 @@ public: return implicitFeatureSnap_; } + Switch multiRegionFeatureSnap() const + { + return multiRegionFeatureSnap_; + } + }; diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index 918aae9000d4b6c3603f0c057824b102e3a91c8e..b98230e4122c925527c9158dbcc57b8bc8c8abc4 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -264,6 +264,14 @@ private: label& nRefine ) const; + //- Mark cells for distance-to-feature based refinement. + label markInternalDistanceToFeatureRefinement + ( + const label nAllowRefine, + labelList& refineCell, + label& nRefine + ) const; + //- Mark cells for refinement-shells based refinement. label markInternalRefinement ( @@ -656,6 +664,7 @@ public: const scalar curvature, const bool featureRefinement, + const bool featureDistanceRefinement, const bool internalRefinement, const bool surfaceRefinement, const bool curvatureRefinement, diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C index 4d9d10ab80106b2bd566b04dcc8774a83b782d01..2c15a847ead3d6571c75656d7352cc9f762d3bb0 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C @@ -290,7 +290,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement forAll(features_, featI) { const featureEdgeMesh& featureMesh = features_[featI]; - const label featureLevel = features_.levels()[featI]; + const label featureLevel = features_.levels()[featI][0]; const labelListList& pointEdges = featureMesh.pointEdges(); // Find regions on edgeMesh @@ -511,6 +511,90 @@ Foam::label Foam::meshRefinement::markFeatureRefinement } +// Mark cells for distance-to-feature based refinement. +Foam::label Foam::meshRefinement::markInternalDistanceToFeatureRefinement +( + const label nAllowRefine, + + labelList& refineCell, + label& nRefine +) const +{ + const labelList& cellLevel = meshCutter_.cellLevel(); + const pointField& cellCentres = mesh_.cellCentres(); + + // Detect if there are any distance shells + if (features_.maxDistance() <= 0.0) + { + return 0; + } + + label oldNRefine = nRefine; + + // Collect cells to test + pointField testCc(cellLevel.size()-nRefine); + labelList testLevels(cellLevel.size()-nRefine); + label testI = 0; + + forAll(cellLevel, cellI) + { + if (refineCell[cellI] == -1) + { + testCc[testI] = cellCentres[cellI]; + testLevels[testI] = cellLevel[cellI]; + testI++; + } + } + + // Do test to see whether cells is inside/outside shell with higher level + labelList maxLevel; + features_.findHigherLevel(testCc, testLevels, maxLevel); + + // Mark for refinement. Note that we didn't store the original cellID so + // now just reloop in same order. + testI = 0; + forAll(cellLevel, cellI) + { + if (refineCell[cellI] == -1) + { + if (maxLevel[testI] > testLevels[testI]) + { + bool reachedLimit = !markForRefine + ( + maxLevel[testI], // mark with any positive value + nAllowRefine, + refineCell[cellI], + nRefine + ); + + if (reachedLimit) + { + if (debug) + { + Pout<< "Stopped refining internal cells" + << " since reaching my cell limit of " + << mesh_.nCells()+7*nRefine << endl; + } + break; + } + } + testI++; + } + } + + if + ( + returnReduce(nRefine, sumOp<label>()) + > returnReduce(nAllowRefine, sumOp<label>()) + ) + { + Info<< "Reached refinement limit." << endl; + } + + return returnReduce(nRefine-oldNRefine, sumOp<label>()); +} + + // Mark cells for non-surface intersection based refinement. Foam::label Foam::meshRefinement::markInternalRefinement ( @@ -1128,6 +1212,7 @@ Foam::labelList Foam::meshRefinement::refineCandidates const scalar curvature, const bool featureRefinement, + const bool featureDistanceRefinement, const bool internalRefinement, const bool surfaceRefinement, const bool curvatureRefinement, @@ -1196,8 +1281,24 @@ Foam::labelList Foam::meshRefinement::refineCandidates nRefine ); - Info<< "Marked for refinement due to explicit features : " - << nFeatures << " cells." << endl; + Info<< "Marked for refinement due to explicit features " + << ": " << nFeatures << " cells." << endl; + } + + // Inside distance-to-feature shells + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + if (featureDistanceRefinement) + { + label nShell = markInternalDistanceToFeatureRefinement + ( + nAllowRefine, + + refineCell, + nRefine + ); + Info<< "Marked for refinement due to distance to explicit features " + ": " << nShell << " cells." << endl; } // Inside refinement shells @@ -1212,8 +1313,8 @@ Foam::labelList Foam::meshRefinement::refineCandidates refineCell, nRefine ); - Info<< "Marked for refinement due to refinement shells : " - << nShell << " cells." << endl; + Info<< "Marked for refinement due to refinement shells " + << ": " << nShell << " cells." << endl; } // Refinement based on intersection of surface @@ -1230,8 +1331,8 @@ Foam::labelList Foam::meshRefinement::refineCandidates refineCell, nRefine ); - Info<< "Marked for refinement due to surface intersection : " - << nSurf << " cells." << endl; + Info<< "Marked for refinement due to surface intersection " + << ": " << nSurf << " cells." << endl; } // Refinement based on curvature of surface @@ -1254,8 +1355,8 @@ Foam::labelList Foam::meshRefinement::refineCandidates refineCell, nRefine ); - Info<< "Marked for refinement due to curvature/regions : " - << nCurv << " cells." << endl; + Info<< "Marked for refinement due to curvature/regions " + << ": " << nCurv << " cells." << endl; } // Pack cells-to-refine diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C index 0cdd440d1a1d8a0cf40cfdd9c6579a58f687f41b..e72f13d72663e3683a878f7267c116d2428be75e 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C @@ -25,6 +25,7 @@ License #include "refinementFeatures.H" #include "Time.H" +#include "Tuple2.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -34,15 +35,15 @@ void Foam::refinementFeatures::read const PtrList<dictionary>& featDicts ) { - forAll(featDicts, i) + forAll(featDicts, featI) { - const dictionary& dict = featDicts[i]; + const dictionary& dict = featDicts[featI]; fileName featFileName(dict.lookup("file")); set ( - i, + featI, new featureEdgeMesh ( IOobject @@ -58,15 +59,74 @@ void Foam::refinementFeatures::read ) ); - const featureEdgeMesh& eMesh = operator[](i); + const featureEdgeMesh& eMesh = operator[](featI); //eMesh.mergePoints(meshRefiner_.mergeDistance()); - levels_[i] = readLabel(dict.lookup("level")); - Info<< "Refinement level " << levels_[i] - << " for all cells crossed by feature " << featFileName - << " (" << eMesh.points().size() << " points, " + if (dict.found("levels")) + { + List<Tuple2<scalar, label> > distLevels(dict["levels"]); + + if (dict.size() < 1) + { + FatalErrorIn + ( + "refinementFeatures::read" + "(const objectRegistry&" + ", const PtrList<dictionary>&)" + ) << " : levels should be at least size 1" << endl + << "levels : " << dict["levels"] + << exit(FatalError); + } + + distances_[featI].setSize(distLevels.size()); + levels_[featI].setSize(distLevels.size()); + + forAll(distLevels, j) + { + distances_[featI][j] = distLevels[j].first(); + levels_[featI][j] = distLevels[j].second(); + + // Check in incremental order + if (j > 0) + { + if + ( + (distances_[featI][j] <= distances_[featI][j-1]) + || (levels_[featI][j] > levels_[featI][j-1]) + ) + { + FatalErrorIn + ( + "refinementFeatures::read" + "(const objectRegistry&" + ", const PtrList<dictionary>&)" + ) << " : Refinement should be specified in order" + << " of increasing distance" + << " (and decreasing refinement level)." << endl + << "Distance:" << distances_[featI][j] + << " refinementLevel:" << levels_[featI][j] + << exit(FatalError); + } + } + } + } + else + { + // Look up 'level' for single level + levels_[featI] = labelList(1, readLabel(dict.lookup("level"))); + distances_[featI] = scalarField(1, 0.0); + } + + Info<< "Refinement level according to distance to " + << featFileName << " (" << eMesh.points().size() << " points, " << eMesh.edges().size() << " edges)." << endl; + forAll(levels_[featI], j) + { + Info<< " level " << levels_[featI][j] + << " for all cells within " << distances_[featI][j] + << " meter." << endl; + } } } @@ -127,6 +187,80 @@ void Foam::refinementFeatures::buildTrees } + +// Find maximum level of a shell. +void Foam::refinementFeatures::findHigherLevel +( + const pointField& pt, + const label featI, + labelList& maxLevel +) const +{ + const labelList& levels = levels_[featI]; + + const scalarField& distances = distances_[featI]; + + // Collect all those points that have a current maxLevel less than + // (any of) the shell. Also collect the furthest distance allowable + // to any shell with a higher level. + + pointField candidates(pt.size()); + labelList candidateMap(pt.size()); + scalarField candidateDistSqr(pt.size()); + label candidateI = 0; + + forAll(maxLevel, pointI) + { + forAllReverse(levels, levelI) + { + if (levels[levelI] > maxLevel[pointI]) + { + candidates[candidateI] = pt[pointI]; + candidateMap[candidateI] = pointI; + candidateDistSqr[candidateI] = sqr(distances[levelI]); + candidateI++; + break; + } + } + } + candidates.setSize(candidateI); + candidateMap.setSize(candidateI); + candidateDistSqr.setSize(candidateI); + + // Do the expensive nearest test only for the candidate points. + const indexedOctree<treeDataEdge>& tree = edgeTrees_[featI]; + + List<pointIndexHit> nearInfo(candidates.size()); + forAll(candidates, candidateI) + { + nearInfo[candidateI] = tree.findNearest + ( + candidates[candidateI], + candidateDistSqr[candidateI] + ); + } + + // Update maxLevel + forAll(nearInfo, candidateI) + { + if (nearInfo[candidateI].hit()) + { + // Check which level it actually is in. + label minDistI = findLower + ( + distances, + mag(nearInfo[candidateI].hitPoint()-candidates[candidateI]) + ); + + label pointI = candidateMap[candidateI]; + + // pt is inbetween shell[minDistI] and shell[minDistI+1] + maxLevel[pointI] = levels[minDistI+1]; + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::refinementFeatures::refinementFeatures @@ -136,6 +270,7 @@ Foam::refinementFeatures::refinementFeatures ) : PtrList<featureEdgeMesh>(featDicts.size()), + distances_(featDicts.size()), levels_(featDicts.size()), edgeTrees_(featDicts.size()), pointTrees_(featDicts.size()) @@ -175,6 +310,7 @@ Foam::refinementFeatures::refinementFeatures ) : PtrList<featureEdgeMesh>(featDicts.size()), + distances_(featDicts.size()), levels_(featDicts.size()), edgeTrees_(featDicts.size()), pointTrees_(featDicts.size()) @@ -336,4 +472,32 @@ void Foam::refinementFeatures::findNearestPoint } +void Foam::refinementFeatures::findHigherLevel +( + const pointField& pt, + const labelList& ptLevel, + labelList& maxLevel +) const +{ + // Maximum level of any shell. Start off with level of point. + maxLevel = ptLevel; + + forAll(*this, featI) + { + findHigherLevel(pt, featI, maxLevel); + } +} + + +Foam::scalar Foam::refinementFeatures::maxDistance() const +{ + scalar overallMax = -GREAT; + forAll(distances_, featI) + { + overallMax = max(overallMax, max(distances_[featI])); + } + return overallMax; +} + + // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H index 5442e140ddfab7b4626bfad256239fe6e4749561..aa2807bac16f008d5ba5ca31c1a1967338d01e1f 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H +++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H @@ -57,8 +57,11 @@ private: // Private data - //- Refinement levels - labelList levels_; + //- Per shell the list of ranges + List<scalarField> distances_; + + //- Per shell per distance the refinement level + labelListList levels_; //- Edge PtrList<indexedOctree<treeDataEdge> > edgeTrees_; @@ -75,6 +78,13 @@ private: //- Build edge tree and feature point tree void buildTrees(const label, const labelList&); + //- Find shell level higher than ptLevel + void findHigherLevel + ( + const pointField& pt, + const label featI, + labelList& maxLevel + ) const; public: @@ -101,11 +111,18 @@ public: // Access - const labelList& levels() const + //- Per featureEdgeMesh the list of level + const labelListList& levels() const { return levels_; } + //- Per featureEdgeMesh the list of ranges + const List<scalarField>& distances() const + { + return distances_; + } + const PtrList<indexedOctree<treeDataEdge> >& edgeTrees() const { return edgeTrees_; @@ -119,6 +136,9 @@ public: // Query + //- Highest distance of all features + scalar maxDistance() const; + //- Find nearest point on nearest feature edge void findNearestEdge ( @@ -141,6 +161,14 @@ public: labelList& nearIndex ) const; + //- Find shell level higher than ptLevel + void findHigherLevel + ( + const pointField& pt, + const labelList& ptLevel, + labelList& maxLevel + ) const; + }; diff --git a/src/regionModels/pyrolysisModels/Make/options b/src/regionModels/pyrolysisModels/Make/options index b922d0f5736bbf1c99aff2695b617d7316777df4..ff86d012acff7869956ac829b979635c034d2000 100644 --- a/src/regionModels/pyrolysisModels/Make/options +++ b/src/regionModels/pyrolysisModels/Make/options @@ -3,10 +3,10 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ @@ -20,12 +20,13 @@ LIB_LIBS = \ -lmeshTools \ -lchemistryModel \ -lspecie \ - -lsolidSpecie \ -lfluidThermophysicalModels \ -lsolidChemistryModel \ + -lsolidThermo \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lLESdeltas \ -lregionModels \ - -lradiationModels + -lradiationModels \ + -lreactionThermophysicalModels diff --git a/src/regionModels/thermoBaffleModels/Make/options b/src/regionModels/thermoBaffleModels/Make/options index 7e400684128703586ff8a1836368b3eb08c74b29..2c0e2cf57ca23b57686ac288837710aa4ba0174d 100644 --- a/src/regionModels/thermoBaffleModels/Make/options +++ b/src/regionModels/thermoBaffleModels/Make/options @@ -1,7 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ @@ -18,5 +17,4 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lOpenFOAM \ - -lsolidSpecie \ -lradiationModels diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 118a48cab4cef13e9ae1a61f075e5f8d957d2dba..8c5227dbf206a2ec9cf3560c42e10d82435ae6ca 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -18,6 +18,7 @@ sampledSet/sampledSets/sampledSetsGrouping.C sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C sampledSet/uniform/uniformSet.C +sampledSet/array/arraySet.C setWriters = sampledSet/writers diff --git a/src/sampling/sampledSet/array/arraySet.C b/src/sampling/sampledSet/array/arraySet.C new file mode 100644 index 0000000000000000000000000000000000000000..fb97a93bfe57ce534d1de1ce8b3e261aeac864d7 --- /dev/null +++ b/src/sampling/sampledSet/array/arraySet.C @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "arraySet.H" +#include "sampledSet.H" +#include "meshSearch.H" +#include "DynamicList.H" +#include "polyMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "word.H" +#include "transform.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(arraySet, 0); + addToRunTimeSelectionTable(sampledSet, arraySet, word); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::arraySet::calcSamples +( + DynamicList<point>& samplingPts, + DynamicList<label>& samplingCells, + DynamicList<label>& samplingFaces, + DynamicList<label>& samplingSegments, + DynamicList<scalar>& samplingCurveDist +) const +{ + const meshSearch& queryMesh = searchEngine(); + + label nTotalSamples + ( + pointsDensity_.x() + *pointsDensity_.y() + *pointsDensity_.z() + ); + + List<point> sampleCoords(nTotalSamples); + + const scalar deltax = spanBox_.x()/(pointsDensity_.x() + 1); + const scalar deltay = spanBox_.y()/(pointsDensity_.y() + 1); + const scalar deltaz = spanBox_.z()/(pointsDensity_.z() + 1); + + label p(0); + for (label k=1; k<=pointsDensity_.z(); k++) + { + for (label j=1; j<=pointsDensity_.y(); j++) + { + for (label i=1; i<=pointsDensity_.x(); i++) + { + vector t(deltax*i , deltay*j, deltaz*k); + sampleCoords[p] = coordSys_.origin() + t; + p++; + } + } + } + + forAll(sampleCoords, i) + { + sampleCoords[i] = transform(coordSys_.R(), sampleCoords[i]); + } + + forAll(sampleCoords, sampleI) + { + label cellI = queryMesh.findCell(sampleCoords[sampleI]); + + if (cellI != -1) + { + samplingPts.append(sampleCoords[sampleI]); + samplingCells.append(cellI); + samplingFaces.append(-1); + samplingSegments.append(0); + samplingCurveDist.append(1.0 * sampleI); + } + } +} + + +void Foam::arraySet::genSamples() +{ + // Storage for sample points + DynamicList<point> samplingPts; + DynamicList<label> samplingCells; + DynamicList<label> samplingFaces; + DynamicList<label> samplingSegments; + DynamicList<scalar> samplingCurveDist; + + calcSamples + ( + samplingPts, + samplingCells, + samplingFaces, + samplingSegments, + samplingCurveDist + ); + + samplingPts.shrink(); + samplingCells.shrink(); + samplingFaces.shrink(); + samplingSegments.shrink(); + samplingCurveDist.shrink(); + + setSamples + ( + samplingPts, + samplingCells, + samplingFaces, + samplingSegments, + samplingCurveDist + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::arraySet::arraySet +( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const word& axis, + const coordinateSystem& origin, + const Vector<label>& pointsDensity, + const Vector<scalar>& spanBox +) +: + sampledSet(name, mesh, searchEngine, axis), + coordSys_(origin), + pointsDensity_(pointsDensity), + spanBox_(spanBox) +{ + genSamples(); + + if (debug) + { + write(Info); + } +} + + +Foam::arraySet::arraySet +( + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const dictionary& dict +) +: + sampledSet(name, mesh, searchEngine, dict), + coordSys_(dict), + pointsDensity_(dict.lookup("pointsDensity")), + spanBox_(dict.lookup("spanBox")) +{ + genSamples(); + + if (debug) + { + write(Info); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::arraySet::~arraySet() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H b/src/sampling/sampledSet/array/arraySet.H similarity index 52% rename from src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H rename to src/sampling/sampledSet/array/arraySet.H index 79f1afb7adde4244e7a0773ca5bff3f4f5dd4c46..5058f4670fe89de537d34ea5ea5535ee30a27e6c 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H +++ b/src/sampling/sampledSet/array/arraySet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,103 +22,99 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::IrreversibleSolidReaction + Foam::arraySet Description - Simple extension of Reaction to handle reversible reactions SourceFiles - IrreversibleSolidReaction.C + arraySet.C \*---------------------------------------------------------------------------*/ -#ifndef IrreversibleSolidReaction_H -#define IrreversibleSolidReaction_H +#ifndef arraySet_H +#define arraySet_H -#include "solidReaction.H" +#include "sampledSet.H" +#include "DynamicList.H" +#include "coordinateSystem.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward declaration of classes +class passiveParticle; +template<class Type> class particle; + /*---------------------------------------------------------------------------*\ - Class IrreversibleSolidReaction Declaration + Class arraySet Declaration \*---------------------------------------------------------------------------*/ -template<class ReactionRate> -class IrreversibleSolidReaction +class arraySet : - public solidReaction + public sampledSet { // Private data - // Reaction rate - ReactionRate k_; + //- Coordinate syste + coordinateSystem coordSys_; + + //- Point density vector + Vector<label> pointsDensity_; - // Reaction order - scalar nReact_; + //- Span box + Vector<scalar> spanBox_; // Private Member Functions - //- Disallow default bitwise assignment - void operator= + //- Samples all points in sampleCoords. + void calcSamples ( - const IrreversibleSolidReaction<ReactionRate>& - ); + DynamicList<point>& samplingPts, + DynamicList<label>& samplingCells, + DynamicList<label>& samplingFaces, + DynamicList<label>& samplingSegments, + DynamicList<scalar>& samplingCurveDist + ) const; + + //- Uses calcSamples to obtain samples. Copies them into *this. + void genSamples(); public: //- Runtime type information - TypeName("irreversible"); + TypeName("array"); // Constructors //- Construct from components - IrreversibleSolidReaction + arraySet ( - const solidReaction& reaction, - const ReactionRate& reactionRate, - const scalar nReact + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const word& axis, + const coordinateSystem& coordSys, + const Vector<label>& pointsDensity, + const Vector<scalar>& spanBox ); - - //- Construct from Istream - IrreversibleSolidReaction + //- Construct from dictionary + arraySet ( - const speciesTable& components, - Istream& is, - const speciesTable& pyrolysisGases + const word& name, + const polyMesh& mesh, + const meshSearch& searchEngine, + const dictionary& dict ); //- Destructor - virtual ~IrreversibleSolidReaction() - {} - - - // Member Functions - - // IrreversibleSolidReaction rate coefficients - - //- Forward rate constant - virtual scalar kf - ( - const scalar p, - const scalar T, - const scalarField& c - ) const; - - - //- Reaction order - virtual scalar nReact() const; - - - //- Write - virtual void write(Ostream&) const; + virtual ~arraySet(); }; @@ -128,12 +124,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "IrreversibleSolidReaction.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index bb814f2628adce4114fb89a5ef1384ad6f139c55..6287722ae5e06896ae40cb48a1fbf30780673ed6 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -164,17 +164,19 @@ void Foam::sampledSurfaces::write() writeGeometry(); } - sampleAndWrite<volScalarField>(mesh_); - sampleAndWrite<volVectorField>(mesh_); - sampleAndWrite<volSphericalTensorField>(mesh_); - sampleAndWrite<volSymmTensorField>(mesh_); - sampleAndWrite<volTensorField>(mesh_); - - sampleAndWrite<surfaceScalarField>(mesh_); - sampleAndWrite<surfaceVectorField>(mesh_); - sampleAndWrite<surfaceSphericalTensorField>(mesh_); - sampleAndWrite<surfaceSymmTensorField>(mesh_); - sampleAndWrite<surfaceTensorField>(mesh_); + const IOobjectList objects(mesh_, mesh_.time().timeName()); + + sampleAndWrite<volScalarField>(objects); + sampleAndWrite<volVectorField>(objects); + sampleAndWrite<volSphericalTensorField>(objects); + sampleAndWrite<volSymmTensorField>(objects); + sampleAndWrite<volTensorField>(objects); + + sampleAndWrite<surfaceScalarField>(objects); + sampleAndWrite<surfaceVectorField>(objects); + sampleAndWrite<surfaceSphericalTensorField>(objects); + sampleAndWrite<surfaceSymmTensorField>(objects); + sampleAndWrite<surfaceTensorField>(objects); } } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 15e34a7983d6a2b9068855cf9cacd8face3e81c6..f16a2ceabfda48b57d7221c8f99602d59fd6e0df 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -160,7 +160,7 @@ class sampledSurfaces //- Sample and write all sampled fields template<class Type> - void sampleAndWrite(const fvMesh&); + void sampleAndWrite(const IOobjectList&); //- Disallow default bitwise copy construct and assignment sampledSurfaces(const sampledSurfaces&); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index f85f0e155d5726bc7c1779dd8d9f643d33792499..91dad4075214ab9efc1e1b27e6fadfcd2d31a45f 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -166,13 +166,18 @@ void Foam::sampledSurfaces::sampleAndWrite template<class GeoField> -void Foam::sampledSurfaces::sampleAndWrite(const fvMesh& mesh) +void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects) { forAll (fieldSelection_, fieldI) { const wordRe field = fieldSelection_[fieldI]; + IOobject* fieldIOPtr = allObjects.lookup(field); - if (mesh.thisDb().foundObject<GeoField>(field)) + if + ( + fieldIOPtr != NULL + && fieldIOPtr->headerClassName() == GeoField::typeName + ) { if (Pstream::master() && verbose_) { @@ -181,17 +186,25 @@ void Foam::sampledSurfaces::sampleAndWrite(const fvMesh& mesh) if (loadFromFiles_) { - const GeoField& geoField = - mesh.thisDb().lookupObject<GeoField>(field); + const GeoField geoField + ( + IOobject + ( + field, + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ + ), + mesh_ + ); - const_cast<GeoField&>(geoField).readOpt() = IOobject::MUST_READ; sampleAndWrite(geoField); } else { sampleAndWrite ( - mesh.thisDb().lookupObject<GeoField>(field) + mesh_.thisDb().lookupObject<GeoField>(field) ); } } diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 3a8da7148a3b1603702abe29aaeffb4c403ffced..dbd8310a3bcfb9b075311a019f669304d88eb042 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -4,6 +4,7 @@ makeType=${1:-libso} set -x wmake $makeType specie +wmake $makeType solidSpecie wmake $makeType thermophysicalFunctions ./properties/Allwmake $* @@ -14,7 +15,7 @@ wmake $makeType chemistryModel wmake $makeType barotropicCompressibilityModel wmake $makeType SLGThermo -wmake $makeType solidSpecie + wmake $makeType solidThermo wmake $makeType solidChemistryModel diff --git a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H index b2401e1123afef1e102467bf5b4996a192eb89c4..52978db2e555257b03947c980bd7396cc083f6d3 100644 --- a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H +++ b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H @@ -87,6 +87,27 @@ public: return mixture_; } + const ThermoType& cellVolMixture + ( + const scalar, + const scalar, + const label + ) const + { + return mixture_; + } + + const ThermoType& patchFaceVolMixture + ( + const scalar, + const scalar, + const label, + const label + ) const + { + return mixture_; + } + //- Read dictionary void read(const dictionary&); }; diff --git a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C index 1d2c76d036beb4ef21ea9970cdf11a4dd4e757e1..5121436412965833a947108448230dc7e8f467bc 100644 --- a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C +++ b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "unitConversion.H" #include "zeroGradientFvPatchFields.H" -#include "basicSolidMixture.H" + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -71,7 +71,7 @@ greyMeanSolidAbsorptionEmission::X(const word specie) const } } const scalarField& Yj = mixture_.Y(specie); - const label mySpecieI = mixture_.components()[specie]; + const label mySpecieI = mixture_.species()[specie]; forAll(Xj, iCell) { Xj[iCell] = Yj[iCell]/mixture_.rho(mySpecieI, p[iCell], T[iCell]); @@ -93,10 +93,10 @@ greyMeanSolidAbsorptionEmission coeffsDict_((dict.subDict(typeName + "Coeffs"))), thermo_(mesh.lookupObject<solidThermo>("thermophysicalProperties")), speciesNames_(0), - mixture_(dynamic_cast<const basicSolidMixture&>(thermo_)), + mixture_(dynamic_cast<const basicMultiComponentMixture&>(thermo_)), solidData_(mixture_.Y().size()) { - if (!isA<basicSolidMixture>(thermo_)) + if (!isA<basicMultiComponentMixture>(thermo_)) { FatalErrorIn ( diff --git a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H index fad8868086b19128635b5d3f249cffa3260b9a0f..d922980888b43fb7caafe21de44dd3a03ab95d5a 100644 --- a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H +++ b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.H @@ -90,7 +90,7 @@ private: HashTable<label> speciesNames_; //- Basic multicomponent mixture - const basicSolidMixture& mixture_; + const basicMultiComponentMixture& mixture_; //- List of solid species data List<FixedList<scalar, 2> > solidData_; diff --git a/src/thermophysicalModels/reactionThermo/Make/options b/src/thermophysicalModels/reactionThermo/Make/options index 8c18cf8318024f42bb1525dd6e0884982f801738..1758b4921ee7c868c26067b7b07ec30df6386e8b 100644 --- a/src/thermophysicalModels/reactionThermo/Make/options +++ b/src/thermophysicalModels/reactionThermo/Make/options @@ -2,10 +2,13 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude + LIB_LIBS = \ -lfiniteVolume \ -lfluidThermophysicalModels \ -lspecie \ + -lsolidSpecie \ -lmeshTools diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C index 7ee6324527ef910bff3ab09fd39c0f0fca4cb990..b7474a9fafba56f46d2fae5eb0199ae2b04c8aa1 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C @@ -25,6 +25,7 @@ License #include "makeReactionThermo.H" #include "thermoPhysicsTypes.H" +#include "solidThermoPhysicsTypes.H" #include "chemistryReader.H" #include "foamChemistryReader.H" @@ -41,6 +42,8 @@ makeChemistryReader(gasThermoPhysics); makeChemistryReader(constIncompressibleGasThermoPhysics); makeChemistryReader(incompressibleGasThermoPhysics); makeChemistryReader(icoPoly8ThermoPhysics); +makeChemistryReader(hConstSolidThermoPhysics); +makeChemistryReader(hExponentialSolidThermoPhysics); makeChemistryReaderType(foamChemistryReader, constGasThermoPhysics); makeChemistryReaderType(foamChemistryReader, gasThermoPhysics); @@ -51,6 +54,8 @@ makeChemistryReaderType ); makeChemistryReaderType(foamChemistryReader, incompressibleGasThermoPhysics); makeChemistryReaderType(foamChemistryReader, icoPoly8ThermoPhysics); +makeChemistryReaderType(foamChemistryReader, hConstSolidThermoPhysics); +makeChemistryReaderType(foamChemistryReader, hExponentialSolidThermoPhysics); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 26fb1b14789489335652705d91f9116cb7e34bc2..922c1227b9c55615fd44f985bd2eef75e9e0fc59 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -41,6 +41,7 @@ License #include "powerSeriesReactionRate.H" #include "addToRunTimeSelectionTable.H" + /* * * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * */ namespace Foam @@ -178,7 +179,8 @@ void Foam::chemkinReader::addReactionType { reactions_.append ( - new IrreversibleReaction<gasThermoPhysics, ReactionRateType> + new IrreversibleReaction + <Reaction, gasThermoPhysics, ReactionRateType> ( Reaction<gasThermoPhysics> ( @@ -197,7 +199,8 @@ void Foam::chemkinReader::addReactionType { reactions_.append ( - new ReversibleReaction<gasThermoPhysics, ReactionRateType> + new ReversibleReaction + <Reaction, gasThermoPhysics, ReactionRateType> ( Reaction<gasThermoPhysics> ( @@ -496,7 +499,7 @@ void Foam::chemkinReader::addReaction reactions_.append ( new NonEquilibriumReversibleReaction - <gasThermoPhysics, ArrheniusReactionRate> + <Reaction, gasThermoPhysics, ArrheniusReactionRate> ( Reaction<gasThermoPhysics> ( @@ -549,7 +552,11 @@ void Foam::chemkinReader::addReaction reactions_.append ( new NonEquilibriumReversibleReaction - <gasThermoPhysics, thirdBodyArrheniusReactionRate> + < + Reaction, + gasThermoPhysics, + thirdBodyArrheniusReactionRate + > ( Reaction<gasThermoPhysics> ( @@ -654,7 +661,7 @@ void Foam::chemkinReader::addReaction reactions_.append ( new NonEquilibriumReversibleReaction - <gasThermoPhysics, LandauTellerReactionRate> + <Reaction, gasThermoPhysics, LandauTellerReactionRate> ( Reaction<gasThermoPhysics> ( diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index e307aedf5ab81a13c8aee770fccc9378996e01da..dbdc804d8b239768a3ff99bb923904ab296d6ac6 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -77,7 +77,8 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture : basicMultiComponentMixture(thermoDict, specieNames, mesh), speciesData_(species_.size()), - mixture_("mixture", *thermoData[specieNames[0]]) + mixture_("mixture", *thermoData[specieNames[0]]), + mixtureVol_("volMixture", *thermoData[specieNames[0]]) { forAll(species_, i) { @@ -101,7 +102,8 @@ Foam::multiComponentMixture<ThermoType>::multiComponentMixture : basicMultiComponentMixture(thermoDict, thermoDict.lookup("species"), mesh), speciesData_(species_.size()), - mixture_("mixture", constructSpeciesData(thermoDict)) + mixture_("mixture", constructSpeciesData(thermoDict)), + mixtureVol_("volMixture", speciesData_[0]) { correctMassFractions(); } @@ -148,6 +150,65 @@ const ThermoType& Foam::multiComponentMixture<ThermoType>::patchFaceMixture } +template<class ThermoType> +const ThermoType& Foam::multiComponentMixture<ThermoType>::cellVolMixture +( + const scalar p, + const scalar T, + const label celli +) const +{ + scalar rhoInv = 0.0; + forAll(speciesData_, i) + { + rhoInv += Y_[i][celli]/speciesData_[i].rho(p, T); + } + + mixtureVol_ = + Y_[0][celli]/speciesData_[0].rho(p, T)/rhoInv*speciesData_[0]; + + for (label n=1; n<Y_.size(); n++) + { + mixtureVol_ += + Y_[n][celli]/speciesData_[n].rho(p, T)/rhoInv*speciesData_[n]; + } + + return mixtureVol_; +} + + +template<class ThermoType> +const ThermoType& Foam::multiComponentMixture<ThermoType>:: +patchFaceVolMixture +( + const scalar p, + const scalar T, + const label patchi, + const label facei +) const +{ + scalar rhoInv = 0.0; + forAll(speciesData_, i) + { + rhoInv += + Y_[i].boundaryField()[patchi][facei]/speciesData_[i].rho(p, T); + } + + mixtureVol_ = + Y_[0].boundaryField()[patchi][facei]/speciesData_[0].rho(p, T)/rhoInv + * speciesData_[0]; + + for (label n=1; n<Y_.size(); n++) + { + mixtureVol_ += + Y_[n].boundaryField()[patchi][facei]/speciesData_[n].rho(p,T) + / rhoInv*speciesData_[n]; + } + + return mixtureVol_; +} + + template<class ThermoType> void Foam::multiComponentMixture<ThermoType>::read ( diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H index 4017a5fd13b8c39d40ed6aa14898e1f8ef175bbc..c7b50a77aebf87b929d23a457c6cb4fac7017edf 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H @@ -60,6 +60,10 @@ class multiComponentMixture //- Temporary storage for the cell/face mixture thermo data mutable ThermoType mixture_; + //- Temporary storage for the volume weighted + // cell/face mixture thermo data + mutable ThermoType mixtureVol_; + // Private Member Functions @@ -110,6 +114,21 @@ public: const label facei ) const; + const ThermoType& cellVolMixture + ( + const scalar p, + const scalar T, + const label celli + ) const; + + const ThermoType& patchFaceVolMixture + ( + const scalar p, + const scalar T, + const label patchi, + const label facei + ) const; + //- Return the raw specie thermodynamic data const PtrList<ThermoType>& speciesData() const { diff --git a/src/thermophysicalModels/solidChemistryModel/Make/options b/src/thermophysicalModels/solidChemistryModel/Make/options index bf091e91f888a4f2ee2ae96e13cce1f37bb1b094..e871169b17f52e46e9fdf1ab5878f7c4f4532acc 100644 --- a/src/thermophysicalModels/solidChemistryModel/Make/options +++ b/src/thermophysicalModels/solidChemistryModel/Make/options @@ -1,10 +1,11 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude @@ -12,4 +13,5 @@ EXE_INC = \ LIB_LIBS = \ -lchemistryModel \ -lfiniteVolume \ - -lODE + -lODE\ + -lreactionThermophysicalModels diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C index 6bc25ebc2c880e21677dcf518d06fca535cbbd2d..f61de4026bd3615833b5b2f8a958c7e935df64ff 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C @@ -24,7 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "ODESolidChemistryModel.H" -#include "reactingSolidMixture.H" +#include "reactingMixture.H" +#include "solidReaction.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -38,24 +39,20 @@ ODESolidChemistryModel CompType(mesh), ODE(), Ys_(this->solidThermo().composition().Y()), - pyrolisisGases_ - ( - mesh.lookupObject<dictionary> - ("thermophysicalProperties").lookup("gaseousSpecies") - ), reactions_ ( - dynamic_cast<const reactingSolidMixture<SolidThermo>& > + dynamic_cast<const reactingMixture<SolidThermo>& > ( this->solidThermo() ) ), + pyrolisisGases_(reactions_[0].gasSpecies()), solidThermo_ ( - dynamic_cast<const reactingSolidMixture<SolidThermo>& > + dynamic_cast<const reactingMixture<SolidThermo>& > ( this->solidThermo() - ).solidData() + ).speciesData() ), gasThermo_(pyrolisisGases_.size()), nGases_(pyrolisisGases_.size()), @@ -184,7 +181,7 @@ ODESolidChemistryModel mesh.lookupObject<dictionary> ( "thermophysicalProperties" - ).subDict(pyrolisisGases_[gasI] + "Coeffs"); + ).subDict(pyrolisisGases_[gasI]); gasThermo_.set ( @@ -193,14 +190,13 @@ ODESolidChemistryModel ); } - Info<< "ODESolidChemistryModel: Number of solids = " << nSolids_ - << " and reactions = " << nReaction_ << endl; + Info<< "solidChemistryModel: Number of solids = " << nSolids_ << endl; - Info<< "Number of gases from pyrolysis = " << nGases_ << endl; + Info<< "solidChemistryModel: Number of gases = " << nGases_ << endl; forAll(reactions_, i) { - Info<< indent << "Reaction " << i << nl << reactions_[i] << nl; + Info<< indent << reactions_[i] << nl; } } @@ -235,23 +231,23 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega forAll(reactions_, i) { - const solidReaction& R = reactions_[i]; + const Reaction<SolidThermo>& R = reactions_[i]; scalar omegai = omega ( R, c, T, p, pf, cf, lRef, pr, cr, rRef ); scalar rhoL = 0.0; - forAll(R.slhs(), s) + forAll(R.lhs(), s) { - label si = R.slhs()[s]; + label si = R.lhs()[s].index; om[si] -= omegai; rhoL = solidThermo_[si].rho(p, T); } scalar sr = 0.0; - forAll(R.srhs(), s) + forAll(R.rhs(), s) { - label si = R.srhs()[s]; + label si = R.rhs()[s].index; scalar rhoR = solidThermo_[si].rho(p, T); sr = rhoR/rhoL; om[si] += sr*omegai; @@ -263,7 +259,7 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega } forAll(R.grhs(), g) { - label gi = R.grhs()[g]; + label gi = R.grhs()[g].index; om[gi + nSolids_] += (1.0 - sr)*omegai; } } @@ -276,7 +272,7 @@ template<class CompType, class SolidThermo, class GasThermo> Foam::scalar Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega ( - const solidReaction& R, + const Reaction<SolidThermo>& R, const scalarField& c, const scalar T, const scalar p, @@ -299,16 +295,17 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega scalar kf = R.kf(p, T, c1); - const scalar exponent = R.nReact(); + //const scalar exponent = R.nReact(); - const label Nl = R.slhs().size(); + const label Nl = R.lhs().size(); for (label s=0; s<Nl; s++) { - label si = R.slhs()[s]; + label si = R.lhs()[s].index; + const scalar exp = R.lhs()[si].exponent; kf *= - pow(c1[si]/Ys0_[si][cellI], exponent) + pow(c1[si]/Ys0_[si][cellI], exp) *(Ys0_[si][cellI]); } @@ -390,18 +387,18 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian for (label ri=0; ri<reactions_.size(); ri++) { - const solidReaction& R = reactions_[ri]; + const Reaction<SolidThermo>& R = reactions_[ri]; scalar kf0 = R.kf(p, T, c2); - forAll(R.slhs(), j) + forAll(R.lhs(), j) { - label sj = R.slhs()[j]; + label sj = R.lhs()[j].index; scalar kf = kf0; - forAll(R.slhs(), i) + forAll(R.lhs(), i) { - label si = R.slhs()[i]; - scalar exp = R.nReact(); + label si = R.lhs()[i].index; + scalar exp = R.lhs()[i].exponent; if (i == j) { if (exp < 1.0) @@ -428,14 +425,14 @@ void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian } } - forAll(R.slhs(), i) + forAll(R.lhs(), i) { - label si = R.slhs()[i]; + label si = R.lhs()[i].index; dfdc[si][sj] -= kf; } - forAll(R.srhs(), i) + forAll(R.rhs(), i) { - label si = R.srhs()[i]; + label si = R.rhs()[i].index; dfdc[si][sj] += kf; } } @@ -551,7 +548,8 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const template<class CompType, class SolidThermo, class GasThermo> -void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::calculate() +void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>:: +calculate() { if (!this->chemistry_) { diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H index 796d055388437bffb629909ae36525d4d87aaacf..21dc5a5eecfe0b9f7fc7297c5aa08099afe1fe21 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H @@ -38,7 +38,7 @@ SourceFiles #ifndef ODESolidChemistryModel_H #define ODESolidChemistryModel_H -#include "solidReaction.H" +#include "Reaction.H" #include "ODE.H" #include "volFieldsFwd.H" #include "DimensionedField.H" @@ -72,12 +72,12 @@ protected: //- Reference to solid mass fractions PtrList<volScalarField>& Ys_; + //- Reactions + const PtrList<Reaction<SolidThermo> >& reactions_; + //- List of gas species present in reaction system speciesTable pyrolisisGases_; - //- Reactions - const PtrList<solidReaction>& reactions_; - //- Thermodynamic data of solids const PtrList<SolidThermo>& solidThermo_; @@ -149,7 +149,7 @@ public: // Member Functions //- The reactions - inline const PtrList<solidReaction>& reactions() const; + inline const PtrList<Reaction<SolidThermo> >& reactions() const; //- Thermodynamic data of gases inline const PtrList<GasThermo>& gasThermo() const; @@ -180,7 +180,7 @@ public: // species and charateristic times virtual scalar omega ( - const solidReaction& r, + const Reaction<SolidThermo>& r, const scalarField& c, const scalar T, const scalar p, diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H index bcb6a89f993179d7e415a60489c16e91d8b49be3..73a5b03d7dff860ed02cdc4b9eb62e493951b600 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H @@ -45,7 +45,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() template<class CompType, class SolidThermo, class GasThermo> -inline const Foam::PtrList<Foam::solidReaction>& +inline const Foam::PtrList<Foam::Reaction<SolidThermo> >& Foam::ODESolidChemistryModel<CompType, SolidThermo,GasThermo>::reactions() const { return reactions_; diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C index a207428abab53ca558c0e9752ec1c850423adc85..9c8a6df052fbd0e7be6f5efc0ce21c519c2582e7 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolvers.C @@ -51,6 +51,7 @@ namespace Foam hExponentialSolidThermoPhysics, gasThermoPhysics ) + } diff --git a/src/thermophysicalModels/solidSpecie/Make/files b/src/thermophysicalModels/solidSpecie/Make/files index 0e8165b9ad1f39f8501f7f6fbab175c20c79d1a5..403c1483589b74bba60e318e96bb03b54c25ba0f 100644 --- a/src/thermophysicalModels/solidSpecie/Make/files +++ b/src/thermophysicalModels/solidSpecie/Make/files @@ -1,4 +1,3 @@ -reaction/Reactions/solidReaction/solidReaction.C reaction/reactions/makeSolidReactions.C LIB = $(FOAM_LIBBIN)/libsolidSpecie diff --git a/src/thermophysicalModels/solidSpecie/Make/options b/src/thermophysicalModels/solidSpecie/Make/options index 848cce789f2aad33d9ed6eda979ea31c32377425..bdc8b074c03a509ce2f001f40aff6c0c189b0222 100644 --- a/src/thermophysicalModels/solidSpecie/Make/options +++ b/src/thermophysicalModels/solidSpecie/Make/options @@ -1,2 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + +LIB_LIBS = \ + -lspecie diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C b/src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C deleted file mode 100644 index ad08af33165e723c9984181e58a6ace503e902d0..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C +++ /dev/null @@ -1,92 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "IrreversibleSolidReaction.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ReactionRate> -Foam::IrreversibleSolidReaction<ReactionRate>::IrreversibleSolidReaction -( - const solidReaction& reaction, - const ReactionRate& k, - const scalar nReact -) -: - solidReaction(reaction), - k_(k), - nReact_(nReact) -{} - - -template<class ReactionRate> -Foam::IrreversibleSolidReaction<ReactionRate>::IrreversibleSolidReaction -( - const speciesTable& components, - Istream& is, - const speciesTable& pyrolysisGases -) -: - solidReaction(components, is, pyrolysisGases), - k_(components, is), - nReact_(readScalar(is)) -{ - is.readEnd("solidArrheniusReactionRate(Istream&)"); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ReactionRate> -Foam::scalar Foam::IrreversibleSolidReaction<ReactionRate>::kf -( - const scalar p, - const scalar T, - const scalarField& c -) const -{ - return k_(p, T, c); -} - - -template<class ReactionRate> -Foam::scalar Foam::IrreversibleSolidReaction<ReactionRate>::nReact() const -{ - return nReact_; -} - - -template<class ReactionRate> -void Foam::IrreversibleSolidReaction<ReactionRate>::write -( - Ostream& os -) const -{ - solidReaction::write(os); - os << token::SPACE << "Reaction order: " << nReact_ << nl << k_; -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C index 5e351cff4a3ff4e9b5dc5f02d57bb089b4c0c171..ead9b263fc04fc1c1bfa6c11695a7884bd008e8b 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.C @@ -26,299 +26,118 @@ License #include "solidReaction.H" #include "DynamicList.H" -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ - -namespace Foam -{ - defineTypeNameAndDebug(solidReaction, 0); - defineRunTimeSelectionTable(solidReaction, Istream); -} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidReaction::solidReaction +template<class ReactionThermo> +Foam::solidReaction<ReactionThermo>::solidReaction ( - const speciesTable& componets, + const Reaction<ReactionThermo>& reaction, const speciesTable& pyrolisisGases, - const List<label>& slhs, - const List<label>& srhs, - const List<label>& grhs + const List<specieCoeffs>& glhs, + const List<specieCoeffs>& grhs ) : - components_(componets), + Reaction<ReactionThermo>(reaction), pyrolisisGases_(pyrolisisGases), - slhs_(slhs), - srhs_(srhs), + glhs_(glhs), grhs_(grhs) {} -Foam::solidReaction::solidReaction +template<class ReactionThermo> +Foam::solidReaction<ReactionThermo>::solidReaction ( - const solidReaction& r, - const speciesTable& componets, + const solidReaction<ReactionThermo>& r, const speciesTable& pyrolisisGases ) : - components_(componets), + Reaction<ReactionThermo>(r), pyrolisisGases_(pyrolisisGases), - slhs_(r.slhs_), - srhs_(r.srhs_), + glhs_(r.glhs_), grhs_(r.grhs_) {} -Foam::solidReaction::solidReaction -( - const speciesTable& components, - Istream& is, - const speciesTable& pyrolisisGases -) -: - components_(components), - pyrolisisGases_(pyrolisisGases) -{ - setLRhs(is); -} - - -Foam::label Foam::solidReaction::componentIndex +template<class ReactionThermo> +Foam::solidReaction<ReactionThermo>::solidReaction ( - bool& isGas, + const speciesTable& species, + const HashPtrTable<ReactionThermo>& thermoDatabase, Istream& is ) +: + Reaction<ReactionThermo>(species, thermoDatabase, is), + pyrolisisGases_(), + glhs_(), + grhs_() { - token t(is); - - if (t.isWord()) - { - word componentName = t.wordToken(); - - size_t i = componentName.find('='); - - if (i != word::npos) - { - string exponentStr = componentName - ( - i + 1, - componentName.size() - i - 1 - ); - componentName = componentName(0, i); - } - if (components_.contains(componentName)) - { - isGas = false; - return (components_[componentName]); - } - else if (pyrolisisGases_.contains(componentName)) - { - isGas = true; - return (pyrolisisGases_[componentName]); - } - else - { - FatalIOErrorIn - ( - "solidReaction::componentIndex(bool&, Istream& is)", - is - ) - << "Cannot find component" << componentName - << "in tables :" << pyrolisisGases_ << " or " - << components_ - << exit(FatalIOError); - return -1; - } - - } - else - { - FatalIOErrorIn("solidReaction::componentIndex(bool&, Istream& is)", is) - << "Expected a word but found " << t.info() - << exit(FatalIOError); - return -1; - } -} - - -void Foam::solidReaction::setLRhs(Istream& is) -{ - DynamicList<label> dlsrhs; - - label index = 0; - - while (is) - { - bool isGas = false; - index = componentIndex(isGas, is); - - if (index != -1) - { - dlsrhs.append(index); - - token t(is); - - if (t.isPunctuation()) - { - if (t == token::ADD) - { - if (isGas) - { - grhs_ = dlsrhs.shrink(); - dlsrhs.clear(); - //is.putBack(t); - //return; - } - else - { - srhs_ = dlsrhs.shrink(); - dlsrhs.clear(); //is.putBack(t); - //return; - } - } - else if (t == token::ASSIGN) - { - if (isGas) - { - Info << "Pyrolysis Gases should appear on lhs of the" - "reaction" << endl; - } - else - { - slhs_ = dlsrhs.shrink(); - dlsrhs.clear(); - } - } - else if (isGas) - { - grhs_ = dlsrhs.shrink(); - is.putBack(t); - return; - } - else - { - srhs_ = dlsrhs.shrink(); - is.putBack(t); - return; - } - } - else if (isGas) - { - grhs_ = dlsrhs.shrink(); - is.putBack(t); - return; - } - else - { - srhs_ = dlsrhs.shrink(); - is.putBack(t); - return; - } - } - else - { - FatalIOErrorIn("solidReaction::lsrhs(Istream& is)", is) - << "Cannot find component in tables" - << exit(FatalIOError); - } - } - - FatalIOErrorIn("solidReaction::lsrhs(Istream& is)", is) - << "Cannot continue reading reaction data from stream" - << exit(FatalIOError); + notImplemented + ( + "template<class ReactionThermo>" + "Foam::solidReaction<ReactionThermo>::solidReaction" + "(" + " const speciesTable& species," + " const HashPtrTable<ReactionThermo>& thermoDatabase," + " Istream& is" + ")" + ); } -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - -Foam::autoPtr<Foam::solidReaction> Foam::solidReaction::New +template<class ReactionThermo> +Foam::solidReaction<ReactionThermo>::solidReaction ( const speciesTable& species, - Istream& is, - const speciesTable& pyrolisisGases + const HashPtrTable<ReactionThermo>& thermoDatabase, + const dictionary& dict ) +: + Reaction<ReactionThermo>(species, thermoDatabase, dict), + pyrolisisGases_(dict.parent().parent().lookup("gaseousSpecies")), + glhs_(), + grhs_() { - if (is.eof()) - { - FatalIOErrorIn - ( - "solidReaction::New(const speciesTable& species," - " const HashPtrTable& thermoDatabase, Istream&)", - is - ) << "solidReaction type not specified" << nl << nl - << "Valid solidReaction types are :" << endl - << IstreamConstructorTablePtr_->sortedToc() - << exit(FatalIOError); - } - - const word reactionTypeName(is); - - IstreamConstructorTable::iterator cstrIter - = IstreamConstructorTablePtr_->find(reactionTypeName); - - if (cstrIter == IstreamConstructorTablePtr_->end()) - { - FatalIOErrorIn - ( - "solidReaction::New(const speciesTable& species," - " const HashPtrTable& thermoDatabase, Istream&)", - is - ) << "Unknown reaction type " - << reactionTypeName << nl << nl - << "Valid reaction types are :" << endl - << IstreamConstructorTablePtr_->sortedToc() - << exit(FatalIOError); - } - - return autoPtr<solidReaction> + this->setLRhs ( - cstrIter()(species, is, pyrolisisGases) + IStringStream(dict.lookup("reaction"))(), + pyrolisisGases_, + glhs_, + grhs_ ); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::solidReaction::write(Ostream& os) const +template<class ReactionThermo> +const Foam::List<typename Foam::solidReaction<ReactionThermo>::specieCoeffs>& +Foam::solidReaction<ReactionThermo>::glhs() const { - os << type() << nl << " "; - - forAll(slhs_, i) - { - os << components_[slhs_[i]]; - } - - os << " = "; - - forAll(srhs_, i) - { - os << components_[srhs_[i]]; - } - - os << " + "; + return glhs_; +} - forAll(grhs_, i) - { - os << pyrolisisGases_[grhs_[i]]; - } - os << endl << " "; +template<class ReactionThermo> +const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>& +Foam::solidReaction<ReactionThermo>::grhs() const +{ + return grhs_; } -Foam::scalar Foam::solidReaction::kf -( - const scalar p, - const scalar T, - const scalarField& c -) const +template<class ReactionThermo> +const Foam::speciesTable& Foam::solidReaction<ReactionThermo>:: +gasSpecies() const { - return 0.0; + return pyrolisisGases_; } -Foam::scalar Foam::solidReaction::nReact() const +template<class ReactionThermo> +void Foam::solidReaction<ReactionThermo>::write(Ostream& os) const { - return 1.0; + Reaction<ReactionThermo>::write(os); } diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H index 2b2e383aaf27fcce16c8a16bf11ed6ac721a6fc4..1bc4a82243c31cbaaf134bac6b5796d01fbf4bed 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReaction.H @@ -38,9 +38,7 @@ SourceFiles #define solidReaction_H #include "speciesTable.H" -#include "scalarField.H" -#include "typeInfo.H" -#include "runTimeSelectionTables.H" +#include "Reaction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,44 +46,40 @@ namespace Foam { // Forward declaration of friend functions and operators +template<class ReactionThermo> class solidReaction; -inline Ostream& operator<<(Ostream&, const solidReaction&); +template<class ReactionThermo> +inline Ostream& operator<<(Ostream&, const solidReaction<ReactionThermo>&); /*---------------------------------------------------------------------------*\ Class solidReaction Declaration \*---------------------------------------------------------------------------*/ +template<class ReactionThermo> class solidReaction +: + public Reaction<ReactionThermo> { private: // Private data - //- List of solid names present in reaction system - const speciesTable& components_; + typedef typename Reaction<ReactionThermo>::specieCoeffs specieCoeffs; //- List of gas species present in reaction system speciesTable pyrolisisGases_; - //- Solid components index for the left-hand-side of the reaction - List<label> slhs_; + //- Gas specie index for the left-hand-side of the reaction + List<specieCoeffs> glhs_; - //- Solid components index for the right-hand-side of the reaction - List<label> srhs_; - - //- Specie index for the right-hand-side of the reaction - List<label> grhs_; + //- Gas specie index for the right-hand-side of the reaction + List<specieCoeffs> grhs_; // Private Member Functions - //- Set rhs and lhs of the reaction - void setLRhs(Istream&); - - //- Look for the component index in the reaction - label componentIndex(bool& isGas, Istream& is); //- Disallow default bitwise assignment void operator=(const solidReaction&); @@ -94,58 +88,7 @@ private: public: //- Runtime type information - TypeName("Reaction"); - - - // Declare run-time constructor selection tables - - declareRunTimeSelectionTable - ( - autoPtr, - solidReaction, - Istream, - ( - const speciesTable& components, - Istream& is, - const speciesTable& pyrolysisGases - ), - (components, is, pyrolysisGases) - ); - - - // Public classes - - //- Class used for the read-construction of PtrLists of reaction - class iNew - { - const speciesTable& components_; - speciesTable pyrolisisGases_; - - public: - - iNew - ( - const speciesTable& components, - Istream& pyrolisisGases - ) - : - components_(components), - pyrolisisGases_(pyrolisisGases) - {} - - autoPtr<solidReaction> operator()(Istream& is) const - { - return autoPtr<solidReaction> - ( - solidReaction::New - ( - components_, - is, - pyrolisisGases_ - ) - ); - } - }; + TypeName("SolidReaction"); // Constructors @@ -153,48 +96,59 @@ public: //- Construct from components solidReaction ( - const speciesTable& components, + const Reaction<ReactionThermo>& reaction, const speciesTable& pyrolisisGases, - const List<label>& slhs, - const List<label>& srhs, - const List<label>& grhs + const List<specieCoeffs>& glhs, + const List<specieCoeffs>& grhs ); + //- Construct as copy given new speciesTable solidReaction ( - const solidReaction&, - const speciesTable& components, + const solidReaction<ReactionThermo>&, const speciesTable& pyrolisisGases ); + //- Construct from Istream solidReaction ( - const speciesTable& components, - Istream& is, - const speciesTable& pyrolisisGases + const speciesTable& pyrolisisGases, + const HashPtrTable<ReactionThermo>& thermoDatabase, + Istream& is ); + + //- Construct from dictionary + solidReaction + ( + const speciesTable& species, + const HashPtrTable<ReactionThermo>& thermoDatabase, + const dictionary& dict + ); + + //- Construct and return a clone - virtual autoPtr<solidReaction > clone() const + virtual autoPtr<Reaction<ReactionThermo> > clone() const { - return autoPtr<solidReaction > + return autoPtr<Reaction<ReactionThermo> > ( - new solidReaction(*this) + new solidReaction<ReactionThermo>(*this) ); } - - // Selectors - - //- Return a pointer to a new patchField created on freestore from input - static autoPtr<solidReaction > New + //- Construct and return a clone with new speciesTable + virtual autoPtr<Reaction<ReactionThermo> > clone ( - const speciesTable& components, - Istream&, - const speciesTable& pyrolisisGases - ); + const speciesTable& species + ) const + { + return autoPtr<Reaction<ReactionThermo> > + ( + new solidReaction<ReactionThermo>(*this, species) + ); + } //- Destructor @@ -206,23 +160,13 @@ public: // Access - inline const List<label>& slhs() const; - inline const List<label>& srhs() const; - inline const List<label>& grhs() const; - - inline const speciesTable& pyrolisisGases() const; - - - // solidReaction rate coefficients - virtual scalar kf - ( - const scalar p, - const scalar T, - const scalarField& c - ) const; + // - Acces to gas components of the reaction + virtual const List<specieCoeffs>& grhs() const; + virtual const List<specieCoeffs>& glhs() const; - virtual scalar nReact() const; + // - Access to gas specie list + virtual const speciesTable& gasSpecies() const; //- Write @@ -231,10 +175,10 @@ public: // Ostream Operator - friend Ostream& operator<< + friend Ostream& operator<< <ReactionThermo> ( Ostream&, - const solidReaction& + const solidReaction<ReactionThermo>& ); }; @@ -249,6 +193,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "solidReaction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H index 07b7727decfd3376f0722da2da7ba86184563478..534bb66fa7db3899f7ad7711001cb5e4a48959eb 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H +++ b/src/thermophysicalModels/solidSpecie/reaction/Reactions/solidReaction/solidReactionI.H @@ -30,38 +30,13 @@ License namespace Foam { -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const List<label>& solidReaction::slhs() const -{ - return slhs_; -} - - -inline const List<label>& solidReaction::srhs() const -{ - return srhs_; -} - - -inline const List<label>& solidReaction::grhs() const -{ - return grhs_; -} - - -inline const speciesTable& solidReaction::pyrolisisGases() const -{ - return pyrolisisGases_; -} - - // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // +template<class ReactionThermo> inline Ostream& operator<< ( Ostream& os, - const solidReaction& r + const solidReaction<ReactionThermo>& r ) { r.write(os); diff --git a/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRate.H b/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRate.H index 7c4db23ba323071b521479c2804510907e90d5e9..8569b44e224655cd93d3fae441f84471d7326e08 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRate.H +++ b/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRate.H @@ -75,13 +75,25 @@ public: Istream& is ); + //- Construct from dictionary + inline solidArrheniusReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + + + //- Destructor + virtual ~solidArrheniusReactionRate() + {} + // Member Functions //- Return the type name static word type() { - return "SolidArrhenius"; + return "Arrhenius"; } inline scalar operator() @@ -92,6 +104,10 @@ public: ) const; + //- Write to stream + inline void write(Ostream& os) const; + + // Ostream Operator inline friend Ostream& operator<< diff --git a/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRateI.H b/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRateI.H index 8812512bf6343043abc417dde875c84ada933537..2c59b2842820f8f89ea7ee38d494f61dcd087a9f 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRateI.H +++ b/src/thermophysicalModels/solidSpecie/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRateI.H @@ -30,6 +30,7 @@ inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate const scalar A, const scalar Ta, const scalar Tcrit + //const scalar nReact ) : A_(A), @@ -50,6 +51,18 @@ inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate {} +inline Foam::solidArrheniusReactionRate::solidArrheniusReactionRate +( + const speciesTable&, + const dictionary& dict +) +: + A_(readScalar(dict.lookup("A"))), + Ta_(readScalar(dict.lookup("Ta"))), + Tcrit_(readScalar(dict.lookup("Tcrit"))) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline Foam::scalar Foam::solidArrheniusReactionRate::operator() @@ -74,6 +87,14 @@ inline Foam::scalar Foam::solidArrheniusReactionRate::operator() } +inline void Foam::solidArrheniusReactionRate::write(Ostream& os) const +{ + os.writeKeyword("A") << A_ << token::END_STATEMENT << nl; + os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl; + os.writeKeyword("Tcrit") << Tcrit_ << token::END_STATEMENT << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReaction.H b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReaction.H index 45bd04abe2d442d7d75bfc7093dcff7a51df71bc..7674c457d7bdb82931fd3fbd36d536652c52dad7 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReaction.H +++ b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReaction.H @@ -33,7 +33,9 @@ Description #define makeSolidReactionThermo_H #include "solidReaction.H" -#include "IrreversibleSolidReaction.H" +#include "IrreversibleReaction.H" +#include "Reaction.H" + #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,32 +45,46 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define makeReaction(ReactionType, ReactionRate) \ +#define makeSolidReaction(ReactionType, Thermo, ReactionRate) \ + \ + typedef solidReaction<Thermo> solidReaction##Thermo; \ + \ + typedef Reaction<Thermo> Reaction##Thermo; \ \ - typedef solidReaction Reaction; \ + typedef ReactionType<solidReaction, Thermo, ReactionRate> \ + ReactionType##Thermo##ReactionRate; \ \ - typedef ReactionType<ReactionRate> \ - ReactionType##ReactionRate; \ + defineTemplateRunTimeSelectionTable(Reaction##Thermo, Istream); \ + defineTemplateRunTimeSelectionTable(Reaction##Thermo, dictionary); \ + \ + defineTemplateTypeNameAndDebug(solidReaction##Thermo, 0); \ + defineTemplateTypeNameAndDebug(Reaction##Thermo, 0); \ \ template<> \ - const word ReactionType##ReactionRate::typeName \ + const word ReactionType##Thermo##ReactionRate::typeName \ ( \ ReactionType::typeName_() \ + ReactionRate::type() \ - + Reaction::typeName_() \ + + solidReaction##Thermo::typeName_() \ ); \ \ addToRunTimeSelectionTable \ ( \ - Reaction, \ - ReactionType##ReactionRate, \ + Reaction##Thermo, \ + ReactionType##Thermo##ReactionRate, \ Istream \ + ); \ + \ + addToRunTimeSelectionTable \ + ( \ + Reaction##Thermo, \ + ReactionType##Thermo##ReactionRate, \ + dictionary \ ); - -#define makeIRReactions(ReactionRate) \ +#define makeSolidIRReactions(Thermo, ReactionRate) \ \ - makeReaction(IrreversibleSolidReaction, ReactionRate) + makeSolidReaction(IrreversibleReaction, Thermo, ReactionRate) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C index 6962ad16f6d6caf51d6ea6add3b5f497232ff9fd..8fe56961ca9972e56a6cc1a505cd73bc0840b549 100644 --- a/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C +++ b/src/thermophysicalModels/solidSpecie/reaction/reactions/makeSolidReactions.C @@ -25,6 +25,7 @@ License #include "makeSolidReaction.H" #include "solidArrheniusReactionRate.H" +#include "solidThermoPhysicsTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -33,7 +34,13 @@ namespace Foam // * * * * * * * * * * * * * Make Solid reactions * * * * * * * * * * * * // -makeIRReactions(solidArrheniusReactionRate) +makeSolidIRReactions(hConstSolidThermoPhysics, solidArrheniusReactionRate) + +makeSolidIRReactions +( + hExponentialSolidThermoPhysics, + solidArrheniusReactionRate +) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H index e09d43a1cdacbf04e5de5858928c5c8ec039ac3e..60b846fd7ad03646e72b769e294bafa3ae402d3f 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H @@ -26,7 +26,7 @@ Class Description Constant properties Transport package. - Templated into a given thermodynamics package (needed for thermal + Templated into a given Thermodynamics package (needed for thermal conductivity). SourceFiles @@ -44,20 +44,20 @@ SourceFiles namespace Foam { -template<class thermo> class constAnIsoSolidTransport; +template<class Thermo> class constAnIsoSolidTransport; -template<class thermo> -inline constAnIsoSolidTransport<thermo> operator* +template<class Thermo> +inline constAnIsoSolidTransport<Thermo> operator* ( const scalar, - const constAnIsoSolidTransport<thermo>& + const constAnIsoSolidTransport<Thermo>& ); -template<class thermo> +template<class Thermo> Ostream& operator<< ( Ostream&, - const constAnIsoSolidTransport<thermo>& + const constAnIsoSolidTransport<Thermo>& ); @@ -65,10 +65,10 @@ Ostream& operator<< Class constAnIsoSolidTransport Declaration \*---------------------------------------------------------------------------*/ -template<class thermo> +template<class Thermo> class constAnIsoSolidTransport : - public thermo + public Thermo { // Private data @@ -79,7 +79,7 @@ class constAnIsoSolidTransport // Private Member Functions //- Construct from components - inline constAnIsoSolidTransport(const thermo& t, const vector kappa); + inline constAnIsoSolidTransport(const Thermo& t, const vector kappa); public: @@ -93,18 +93,36 @@ public: const constAnIsoSolidTransport& ); - //- Construct from Istream - //constAnIsoSolidTransport(Istream&); + //- Construct from dictionary constAnIsoSolidTransport(const dictionary&); + // Selector from dictionary + inline static autoPtr<constAnIsoSolidTransport> New + ( + const dictionary& dict + ); + // Member functions + //- Return the instantiated type name + static word typeName() + { + return "constAnIso<" + Thermo::typeName() + '>'; + } + //- Isotropic thermal conductivity [W/mK] - inline scalar kappa(const scalar T) const; + inline scalar kappa(const scalar p, const scalar T) const; //- Un-isotropic thermal conductivity [W/mK] - inline vector Kappa(const scalar T) const; + inline vector Kappa(const scalar p, const scalar T) const; + + //- Dynamic viscosity [kg/ms] + inline scalar mu(const scalar p, const scalar T) const; + + //- Thermal diffusivity of enthalpy [kg/ms] + inline vector alphah(const scalar p, const scalar T) const; + //- Write to Ostream void write(Ostream& os) const; @@ -121,7 +139,7 @@ public: // Friend operators - friend constAnIsoSolidTransport operator* <thermo> + friend constAnIsoSolidTransport operator* <Thermo> ( const scalar, const constAnIsoSolidTransport& @@ -130,7 +148,7 @@ public: // Ostream Operator - friend Ostream& operator<< <thermo> + friend Ostream& operator<< <Thermo> ( Ostream&, const constAnIsoSolidTransport& diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H index 7213a260a2fc8913685cc141d2fa0cfe8e982305..ff90fe1d268546879952d5285a14b50ede73399d 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H @@ -25,53 +25,89 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class thermo> -inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport +template<class Thermo> +inline Foam::constAnIsoSolidTransport<Thermo>::constAnIsoSolidTransport ( - const thermo& t, + const Thermo& t, const vector kappa ) : - thermo(t), + Thermo(t), kappa_(kappa) {} -template<class thermo> -inline Foam::constAnIsoSolidTransport<thermo>::constAnIsoSolidTransport +template<class Thermo> +inline Foam::constAnIsoSolidTransport<Thermo>::constAnIsoSolidTransport ( const word& name, const constAnIsoSolidTransport& ct ) : - thermo(name, ct), + Thermo(name, ct), kappa_(ct.kappa_) {} +template<class Thermo> +inline Foam::autoPtr<Foam::constAnIsoSolidTransport<Thermo> > +Foam::constAnIsoSolidTransport<Thermo>::New +( + const dictionary& dict +) +{ + return autoPtr<constAnIsoSolidTransport<Thermo> > + ( + new constAnIsoSolidTransport<Thermo>(dict) + ); +} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class thermo> -inline Foam::scalar Foam::constAnIsoSolidTransport<thermo>:: -kappa(const scalar T) const +template<class Thermo> +inline Foam::scalar Foam::constAnIsoSolidTransport<Thermo>:: +kappa(const scalar p, const scalar T) const { return mag(kappa_); } -template<class thermo> -inline Foam::vector Foam::constAnIsoSolidTransport<thermo>:: -Kappa(const scalar T) const +template<class Thermo> +inline Foam::vector Foam::constAnIsoSolidTransport<Thermo>:: +Kappa(const scalar p, const scalar T) const { return kappa_; } + +template<class Thermo> +inline Foam::scalar Foam::constAnIsoSolidTransport<Thermo>:: +mu(const scalar p, const scalar T) const +{ + notImplemented + ( + "Foam::scalar Foam::constAnIsoSolidTransport<Thermo>mu::" + "(" + " const scalar p, const scalar T" + ") const" + ); + return scalar(0); +} + + +template<class Thermo> +inline Foam::vector Foam::constAnIsoSolidTransport<Thermo>:: +alphah(const scalar p, const scalar T) const +{ + return kappa_/this->Cpv(p, T); +} + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template<class thermo> -inline Foam::constAnIsoSolidTransport<thermo>& -Foam::constAnIsoSolidTransport<thermo>::operator= +template<class Thermo> +inline Foam::constAnIsoSolidTransport<Thermo>& +Foam::constAnIsoSolidTransport<Thermo>::operator= ( - const constAnIsoSolidTransport<thermo>& ct + const constAnIsoSolidTransport<Thermo>& ct ) { kappa_ = ct.kappa_; @@ -80,10 +116,10 @@ Foam::constAnIsoSolidTransport<thermo>::operator= } -template<class thermo> -inline void Foam::constAnIsoSolidTransport<thermo>::operator+= +template<class Thermo> +inline void Foam::constAnIsoSolidTransport<Thermo>::operator+= ( - const constAnIsoSolidTransport<thermo>& ct + const constAnIsoSolidTransport<Thermo>& ct ) { scalar molr1 = this->nMoles(); @@ -95,10 +131,10 @@ inline void Foam::constAnIsoSolidTransport<thermo>::operator+= } -template<class thermo> -inline void Foam::constAnIsoSolidTransport<thermo>::operator-= +template<class Thermo> +inline void Foam::constAnIsoSolidTransport<Thermo>::operator-= ( - const constAnIsoSolidTransport<thermo>& ct + const constAnIsoSolidTransport<Thermo>& ct ) { scalar molr1 = this->nMoles(); @@ -113,16 +149,16 @@ inline void Foam::constAnIsoSolidTransport<thermo>::operator-= // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -template<class thermo> -inline Foam::constAnIsoSolidTransport<thermo> Foam::operator* +template<class Thermo> +inline Foam::constAnIsoSolidTransport<Thermo> Foam::operator* ( const scalar s, - const constAnIsoSolidTransport<thermo>& ct + const constAnIsoSolidTransport<Thermo>& ct ) { - return constAnIsoSolidTransport<thermo> + return constAnIsoSolidTransport<Thermo> ( - s*static_cast<const thermo&>(ct), + s*static_cast<const Thermo&>(ct), ct.kappa_ ); } diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.C b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.C index e2fc5096bd13f241ce62f705fad2d279891c5315..02684194fc05188d7ce2b77875f7689832908541 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.C +++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.C @@ -28,26 +28,26 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class thermo> -Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport +template<class Thermo> +Foam::constIsoSolidTransport<Thermo>::constIsoSolidTransport ( const dictionary& dict ) : - thermo(dict), + Thermo(dict), kappa_(readScalar(dict.subDict("transport").lookup("kappa"))) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class thermo> -void Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport::write +template<class Thermo> +void Foam::constIsoSolidTransport<Thermo>::constIsoSolidTransport::write ( Ostream& os ) const { - thermo::write(os); + Thermo::write(os); dictionary dict("transport"); dict.add("kappa", kappa_); @@ -57,14 +57,14 @@ void Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport::write // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -template<class thermo> +template<class Thermo> Foam::Ostream& Foam::operator<< ( Ostream& os, - const constIsoSolidTransport<thermo>& ct + const constIsoSolidTransport<Thermo>& ct ) { - operator<<(os, static_cast<const thermo&>(ct)); + operator<<(os, static_cast<const Thermo&>(ct)); os << tab << ct.kappa_; os.check diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H index 126589f00b7baf4bb5bb28e9340cdacd5c801c31..5b49beab675742b8b004c4381e942c9a1a0f4cd2 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H @@ -97,6 +97,12 @@ public: //- Construct from Istream constIsoSolidTransport(const dictionary& dict); + // Selector from dictionary + inline static autoPtr<constIsoSolidTransport> New + ( + const dictionary& dict + ); + // Member functions @@ -107,10 +113,17 @@ public: } //- Isotropic thermal conductivity [W/mK] - inline scalar kappa(const scalar T) const; + inline scalar kappa(const scalar p, const scalar T) const; //- Un-isotropic thermal conductivity [W/mK] - inline vector Kappa(const scalar T) const; + inline vector Kappa(const scalar p, const scalar T) const; + + //- Dynamic viscosity [kg/ms] + inline scalar mu(const scalar p, const scalar T) const; + + //- Thermal diffusivity of enthalpy [kg/ms] + inline scalar alphah(const scalar p, const scalar T) const; + //- Write to Ostream void write(Ostream& os) const; diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H index a76676617a5a0fe7bb52096fea12aa6622e0bfad..fdd766a8e43ac5c258402f070568f6482d2a48f2 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H @@ -49,23 +49,58 @@ inline Foam::constIsoSolidTransport<thermo>::constIsoSolidTransport {} +template<class Thermo> +inline Foam::autoPtr<Foam::constIsoSolidTransport<Thermo> > +Foam::constIsoSolidTransport<Thermo>::New +( + const dictionary& dict +) +{ + return autoPtr<constIsoSolidTransport<Thermo> > + ( + new constIsoSolidTransport<Thermo>(dict) + ); +} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class thermo> inline Foam::scalar Foam::constIsoSolidTransport<thermo>:: -kappa(const scalar T) const +kappa(const scalar p, const scalar T) const { return kappa_; } template<class thermo> inline Foam::vector Foam::constIsoSolidTransport<thermo>:: -Kappa(const scalar T) const +Kappa(const scalar p, const scalar T) const { return vector(kappa_, kappa_, kappa_); } +template<class thermo> +inline Foam::scalar Foam::constIsoSolidTransport<thermo>:: +mu(const scalar p, const scalar T) const +{ + notImplemented + ( + "Foam::scalar Foam::constIsoSolidTransport<thermo>mu::" + "(" + " const scalar p, const scalar T" + ") const" + ); + return scalar(0); +} + + +template<class thermo> +inline Foam::scalar Foam::constIsoSolidTransport<thermo>:: +alphah(const scalar p, const scalar T) const +{ + return kappa_/this->Cpv(p, T); +} + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template<class thermo> diff --git a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H index 1531b25f03d6644e664ea19c13ca4eef63f87805..00cc81e1b3be90735d58939f5009204c87e80d4f 100644 --- a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H @@ -103,10 +103,15 @@ public: const exponentialSolidTransport& ); - //- Construct from dictionary exponentialSolidTransport(const dictionary&); + // Selector from dictionary + inline static autoPtr<exponentialSolidTransport> New + ( + const dictionary& dict + ); + // Member functions @@ -117,10 +122,16 @@ public: } //- Thermal conductivity [W/mK] - inline scalar kappa(const scalar T) const; + inline scalar kappa(const scalar p, const scalar T) const; //- Thermal conductivity [W/mK] - inline vector Kappa(const scalar T) const; + inline vector Kappa(const scalar p, const scalar T) const; + + //- Dynamic viscosity [kg/ms] + inline scalar mu(const scalar p, const scalar T) const; + + //- Thermal diffusivity of enthalpy [kg/ms] + inline scalar alphah(const scalar p, const scalar T) const; //- Write to Ostream void write(Ostream& os) const; diff --git a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H index f198c24d232547568c9868937228a32cda8e610c..547c2e0be9435bc9f3978a9ad06e55ee6c204816 100644 --- a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H @@ -55,12 +55,25 @@ inline Foam::exponentialSolidTransport<thermo>::exponentialSolidTransport {} +template<class Thermo> +inline Foam::autoPtr<Foam::exponentialSolidTransport<Thermo> > +Foam::exponentialSolidTransport<Thermo>::New +( + const dictionary& dict +) +{ + return autoPtr<exponentialSolidTransport<Thermo> > + ( + new exponentialSolidTransport<Thermo>(dict) + ); +} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class thermo> inline Foam::scalar Foam::exponentialSolidTransport<thermo>::kappa ( - const scalar T + const scalar p, const scalar T ) const { return (kappa0_*pow(T/Tref_, n0_)); @@ -70,7 +83,7 @@ inline Foam::scalar Foam::exponentialSolidTransport<thermo>::kappa template<class thermo> inline Foam::vector Foam::exponentialSolidTransport<thermo>::Kappa ( - const scalar T + const scalar p, const scalar T ) const { const scalar kappa(kappa0_*pow(T/Tref_, n0_)); @@ -78,6 +91,28 @@ inline Foam::vector Foam::exponentialSolidTransport<thermo>::Kappa } +template<class thermo> +inline Foam::scalar Foam::exponentialSolidTransport<thermo>:: +mu(const scalar p, const scalar T) const +{ + notImplemented + ( + "Foam::scalar Foam::exponentialSolidTransport<thermo>mu::" + "(" + " const scalar p, const scalar T" + ") const" + ); + return scalar(0); +} + + +template<class thermo> +inline Foam::scalar Foam::exponentialSolidTransport<thermo>:: +alphah(const scalar p, const scalar T) const +{ + return kappa(p, T)/this->Cpv(p, T); +} + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidThermo/Make/files b/src/thermophysicalModels/solidThermo/Make/files index 8ed7c05dfdd6d4a915eb20644e63704839b0dcde..b7e2eb623bcf9eb6d12009fab24c9653c40d5b35 100644 --- a/src/thermophysicalModels/solidThermo/Make/files +++ b/src/thermophysicalModels/solidThermo/Make/files @@ -1,7 +1,6 @@ solidThermo/solidThermo.C solidThermo/solidThermos.C -mixtures/basicSolidMixture/basicSolidMixture.C solidReactionThermo/solidReactionThermo.C solidReactionThermo/solidReactionThermos.C diff --git a/src/thermophysicalModels/solidThermo/Make/options b/src/thermophysicalModels/solidThermo/Make/options index 356a2ba06edb905df31d80de6e20e2125c6d89c7..d3e1cb87ce5eac43f9599cf03d7d2c861d24bfab 100644 --- a/src/thermophysicalModels/solidThermo/Make/options +++ b/src/thermophysicalModels/solidThermo/Make/options @@ -3,11 +3,13 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude + -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude LIB_LIBS = \ -lmeshTools \ -lfiniteVolume \ -lspecie \ -lsolidSpecie \ - -lfluidThermophysicalModels + -lfluidThermophysicalModels \ + -lreactionThermophysicalModels diff --git a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.C b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.C deleted file mode 100644 index d815f35c4fd1ecf7df653cc1f8a6c0d57f51075a..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.C +++ /dev/null @@ -1,105 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "basicSolidMixture.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::basicSolidMixture::basicSolidMixture -( - const wordList& solidNames, - const fvMesh& mesh -) -: - components_(solidNames), - Y_(components_.size()) -{ - forAll(components_, i) - { - IOobject header - ( - "Y" + components_[i], - mesh.time().timeName(), - mesh, - IOobject::NO_READ - ); - - // check if field exists and can be read - if (header.headerOk()) - { - Y_.set - ( - i, - new volScalarField - ( - IOobject - ( - "Y" + components_[i], - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } - else - { - volScalarField Ydefault - ( - IOobject - ( - "Ydefault", - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ), - mesh - ); - - Y_.set - ( - i, - new volScalarField - ( - IOobject - ( - "Y" + components_[i], - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - Ydefault - ) - ); - } - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.H b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.H deleted file mode 100644 index 897832cbd14afa2ad6a4953d04555fc2c7a7c0ec..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixture.H +++ /dev/null @@ -1,214 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::basicSolidMixture - -Description - Foam::basicSolidMixture - -\*---------------------------------------------------------------------------*/ - -#ifndef basicSolidMixture_H -#define basicSolidMixture_H - -#include "volFields.H" -#include "speciesTable.H" -#include "PtrList.H" -#include "error.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class basicSolidMixture Declaration -\*---------------------------------------------------------------------------*/ - -class basicSolidMixture -{ - -protected: - - // Protected data - - typedef speciesTable solidsTable; - - //- The names of the solids - solidsTable components_; - - //- Solid mass fractions - PtrList<volScalarField> Y_; - - -public: - - //- The base class of the mixture - typedef basicSolidMixture basicMixtureType; - - - // Constructors - - //- Construct from word list and mesh - basicSolidMixture - ( - const wordList& solidNames, - const fvMesh& - ); - - - //- Destructor - virtual ~basicSolidMixture() - {} - - - // Member Functions - - //- Return the solid table - const solidsTable& components() const - { - return components_; - } - - //- Return the mass-fraction fields - inline PtrList<volScalarField>& Y(); - - //- Return the const mass-fraction fields - inline const PtrList<volScalarField>& Y() const; - - //- Return the mass-fraction field for a specie given by index - inline volScalarField& Y(const label i); - - //- Return the const mass-fraction field for a specie given by index - inline const volScalarField& Y(const label i) const; - - //- Return the mass-fraction field for a specie given by name - inline volScalarField& Y(const word& specieName); - - //- Return the const mass-fraction field for a specie given by name - inline const volScalarField& Y(const word& specieName) const; - - //- Does the mixture include this specie? - inline bool contains(const word& specieName) const; - - - // Per specie thermo properties - - //- Heat capacity at constant pressure [J/(kg K)] - virtual scalar Cp - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- Heat capacity at constant volume [J/(kg K)] - virtual scalar Cv - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- Absolute enthalpy [J/kg] - virtual scalar Ha - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- Sensible enthalpy [J/kg] - virtual scalar Hs - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- Chemical enthalpy [J/kg] - virtual scalar Hc(const label specieI) const = 0; - - //- Density [Kg/m3] - virtual scalar rho - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - - // Per specie transport properties - - //- Thermal conductivity [W/m/K] - virtual scalar kappa - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- An-isotropic thermal conductivity [W/m/K] - virtual vector Kappa - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - //- Thermal diffusivity of enthalpy/internal energy [kg/m/s] - virtual scalar alpha - ( - const label specieI, - const scalar p, - const scalar T - ) const = 0; - - - // Cell based properties with on the run mixture calculation - - //- Density - virtual scalar rho(scalar p, scalar T, label celli) const = 0; - - //- Thermal conductivity - virtual scalar kappa(scalar p, scalar T, label celli) const = 0; - - //- Specific heat capacity - virtual scalar Cp(scalar p, scalar T, label celli) const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "basicSolidMixtureI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H deleted file mode 100644 index 5145e6b26a43a31be78ce077c0a07dab791d6f78..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H +++ /dev/null @@ -1,76 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - - -inline Foam::PtrList<Foam::volScalarField>& Foam::basicSolidMixture::Y() -{ - return Y_; -} - - -inline const Foam::PtrList<Foam::volScalarField>& Foam::basicSolidMixture::Y() -const -{ - return Y_; -} - - -inline Foam::volScalarField& Foam::basicSolidMixture::Y(const label i) -{ - return Y_[i]; -} - - -inline const Foam::volScalarField& Foam::basicSolidMixture::Y -( - const label i -) const -{ - return Y_[i]; -} - - -inline Foam::volScalarField& Foam::basicSolidMixture::Y(const word& specieName) -{ - return Y_[components_[specieName]]; -} - - -inline const Foam::volScalarField& Foam::basicSolidMixture::Y -( - const word& specieName -) const -{ - return Y_[components_[specieName]]; -} - - -inline bool Foam::basicSolidMixture::contains(const word& specieName) const -{ - return components_.contains(specieName); -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C b/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C deleted file mode 100644 index 666fd8a66c79ce78878ab876e30c06cc941e0526..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/basicSolidMixture/basicSolidMixtures.C +++ /dev/null @@ -1,108 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - Mixture instantiation - -\*---------------------------------------------------------------------------*/ - -#include "basicMixture.H" -#include "makeBasicMixture.H" - -#include "rhoConst.H" - -#include "hConstThermo.H" -#include "hExponentialThermo.H" - -#include "constIsoSolidTransport.H" -#include "constAnIsoSolidTransport.H" -#include "exponentialSolidTransport.H" - -#include "sensibleInternalEnergy.H" -#include "sensibleEnthalpy.H" -#include "thermo.H" - -#include "pureSolidMixture.H" -#include "multiComponentSolidMixture.H" -#include "reactingSolidMixture.H" - -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ - -makeBasicMixture -( - pureSolidMixture, - constIsoSolidTransport, - sensibleEnthalpy, - hConstThermo, - rhoConst -); - -makeBasicMixture -( - pureSolidMixture, - constAnIsoSolidTransport, - sensibleEnthalpy, - hConstThermo, - rhoConst -); - -makeBasicMixture -( - pureSolidMixture, - exponentialSolidTransport, - sensibleEnthalpy, - hExponentialThermo, - rhoConst -); - -makeBasicMixture -( - multiComponentSolidMixture, - constIsoSolidTransport, - sensibleEnthalpy, - hConstThermo, - rhoConst -); - -makeBasicMixture -( - reactingSolidMixture, - constIsoSolidTransport, - sensibleEnthalpy, - hConstThermo, - rhoConst -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C b/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C deleted file mode 100644 index e15ac919caa689aedd4b87ea7928efc38804a5e5..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C +++ /dev/null @@ -1,363 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "multiComponentSolidMixture.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class ThermoType> -const ThermoType& Foam::multiComponentSolidMixture<ThermoType>:: -constructSolidData -( - const dictionary& thermoSolidDict -) -{ - forAll(components_, i) - { - solidData_.set - ( - i, - new ThermoType - ( - thermoSolidDict.subDict(components_[i] + "Coeffs") - ) - ); - } - - return solidData_[0]; -} - - -template<class ThermoType> -void Foam::multiComponentSolidMixture<ThermoType>::correctMassFractions() -{ - volScalarField Yt("Yt", Y_[0]); - - for (label n=1; n<Y_.size(); n++) - { - Yt += Y_[n]; - } - - forAll(Y_, n) - { - Y_[n] /= Yt; - } - - -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::X -( - label specieI, label celli, scalar p, scalar T -) const -{ - scalar rhoInv = 0.0; - forAll(solidData_, i) - { - rhoInv += Y_[i][celli]/solidData_[i].rho(p, T); - } - - scalar X = Y_[specieI][celli]/solidData_[specieI].rho(p, T); - - return (X/rhoInv); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ThermoType> -Foam::multiComponentSolidMixture<ThermoType>::multiComponentSolidMixture -( - const dictionary& thermoSolidDict, - const fvMesh& mesh -) -: - basicSolidMixture - ( - thermoSolidDict.lookup("solidComponents"), - mesh - ), - solidData_(components_.size()), - mixture_("mixture", constructSolidData(thermoSolidDict)), - mixtureVol_("mixture", constructSolidData(thermoSolidDict)) -{ - correctMassFractions(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -template<class ThermoType> -const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellVolMixture -( - const scalar p, - const scalar T, - const label celli -) const -{ - scalar rhoInv = 0.0; - forAll(solidData_, i) - { - rhoInv += Y_[i][celli]/solidData_[i].rho(p, T); - } - - mixtureVol_ = Y_[0][celli]/solidData_[0].rho(p, T)/rhoInv*solidData_[0]; - - for (label n=1; n<Y_.size(); n++) - { - mixtureVol_ += - Y_[n][celli]/solidData_[n].rho(p, T)/rhoInv*solidData_[n]; - } - - return mixtureVol_; -} - - -template<class ThermoType> -const ThermoType& Foam::multiComponentSolidMixture<ThermoType>::cellMixture -( - const label celli -) const -{ - mixture_ = Y_[0][celli]*solidData_[0]; - for (label n=1; n<Y_.size(); n++) - { - mixture_ += Y_[n][celli]*solidData_[n]; - } - - return mixture_; -} - - -template<class ThermoType> -const ThermoType& Foam::multiComponentSolidMixture<ThermoType>:: -patchFaceVolMixture -( - const scalar p, - const scalar T, - const label patchi, - const label facei -) const -{ - scalar rhoInv = 0.0; - forAll(solidData_, i) - { - rhoInv += Y_[i].boundaryField()[patchi][facei]/solidData_[i].rho(p, T); - } - - mixtureVol_ = - Y_[0].boundaryField()[patchi][facei] - / solidData_[0].rho(p, T) - / rhoInv - * solidData_[0]; - - for (label n=1; n<Y_.size(); n++) - { - mixtureVol_ += - Y_[n].boundaryField()[patchi][facei] - / solidData_[n].rho(p,T) - / rhoInv - * solidData_[n]; - } - - return mixtureVol_; -} - - -template<class ThermoType> -const ThermoType& Foam::multiComponentSolidMixture<ThermoType>:: -patchFaceMixture -( - const label patchi, - const label facei -) const -{ - - mixture_ = - Y_[0].boundaryField()[patchi][facei]*solidData_[0]; - - for (label n=1; n<Y_.size(); n++) - { - mixture_ += Y_[n].boundaryField()[patchi][facei]*solidData_[n]; - } - - return mixture_; -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].Cp(p, T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cv -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].Cv(p, T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Ha -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].Ha(p, T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hs -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].Hs(p, T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Hc -( - const label specieI -) const -{ - return solidData_[specieI].Hc(); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].rho(p, T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].kappa(T); -} - - -template<class ThermoType> -Foam::vector Foam::multiComponentSolidMixture<ThermoType>::Kappa -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].Kappa(T); -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::alpha -( - const label specieI, const scalar p, const scalar T -) const -{ - return solidData_[specieI].kappa(T)/solidData_[specieI].Cpv(p, T); -} - - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::rho -( - scalar p, scalar T, label celli -) const -{ - scalar tmp = 0.0; - forAll(solidData_, i) - { - tmp += solidData_[i].rho(p, T)*X(i, celli, p, T); - } - return tmp; -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::kappa -( - scalar p, scalar T, label celli -) const -{ - scalar tmp = 0.0; - forAll(solidData_, i) - { - tmp += solidData_[i].kappa(T)*X(i, celli, p, T); - } - return tmp; -} - - -template<class ThermoType> -Foam::scalar Foam::multiComponentSolidMixture<ThermoType>::Cp -( - scalar p, scalar T, label celli -) const -{ - scalar tmp = 0.0; - forAll(solidData_, i) - { - tmp += solidData_[i].Cp(p, T)*Y_[i][celli]; - } - return tmp; -} - - -template<class ThermoType> -void Foam::multiComponentSolidMixture<ThermoType>::read -( - const dictionary& thermoDict -) -{ - forAll(components_, i) - { - solidData_[i] = - ThermoType(thermoDict.subDict(components_[i] + "Coeffs")); - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H b/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H deleted file mode 100644 index acdf0391b56d9e3adc4b255f323cfdce9a85e194..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H +++ /dev/null @@ -1,233 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::multiComponentSolidMixture - -Description - Foam::multiComponentSolidMixture - -\*---------------------------------------------------------------------------*/ - -#ifndef multiComponentSolidMixture_H -#define multiComponentSolidMixture_H - -#include "PtrList.H" -#include "autoPtr.H" -#include "basicSolidMixture.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class multiComponentSolidMixture Declaration -\*---------------------------------------------------------------------------*/ - -template<class ThermoType> -class multiComponentSolidMixture -: - public basicSolidMixture -{ - - // Private data - - //- Solid data - PtrList<ThermoType> solidData_; - - //- Temporary storage for the mass cell/face mixture thermo data - mutable ThermoType mixture_; - - //- Temporary storage for the volume weighted - // cell/face mixture thermo data - mutable ThermoType mixtureVol_; - - - // Private Member Functions - - //- Correct the mass fractions to sum to 1 - void correctMassFractions(); - - //- Return molar fraction for specieI in celli - scalar X(label specieI, label celli, scalar p, scalar T) const; - - //- Construct solid data - const ThermoType& constructSolidData(const dictionary&); - - -public: - - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; - - - // Constructors - - //- Construct from dictionary and mesh - multiComponentSolidMixture(const dictionary&, const fvMesh&); - - - //- Destructor - virtual ~multiComponentSolidMixture() - {} - - - // Member Functions - - - const ThermoType& cellMixture(const label celli) const; - - const ThermoType& patchFaceMixture - ( - const label patchi, - const label facei - ) const; - - const ThermoType& cellVolMixture - ( - const scalar p, - const scalar T, - const label celli - ) const; - - const ThermoType& patchFaceVolMixture - ( - const scalar p, - const scalar T, - const label patchi, - const label facei - ) const; - - //- Return the raw solid data - const PtrList<ThermoType>& solidData() const - { - return solidData_; - } - - //- Read dictionary - void read(const dictionary&); - - - // Per specie thermo properties - - //- Heat capacity at constant pressure [J/(kg K)] - virtual scalar Cp - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- Heat capacity at constant volume [J/(kg K)] - virtual scalar Cv - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- Absolute enthalpy [J/kg] - virtual scalar Ha - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- Sensible enthalpy [J/kg] - virtual scalar Hs - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- Chemical enthalpy [J/kg] - virtual scalar Hc(const label specieI) const; - - //- Density [Kg/m3] - virtual scalar rho - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - - // Per specie transport properties - - //- Thermal conductivity [W/m/K] - virtual scalar kappa - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- An-isotropic thermal conductivity [W/m/K] - virtual vector Kappa - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - //- Thermal diffusivity of enthalpy/internal energy [kg/m/s] - virtual scalar alpha - ( - const label specieI, - const scalar p, - const scalar T - ) const; - - - // Cell based properties with on the run mixture calculation. - - //- Density - virtual scalar rho(scalar p, scalar T, label celli) const; - - //- Thermal conductivity - virtual scalar kappa(scalar p, scalar T, label celli) const; - - //- Specific heat capacity - virtual scalar Cp(scalar p, scalar T, label celli) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "multiComponentSolidMixture.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.H b/src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.H deleted file mode 100644 index 2605843a6a9a774ba1479b5de681db8f8051461f..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/pureSolidMixture/pureSolidMixture.H +++ /dev/null @@ -1,134 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::pureSolidMixture - -Description - Foam::pureSolidMixture - -SourceFiles - pureSolidMixture.C - -\*---------------------------------------------------------------------------*/ - -#ifndef pureSolidMixture_H -#define pureSolidMixture_H - -#include "basicMixture.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class pureSolidMixture Declaration -\*---------------------------------------------------------------------------*/ - -template<class ThermoType> -class pureSolidMixture -: - public basicMixture -{ - // Private data - - ThermoType mixture_; - - //- Construct as copy (not implemented) - pureSolidMixture(const pureSolidMixture<ThermoType>&); - - -public: - - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; - - - // Constructors - - //- Construct from dictionary and mesh - pureSolidMixture(const dictionary&, const fvMesh&); - - - //- Destructor - virtual ~pureSolidMixture(); - - - // Member functions - - const ThermoType& cellMixture(const label) const - { - return mixture_; - } - - const ThermoType& cellVolMixture - ( - const scalar, - const scalar, - const label - ) const - { - return mixture_; - } - - const ThermoType& patchFaceMixture - ( - const label, - const label - ) const - { - return mixture_; - } - - const ThermoType& patchFaceVolMixture - ( - const scalar, - const scalar, - const label, - const label - ) const - { - return mixture_; - } - - //- Read dictionary - void read(const dictionary&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -#ifdef NoRepository -# include "pureSolidMixture.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C b/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C deleted file mode 100644 index eb5d1f3c2b3b1a91e5a4f9d38d05389e87429185..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C +++ /dev/null @@ -1,67 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "reactingSolidMixture.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ThermoSolidType> -Foam::reactingSolidMixture<ThermoSolidType>::reactingSolidMixture -( - const dictionary& thermoDict, - const fvMesh& mesh -) -: - multiComponentSolidMixture<ThermoSolidType> - ( - thermoDict, - mesh - ), - PtrList<solidReaction> - ( - mesh.lookupObject<dictionary> - ("chemistryProperties").lookup("reactions"), - solidReaction::iNew - ( - this->components_, - mesh.lookupObject<dictionary> - ("thermophysicalProperties").lookup("gaseousSpecies") - ) - ) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ThermoSolidType> -void Foam::reactingSolidMixture<ThermoSolidType>::read -( - const dictionary& thermoDict -) -{} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H b/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H deleted file mode 100644 index 66443f43240bd0cab27b7ead2bc7a9989988c978..0000000000000000000000000000000000000000 --- a/src/thermophysicalModels/solidThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::reactingSolidMixture - -Description - Foam::reactingSolidMixture - -SourceFiles - reactingSolidMixture.C - -\*---------------------------------------------------------------------------*/ - -#ifndef reactingSolidMixture_H -#define reactingSolidMixture_H - -#include "multiComponentSolidMixture.H" -#include "solidReaction.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class reactingSolidMixture Declaration -\*---------------------------------------------------------------------------*/ - -template<class ThermoSolidType> -class reactingSolidMixture -: - public multiComponentSolidMixture<ThermoSolidType>, - public PtrList<solidReaction> -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - reactingSolidMixture(const reactingSolidMixture&); - - //- Disallow default bitwise assignment - void operator=(const reactingSolidMixture&); - - -public: - - //- The type of thermo package this mixture is instantiated for - typedef ThermoSolidType thermoType; - - - // Constructors - - //- Construct from dictionary and mesh - reactingSolidMixture(const dictionary&, const fvMesh&); - - - //- Destructor - virtual ~reactingSolidMixture() - {} - - - // Member functions - - //- Read dictionary - void read(const dictionary&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "reactingSolidMixture.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/makeReactingSolidThermo.H b/src/thermophysicalModels/solidThermo/solidReactionThermo/makeReactingSolidThermo.H new file mode 100644 index 0000000000000000000000000000000000000000..34c958b106153521130201438fad8cd0690a1041 --- /dev/null +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/makeReactingSolidThermo.H @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +InClass + Foam::solidThermo + +Description + Macros for creating reacting solid thermo packages + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactingSolidThermo_H +#define makeReactingSolidThermo_H + +#include "addToRunTimeSelectionTable.H" +#include "SpecieMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#define makeSolidReactionMixtureThermo(BaseThermo,Cthermo,Mixture,ThermoPhys) \ + \ +typedef SpecieMixture \ + < \ + Mixture \ + < \ + ThermoPhys \ + > \ + > SpecieMixture##Mixture##ThermoPhys; \ + \ +typedef \ + heThermo \ + < \ + BaseThermo, \ + SpecieMixture##Mixture##ThermoPhys \ + > heThermo##Mixture##ThermoPhys; \ + \ +typedef \ + Cthermo \ + < \ + BaseThermo, \ + SpecieMixture##Mixture##ThermoPhys \ + > Cthermo##Mixture##ThermoPhys; \ + \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + Cthermo##Mixture##ThermoPhys, \ + ( \ + #Cthermo"<"#Mixture"<" \ + + ThermoPhys::typeName() \ + + ">>" \ + ).c_str(), \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + basicThermo, \ + Cthermo##Mixture##ThermoPhys, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + BaseThermo, \ + Cthermo##Mixture##ThermoPhys, \ + fvMesh \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + BaseThermo, \ + Cthermo##Mixture##ThermoPhys, \ + dictionary \ +); + + +#define makeReactingSolidThermo(BaseThermo,CThermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie) \ + \ +typedef \ + Transport \ + < \ + species::thermo \ + < \ + Thermo \ + < \ + EqnOfState \ + < \ + Specie \ + > \ + >, \ + Type \ + > \ + > Transport##Type##Thermo##EqnOfState##Specie; \ + \ +makeSolidReactionMixtureThermo \ +( \ + BaseThermo, \ + CThermo, \ + Mixture, \ + Transport##Type##Thermo##EqnOfState##Specie \ +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H index e9112602e106d3578b8a91dd36646c371aebd8e3..ebb74aa0b4ef7ce1dd770ed654d782068499e7e7 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H @@ -35,7 +35,7 @@ SourceFiles #ifndef solidReactionThermo_H #define solidReactionThermo_H -#include "basicSolidMixture.H" +#include "basicMultiComponentMixture.H" #include "solidThermo.H" #include "autoPtr.H" #include "runTimeSelectionTables.H" @@ -109,10 +109,11 @@ public: // Member functions //- Return the composition of the multi-component mixture - virtual basicSolidMixture& composition() = 0; + virtual basicMultiComponentMixture& composition() = 0; //- Return the composition of the multi-component mixture - virtual const basicSolidMixture& composition() const = 0; + virtual const basicMultiComponentMixture& composition() const = 0; + }; diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C index cbfa81b30e4e9e18e5d917944354f8b040147434..e3a95e079c1547d6211172992bc84751e20a4e86 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermos.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "makeSolidThermo.H" +#include "makeReactingSolidThermo.H" #include "solidReactionThermo.H" #include "heSolidThermo.H" @@ -34,7 +34,10 @@ License #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" -#include "reactingSolidMixture.H" + +#include "reactingMixture.H" +#include "multiComponentMixture.H" + #include "sensibleEnthalpy.H" #include "thermo.H" @@ -46,11 +49,24 @@ namespace Foam /* * * * * * * * * * * * * * * * * Enthalpy-based * * * * * * * * * * * * * */ -makeSolidThermo +makeReactingSolidThermo ( solidReactionThermo, heSolidThermo, - reactingSolidMixture, + reactingMixture, + constIsoSolidTransport, + sensibleEnthalpy, + hConstThermo, + rhoConst, + specie +); + + +makeReactingSolidThermo +( + solidThermo, + heSolidThermo, + multiComponentMixture, constIsoSolidTransport, sensibleEnthalpy, hConstThermo, diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C index 55f9bc1999b6adc251d040f0638b545eb9c71447..193ec0a9a6009695ead0937694c713c7b6507e9e 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C @@ -56,7 +56,7 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate() rhoCells[celli] = volMixture_.rho(pCells[celli], TCells[celli]); alphaCells[celli] = - volMixture_.kappa(TCells[celli]) + volMixture_.kappa(pCells[celli], TCells[celli]) / mixture_.Cpv(pCells[celli], TCells[celli]); } @@ -86,10 +86,12 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate() facei ); + ph[facei] = mixture_.HE(pp[facei], pT[facei]); prho[facei] = volMixture_.rho(pp[facei], pT[facei]); + palpha[facei] = - volMixture_.kappa(pT[facei]) + volMixture_.kappa(pp[facei], pT[facei]) / mixture_.Cpv(pp[facei], pT[facei]); } } @@ -111,8 +113,9 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate() pT[facei] = mixture_.THE(ph[facei], pp[facei] ,pT[facei]); prho[facei] = volMixture_.rho(pp[facei], pT[facei]); + palpha[facei] = - volMixture_.kappa(pT[facei]) + volMixture_.kappa(pp[facei], pT[facei]) / mixture_.Cpv(pp[facei], pT[facei]); } } @@ -204,7 +207,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa() const pCells[celli], TCells[celli], celli - ).Kappa(TCells[celli]); + ).Kappa(pCells[celli], TCells[celli]); } forAll(Kappa.boundaryField(), patchi) @@ -222,7 +225,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa() const pT[facei], patchi, facei - ).Kappa(pT[facei]); + ).Kappa(pp[facei], pT[facei]); } } @@ -252,7 +255,7 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::Kappa Tp[facei], patchi, facei - ).Kappa(Tp[facei]); + ).Kappa(pp[facei], Tp[facei]); } return tKappa; diff --git a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H index 2f16507b2058b0c61ec3381575dba24ed65726e7..774a94308a4a5f45ccf2cc9dc344afdb37f6dee3 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H @@ -32,31 +32,55 @@ Description #ifndef makeSolidThermo_H #define makesolidThermo_H -#include "makeThermo.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #define makeSolidThermo(BaseThermo,Cthermo,Mixture,Transport,Type,Thermo,EqnOfState,Specie)\ \ -makeThermoTypedefs \ -( \ - BaseThermo, \ - Cthermo, \ - Mixture, \ - Transport, \ - Type, \ - Thermo, \ - EqnOfState, \ - Specie \ -) \ \ -addToRunTimeSelectionTable \ +typedef \ + Transport \ + < \ + species::thermo \ + < \ + Thermo \ + < \ + EqnOfState \ + < \ + Specie \ + > \ + >, \ + Type \ + > \ + > Transport##Type##Thermo##EqnOfState##Specie; \ + \ +typedef \ + heThermo \ + < \ + BaseThermo, \ + Mixture<Transport##Type##Thermo##EqnOfState##Specie> \ + > heThermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie; \ + \ +typedef \ + Cthermo \ + < \ + BaseThermo, \ + Mixture<Transport##Type##Thermo##EqnOfState##Specie> \ + > Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie; \ + \ + \ +defineTemplateTypeNameAndDebugWithName \ ( \ - basicThermo, \ Cthermo##Mixture##Transport##Type##Thermo##EqnOfState##Specie, \ - fvMesh \ + ( \ + #Cthermo"<"#Mixture"<" \ + + Transport##Type##Thermo##EqnOfState##Specie::typeName() \ + + ">>" \ + ).c_str(), \ + 0 \ ); \ \ + \ addToRunTimeSelectionTable \ ( \ BaseThermo, \ diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index a7fbf5c0675ab80c8b85aa892da10c92d1f620db..12ec3eb308ac7fdf8c2c9ef108a2c1a62fbf0383 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -40,7 +40,6 @@ SourceFiles #include "fvMesh.H" #include "IOdictionary.H" #include "autoPtr.H" -#include "basicSolidMixture.H" #include "basicThermo.H" #include "autoPtr.H" diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index 5c7408eaa4d7a25e2bbaeab267564fc37aed93c5..6814431fecc1757f1717582490b9d258a247eee6 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -34,9 +34,7 @@ License #include "constIsoSolidTransport.H" #include "constAnIsoSolidTransport.H" #include "exponentialSolidTransport.H" -#include "pureSolidMixture.H" -#include "multiComponentSolidMixture.H" -#include "reactingSolidMixture.H" +#include "pureMixture.H" #include "sensibleEnthalpy.H" #include "sensibleInternalEnergy.H" #include "thermo.H" @@ -53,7 +51,7 @@ makeSolidThermo ( solidThermo, heSolidThermo, - pureSolidMixture, + pureMixture, constIsoSolidTransport, sensibleEnthalpy, hConstThermo, @@ -65,7 +63,7 @@ makeSolidThermo ( solidThermo, heSolidThermo, - pureSolidMixture, + pureMixture, constAnIsoSolidTransport, sensibleEnthalpy, hConstThermo, @@ -77,7 +75,7 @@ makeSolidThermo ( solidThermo, heSolidThermo, - pureSolidMixture, + pureMixture, exponentialSolidTransport, sensibleEnthalpy, hExponentialThermo, @@ -85,19 +83,6 @@ makeSolidThermo specie ); -makeSolidThermo -( - solidThermo, - heSolidThermo, - multiComponentSolidMixture, - constIsoSolidTransport, - sensibleEnthalpy, - hConstThermo, - rhoConst, - specie -); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C index 9557c4e5c37956f9076586d30ade6423a25b12e0..c691af1897354be810c1b56dbdc32882acb7497b 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C @@ -27,60 +27,94 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> -Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +IrreversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& k ) : - Reaction<ReactionThermo>(reaction), + ReactionType<ReactionThermo>(reaction), k_(k) {} -template<class ReactionThermo, class ReactionRate> -Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +IrreversibleReaction ( const speciesTable& species, const HashPtrTable<ReactionThermo>& thermoDatabase, Istream& is ) : - Reaction<ReactionThermo>(species, thermoDatabase, is), + ReactionType<ReactionThermo>(species, thermoDatabase, is), k_(species, is) {} -template<class ReactionThermo, class ReactionRate> -Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +IrreversibleReaction ( const speciesTable& species, const HashPtrTable<ReactionThermo>& thermoDatabase, const dictionary& dict ) : - Reaction<ReactionThermo>(species, thermoDatabase, dict), + ReactionType<ReactionThermo>(species, thermoDatabase, dict), k_(species, dict) {} -template<class ReactionThermo, class ReactionRate> -Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +IrreversibleReaction ( - const IrreversibleReaction<ReactionThermo, ReactionRate>& irr, + const IrreversibleReaction<ReactionType, ReactionThermo,ReactionRate>& irr, const speciesTable& species ) : - Reaction<ReactionThermo>(irr, species), + ReactionType<ReactionThermo>(irr, species), k_(irr.k_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> -Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kf +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::scalar Foam::IrreversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kf ( const scalar p, const scalar T, @@ -91,13 +125,19 @@ Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kf } -template<class ReactionThermo, class ReactionRate> -void Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::write +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +void Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +write ( Ostream& os ) const { - Reaction<ReactionThermo>::write(os); + ReactionType<ReactionThermo>::write(os); k_.write(os); } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H index 14ae2c0f83619297cb510f19e8b563abe796cc1b..9ab0ec7b7364799c54109fb745ef41a08d0c3e05 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H @@ -47,10 +47,15 @@ namespace Foam Class IrreversibleReaction Declaration \*---------------------------------------------------------------------------*/ -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> class IrreversibleReaction : - public Reaction<ReactionThermo> + public ReactionType<ReactionThermo> { // Private data @@ -62,7 +67,12 @@ class IrreversibleReaction //- Disallow default bitwise assignment void operator= ( - const IrreversibleReaction<ReactionThermo, ReactionRate>& + const IrreversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >& ); @@ -77,14 +87,19 @@ public: //- Construct from components IrreversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& reactionRate ); //- Construct as copy given new speciesTable IrreversibleReaction ( - const IrreversibleReaction<ReactionThermo, ReactionRate>&, + const IrreversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >&, const speciesTable& species ); @@ -109,7 +124,12 @@ public: { return autoPtr<Reaction<ReactionThermo> > ( - new IrreversibleReaction<ReactionThermo, ReactionRate>(*this) + new IrreversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >(*this) ); } @@ -121,7 +141,12 @@ public: { return autoPtr<Reaction<ReactionThermo> > ( - new IrreversibleReaction<ReactionThermo, ReactionRate> + new IrreversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + > ( *this, species diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C index c3cd486e1acacd867d9b986c242810ba5cf980d5..f2f8b175bc04d8dd2afb7c732e1eb9923c658823 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C @@ -27,24 +27,44 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>:: +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>:: NonEquilibriumReversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& forwardReactionRate, const ReactionRate& reverseReactionRate ) : - Reaction<ReactionThermo>(reaction), + ReactionType<ReactionThermo>(reaction), fk_(forwardReactionRate), rk_(reverseReactionRate) {} -template<class ReactionThermo, class ReactionRate> -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>:: +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>:: NonEquilibriumReversibleReaction ( const speciesTable& species, @@ -52,14 +72,24 @@ NonEquilibriumReversibleReaction Istream& is ) : - Reaction<ReactionThermo>(species, thermoDatabase, is), + ReactionType<ReactionThermo>(species, thermoDatabase, is), fk_(species, is), rk_(species, is) {} -template<class ReactionThermo, class ReactionRate> -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>:: +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>:: NonEquilibriumReversibleReaction ( const speciesTable& species, @@ -67,21 +97,36 @@ NonEquilibriumReversibleReaction const dictionary& dict ) : - Reaction<ReactionThermo>(species, thermoDatabase, dict), + ReactionType<ReactionThermo>(species, thermoDatabase, dict), fk_(species, dict.subDict("forward")), rk_(species, dict.subDict("reverse")) {} -template<class ReactionThermo, class ReactionRate> -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>:: +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>:: NonEquilibriumReversibleReaction ( - const NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>& nerr, + const NonEquilibriumReversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >& nerr, const speciesTable& species ) : - Reaction<ReactionThermo>(nerr, species), + ReactionType<ReactionThermo>(nerr, species), fk_(nerr.fk_), rk_(nerr.rk_) {} @@ -89,9 +134,19 @@ NonEquilibriumReversibleReaction // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> Foam::scalar -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kf ( const scalar p, const scalar T, @@ -102,9 +157,19 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf } -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> Foam::scalar -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kr ( const scalar, const scalar p, @@ -116,9 +181,19 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr } -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> Foam::scalar -Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr +Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kr ( const scalar p, const scalar T, @@ -129,13 +204,23 @@ Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr } -template<class ReactionThermo, class ReactionRate> -void Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::write +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +void Foam::NonEquilibriumReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::write ( Ostream& os ) const { - Reaction<ReactionThermo>::write(os); + ReactionType<ReactionThermo>::write(os); os << indent << "forward" << nl; os << indent << token::BEGIN_BLOCK << nl; diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H index 25677c531905307c3cfadf7b736153ca44060144..43a1a43be4c7496e7b93e4626bb126ec2c16bcec 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H @@ -47,10 +47,15 @@ namespace Foam Class NonEquilibriumReversibleReaction Declaration \*---------------------------------------------------------------------------*/ -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> class NonEquilibriumReversibleReaction : - public Reaction<ReactionThermo> + public ReactionType<ReactionThermo> { // Private data @@ -64,7 +69,7 @@ class NonEquilibriumReversibleReaction void operator= ( const NonEquilibriumReversibleReaction - <ReactionThermo, ReactionRate>& + <ReactionType, ReactionThermo, ReactionRate>& ); @@ -79,7 +84,7 @@ public: //- Construct from components NonEquilibriumReversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& forwardReactionRate, const ReactionRate& reverseReactionRate ); @@ -88,7 +93,7 @@ public: NonEquilibriumReversibleReaction ( const NonEquilibriumReversibleReaction - <ReactionThermo, ReactionRate>&, + <ReactionType, ReactionThermo, ReactionRate>&, const speciesTable& species ); @@ -109,25 +114,25 @@ public: ); //- Construct and return a clone - virtual autoPtr<Reaction<ReactionThermo> > clone() const + virtual autoPtr<ReactionType<ReactionThermo> > clone() const { - return autoPtr<Reaction<ReactionThermo> > + return autoPtr<ReactionType<ReactionThermo> > ( new NonEquilibriumReversibleReaction - <ReactionThermo, ReactionRate>(*this) + <ReactionType, ReactionThermo, ReactionRate>(*this) ); } //- Construct and return a clone with new speciesTable - virtual autoPtr<Reaction<ReactionThermo> > clone + virtual autoPtr<ReactionType<ReactionThermo> > clone ( const speciesTable& species ) const { - return autoPtr<Reaction<ReactionThermo> > + return autoPtr<ReactionType<ReactionThermo> > ( new NonEquilibriumReversibleReaction - <ReactionThermo, ReactionRate> + <ReactionType, ReactionThermo, ReactionRate> (*this, species) ); } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C index 97184a1e6be4a9ab729ab2b753343abf19e1ac60..8f2c39c37eb1d642be99f36abd142bd8039125e8 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C @@ -63,6 +63,25 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const } } + for (label i = 0; i < glhs().size(); ++i) + { + reaction << " + "; + + if (i > 0) + { + reaction << " + "; + } + if (mag(glhs()[i].stoichCoeff - 1) > SMALL) + { + reaction << glhs()[i].stoichCoeff; + } + reaction << gasSpecies()[glhs()[i].index]; + if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL) + { + reaction << "^" << glhs()[i].exponent; + } + } + reaction << " = "; for (label i = 0; i < rhs_.size(); ++i) @@ -82,29 +101,49 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const } } + for (label i = 0; i < grhs().size(); ++i) + { + reaction << " + "; + + if (i > 0) + { + reaction << " + "; + } + if (mag(grhs()[i].stoichCoeff - 1) > SMALL) + { + reaction << grhs()[i].stoichCoeff; + } + reaction << gasSpecies()[grhs()[i].index]; + if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL) + { + reaction << "^" << grhs()[i].exponent; + } + } + return reaction.str(); } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - template<class ReactionThermo> void Foam::Reaction<ReactionThermo>::setThermo ( const HashPtrTable<ReactionThermo>& thermoDatabase ) { - ReactionThermo::operator= - ( - rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]]) - ); - - for (label i=1; i<rhs_.size(); ++i) + if (rhs_.size() > 0) { - this->operator+= + ReactionThermo::operator= ( - rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]]) + rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]]) ); + + for (label i=1; i<rhs_.size(); ++i) + { + this->operator+= + ( + rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]]) + ); + } } forAll(lhs_, i) @@ -117,6 +156,9 @@ void Foam::Reaction<ReactionThermo>::setThermo } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + template<class ReactionThermo> Foam::Reaction<ReactionThermo>::Reaction ( @@ -159,7 +201,6 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs ) { token t(is); - if (t.isNumber()) { stoichCoeff = t.number(); @@ -189,7 +230,14 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs specieName = specieName(0, i); } - index = species[specieName]; + if (species.contains(specieName)) + { + index = species[specieName]; + } + else + { + index = -1; + } } else { @@ -201,38 +249,79 @@ Foam::Reaction<ReactionThermo>::specieCoeffs::specieCoeffs template<class ReactionThermo> -void Foam::Reaction<ReactionThermo>::setLRhs(Istream& is) +void Foam::Reaction<ReactionThermo>::setLRhs +( + Istream& is, + const speciesTable& species, + List<specieCoeffs>& lhs, + List<specieCoeffs>& rhs +) { DynamicList<specieCoeffs> dlrhs; - while (is) + while (is.good()) { - dlrhs.append(specieCoeffs(species_, is)); - - token t(is); + dlrhs.append(specieCoeffs(species, is)); - if (t.isPunctuation()) + if (dlrhs.last().index != -1) { - if (t == token::ADD) + token t(is); + if (t.isPunctuation()) { - } - else if (t == token::ASSIGN) - { - lhs_ = dlrhs.shrink(); - dlrhs.clear(); + if (t == token::ADD) + { + } + else if (t == token::ASSIGN) + { + lhs = dlrhs.shrink(); + dlrhs.clear(); + } + else + { + rhs = dlrhs.shrink(); + is.putBack(t); + return; + } } else { - rhs_ = dlrhs.shrink(); + rhs = dlrhs.shrink(); is.putBack(t); return; } } else { - rhs_ = dlrhs.shrink(); - is.putBack(t); - return; + dlrhs.remove(); + if (is.good()) + { + token t(is); + if (t.isPunctuation()) + { + if (t == token::ADD) + { + } + else if (t == token::ASSIGN) + { + lhs = dlrhs.shrink(); + dlrhs.clear(); + } + else + { + rhs = dlrhs.shrink(); + is.putBack(t); + return; + } + } + } + else + { + if (!dlrhs.empty()) + { + rhs = dlrhs.shrink(); + } + return; + } } } @@ -254,7 +343,7 @@ Foam::Reaction<ReactionThermo>::Reaction name_("un-named-reaction" + Foam::name(getNewReactionID())), species_(species) { - setLRhs(is); + setLRhs(is, species, lhs_, rhs_); setThermo(thermoDatabase); } @@ -271,7 +360,13 @@ Foam::Reaction<ReactionThermo>::Reaction name_(dict.dictName()), species_(species) { - setLRhs(IStringStream(dict.lookup("reaction"))()); + setLRhs + ( + IStringStream(dict.lookup("reaction"))(), + species_, + lhs_, + rhs_ + ); setThermo(thermoDatabase); } @@ -410,4 +505,48 @@ Foam::scalar Foam::Reaction<ReactionThermo>::kr } +template<class ReactionThermo> +const Foam::speciesTable& Foam::Reaction<ReactionThermo>::species() const +{ + return species_; +} + + +template<class ReactionThermo> +const Foam::speciesTable& Foam::Reaction<ReactionThermo>::gasSpecies() const +{ + notImplemented + ( + "const speciesTable& gasSpecies() const" + " for this reaction" + ); + return *reinterpret_cast<speciesTable*>(0); +} + + +template<class ReactionThermo> +const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>& +Foam::Reaction<ReactionThermo>::glhs() const +{ + notImplemented + ( + "inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&" + "Reaction<ReactionThermo>::glhs()" + ); + return *reinterpret_cast<List<specieCoeffs>*>(0); +} + + +template<class ReactionThermo> +const Foam::List<typename Foam::Reaction<ReactionThermo>::specieCoeffs>& +Foam::Reaction<ReactionThermo>::grhs() const +{ + notImplemented + ( + "inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&" + "Reaction<ReactionThermo>::grhs()" + ); + return *reinterpret_cast<List<specieCoeffs>*>(0); +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H index 364aa26c0401ff2057c31508731f3e648f8607e8..b0c66fb86fbb78aea0a0d278b084d47aed7143cb 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H @@ -136,9 +136,6 @@ private: //- Return string representation of reaction string reactionStr() const; - //- Construct the left- and right-hand-side reaction coefficients - void setLRhs(Istream&); - //- Construct reaction thermo void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase); @@ -245,7 +242,7 @@ public: ); //- Construct and return a clone - virtual autoPtr<Reaction<ReactionThermo> > clone() const + virtual autoPtr<Reaction<ReactionThermo> > clone() const // { return autoPtr<Reaction<ReactionThermo> > ( @@ -297,9 +294,29 @@ public: inline word& name(); inline const word& name() const; + // - Access to basic components of the reaction inline const List<specieCoeffs>& lhs() const; inline const List<specieCoeffs>& rhs() const; + // - Access to gas components of the reaction + virtual const List<specieCoeffs>& grhs() const; + virtual const List<specieCoeffs>& glhs() const; + + // - Access to specie list + const speciesTable& species() const; + + // - Access to gas specie list + virtual const speciesTable& gasSpecies() const; + + //- Construct the left- and right-hand-side reaction coefficients + void setLRhs + ( + Istream&, + const speciesTable&, + List<specieCoeffs>& lhs, + List<specieCoeffs>& rhs + ); + // Reaction rate coefficients diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H index 89dd337a34960ffc80c2c1a6678f95238f005ef8..7e380b4c801880c33db65f26ed30c4eaf4c604d2 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H @@ -67,57 +67,9 @@ Reaction<ReactionThermo>::rhs() const template<class ReactionThermo> inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r) { - os << r.type() << nl << " "; + os << r.reactionStr()<< token::END_STATEMENT <<nl; - forAll(r.lhs_, i) - { - const typename Reaction<ReactionThermo>::specieCoeffs& sc = r.lhs_[i]; - - if (sc.stoichCoeff != 1) - { - os << sc.stoichCoeff; - } - - os << r.species_[sc.index]; - - if (sc.exponent != sc.stoichCoeff) - { - os << '^' << sc.exponent; - } - - if (i < r.lhs_.size() - 1) - { - os << " + "; - } - } - - os << " = "; - - forAll(r.rhs_, i) - { - const typename Reaction<ReactionThermo>::specieCoeffs& sc = r.rhs_[i]; - - if (sc.stoichCoeff != 1) - { - os << sc.stoichCoeff; - } - - os << r.species_[sc.index]; - - if (sc.exponent != sc.stoichCoeff) - { - os << '^' << sc.exponent; - } - - if (i < r.rhs_.size() - 1) - { - os << " + "; - } - } - - os << endl << " "; - - return os; + return os; } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C index e0fdeed31d8388deceaaf223f867987b142bc46a..d23d674c4e41f3c1b5fc96ae5431299e852c984d 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C @@ -27,60 +27,94 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> -Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +ReversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& k ) : - Reaction<ReactionThermo>(reaction), + ReactionType<ReactionThermo>(reaction), k_(k) {} -template<class ReactionThermo, class ReactionRate> -Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +ReversibleReaction ( const speciesTable& species, const HashPtrTable<ReactionThermo>& thermoDatabase, Istream& is ) : - Reaction<ReactionThermo>(species, thermoDatabase, is), + ReactionType<ReactionThermo>(species, thermoDatabase, is), k_(species, is) {} -template<class ReactionThermo, class ReactionRate> -Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +ReversibleReaction ( const speciesTable& species, const HashPtrTable<ReactionThermo>& thermoDatabase, const dictionary& dict ) : - Reaction<ReactionThermo>(species, thermoDatabase, dict), + ReactionType<ReactionThermo>(species, thermoDatabase, dict), k_(species, dict) {} -template<class ReactionThermo, class ReactionRate> -Foam::ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>:: +ReversibleReaction ( - const ReversibleReaction<ReactionThermo, ReactionRate>& rr, + const ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>& rr, const speciesTable& species ) : - Reaction<ReactionThermo>(rr, species), + ReactionType<ReactionThermo>(rr, species), k_(rr.k_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class ReactionThermo, class ReactionRate> -Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kf +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::scalar Foam::ReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kf ( const scalar p, const scalar T, @@ -91,8 +125,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kf } -template<class ReactionThermo, class ReactionRate> -Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::scalar Foam::ReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kr ( const scalar kfwd, const scalar p, @@ -104,8 +148,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr } -template<class ReactionThermo, class ReactionRate> -Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +Foam::scalar Foam::ReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::kr ( const scalar p, const scalar T, @@ -116,8 +170,18 @@ Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr } -template<class ReactionThermo, class ReactionRate> -void Foam::ReversibleReaction<ReactionThermo, ReactionRate>::write +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> +void Foam::ReversibleReaction +< + ReactionType, + ReactionThermo, + ReactionRate +>::write ( Ostream& os ) const diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H index 254171275293d3626f82d2c1b0e155a52c1e02c5..b0e16bdcca7f6a149823eb57a513ff6cff0a6f96 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H @@ -47,10 +47,15 @@ namespace Foam Class ReversibleReaction Declaration \*---------------------------------------------------------------------------*/ -template<class ReactionThermo, class ReactionRate> +template +< + template<class> class ReactionType, + class ReactionThermo, + class ReactionRate +> class ReversibleReaction : - public Reaction<ReactionThermo> + public ReactionType<ReactionThermo> { // Private data @@ -60,7 +65,15 @@ class ReversibleReaction // Private Member Functions //- Disallow default bitwise assignment - void operator=(const ReversibleReaction<ReactionThermo, ReactionRate>&); + void operator= + ( + const ReversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >& + ); public: @@ -74,14 +87,19 @@ public: //- Construct from components ReversibleReaction ( - const Reaction<ReactionThermo>& reaction, + const ReactionType<ReactionThermo>& reaction, const ReactionRate& k ); //- Construct as copy given new speciesTable ReversibleReaction ( - const ReversibleReaction<ReactionThermo, ReactionRate>&, + const ReversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >&, const speciesTable& species ); @@ -102,23 +120,29 @@ public: ); //- Construct and return a clone - virtual autoPtr<Reaction<ReactionThermo> > clone() const + virtual autoPtr<ReactionType<ReactionThermo> > clone() const { - return autoPtr<Reaction<ReactionThermo> > + return autoPtr<ReactionType<ReactionThermo> > ( - new ReversibleReaction<ReactionThermo, ReactionRate>(*this) + new ReversibleReaction + < + ReactionType, + ReactionThermo, + ReactionRate + >(*this) ); } //- Construct and return a clone with new speciesTable - virtual autoPtr<Reaction<ReactionThermo> > clone + virtual autoPtr<ReactionType<ReactionThermo> > clone ( const speciesTable& species ) const { - return autoPtr<Reaction<ReactionThermo> > + return autoPtr<ReactionType<ReactionThermo> > ( - new ReversibleReaction<ReactionThermo, ReactionRate> + new ReversibleReaction + <ReactionType, ReactionThermo, ReactionRate> ( *this, species @@ -154,8 +178,8 @@ public: ) const; //- Reverse rate constant. - // Note this evaluates the forward rate constant and divides by the - // equilibrium constant + // Note this evaluates the forward rate constant and divides by + // the equilibrium constant virtual scalar kr ( const scalar p, diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H b/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H index be1a76cf004aae77fb26f4e3142e61ae53ee117d..0b72f6800d76391772953bb06b6f2c21746797ae 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H +++ b/src/thermophysicalModels/specie/reaction/reactions/makeReaction.H @@ -61,7 +61,7 @@ namespace Foam \ typedef Reaction<Thermo> Reaction##Thermo; \ \ - typedef ReactionType<Thermo, ReactionRate> \ + typedef ReactionType<Reaction, Thermo, ReactionRate> \ ReactionType##Thermo##ReactionRate; \ \ template<> \ diff --git a/src/thermophysicalModels/specie/specie/specie.H b/src/thermophysicalModels/specie/specie/specie.H index fd7c69c1283efa6d2d2903a0af4364ccab9d69e2..354fdcceea3114e997de0b0c41f3359bb0462319 100644 --- a/src/thermophysicalModels/specie/specie/specie.H +++ b/src/thermophysicalModels/specie/specie/specie.H @@ -66,12 +66,6 @@ class specie scalar molWeight_; - // Private Member Functions - - //- Construct from components without name - inline specie(const scalar nMoles, const scalar molWeight); - - public: //- Runtime type information @@ -94,6 +88,10 @@ public: // Constructors + + //- Construct from components without name + inline specie(const scalar nMoles, const scalar molWeight); + //- Construct from components with name inline specie ( diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C index bd942515e9b77ea731fdba7b47d3913d231ab485..a004ed0e62b62a0aa5c6138262ff185b169ff8dc 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,9 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(Istream& is) Hf_(readScalar(is)) { is.check("eConstThermo<EquationOfState>::eConstThermo(Istream&)"); + + Cv_ *= this->W(); + Hf_ *= this->W(); } @@ -45,7 +48,10 @@ Foam::eConstThermo<EquationOfState>::eConstThermo(const dictionary& dict) EquationOfState(dict), Cv_(readScalar(dict.subDict("thermodynamics").lookup("Cv"))), Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf"))) -{} +{ + Cv_ *= this->W(); + Hf_ *= this->W(); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -56,8 +62,8 @@ void Foam::eConstThermo<EquationOfState>::write(Ostream& os) const EquationOfState::write(os); dictionary dict("thermodynamics"); - dict.add("Cv", Cv_); - dict.add("Hf", Hf_); + dict.add("Cv", Cv_/this->W()); + dict.add("Hf", Hf_/this->W()); os << indent << dict.dictName() << dict; } @@ -72,7 +78,7 @@ Foam::Ostream& Foam::operator<< ) { os << static_cast<const EquationOfState&>(ct) << tab - << ct.Cv_ << tab << ct.Hf_; + << ct.Cv_/ct.W() << tab << ct.Hf_/ct.W(); os.check("Ostream& operator<<(Ostream&, const eConstThermo&)"); return os; diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 7e0781cc401b978e07c6001c3a857fd550cf2f47..fea19e2cc6ad04e4509747b88fd93de0322945d1 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -95,7 +95,12 @@ class eConstThermo { // Private data + //- Heat capacity at constant volume + // Note: input in [J/(kg K)], but internally uses [J/(kmol K)] scalar Cv_; + + //- Heat of formation + // Note: input in [J/kg], but internally uses [J/kmol] scalar Hf_; diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index b465f80497f71cd718c3384fbe898542cdeead66..687ebae35583174f4dfdd80254ff5825d4b21ef4 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -106,7 +106,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::cp const scalar T ) const { - return Cv_*this->W() + this->cpMcv(p, T); + return Cv_ + this->cpMcv(p, T); } @@ -117,7 +117,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::ha const scalar T ) const { - return cp(p, T)*T + Hf_*this->W(); + return cp(p, T)*T + Hf_; } @@ -135,7 +135,7 @@ inline Foam::scalar Foam::eConstThermo<EquationOfState>::hs template<class EquationOfState> inline Foam::scalar Foam::eConstThermo<EquationOfState>::hc() const { - return Hf_*this->W(); + return Hf_; } diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C index 3f2a7cf1c4d78d7775238b68fbf84c703f982a98..b117f82bc70299d6b6021ef42217efd56d3a5db3 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,9 @@ Foam::hConstThermo<equationOfState>::hConstThermo(Istream& is) Hf_(readScalar(is)) { is.check("hConstThermo::hConstThermo(Istream& is)"); + + Cp_ *= this->W(); + Hf_ *= this->W(); } @@ -45,7 +48,10 @@ Foam::hConstThermo<equationOfState>::hConstThermo(const dictionary& dict) equationOfState(dict), Cp_(readScalar(dict.subDict("thermodynamics").lookup("Cp"))), Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf"))) -{} +{ + Cp_ *= this->W(); + Hf_ *= this->W(); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -56,8 +62,8 @@ void Foam::hConstThermo<equationOfState>::write(Ostream& os) const equationOfState::write(os); dictionary dict("thermodynamics"); - dict.add("Cp", Cp_); - dict.add("Hf", Hf_); + dict.add("Cp", Cp_/this->W()); + dict.add("Hf", Hf_/this->W()); os << indent << dict.dictName() << dict; } @@ -72,7 +78,7 @@ Foam::Ostream& Foam::operator<< ) { os << static_cast<const equationOfState&>(ct) << tab - << ct.Cp_ << tab << ct.Hf_; + << ct.Cp_/ct.W() << tab << ct.Hf_/ct.W(); os.check("Ostream& operator<<(Ostream& os, const hConstThermo& ct)"); return os; diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H index b7eda522b4c3733a5f81e1cc30e7ef57902fc4de..3fda6268c33f010c4d9a79899e999b76a519f2af 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H @@ -106,7 +106,7 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::cp const scalar T ) const { - return Cp_*this->W(); + return Cp_; } @@ -116,7 +116,7 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::ha const scalar p, const scalar T ) const { - return (Cp_*T + Hf_)*this->W(); + return Cp_*T + Hf_; } @@ -126,14 +126,14 @@ inline Foam::scalar Foam::hConstThermo<equationOfState>::hs const scalar p, const scalar T ) const { - return Cp_*T*this->W(); + return Cp_*T; } template<class equationOfState> inline Foam::scalar Foam::hConstThermo<equationOfState>::hc() const { - return Hf_*this->W(); + return Hf_; } diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 5543878eeaf4e5db7358cd9482f2defcdcbeaa8e..4824b997d5446bdafa9046e82d366bd59f26d64f 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -101,8 +101,8 @@ void Foam::hPolynomialThermo<EquationOfState, PolySize>::write EquationOfState::write(os); dictionary dict("thermodynamics"); - dict.add("Hf", Hf_); - dict.add("Sf", Sf_); + dict.add("Hf", Hf_/this->W()); + dict.add("Sf", Sf_/this->W()); dict.add ( word("CpCoeffs<" + Foam::name(PolySize) + '>'), diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H index 27bb855c43899abb57a3dd7b0b989cee8f8922e2..ab19475edab06bd6389a81c3a6a7620ccbd71feb 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H @@ -298,22 +298,15 @@ template<class Thermo, template<class> class Type> inline Foam::scalar Foam::species::thermo<Thermo, Type>::K(const scalar p, const scalar T) const { - if (equal(this->nMoles(), SMALL)) + scalar arg = -this->nMoles()*this->g(p, T)/(this->RR*T); + + if (arg < 600.0) { - return 1.0; + return exp(arg); } else { - scalar arg = -this->nMoles()*this->g(p, T)/(this->RR*T); - - if (arg < 600.0) - { - return exp(arg); - } - else - { - return VGREAT; - } + return VGREAT; } } diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C index e33fa644c235bd6fc63f217e772cbbb62136189f..5d39d5e40f2f7c1210eda020510fd0bac7644d82 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.C @@ -269,11 +269,11 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs() tmp<scalarField> tKDeltaw(new scalarField(patch().size())); scalarField KDeltaw = tKDeltaw(); - // Create fields for solid properties + // Create fields for solid properties (p paramater not used) forAll(KDeltaw, i) { KDeltaw[i] = - solidPtr_().kappa((Tp[i] + nbrTw[i])/2.0)/thickness_[i]; + solidPtr_().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i]; } const scalarField q diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H index 524fb9c95a6747bee85b9f5f0c7104c322d90e52..8708bd125c4a30a301bd93ec50f6cdb423dbfb19 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H @@ -74,14 +74,6 @@ class temperatureThermoBaffle1DFvPatchScalarField autoPtr<solidType> solidPtr_; - // Private Member Functions - - scalar kappa(const scalar T) const - { - return solidPtr_().kappa(T); - } - - public: //- Runtime type information diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Ychar b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/char similarity index 95% rename from tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Ychar rename to tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/char index 382bcddd50ccb1b87914f9966153d385dd9d98b9..7f209e5234b88ea7bf6356de675794b3ec7a1dac 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Ychar +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/char @@ -11,13 +11,13 @@ FoamFile format ascii; class volScalarField; location "0"; - object Ydefault; + object char; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; -internalField uniform 1; +internalField uniform 0.5; boundaryField { diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Yv b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/wood similarity index 98% rename from tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Yv rename to tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/wood index f3f321b06b5f14c267cf3a9f140e50ceb9c2abed..4b30182d375fc0a22b19510b5f02a6fa7e4c41da 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/Yv +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/0/panelRegion/wood @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object Yv; + object wood; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties index 5051adef2c87c987e650328d1a25706ab4f99118..929ed127f856a9ee1fc6177576d65b1886e2172c 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties @@ -8,7 +8,7 @@ FoamFile { version 2.0; - format binary; + format ascii; class dictionary; location "constant"; object chemistryProperties; @@ -31,12 +31,5 @@ odeCoeffs eps 0.05; } -reactions -( - irreversibleSolidArrheniusReaction - v = gas + char - (7.83e10 15274.57 400 4.86) -); - // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/reactions b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/reactions new file mode 100644 index 0000000000000000000000000000000000000000..ee8b4281db6af696cb6a843ba795ab83e3011042 --- /dev/null +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/reactions @@ -0,0 +1,23 @@ +species +( + wood + char +); + +gaseousSpecies +( + gas +); + +reactions +{ + charReaction + { + type irreversibleArrheniusSolidReaction; + reaction "wood^4.86 = char + gas"; + A 7.83e10; + Ta 15274.57; + Tcrit 400; + } +} + diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ychar b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermo.solid similarity index 54% rename from tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ychar rename to tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermo.solid index 95625c52170567c1dcffcb4be3a2fc27c5d5108f..a4b2c48134af29807b445bf6c48b5d530ec22f0c 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ychar +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermo.solid @@ -8,23 +8,55 @@ FoamFile { version 2.0; - format ascii; - class volScalarField; - object Tchar; + format binary; + class dictionary; + location "constant"; + object thermo.solid; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; +wood +{ + specie + { + nMoles 1; + molWeight 100; + } + transport + { + kappa 0.135; + } + thermodynamics + { + Cp 696; + Hf -1.41e6; + } + equationOfState + { + rho 114.7; + } +}; -boundaryField +char { - ".*" + specie { - type calculated; - value uniform 0.5; + nMoles 1; + molWeight 50; } -} + transport + { + kappa 0.4; + } + thermodynamics + { + Cp 611; + Hf 0; + } + equationOfState + { + rho 11.5; + } +}; // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties index 6f70cdd8c8e91658a24c3bc8f0231e8f1a442771..a4d89de8c3bbc2aef94ddd74d729bf272bf964fc 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture reactingSolidMixture; + mixture reactingMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -25,6 +25,13 @@ thermoType energy sensibleEnthalpy; } + +chemistryReader foamChemistryReader; + +foamChemistryFile "$FOAM_CASE/constant/panelRegion/reactions"; + +foamChemistryThermoFile "$FOAM_CASE/constant/panelRegion/thermo.solid"; + gasThermoType { transport sutherland; @@ -34,61 +41,8 @@ gasThermoType energy sensibleEnthalpy; } -solidComponents -( - v char -); - -gaseousSpecies -( - gas -); - -vCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - transport - { - kappa 0.135; - } - thermodynamics - { - Cp 696; - Hf -1.41e6; - } - equationOfState - { - rho 114.7; - } -}; - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - transport - { - kappa 0.4; - } - thermodynamics - { - Cp 611; - Hf 0; - } - equationOfState - { - rho 11.5; - } -}; -gasCoeffs +gas { specie { diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties index f9b2dc1f9ac0a48e33cf57e04b89e5900a2821e2..89ee652071b09e14ed05d12e58017422f461b891 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties @@ -16,6 +16,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +radiation on; + radiationModel fvDOM; fvDOMCoeffs @@ -50,7 +52,7 @@ greyMeanAbsorptionEmissionCoeffs Tcommon 300; //Common Temp invTemp true; //Is the polynomio using inverse temperature. Tlow 200; //Low Temp - Thigh 2000; //High Temp + Thigh 2500; //High Temp loTcoeffs //coefss for T < Tcommon ( @@ -78,7 +80,7 @@ greyMeanAbsorptionEmissionCoeffs Tcommon 300; invTemp true; Tlow 200; - Thigh 2000; + Thigh 2500; loTcoeffs ( diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict index fb425995789bf14d15d5f89335a0ef39ec0064b9..3efab07aeb899a9b83c1b1eb4c4559be420e6014 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict @@ -16,19 +16,19 @@ FoamFile application fireFoam; -startFrom latestTime; +startFrom startTime; startTime 0; stopAt endTime; -endTime 15; +endTime 5; deltaT 0.03; writeControl adjustableRunTime; -writeInterval 1 +writeInterval 1; purgeWrite 0; diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion index d31d4d8771f94fa8ba759e8b245c93cf5305e50a..eb661d3a35dcfdfcd80ede8ff9c12b7ae4849ba6 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/changeDictionaryDict.baffleRegion @@ -101,7 +101,7 @@ dictionaryReplacement // Thermo baffle model thermoBaffleModel thermoBaffle2D; regionName baffleRegion; - infoOutput yes; + infoOutput no; active yes; thermoBaffle2DCoeffs { @@ -111,7 +111,7 @@ dictionaryReplacement thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ypmma b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ypmma deleted file mode 100644 index c2a485aeac008550cd25ee9abbcdcd49c2711853..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ypmma +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ypmma; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun index 64b8a22a128cdd7e245abbb4511222e160fb84d5..e86330c489e1b61103d4a996131c524ee5696d23 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/Allrun @@ -15,11 +15,6 @@ do rm -f 0*/$i/{mut,alphat,epsilon,k,U,p_rgh} done -# remove solid fields from fluid regions (important for post-processing) -for i in bottomAir topAir -do - rm -f 0*/$i/{Ychar,Ypmma} -done for i in bottomAir topAir heater leftSolid rightSolid do diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties index cc99e78017194787fac8a1329dff8458b6ece946..edb01db8b83370ec9908df5569abd2420aff451e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/heater/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -30,7 +30,7 @@ mixture specie { nMoles 1; - molWeight 12; + molWeight 50; } transport @@ -50,59 +50,4 @@ mixture } } -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties index dc0d1417d50c1d65060dbee01ac954166a99e5d3..8e1fe39d2c7980ae17ad81c04de4f76700970b79 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/regionProperties @@ -19,8 +19,6 @@ regions ( fluid (bottomAir topAir) solid (heater leftSolid rightSolid) - porousFluid () - porousSolid () ); // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties deleted file mode 100644 index cc99e78017194787fac8a1329dff8458b6ece946..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties +++ /dev/null @@ -1,108 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict index 1222482e8fa96ac25ee1b8118f5e3e71e59752f3..0f936407a4f3ece79bb85279d2ee5a23c11046a8 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -59,7 +59,7 @@ dictionaryReplacement } } - Ypmma + pmma { internalField uniform 0.5; @@ -75,7 +75,7 @@ dictionaryReplacement } - Ychar + char { internalField uniform 0.5; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index c70f5391f632c2889eb1f33d255d6548d96abd14..4deb0d8e1b0b0377fae898d61778e644e31f1044 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -50,7 +50,7 @@ dictionaryReplacement } } - Ypmma + pmma { internalField uniform 0.5; @@ -66,7 +66,7 @@ dictionaryReplacement } - Ychar + char { internalField uniform 0.5; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index 913adcf7844b5fd8984ea628382de5953af89ad4..c97bbad50fa6ecd12205ac09503c3b61d16dc70e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -50,7 +50,7 @@ dictionaryReplacement } } - Ypmma + pmma { internalField uniform 0.5; @@ -66,7 +66,7 @@ dictionaryReplacement } - Ychar + char { internalField uniform 0.5; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/Allrun index a1ef0bd9d686d9dbdd4f8c45afacc473a8d2dca2..b609b24a30b0fd5c160306c50b7e86c204f684f2 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/Allrun @@ -15,11 +15,6 @@ do rm -f 0*/$i/{mut,alphat,epsilon,k,U,p_rgh} done -## remove solid fields from fluid regions (important for post-processing) -for i in bottomWater topAir -do - rm -f 0*/$i/{Ypmma,Ychar} -done for i in bottomWater topAir heater leftSolid rightSolid do diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..df146b74f388882fe6c3f8dd863b7bdd3a76a209 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/heater/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -50,60 +50,4 @@ mixture } } -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/regionProperties index d76684c2cddba17a9d809b86225e36a95258dae3..59cff17f3fdb426704d79293e125be0164340a18 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/regionProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/regionProperties @@ -19,8 +19,7 @@ regions ( fluid (bottomWater topAir) solid (heater leftSolid rightSolid) - porousFluid () - porousSolid () + ); // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ychar b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ychar deleted file mode 100644 index 0d9e45f046ae33afaa026bd7e1b390ea5d02e0f7..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ychar +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ychar; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ypmma b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ypmma deleted file mode 100644 index c2a485aeac008550cd25ee9abbcdcd49c2711853..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ypmma +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ypmma; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun index 91f74227acb273fa5c52ae96b5a839c38bbf5f9a..59dcb70a89779ba183b06f91fa913f308ebb85df 100755 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/Allrun @@ -19,11 +19,6 @@ do rm -f 0*/$i/{mut,alphat,epsilon,k,U,p_rgh} done -# No solid fields to remove from fluid regions (important for post-processing) -for i in bottomAir topAir -do - rm -f 0*/$i/{Ypmma, Ychar} -done for i in bottomAir topAir heater leftSolid rightSolid do diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..df146b74f388882fe6c3f8dd863b7bdd3a76a209 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/heater/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -50,60 +50,4 @@ mixture } } -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/regionProperties index 9ca5dc857c35bb5b70fc26e27f990a4c6c77e438..1f1e965d524a004e72873a75a16048cd19ae6029 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/regionProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/regionProperties @@ -19,8 +19,6 @@ regions ( fluid (bottomAir topAir) solid (heater leftSolid rightSolid) - porousFluid () - porousSolid () ); diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ychar b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ychar deleted file mode 100644 index 0d9e45f046ae33afaa026bd7e1b390ea5d02e0f7..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ychar +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ychar; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ypmma b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ypmma deleted file mode 100644 index c2a485aeac008550cd25ee9abbcdcd49c2711853..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ypmma +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ypmma; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allclean b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allclean index 0ff2d80fa23c022c97cf87fdf526e56aecc71558..98a5d09794f59e02b90f8a3aabb317329355afb9 100755 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allclean +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allclean @@ -18,6 +18,6 @@ rm -rf constant/topAir/polyMesh rm -rf constant/heater/polyMesh rm -rf constant/leftSolid/polyMesh rm -rf constant/rightSolid/polyMesh -rm -rf topAir_maxX topAir_minX +rm -rf postProcessing # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allrun index 4f27179ebc1635cf08597a4311ef0606e46e7492..a0cd6737accf3f4a4b44388263a34b68ceaa706a 100755 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/Allrun @@ -15,12 +15,6 @@ do rm -f 0*/$i/{mut,alphat,epsilon,k,U,p_rgh} done -## remove solid fields from fluid regions (important for post-processing) -for i in bottomAir topAir -do - rm -f 0*/$i/{Ypmma,Ychar} -done - for i in bottomAir topAir heater leftSolid rightSolid do changeDictionary -region $i > log.changeDictionary.$i 2>&1 diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..df146b74f388882fe6c3f8dd863b7bdd3a76a209 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/heater/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -50,60 +50,4 @@ mixture } } -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/regionProperties index dc0d1417d50c1d65060dbee01ac954166a99e5d3..8e1fe39d2c7980ae17ad81c04de4f76700970b79 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/regionProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/regionProperties @@ -19,8 +19,6 @@ regions ( fluid (bottomAir topAir) solid (heater leftSolid rightSolid) - porousFluid () - porousSolid () ); // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ychar b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ychar deleted file mode 100644 index 0d9e45f046ae33afaa026bd7e1b390ea5d02e0f7..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ychar +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ychar; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ypmma b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ypmma deleted file mode 100644 index c2a485aeac008550cd25ee9abbcdcd49c2711853..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/0/Ypmma +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object Ypmma; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0.5; - -boundaryField -{ - ".*" - { - type calculated; - value uniform 0.5; - } -} - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun index 40b3687d50871d798336b3d1e1717cf058accf30..61fd0e371bf42fa954a5f677fbfb6c239b342af2 100755 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun @@ -15,12 +15,6 @@ do rm -f 0*/$i/{rho,mut,alphat,epsilon,k,U,p_rgh,Qr,G,IDefault} done -## remove solid fields from fluid regions (important for post-processing) -for i in bottomAir topAir -do - rm -f 0*/$i/{Ypmma,Ychar} -done - for i in bottomAir topAir heater leftSolid rightSolid do changeDictionary -region $i > log.changeDictionary.$i 2>&1 diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties index a4db76eba219fe8931c2751298d57e580bd5f04b..894a9f39be209c8cc007b561a91c9a6a762744d5 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/heater/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { type heSolidThermo; - mixture pureSolidMixture; + mixture pureMixture; transport constIso; thermo hConst; equationOfState rhoConst; @@ -50,60 +50,4 @@ mixture } } -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/leftSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/regionProperties index dc0d1417d50c1d65060dbee01ac954166a99e5d3..8e1fe39d2c7980ae17ad81c04de4f76700970b79 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/regionProperties +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/regionProperties @@ -19,8 +19,6 @@ regions ( fluid (bottomAir topAir) solid (heater leftSolid rightSolid) - porousFluid () - porousSolid () ); // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties deleted file mode 100644 index 4a7184c0ae50c4d1e64eb990ca187200bc0f2356..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object thermophysicalProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -thermoType -{ - type heSolidThermo; - mixture pureSolidMixture; - transport constIso; - thermo hConst; - equationOfState rhoConst; - specie specie; - energy sensibleEnthalpy; -} - -mixture -{ - specie - { - nMoles 1; - molWeight 12; - } - - transport - { - kappa 80; - } - - thermodynamics - { - Hf 0; - Cp 450; - } - - equationOfState - { - rho 8000; - } -} - -solidComponents -( - pmma char -); - -pmmaCoeffs -{ - specie - { - nMoles 1; - molWeight 100; - } - - transport - { - kappa 0.152; - } - - thermodynamics - { - Hf 0; - Cp 1462; - } - - equationOfState - { - rho 1114.0; - } -} - -charCoeffs -{ - specie - { - nMoles 1; - molWeight 50; - } - - transport - { - kappa 0.4; - } - - thermodynamics - { - Hf 0; - Cp 611.0; - } - - equationOfState - { - rho 11.5; - } -} - - -// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties new file mode 120000 index 0000000000000000000000000000000000000000..dc4d3a18ee4b034d4fdd38eef0466567d0d331bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/constant/rightSolid/thermophysicalProperties @@ -0,0 +1 @@ +../heater/thermophysicalProperties \ No newline at end of file