diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 0ddfa64588cff2d1bf0fe3177ddb244b3ee6dacc..000948514ef0ff61699665830a1e557743e315a2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -30,7 +30,7 @@ Description Sub-models include: - turbulence modelling, i.e. laminar, RAS or LES - - run-time selectable fvOptions, e.g. MRF, explicit porosity + - run-time selectable finitie volume options, e.g. MRF, explicit porosity \*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Allwmake b/applications/solvers/lagrangian/reactingParcelFoam/Allwmake index ecd3f260150d6169af78e88562a5bf3e87487aa8..f615df216c2c4087951cbcf947d83060f0ce8488 100755 --- a/applications/solvers/lagrangian/reactingParcelFoam/Allwmake +++ b/applications/solvers/lagrangian/reactingParcelFoam/Allwmake @@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake +wmake simpleReactingParcelFoam wmake LTSReactingParcelFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C index 991de15ad658d640eb6e0a2bc69f66442c5fdd39..34aecb65b4ee3cb3ef287d6f61410e8e6e249301 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -28,7 +28,7 @@ Description Local time stepping (LTS) solver for steady, compressible, laminar or turbulent reacting and non-reacting flow with multiphase Lagrangian parcels and porous media, including run-time selectable finitite volume - options, e.g. fvOptions, constraints + options, e.g. sources, constraints Note: ddtPhiCorr not used here when porous zones are active - not well defined for porous calculations diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 424c23b8b9ce3b88a42feb5ded7b4fceb3e5c32a..c4503cc10119f5dddb0e7d86179fafd042790706 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -22,12 +22,12 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application - porousExplicitSourceReactingParcelFoam + reactingParcelFoam Description Transient PIMPLE solver for compressible, laminar or turbulent flow with reacting multiphase Lagrangian parcels, including run-time selectable - finite volume options, e.g. fvOptions, constraints + finite volume options, e.g. sources, constraints \*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..d4d686e35569c6ea2d4151a455998a1f62ea581f --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/EEqn.H @@ -0,0 +1,32 @@ +{ + volScalarField& he = thermo.he(); + + fvScalarMatrix EEqn + ( + mvConvection->fvmDiv(phi, he) + + ( + he.name() == "e" + ? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho)) + : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) + ) + - fvm::laplacian(turbulence->alphaEff(), he) + == + parcels.Sh(he) + + radiation->Sh(thermo) + + combustion->Sh() + + fvOptions(rho, he) + ); + + EEqn.relax(); + + fvOptions.constrain(EEqn); + + EEqn.solve(); + + fvOptions.correct(he); + thermo.correct(); + radiation->correct(); + + Info<< "T gas min/max = " << min(T).value() << ", " + << max(T).value() << endl; +} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/files b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..4a202fcd4df960c5f67830593c89222b6211409a --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/files @@ -0,0 +1,3 @@ +simpleReactingParcelFoam.C + +EXE = $(FOAM_APPBIN)/simpleReactingParcelFoam diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..705cfc9433f4f9e47764f0f7d26e59cb0d82ff2c --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options @@ -0,0 +1,53 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I${LIB_SRC}/meshTools/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam + + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -llagrangian \ + -llagrangianIntermediate \ + -lspecie \ + -lfluidThermophysicalModels \ + -lliquidProperties \ + -lliquidMixtureProperties \ + -lsolidProperties \ + -lsolidMixtureProperties \ + -lthermophysicalFunctions \ + -lreactionThermophysicalModels \ + -lSLGThermo \ + -lchemistryModel \ + -lradiationModels \ + -lODE \ + -lregionModels \ + -lsurfaceFilmModels \ + -lcombustionModels \ + -lfvOptions \ + -lsampling diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..eabbb40454739032efbe679f92e2f69985cf9852 --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/UEqn.H @@ -0,0 +1,17 @@ + tmp<fvVectorMatrix> UEqn + ( + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) + == + rho.dimensionedInternalField()*g + + parcels.SU(U) + + fvOptions(rho, U) + ); + + UEqn().relax(); + + fvOptions.constrain(UEqn()); + + solve(UEqn() == -fvc::grad(p)); + + fvOptions.correct(U); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..cd0a45f0f020295bb6341f345e109b2999465471 --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/YEqn.H @@ -0,0 +1,53 @@ +tmp<fv::convectionScheme<scalar> > mvConvection +( + fv::convectionScheme<scalar>::New + ( + mesh, + fields, + phi, + mesh.divScheme("div(phi,Yi_h)") + ) +); + +{ + combustion->correct(); + dQ = combustion->dQ(); + label inertIndex = -1; + volScalarField Yt(0.0*Y[0]); + + forAll(Y, i) + { + if (Y[i].name() != inertSpecie) + { + volScalarField& Yi = Y[i]; + + fvScalarMatrix YEqn + ( + mvConvection->fvmDiv(phi, Yi) + - fvm::laplacian(turbulence->muEff(), Yi) + == + parcels.SYi(i, Yi) + + combustion->R(Yi) + + fvOptions(rho, Yi) + ); + + YEqn.relax(); + + fvOptions.constrain(YEqn); + + YEqn.solve(mesh.solver("Yi")); + + fvOptions.correct(Yi); + + Yi.max(0.0); + Yt += Yi; + } + else + { + inertIndex = i; + } + } + + Y[inertIndex] = scalar(1) - Yt; + Y[inertIndex].max(0.0); +} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H new file mode 100644 index 0000000000000000000000000000000000000000..954b74e069f5463683ba0941a1f2818a5258e9fc --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createClouds.H @@ -0,0 +1,9 @@ +Info<< "\nConstructing reacting cloud" << endl; +basicReactingMultiphaseCloud parcels +( + "reactingCloud1", + rho, + U, + g, + slgThermo +); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..d6df24cb48db47b198ce034055c0a656b0bac387 --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/createFields.H @@ -0,0 +1,98 @@ + Info<< "Creating combustion model\n" << endl; + + autoPtr<combustionModels::rhoCombustionModel> combustion + ( + combustionModels::rhoCombustionModel::New(mesh) + ); + + rhoReactionThermo& thermo = combustion->thermo(); + thermo.validate(args.executable(), "h", "e"); + + SLGThermo slgThermo(mesh, thermo); + + basicMultiComponentMixture& composition = thermo.composition(); + PtrList<volScalarField>& Y = composition.Y(); + + const word inertSpecie(thermo.lookup("inertSpecie")); + + if (!composition.contains(inertSpecie)) + { + FatalErrorIn(args.executable()) + << "Specified inert specie '" << inertSpecie << "' not found in " + << "species list. Available species:" << composition.species() + << exit(FatalError); + } + + volScalarField& p = thermo.p(); + const volScalarField& T = thermo.T(); + const volScalarField& psi = thermo.psi(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + Info<< "\nReading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "compressibleCreatePhi.H" + + dimensionedScalar rhoMax(simple.dict().lookup("rhoMax")); + dimensionedScalar rhoMin(simple.dict().lookup("rhoMin")); + + Info<< "Creating turbulence model\n" << endl; + autoPtr<compressible::turbulenceModel> turbulence + ( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + // Set the turbulence into the combustion model + combustion->setTurbulence(turbulence()); + + Info<< "Creating multi-variate interpolation scheme\n" << endl; + multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; + + forAll(Y, i) + { + fields.add(Y[i]); + } + fields.add(thermo.he()); + + volScalarField dQ + ( + IOobject + ( + "dQ", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) + ); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..0d1aa2e2387c3ad5d52c518414060634bbb2200b --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/pEqn.H @@ -0,0 +1,59 @@ +{ + rho = thermo.rho(); + + // Thermodynamic density needs to be updated by psi*d(p) after the + // pressure solution - done in 2 parts. Part 1: + thermo.rho() -= psi*p; + + volScalarField rAU(1.0/UEqn().A()); + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn().H(); + + UEqn.clear(); + + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf()) + ); + + fvOptions.relativeFlux(fvc::interpolate(rho), phiHbyA); + + while (simple.correctNonOrthogonal()) + { + fvScalarMatrix pEqn + ( + fvc::div(phiHbyA) + - fvm::laplacian(rho*rAU, p) + == + parcels.Srho() + + fvOptions(psi, p, rho.name()) + ); + + fvOptions.constrain(pEqn); + + pEqn.solve(); + + if (simple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqn.flux(); + } + } + + p.relax(); + + // Second part of thermodynamic density update + thermo.rho() += psi*p; + + #include "compressibleContinuityErrs.H" + + U = HbyA - rAU*fvc::grad(p); + U.correctBoundaryConditions(); + fvOptions.correct(U); + + rho = thermo.rho(); + rho = max(rho, rhoMin); + rho = min(rho, rhoMax); + + Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl; +} diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..6620d2af52dfbb6a40bf811c3503132db7d75f89 --- /dev/null +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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/>. + +Application + simpleReactingParcelFoam + +Description + Steady state SIMPLE solver for compressible, laminar or turbulent flow with + reacting multiphase Lagrangian parcels, including run-time selectable + finite volume options, e.g. sources, constraints + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "turbulenceModel.H" +#include "basicReactingMultiphaseCloud.H" +#include "rhoCombustionModel.H" +#include "radiationModel.H" +#include "IOporosityModelList.H" +#include "fvIOoptionList.H" +#include "SLGThermo.H" +#include "simpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createMesh.H" + #include "readGravitationalAcceleration.H" + + simpleControl simple(mesh); + + #include "createFields.H" + #include "createRadiationModel.H" + #include "createClouds.H" + #include "createFvOptions.H" + #include "initContinuityErrs.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (simple.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + parcels.evolve(); + + // --- Pressure-velocity SIMPLE corrector loop + { + #include "UEqn.H" + #include "YEqn.H" + #include "EEqn.H" + #include "pEqn.H" + } + + turbulence->correct(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H new file mode 100644 index 0000000000000000000000000000000000000000..c894b36b41c4e48a07a650590f9c6fe6fdc7edc2 --- /dev/null +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/EEqns.H @@ -0,0 +1,49 @@ +{ + volScalarField k1 + ( + "k1", + alpha1*(thermo1.alpha()/rho1 + sqr(Ct)*nut2*thermo1.CpByCpv()/Prt) + ); + + volScalarField k2 + ( + "k2", + alpha2*(thermo2.alpha()/rho2 + nut2*thermo2.CpByCpv()/Prt) + ); + + volScalarField& he1 = thermo1.he(); + volScalarField& he2 = thermo2.he(); + + Info<< max(he1) << min(he1) << endl; + + fvScalarMatrix he1Eqn + ( + fvm::ddt(alpha1, he1) + + fvm::div(alphaPhi1, he1) + - fvm::laplacian(k1, he1) + == + heatTransferCoeff*(he1/thermo1.Cp())/rho1 + - fvm::Sp(heatTransferCoeff/thermo1.Cp()/rho1, he1) + + alpha1*(dpdt/rho1 - (fvc::ddt(K1) + fvc::div(phi1, K1))) + ); + + fvScalarMatrix he2Eqn + ( + fvm::ddt(alpha2, he2) + + fvm::div(alphaPhi2, he2) + - fvm::laplacian(k2, he2) + == + heatTransferCoeff*(he2/thermo2.Cp())/rho2 + - fvm::Sp(heatTransferCoeff/thermo2.Cp()/rho2, he2) + + alpha2*(dpdt/rho2 - (fvc::ddt(K2) + fvc::div(phi2, K2))) + ); + + he1Eqn.relax(); + he1Eqn.solve(); + + he2Eqn.relax(); + he2Eqn.solve(); + + thermo1.correct(); + thermo2.correct(); +} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options index 16ce2e3674b971c19291acbbfb292aeb2da3795e..d90ba7bbbdf308e0b43489c0e0efd851b5367e28 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -IturbulenceModel \ @@ -8,6 +9,8 @@ EXE_INC = \ -Iaveraging EXE_LIBS = \ + -lfluidThermophysicalModels \ + -lspecie \ -lincompressibleTransportModels \ -lcompressiblePhaseModel \ -lcompressibleEulerianInterfacialModels \ diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/TEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/TEqns.H deleted file mode 100644 index 8f38ca9d91fe910cfad67e53608612d277564b3a..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/TEqns.H +++ /dev/null @@ -1,36 +0,0 @@ -{ - volScalarField kByCp1("kByCp1", alpha1*(k1/Cp1/rho1 + sqr(Ct)*nut2/Prt)); - volScalarField kByCp2("kByCp2", alpha2*(k2/Cp2/rho2 + nut2/Prt)); - - fvScalarMatrix T1Eqn - ( - fvm::ddt(alpha1, T1) - + fvm::div(alphaPhi1, T1) - - fvm::laplacian(kByCp1, T1) - == - heatTransferCoeff*T2/Cp1/rho1 - - fvm::Sp(heatTransferCoeff/Cp1/rho1, T1) - + alpha1*(dpdt/rho1 - (fvc::ddt(K1) + fvc::div(phi1, K1)))/Cp1 - ); - - fvScalarMatrix T2Eqn - ( - fvm::ddt(alpha2, T2) - + fvm::div(alphaPhi2, T2) - - fvm::laplacian(kByCp2, T2) - == - heatTransferCoeff*T1/Cp2/rho2 - - fvm::Sp(heatTransferCoeff/Cp2/rho2, T2) - + alpha2*(dpdt/rho2 - (fvc::ddt(K2) + fvc::div(phi2, K2)))/Cp2 - ); - - T1Eqn.relax(); - T1Eqn.solve(); - - T2Eqn.relax(); - T2Eqn.solve(); - - // Update compressibilities - psi1 = 1.0/(R1*T1); - psi2 = 1.0/(R2*T2); -} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H index 606b4573e47988c921954a011626b7ce80ecfb4b..a243db6300e555bfc8b909c74cd11352d7d66abd 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/UEqns.H @@ -12,12 +12,12 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); } else // If not using kinetic theory is using Ct model { - nuEff1 = sqr(Ct)*nut2 + nu1; + nuEff1 = sqr(Ct)*nut2 + thermo1.mu()/rho1; } volTensorField Rc1 ( - "Rc1", + "Rc", (((2.0/3.0)*I)*nuEff1)*tr(gradU1T) - nuEff1*gradU1T ); @@ -52,7 +52,7 @@ fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); volTensorField gradU2T(fvc::grad(U2)().T()); volTensorField Rc2 ( - "Rc2", + "Rc", (((2.0/3.0)*I)*nuEff2)*tr(gradU2T) - nuEff2*gradU2T ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H index a818ee2e9ea7707a7707b25f40026a2bb08ad591..86d9203dce190cfe520a07149dccbe7ef66eab83 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/alphaEqn.H @@ -1,9 +1,9 @@ -surfaceScalarField alphaPhi1("alphaPhi1", phi1); -surfaceScalarField alphaPhi2("alphaPhi2", phi2); +surfaceScalarField alphaPhi1("alphaPhi", phi1); +surfaceScalarField alphaPhi2("alphaPhi", phi2); { - word scheme("div(phi,alpha1)"); - word schemer("div(phir,alpha1)"); + word scheme("div(phi,alpha)"); + word schemer("div(phir,alpha)"); surfaceScalarField phic("phic", phi); surfaceScalarField phir("phir", phi1 - phi2); @@ -13,7 +13,7 @@ surfaceScalarField alphaPhi2("alphaPhi2", phi2); surfaceScalarField alpha1f(fvc::interpolate(alpha1)); surfaceScalarField phipp(ppMagf*fvc::snGrad(alpha1)*mesh.magSf()); phir += phipp; - phic += fvc::interpolate(alpha1)*phipp; + phic += alpha1f*phipp; } for (int acorr=0; acorr<nAlphaCorr; acorr++) @@ -68,16 +68,22 @@ surfaceScalarField alphaPhi2("alphaPhi2", phi2); if (g0.value() > 0.0) { + surfaceScalarField alpha1f(fvc::interpolate(alpha1)); + ppMagf = fvc::interpolate((1.0/rho1)*rAU1) - *fvc::interpolate - ( - g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax) - ); + *g0*min(exp(preAlphaExp*(alpha1f - alphaMax)), expMax); + + // ppMagf = + // fvc::interpolate((1.0/rho1)*rAU1) + // *fvc::interpolate + // ( + // g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax) + // ); alpha1Eqn -= fvm::laplacian ( - (fvc::interpolate(alpha1) + scalar(0.0001))*ppMagf, + alpha1f*ppMagf, alpha1, "laplacian(alphaPpMag,alpha1)" ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index 855a862b6ba51ac11c1fdadbae38e37f5fa35dc2..65372612b68532228120394c2bcc6e0925e44c2d 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "rhoThermo.H" #include "nearWallDist.H" #include "wallFvPatch.H" #include "fixedValueFvsPatchFields.H" @@ -86,7 +87,7 @@ int main(int argc, char *argv[]) #include "alphaEqn.H" #include "kEpsilon.H" #include "interfacialCoeffs.H" - #include "TEqns.H" + #include "EEqns.H" #include "UEqns.H" // --- Pressure corrector loop diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H index e0cd5328c98a5585040b805c5257cf676ab24996..6095ad6845e3a6b08767950eb9298bc27db2e416 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createFields.H @@ -12,55 +12,43 @@ ) ); + word phase1Name + ( + transportProperties.found("phases") + ? wordList(transportProperties.lookup("phases"))[0] + : "phase1" + ); + + word phase2Name + ( + transportProperties.found("phases") + ? wordList(transportProperties.lookup("phases"))[1] + : "phase2" + ); + autoPtr<phaseModel> phase1 = phaseModel::New ( mesh, transportProperties, - "1" + phase1Name ); autoPtr<phaseModel> phase2 = phaseModel::New ( mesh, transportProperties, - "2" + phase2Name ); + volScalarField& alpha1 = phase1(); + volScalarField& alpha2 = phase2(); + alpha2 = scalar(1) - alpha1; + volVectorField& U1 = phase1->U(); surfaceScalarField& phi1 = phase1->phi(); - const dimensionedScalar& nu1 = phase1->nu(); - const dimensionedScalar& k1 = phase1->kappa(); - const dimensionedScalar& Cp1 = phase1->Cp(); - dimensionedScalar rho10 - ( - "rho0", - dimDensity, - transportProperties.subDict("phase1").lookup("rho0") - ); - dimensionedScalar R1 - ( - "R", - dimensionSet(0, 2, -2, -1, 0), - transportProperties.subDict("phase1").lookup("R") - ); volVectorField& U2 = phase2->U(); surfaceScalarField& phi2 = phase2->phi(); - const dimensionedScalar& nu2 = phase2->nu(); - const dimensionedScalar& k2 = phase2->kappa(); - const dimensionedScalar& Cp2 = phase2->Cp(); - dimensionedScalar rho20 - ( - "rho0", - dimDensity, - transportProperties.subDict("phase2").lookup("rho0") - ); - dimensionedScalar R2 - ( - "R", - dimensionSet(0, 2, -2, -1, 0), - transportProperties.subDict("phase2").lookup("R") - ); dimensionedScalar pMin ( @@ -69,102 +57,16 @@ transportProperties.lookup("pMin") ); + rhoThermo& thermo1 = phase1->thermo(); + rhoThermo& thermo2 = phase2->thermo(); - Info<< "Reading field T1" << endl; - volScalarField T1 - ( - IOobject - ( - "T1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + volScalarField& p = thermo1.p(); - Info<< "Reading field T2" << endl; - volScalarField T2 - ( - IOobject - ( - "T2", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - volScalarField psi1 - ( - IOobject - ( - "psi1", - runTime.timeName(), - mesh - ), - 1.0/(R1*T1) - ); - - volScalarField psi2 - ( - IOobject - ( - "psi2", - runTime.timeName(), - mesh - ), - 1.0/(R2*T2) - ); - psi2.oldTime(); - - Info<< "Reading field p\n" << endl; - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - volScalarField rho1("rho1", rho10 + psi1*p); - volScalarField rho2("rho2", rho20 + psi2*p); - - - Info<< "Reading field alpha1\n" << endl; - volScalarField alpha1 - ( - IOobject - ( - "alpha1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); + volScalarField rho1("rho" + phase1Name, thermo1.rho()); + const volScalarField& psi1 = thermo1.psi(); - volScalarField alpha2 - ( - IOobject - ( - "alpha2", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - scalar(1) - alpha1 - ); + volScalarField rho2("rho" + phase2Name, thermo2.rho()); + const volScalarField& psi2 = thermo2.psi(); volVectorField U ( @@ -179,27 +81,6 @@ alpha1*U1 + alpha2*U2 ); - dimensionedScalar Cvm - ( - "Cvm", - dimless, - transportProperties.lookup("Cvm") - ); - - dimensionedScalar Cl - ( - "Cl", - dimless, - transportProperties.lookup("Cl") - ); - - dimensionedScalar Ct - ( - "Ct", - dimless, - transportProperties.lookup("Ct") - ); - surfaceScalarField phi ( IOobject @@ -226,8 +107,6 @@ alpha1*rho1 + alpha2*rho2 ); - #include "createRASTurbulence.H" - Info<< "Calculating field DDtU1 and DDtU2\n" << endl; volVectorField DDtU1 @@ -248,6 +127,29 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); + dimensionedScalar Cvm + ( + "Cvm", + dimless, + transportProperties.lookup("Cvm") + ); + + dimensionedScalar Cl + ( + "Cl", + dimless, + transportProperties.lookup("Cl") + ); + + dimensionedScalar Ct + ( + "Ct", + dimless, + transportProperties.lookup("Ct") + ); + + #include "createRASTurbulence.H" + IOdictionary interfacialProperties ( IOobject @@ -297,8 +199,8 @@ if ( !( - dispersedPhase == "1" - || dispersedPhase == "2" + dispersedPhase == phase1Name + || dispersedPhase == phase2Name || dispersedPhase == "both" ) ) @@ -337,7 +239,7 @@ ( IOobject ( - "rAU1", + "rAU" + phase1Name, runTime.timeName(), mesh, IOobject::NO_READ, @@ -387,5 +289,5 @@ ); Info<< "Creating field kinetic energy K\n" << endl; - volScalarField K1("K1", 0.5*magSqr(U1)); - volScalarField K2("K2", 0.5*magSqr(U2)); + volScalarField K1("K" + phase1Name, 0.5*magSqr(U1)); + volScalarField K2("K" + phase2Name, 0.5*magSqr(U2)); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H index 8f05a1d1b373ccde772bfba4cee1b575574ae9f3..0a782ef51edf99f32eaf986325fd926db596e410 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createRASTurbulence.H @@ -151,7 +151,7 @@ ( IOobject ( - "nut2", + "nut" + phase2Name, runTime.timeName(), mesh, IOobject::NO_READ, @@ -165,13 +165,13 @@ ( IOobject ( - "nuEff1", + "nuEff" + phase1Name, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), - sqr(Ct)*nut2 + nu1 + sqr(Ct)*nut2 + thermo1.mu()/rho1 ); Info<< "Calculating field nuEff2\n" << endl; @@ -179,11 +179,11 @@ ( IOobject ( - "nuEff2", + "nuEff" + phase2Name, runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), - nut2 + nu2 + nut2 + thermo2.mu()/rho2 ); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H index d6ccf90289ad6891248e665609408a68d4e7c766..d53bec5ea4f5ed2dc8393425bb4c4ddfa816c39d 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialCoeffs.H @@ -38,12 +38,12 @@ volScalarField heatTransferCoeff volVectorField Ur(U1 - U2); volScalarField magUr(mag(Ur) + residualSlip); - if (dispersedPhase == "1") + if (dispersedPhase == phase1Name) { dragCoeff = drag1->K(magUr); heatTransferCoeff = heatTransfer1->K(magUr); } - else if (dispersedPhase == "2") + else if (dispersedPhase == phase2Name) { dragCoeff = drag2->K(magUr); heatTransferCoeff = heatTransfer2->K(magUr); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options index 92fe0b0d74ab657d08fb917834ecd7b4afa9783d..f031e058986a9c4ac3c37c83fafeaf2f592f28df 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/Make/options @@ -1,7 +1,9 @@ EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I../phaseModel/lnInclude LIB_LIBS = \ - -lcompressiblePhaseModel - + -lcompressiblePhaseModel \ + -lfluidThermophysicalModels \ + -lspecie diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C index 9bc6cadaf66495c673b2e7c69781aeabdaaf850d..95ade6ba05944fc306d26ce7c7ed1ffff4d97d2d 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,8 +72,7 @@ Foam::tmp<Foam::volScalarField> Foam::heatTransferModels::RanzMarshall::K ) const { volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); - dimensionedScalar Prb = - phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa(); + volScalarField Prb(phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa()); volScalarField Nu(scalar(2) + 0.6*sqrt(Re)*cbrt(Prb)); return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d()); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options index 2fcce9913d9408482098065ad511e280e366c83f..7fdabf573092bd4219e75fa41044236e02b7d50e 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/foam/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I../phaseModel/lnInclude \ -I../interfacialModels/lnInclude diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 7d0767914ea7ef3d5ef2fa6f11bd9b1d8ef4abda..18db3a70df7a5265075b96ee74e3bc87a073576d 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,8 +45,8 @@ Foam::kineticTheoryModel::kineticTheoryModel phi1_(phase1.phi()), draga_(draga), - rho1_(phase1.rho()), - nu1_(phase1.nu()), + rho1_(phase1.rho()[0]), //***HGW + nu1_(phase1.nu()()[0]), //***HGW kineticTheoryProperties_ ( @@ -120,7 +120,7 @@ Foam::kineticTheoryModel::kineticTheoryModel ( IOobject ( - "mu1", + "mu" + phase1.name(), U1_.time().timeName(), U1_.mesh(), IOobject::NO_READ, diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H index f7010b1c459cc8419b658797c7d7e4998ba1ab3a..f9a7807d00d46f51c83c8ee2f21679866b898d68 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H @@ -1,6 +1,6 @@ { - rho1 = rho10 + psi1*p; - rho2 = rho20 + psi2*p; + rho1 = thermo1.rho(); + rho2 = thermo2.rho(); surfaceScalarField alpha1f(fvc::interpolate(alpha1)); surfaceScalarField alpha2f(scalar(1) - alpha1f); @@ -11,10 +11,10 @@ surfaceScalarField rAlphaAU1f(fvc::interpolate(alpha1*rAU1)); surfaceScalarField rAlphaAU2f(fvc::interpolate(alpha2*rAU2)); - volVectorField HbyA1("HbyA1", U1); + volVectorField HbyA1("HbyA" + phase1Name, U1); HbyA1 = rAU1*U1Eqn.H(); - volVectorField HbyA2("HbyA2", U2); + volVectorField HbyA2("HbyA" + phase2Name, U2); HbyA2 = rAU2*U2Eqn.H(); mrfZones.absoluteFlux(phi1.oldTime()); @@ -38,14 +38,14 @@ surfaceScalarField phiHbyA1 ( - "phiHbyA1", + "phiHbyA" + phase1Name, (fvc::interpolate(HbyA1) & mesh.Sf()) + fvc::ddtPhiCorr(rAU1, alpha1, U1, phi1) ); surfaceScalarField phiHbyA2 ( - "phiHbyA2", + "phiHbyA" + phase2Name, (fvc::interpolate(HbyA2) & mesh.Sf()) + fvc::ddtPhiCorr(rAU2, alpha2, U2, phi2) ); @@ -96,8 +96,16 @@ //} //else { - surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi1); - surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi2); + surfaceScalarField phid1 + ( + "phid" + phase1Name, + fvc::interpolate(psi1)*phi1 + ); + surfaceScalarField phid2 + ( + "phid" + phase2Name, + fvc::interpolate(psi2)*phi2 + ); pEqnComp1 = fvc::ddt(rho1) + psi1*correction(fvm::ddt(p)) @@ -174,13 +182,15 @@ p = max(p, pMin); - rho1 = rho10 + psi1*p; - rho2 = rho20 + psi2*p; + thermo1.correct(); + thermo2.correct(); + rho1 = thermo1.rho(); + rho2 = thermo2.rho(); K1 = 0.5*magSqr(U1); K2 = 0.5*magSqr(U2); - //***HGW if (thermo.dpdt()) + if (thermo1.dpdt()) { dpdt = fvc::ddt(p); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options index 0ec11392098bd862e78e2790e25cf1f49ec557fd..e441b0417bb82b021ee7e0ae470e030900e43a71 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/Make/options @@ -1,6 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude LIB_LIBS = \ - -lincompressibleTransportModels + -lincompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C index d80758ac8c7d6cb754af8fe5aeaf9d2e7e2f7b78..64d59b436d5f2e85d2bd263227878101b3b51c76 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,35 +37,22 @@ Foam::phaseModel::phaseModel const word& phaseName ) : - dict_ + volScalarField ( - transportProperties.subDict("phase" + phaseName) + IOobject + ( + "alpha" + phaseName, + mesh.time().timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("alpha", dimless, 0) ), name_(phaseName), - nu_ - ( - "nu", - dimensionSet(0, 2, -1, 0, 0), - dict_.lookup("nu") - ), - kappa_ - ( - "kappa", - dimensionSet(1, 1, -3, -1, 0), - dict_.lookup("kappa") - ), - Cp_ - ( - "Cp", - dimensionSet(0, 2, -2, -1, 0), - dict_.lookup("Cp") - ), - rho_ - ( - "rho", - dimDensity, - dict_.lookup("rho") - ), + phaseDict_(transportProperties.subDict(phaseName)), + thermo_(rhoThermo::New(mesh, phaseName)), U_ ( IOobject @@ -79,6 +66,8 @@ Foam::phaseModel::phaseModel mesh ) { + thermo_->validate("phaseModel " + phaseName, "h", "e"); + const word phiName = "phi" + phaseName; IOobject phiHeader @@ -147,7 +136,7 @@ Foam::phaseModel::phaseModel dPtr_ = diameterModel::New ( - dict_, + phaseDict_, *this ); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H index 90b2d2184e0d3f971beeb959fe46864805073e89..18f5a47e46950dbec54b8a364b170aa5a3d5bef2 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ SourceFiles #include "dimensionedScalar.H" #include "volFields.H" #include "surfaceFields.H" +#include "rhoThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,25 +51,18 @@ class diameterModel; \*---------------------------------------------------------------------------*/ class phaseModel +: + public volScalarField { // Private data - dictionary dict_; - //- Name of phase word name_; - //- Kinematic viscosity - dimensionedScalar nu_; - - //- Thermal conductivity - dimensionedScalar kappa_; - - //- Heat capacity - dimensionedScalar Cp_; + dictionary phaseDict_; - //- Density - dimensionedScalar rho_; + //- Thermophysical properties + autoPtr<rhoThermo> thermo_; //- Velocity volVectorField U_; @@ -116,24 +110,34 @@ public: tmp<volScalarField> d() const; - const dimensionedScalar& nu() const + tmp<volScalarField> nu() const + { + return thermo_->mu()/thermo_->rho(); + } + + tmp<volScalarField> kappa() const + { + return thermo_->kappa(); + } + + tmp<volScalarField> Cp() const { - return nu_; + return thermo_->Cp(); } - const dimensionedScalar& kappa() const + const volScalarField& rho() const { - return kappa_; + return thermo_->rho(); } - const dimensionedScalar& Cp() const + const rhoThermo& thermo() const { - return Cp_; + return thermo_(); } - const dimensionedScalar& rho() const + rhoThermo& thermo() { - return rho_; + return thermo_(); } const volVectorField& U() const diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H index 7f53411529a31a855f706d13d801f5624d1b7c45..bc9a07b0a81105cdbacc53336c054253844f2d2b 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/kEpsilon.H @@ -61,4 +61,4 @@ if (turbulence) #include "wallViscosity.H" } -nuEff2 = nut2 + nu2; +nuEff2 = nut2 + thermo2.mu()/rho2; diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H index c91cce9a00e2df5ca912a75a57a02d6f813d72c4..d85181cba2e020e57fb2063d09d4af4f14b01807 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallFunctions.H @@ -4,7 +4,6 @@ scalar Cmu25 = ::pow(Cmu.value(), 0.25); scalar Cmu75 = ::pow(Cmu.value(), 0.75); scalar kappa_ = kappa.value(); - scalar nu2_ = nu2.value(); const fvPatchList& patches = mesh.boundary(); @@ -30,6 +29,8 @@ forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; + const scalarField& mu2_ = thermo2.mu().boundaryField()[patchi]; + const scalarField& rho2_ = rho2.boundaryField()[patchi]; if (isA<wallFvPatch>(currPatch)) { @@ -52,7 +53,8 @@ /(kappa_*y[patchi][facei]); G[faceCelli] += - (nut2w[facei] + nu2_)*magFaceGradU[facei] + (nut2w[facei] + mu2_[facei]/rho2_[facei]) + *magFaceGradU[facei] *Cmu25*::sqrt(k[faceCelli]) /(kappa_*y[patchi][facei]); } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H index b153a360146deefed6b9b4a9c2a8a8ecb66075d9..9aa032149ca51f65d51d412c4dc13b7d61b9c46c 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/turbulenceModel/wallViscosity.H @@ -2,13 +2,14 @@ scalar Cmu25 = ::pow(Cmu.value(), 0.25); scalar kappa_ = kappa.value(); scalar E_ = E.value(); - scalar nu2_ = nu2.value(); const fvPatchList& patches = mesh.boundary(); forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; + const scalarField& mu2_ = thermo2.mu().boundaryField()[patchi]; + const scalarField& rho2_ = rho2.boundaryField()[patchi]; if (isA<wallFvPatch>(currPatch)) { @@ -20,11 +21,14 @@ // calculate yPlus scalar yPlus = - Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])/nu2_; + Cmu25*y[patchi][facei]*::sqrt(k[faceCelli]) + /(mu2_[facei]/rho2_[facei]); if (yPlus > 11.6) { - nutw[facei] = nu2_*(yPlus*kappa_/::log(E_*yPlus) - 1); + nutw[facei] = + (mu2_[facei]/rho2_[facei]) + *(yPlus*kappa_/::log(E_*yPlus) - 1); } else { diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H index 34fdc24afc532d56c0fd0ddf0c08479237d2cdb9..ddb923cf8726096119eac8c6b62e4b763877c642 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/alphaEqn.H @@ -13,7 +13,7 @@ surfaceScalarField alpha1f(fvc::interpolate(alpha1)); surfaceScalarField phipp(ppMagf*fvc::snGrad(alpha1)*mesh.magSf()); phir += phipp; - phic += fvc::interpolate(alpha1)*phipp; + phic += alpha1f*phipp; } for (int acorr=0; acorr<nAlphaCorr; acorr++) @@ -52,18 +52,23 @@ if (g0.value() > 0) { - ppMagf = rAU1f*fvc::interpolate - ( - (1.0/(rho1*(alpha1 + scalar(0.0001)))) - *g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax) - ); + surfaceScalarField alpha1f(fvc::interpolate(alpha1)); + + // ppMagf = rAU1f*fvc::interpolate + // ( + // (1.0/(rho1*(alpha1 + scalar(0.0001)))) + // *g0*min(exp(preAlphaExp*(alpha1 - alphaMax)), expMax) + // ); + ppMagf = + rAU1f/(alpha1f + scalar(0.0001)) + *(g0/rho1)*min(exp(preAlphaExp*(alpha1f - alphaMax)), expMax); fvScalarMatrix alpha1Eqn ( fvm::ddt(alpha1) - fvc::ddt(alpha1) - fvm::laplacian ( - (fvc::interpolate(alpha1) + scalar(0.0001))*ppMagf, + alpha1f*ppMagf, alpha1, "laplacian(alpha1PpMag,alpha1)" ) diff --git a/applications/test/Circulator/Test-Circulator.C b/applications/test/Circulator/Test-Circulator.C index 19a21f6b795f388bc561fc694efa2dd400d2ca33..2d8ecd3765aed3ac8892e38a10053d2aad2be6a0 100644 --- a/applications/test/Circulator/Test-Circulator.C +++ b/applications/test/Circulator/Test-Circulator.C @@ -38,94 +38,6 @@ Description using namespace Foam; -// return -// 0: no match -// +1: identical -// -1: same face, but different orientation -label compare(const face& a, const face& b) -{ - // Basic rule: we assume that the sequence of labels in each list - // will be circular in the same order (but not necessarily in the - // same direction or from the same starting point). - - // Trivial reject: faces are different size - label sizeA = a.size(); - label sizeB = b.size(); - - if (sizeA != sizeB || sizeA == 0) - { - return 0; - } - - const_circulator<face> aCirc(a); - const_circulator<face> bCirc(b); - - // Rotate face b until its element matches the starting element of face a. - do - { - if (aCirc() == bCirc()) - { - // Set bCirc fulcrum to its iterator and increment the iterators - bCirc.setFulcrumToIterator(); - ++aCirc; - ++bCirc; - - break; - } - } while (bCirc.circulate(CirculatorBase::CLOCKWISE)); - - // Look forwards around the faces for a match - do - { - if (aCirc() != bCirc()) - { - break; - } - } - while - ( - aCirc.circulate(CirculatorBase::CLOCKWISE), - bCirc.circulate(CirculatorBase::CLOCKWISE) - ); - - // If the circulator has stopped then faces a and b matched. - if (!aCirc.circulate()) - { - return 1; - } - else - { - // Reset the circulators back to their fulcrum - aCirc.setIteratorToFulcrum(); - bCirc.setIteratorToFulcrum(); - ++aCirc; - --bCirc; - } - - // Look backwards around the faces for a match - do - { - if (aCirc() != bCirc()) - { - break; - } - } - while - ( - aCirc.circulate(CirculatorBase::CLOCKWISE), - bCirc.circulate(CirculatorBase::ANTICLOCKWISE) - ); - - // If the circulator has stopped then faces a and b matched. - if (!aCirc.circulate()) - { - return -1; - } - - return 0; -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -184,40 +96,44 @@ int main(int argc, char *argv[]) Info<< nl << nl << "Compare two faces: " << endl; face a(identity(5)); - Info<< "Compare " << a << " and " << a << " Match = " << compare(a, a) + Info<< "Compare " << a << " and " << a << " Match = " << face::compare(a, a) << endl; face b(reverseList(a)); - Info<< "Compare " << a << " and " << b << " Match = " << compare(a, b) + Info<< "Compare " << a << " and " << b << " Match = " << face::compare(a, b) << endl; face c(a); c[4] = 3; - Info<< "Compare " << a << " and " << c << " Match = " << compare(a, c) + Info<< "Compare " << a << " and " << c << " Match = " << face::compare(a, c) << endl; face d(rotateList(a, 2)); - Info<< "Compare " << a << " and " << d << " Match = " << compare(a, d) + Info<< "Compare " << a << " and " << d << " Match = " << face::compare(a, d) << endl; face g(labelList(5, 1)); face h(g); - Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h) << endl; g[0] = 2; h[3] = 2; - Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h) << endl; g[4] = 3; h[4] = 3; - Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + Info<< "Compare " << g << " and " << h << " Match = " << face::compare(g, h) << endl; face face1(identity(1)); Info<< "Compare " << face1 << " and " << face1 - << " Match = " << compare(face1, face1) << endl; + << " Match = " << face::compare(face1, face1) << endl; + + face face2(identity(1)+1); + Info<< "Compare " << face1 << " and " << face2 + << " Match = " << face::compare(face1, face2) << endl; Info<< nl << nl << "Zero face" << nl << endl; diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseDict b/applications/utilities/mesh/advanced/collapseEdges/collapseDict index 60f4cb2f43809aff6b09b4ab0057aec3b226ab9b..340c33049f621562390996a879b93070aa684186 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseDict +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseDict @@ -17,7 +17,7 @@ FoamFile collapseEdgesCoeffs { // Edges shorter than this absolute value will be merged - minimumEdgeLength 1e-8; + minimumEdgeLength 1e-6; // The maximum angle between two edges that share a point attached to // no other edges @@ -25,7 +25,7 @@ collapseEdgesCoeffs // The amount that minimumEdgeLength will be reduced by for each // edge if that edge's collapse generates a poor quality face - reductionFactor 0.5; + reductionFactor 0.5; } @@ -67,14 +67,17 @@ meshQualityCoeffs { // Name of the dictionary that has the mesh quality coefficients used // by motionSmoother::checkMesh - meshQualityCoeffDict meshQualityDict; + #include "meshQualityDict"; + + // Maximum number of smoothing iterations for the reductionFactors + maximumSmoothingIterations 2; // Maximum number of outer iterations is mesh quality checking is enabled - maximumIterations 10; + maximumIterations 10; // Maximum number of iterations deletion of a point can cause a bad face // to be constructed before it is forced to not be deleted - maxPointErrorCount 5; + maxPointErrorCount 5; } diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict index ffa2db8b19ff1779d0ca9e25c2e3c22711e51311..6587c8429874e74f9ad64dea668706f24e5ac848 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -70,6 +70,9 @@ extrudeModel linearNormal; //- Extrudes into sphere around (0 0 0) // extrudeModel linearRadial; +//- Extrudes into sphere around (0 0 0) with specified radii +//extrudeModel radial; + //- Extrudes into sphere with grading according to pressure (atmospherics) // extrudeModel sigmaRadial; @@ -98,6 +101,14 @@ linearDirectionCoeffs linearRadialCoeffs { R 0.1; + // Optional inner radius + Rsurface 0.01; +} + +radialCoeffs +{ + // Radii specified through interpolation table + R table ((0 0.01)(3 0.03)(10 0.1)); } sigmaRadialCoeffs @@ -107,4 +118,5 @@ sigmaRadialCoeffs pStrat 1; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/Make/options b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/Make/options index f1db60d53ffc10f9c888abe43bf6cd36e525aa65..fe1283a73ae78fc7d2e4a354aafb19bae9ba3232 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/Make/options +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - /* -DFULLDEBUG -g -O0 */ \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C index 7979fa966a5e193a58a0f24807245953fdcfb122..1b83599b31633309a0870dbd214139d25575182f 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.C @@ -26,12 +26,6 @@ License #include "patchToPoly2DMesh.H" #include "PatchTools.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::patchToPoly2DMesh::flipFaceOrder() @@ -275,12 +269,9 @@ void Foam::patchToPoly2DMesh::createPolyMeshComponents() addPatchFacesToOwner(); } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -//- Construct from a primitivePatch Foam::patchToPoly2DMesh::patchToPoly2DMesh ( const MeshedSurface<face>& patch, @@ -321,13 +312,5 @@ void Foam::patchToPoly2DMesh::createMesh() } } -// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H index ea27dc6f53cf60c1bce164ca8a8f4308365dfc9d..b7c81e68a29ed9e9b1e3f2bd3eae35b97ae86fe6 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMesh/patchToPoly2DMesh/patchToPoly2DMesh.H @@ -51,6 +51,7 @@ class patchToPoly2DMesh { // Private data + // Reference to the meshed surface const MeshedSurface<face>& patch_; const wordList& patchNames_; @@ -62,11 +63,16 @@ class patchToPoly2DMesh const EdgeMap<label>& mapEdgesRegion_; pointField points_; + faceList faces_; + labelList owner_; + labelList neighbour_; - //- Description of data_ + + // Private Member Functions + void flipFaceOrder(); void createNeighbours(); @@ -79,9 +85,6 @@ class patchToPoly2DMesh void createPolyMeshComponents(); - - // Private Member Functions - //- Disallow default bitwise copy construct patchToPoly2DMesh(const patchToPoly2DMesh&); @@ -110,47 +113,47 @@ public: // Member Functions // Access - pointField& points() - { - return points_; - } - - faceList& faces() - { - return faces_; - } - - labelList& owner() - { - return owner_; - } - - labelList& neighbour() - { - return neighbour_; - } - - const wordList& patchNames() const - { - return patchNames_; - } - - const labelList& patchSizes() const - { - return patchSizes_; - } - - const labelList& patchStarts() const - { - return patchStarts_; - } - // Check - // Edit - void createMesh(); + pointField& points() + { + return points_; + } + + faceList& faces() + { + return faces_; + } + + labelList& owner() + { + return owner_; + } + + labelList& neighbour() + { + return neighbour_; + } + + const wordList& patchNames() const + { + return patchNames_; + } - // Write + const labelList& patchSizes() const + { + return patchSizes_; + } + + const labelList& patchStarts() const + { + return patchStarts_; + } + + + // Edit + //- Create the mesh + void createMesh(); }; diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index 088d0594f8ac2fa18514cd4fbffc4f43a30eb3c3..0b04d91b729aa9cf0938ada2756a569927aec3f7 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -317,12 +317,12 @@ int main(int argc, char *argv[]) } // Take over refinement levels and write to new time directory. - Pout<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName() + Info<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName() << nl << endl; mesh().write(); - Pout<< "End\n" << endl; + Info<< "End\n" << endl; return 0; } diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict index 15547e985e980721764cbf29367d741a4ea8fd37..2cd1a68ca56dd338283239af10e3a668448a1014 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict @@ -69,8 +69,8 @@ structuredCoeffs // Renumber in columns (depthFirst) or in layers depthFirst true; - // Optional: reverse ordering - //reverse false; + // Reverse ordering + reverse false; } diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index b383a6efe3d6f07576df236a33415dda2b3a380c..6a27bdfb2c624eb1e5b252f7c12edc3914d011ca 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -119,7 +119,10 @@ structuredCoeffs { // Patches to do 2D decomposition on. Structured mesh only; cells have // to be in 'columns' on top of patches. - patches (bottomPatch); + patches (movingWall); + + // Method to use on the 2D subset + method scotch; } //// Is the case distributed? Note: command-line argument -roots takes diff --git a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H index f5186c3a2544d7c019e8797754ee33014e988eb4..7aa4459e893d67b82107b05944ccfa6f406afb18 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H +++ b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/CGALPolyhedronRings.H @@ -2,31 +2,31 @@ #define CGAL_PSURF_RINGS_H_ // This file adapted from -// CGAL-3.7/examples/Jet_fitting_3//PolyhedralSurf_rings.h -// Licensed under CGAL-3.7/LICENSE.FREE_USE +// CGAL-4.0/examples/Jet_fitting_3/PolyhedralSurf_rings.h +// Licensed under CGAL-4.0/LICENSE.FREE_USE // Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007 -// Utrecht University (The Netherlands), ETH Zurich (Switzerland), Freie -// Universitaet Berlin (Germany), INRIA Sophia-Antipolis (France), -// Martin-Luther-University Halle-Wittenberg (Germany), Max-Planck-Institute -// Saarbruecken (Germany), RISC Linz (Austria), and Tel-Aviv University -// (Israel). All rights reserved. - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <cassert> diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H index a50d5e3995e295819fd06a0563d24f88ac65d00b..7309af83e1dfbeb4f84b0eeca5d9c57b933df44d 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.H @@ -25,7 +25,8 @@ Class Foam::dynamicIndexedOctree Description - Non-pointer based hierarchical recursive searching + Non-pointer based hierarchical recursive searching. + Storage is dynamic, so elements can be deleted. SourceFiles dynamicIndexedOctree.C @@ -451,6 +452,7 @@ public: ); } + // Member Functions // Access @@ -656,6 +658,7 @@ public: label removeIndex(const label nodIndex, const label index); + // Write //- Print tree. Either print all indices (printContent = true) or @@ -671,6 +674,7 @@ public: void writeTreeInfo() const; + // IOstream Operators friend Ostream& operator<< <Type> diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H index 5aec38af8684fc145149df546d0e029e5691e969..843b386e77fd49bda9cec52ae59a69970c1da600 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/DILU/DILUSmoother.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,9 +27,6 @@ Class Description Simplified diagonal-based incomplete LU smoother for asymmetric matrices. - To improve efficiency, the residual is evaluated after every nSweeps - sweeps. - SourceFiles DILUSmoother.C diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index 1d7ee06c2e99551f44e3f192216886d36a9cb5ce..21576535e9aad00966b892337190341a071ef953 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -318,6 +318,17 @@ int Foam::face::compare(const face& a, const face& b) { return 0; } + else if (sizeA == 1) + { + if (a[0] == b[0]) + { + return 1; + } + else + { + return 0; + } + } const_circulator<face> aCirc(a); const_circulator<face> bCirc(b); @@ -337,7 +348,7 @@ int Foam::face::compare(const face& a, const face& b) } while (bCirc.circulate(CirculatorBase::CLOCKWISE)); // If the circulator has stopped then faces a and b do not share a matching - // point + // point. Doesn't work on matching, single element face. if (!bCirc.circulate()) { return 0; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C index ef697325b6834980e1ba30a010ac48845c672b3a..df95c968187d5cabfefd7d407a793e525e65b807 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -538,6 +538,9 @@ Foam::List<Foam::tetIndices> Foam::polyMeshTetDecomposition::faceTetIndices label cI ) { + static label nWarnings = 0; + static const label maxWarnings = 100; + const faceList& pFaces = mesh.faces(); const labelList& pOwner = mesh.faceOwner(); @@ -553,19 +556,27 @@ Foam::List<Foam::tetIndices> Foam::polyMeshTetDecomposition::faceTetIndices if (tetBasePtI == -1) { - WarningIn - ( - "Foam::List<Foam::tetIndices> " - "Foam::polyMeshTetDecomposition::faceTetIndices" - "(" - "const polyMesh&, " - "label, " - "label" - ")" - ) - << "No base point for face " << fI << ", " << f - << ", produces a valid tet decomposition." - << endl; + if (nWarnings < maxWarnings) + { + WarningIn + ( + "Foam::List<Foam::tetIndices> " + "Foam::polyMeshTetDecomposition::faceTetIndices" + "(" + "const polyMesh&, " + "label, " + "label" + ")" + ) << "No base point for face " << fI << ", " << f + << ", produces a valid tet decomposition." + << endl; + nWarnings++; + } + if (nWarnings == maxWarnings) + { + Warning<< "Suppressing any further warnings." << endl; + nWarnings++; + } tetBasePtI = 0; } diff --git a/src/dynamicMesh/createShellMesh/createShellMesh.H b/src/dynamicMesh/createShellMesh/createShellMesh.H index df1e000be8c90a46ee3391b4a601d669215ef5dc..65edd65cd84b0d9dff43b0a72aab6ae03f0c32fc 100644 --- a/src/dynamicMesh/createShellMesh/createShellMesh.H +++ b/src/dynamicMesh/createShellMesh/createShellMesh.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,7 +137,7 @@ public: // be in top patch // < 0 : face in opposite orientation as patch face. face will // be in bottom patch - // = 0 : for all side and internal faces + // = 0 : for all side faces const labelList& faceToFaceMap() const { return faceToFaceMap_; diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C index c44f646025575e0addcb7468b16aa4f55e641c30..9b184f994e6488086322e6e93fec8fd87f9adb52 100644 --- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C @@ -35,6 +35,12 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +namespace Foam +{ +defineTypeNameAndDebug(polyMeshFilter, 0); +} + + Foam::autoPtr<Foam::fvMesh> Foam::polyMeshFilter::copyMesh(const fvMesh& mesh) { polyTopoChange originalMeshToNewMesh(mesh); diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H index 135a52520caadac3d84b2c3d00c99a69c7244fb4..28aaf7ea06a955739902de94063d2968ece0b7cf 100644 --- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H @@ -25,6 +25,10 @@ Class Foam::polyMeshFilter Description + Filter the edges and faces of a polyMesh whilst satisfying the given mesh + quality criteria. + + Works on a copy of the mesh. SourceFiles polyMeshFilter.C @@ -102,10 +106,10 @@ class polyMeshFilter // faces const scalar faceReductionFactor_; - //- + //- Maximum number of times a deleted point can be associated with the + // creation of a bad face it is forced to be kept. const label maxPointErrorCount_; - //- The minimum edge length for each edge scalarField minEdgeLen_; @@ -195,6 +199,10 @@ class polyMeshFilter public: + //- Runtime type information + ClassName("polyMeshFilter"); + + // Constructors //- Construct from fvMesh @@ -225,6 +233,7 @@ public: //- Filter edges only. label filterEdges(const label nOriginalBadFaces); + //- Filter all faces that are in the face zone indirectPatchFaces label filterIndirectPatchFaces(); }; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index af911c7ad7153db70f2241e9f2196d6c86e06144..f6c35df41e7a3c2c85d2f3c03668831f2da0cf83 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -35,6 +35,12 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +namespace Foam +{ +defineTypeNameAndDebug(edgeCollapser, 0); +} + + Foam::label Foam::edgeCollapser::longestEdge ( const face& f, diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H index 02359f39aca6ff10b1612b1e694895ee20d6bd38..dc6b1578c15764e302a2297dac48a7253b0f7e53 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H @@ -61,7 +61,7 @@ class face; class edge; /*---------------------------------------------------------------------------*\ - Class edgeCollapser Declaration + Class edgeCollapser Declaration \*---------------------------------------------------------------------------*/ class edgeCollapser @@ -84,12 +84,18 @@ private: //- Reference to mesh const polyMesh& mesh_; + //- Controls collapse of a face to an edge const scalar guardFraction_; + //- Only collapse face to a point if high aspect ratio const scalar maxCollapseFaceToPointSideLengthCoeff_; + //- Allow a face to be collapsed to a point early, before the test + // to collapse to an edge const Switch allowEarlyCollapseToPoint_; + //- Fraction of maxCollapseFaceToPointSideLengthCoeff_ to use when + // allowEarlyCollapseToPoint_ is on const scalar allowEarlyCollapseCoeff_; @@ -266,8 +272,8 @@ public: const dictionary& meshQualityDict ); - // Check mesh and mark points on faces in error - // Returns boolList with points in error set + //- Check mesh and mark points on faces in error + // Returns boolList with points in error set static label checkMeshQuality ( const polyMesh& mesh, @@ -300,7 +306,7 @@ public: polyTopoChange& meshMod ) const; - // Mark (in collapseEdge) any edges to collapse + //- Mark (in collapseEdge) any edges to collapse label markSmallEdges ( const scalarField& minEdgeLen, @@ -309,7 +315,7 @@ public: Map<point>& collapsePointToLocation ) const; - // Mark (in collapseEdge) any edges to merge + //- Mark (in collapseEdge) any edges to merge label markMergeEdges ( const scalar maxCos, @@ -332,6 +338,7 @@ public: Map<point>& collapsePointToLocation ) const; + //- Marks edges in the faceZone indirectPatchFaces for collapse void markIndirectPatchFaces ( PackedBoolList& collapseEdge, diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C index ac3762db048d5c5476ed42b99e9608d5176ad65b..0329782315c4d4f4af6ef77d1c4da98602b6a6dd 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,6 +56,48 @@ reconstruct const fvMesh& mesh = ssf.mesh(); + surfaceVectorField faceVols + ( + mesh.Sf()/(mesh.magSf()*mesh.nonOrthDeltaCoeffs()) + ); + + faceVols.internalField() *= (1.0 - mesh.weights().internalField()); + forAll(faceVols.boundaryField(), patchi) + { + if (faceVols.boundaryField()[patchi].coupled()) + { + faceVols.boundaryField()[patchi] *= + (1.0 - mesh.weights().boundaryField()[patchi]); + } + } + + tmp<GeometricField<GradType, fvPatchField, volMesh> > treconField + ( + new GeometricField<GradType, fvPatchField, volMesh> + ( + IOobject + ( + "volIntegrate("+ssf.name()+')', + ssf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + inv(surfaceSum(mesh.Sf()*faceVols))&surfaceSum(faceVols*ssf), + zeroGradientFvPatchField<GradType>::typeName + ) + ); + + treconField().correctBoundaryConditions(); + + return treconField; +} +/* +{ + typedef typename outerProduct<vector, Type>::type GradType; + + const fvMesh& mesh = ssf.mesh(); + tmp<GeometricField<GradType, fvPatchField, volMesh> > treconField ( new GeometricField<GradType, fvPatchField, volMesh> @@ -78,6 +120,7 @@ reconstruct return treconField; } +*/ template<class Type> diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files index d6c2e970a5ebe7393e7f251f0583d2a8ad7057af..23fdf0282f79f2151a91baac02f4112def7ec7e8 100644 --- a/src/fvOptions/Make/files +++ b/src/fvOptions/Make/files @@ -28,11 +28,12 @@ $(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C $(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C $(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C -interRegion = $(derivedSources)/interRegionHeatTransferModel -$(interRegion)/constantHeatTransfer/constantHeatTransfer.C -$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C -$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C -$(interRegion)/variableHeatTransfer/variableHeatTransfer.C +interRegion = sources/interRegion +$(interRegion)/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C +$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C +$(interRegion)/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C +$(interRegion)/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C +$(interRegion)/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C /* constraints */ diff --git a/src/fvOptions/fvOptions/fvIOoptionList.C b/src/fvOptions/fvOptions/fvIOoptionList.C index 1ea4be17d260ebbe4131e7393b52069dd9c82d2f..287e4171be455dd9856a37eeaf0530260324ffe4 100644 --- a/src/fvOptions/fvOptions/fvIOoptionList.C +++ b/src/fvOptions/fvOptions/fvIOoptionList.C @@ -45,14 +45,15 @@ Foam::IOobject Foam::fv::IOoptionList::createIOobject if (io.headerOk()) { - Info<< "Creating field source list from " << io.name() << nl << endl; + Info<< "Creating fintite volume options from " << io.name() << nl + << endl; io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; return io; } else { - Info<< "No field sources present" << nl << endl; + Info<< "No finite volume options present" << nl << endl; io.readOpt() = IOobject::NO_READ; return io; diff --git a/src/fvOptions/fvOptions/fvOption.C b/src/fvOptions/fvOptions/fvOption.C index 65c36598c5dcf488739c134f10b691344592deac..8cb72b8e996b90a89826b037d0781aa5f6b4da5b 100644 --- a/src/fvOptions/fvOptions/fvOption.C +++ b/src/fvOptions/fvOptions/fvOption.C @@ -27,6 +27,7 @@ License #include "fvMesh.H" #include "fvMatrices.H" #include "volFields.H" +#include "ListOps.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -86,9 +87,7 @@ void Foam::fv::option::setSelection(const dictionary& dict) } case smMapRegion: { - dict_.lookup("nbrModelName") >> nbrModelName_; - dict_.lookup("nbrRegionName") >> nbrRegionName_; - master_ = readBool(dict_.lookup("master")); + dict.lookup("nbrRegionName") >> nbrRegionName_; break; } case smAll: @@ -131,7 +130,6 @@ void Foam::fv::option::setCellSet() WarningIn("option::setCellSet()") << "Unable to find owner cell for point " << points_[i] << endl; - } } @@ -167,40 +165,47 @@ void Foam::fv::option::setCellSet() } case smMapRegion: { - if (active_) + if (active_ && master_) { IInfo<< "- selecting inter region mapping" << endl; const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); - boundBox BB(mesh_.points(), false); - boundBox nbrBB(nbrMesh.points(), false); - - if (nbrBB.overlaps(BB)) + if (mesh_.name() == nbrMesh.name()) { - // Dummy patches - wordList cuttingPatches; - HashTable<word> patchMap; + FatalErrorIn("option::setCellIds()") + << "Inter-region model selected, but local and " + << "neighbour regions are the same: " << nl + << " local region: " << mesh_.name() << nl + << " secondary region: " << nbrMesh.name() << nl + << exit(FatalError); + } - secondaryToPrimaryInterpPtr_.reset + if (mesh_.bounds().overlaps(nbrMesh.bounds())) + { + meshInterpPtr_.reset ( - new meshToMesh + new meshToMeshNew ( - nbrMesh, mesh_, - patchMap, - cuttingPatches + nbrMesh, + meshToMeshNew::interpolationMethodNames_.read + ( + dict_.lookup("interpolationMethod") + ) ) ); } else { FatalErrorIn("option::setCellSet()") - << "regions do not overlap " << nbrMesh.name() - << " in region " << mesh_.name() << nl + << "regions " << mesh_.name() << " and " + << nbrMesh.name() << " do not intersect" << exit(FatalError); } + + V_ = meshInterpPtr_->V(); } break; } @@ -244,7 +249,8 @@ Foam::fv::option::option const word& name, const word& modelType, const dictionary& dict, - const fvMesh& mesh + const fvMesh& mesh, + const bool master ) : name_(name), @@ -257,10 +263,9 @@ Foam::fv::option::option selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))), cellSetName_("none"), V_(0.0), - secondaryToPrimaryInterpPtr_(), - nbrModelName_("none"), + meshInterpPtr_(), nbrRegionName_("none"), - master_(false), + master_(master), fieldNames_(), applied_() { @@ -296,7 +301,7 @@ Foam::autoPtr<Foam::fv::option> Foam::fv::option::New { word modelType(coeffs.lookup("type")); - IInfo<< "Selecting source model type " << modelType << endl; + IInfo<< "Selecting finite volume options model type " << modelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(modelType); @@ -317,12 +322,7 @@ Foam::autoPtr<Foam::fv::option> Foam::fv::option::New Foam::fv::option::~option() -{ - if (!secondaryToPrimaryInterpPtr_.empty()) - { - secondaryToPrimaryInterpPtr_.clear(); - } -} +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -352,15 +352,7 @@ Foam::label Foam::fv::option::applyToField(const word& fieldName) const return 0; } - forAll(fieldNames_, i) - { - if (fieldNames_[i] == fieldName) - { - return i; - } - } - - return -1; + return findIndex(fieldNames_, fieldName); } diff --git a/src/fvOptions/fvOptions/fvOption.H b/src/fvOptions/fvOptions/fvOption.H index 8e51e4e3ea37d7dcab182eec0700bbf4af3bf973..28509ee4c0636cb66e86e5a78c353ea5fb65147b 100644 --- a/src/fvOptions/fvOptions/fvOption.H +++ b/src/fvOptions/fvOptions/fvOption.H @@ -35,7 +35,7 @@ Description selectionMode cellSet; // cellSet // points //cellZone // mapRegion Note: - On evaluation, source expects to be added to the rhs of the equation + On evaluation, source/sink options are to be added to the equation rhs SourceFiles fvOption.C @@ -50,7 +50,7 @@ SourceFiles #include "volFieldsFwd.H" #include "cellSet.H" #include "autoPtr.H" -#include "meshToMesh.H" +#include "meshToMeshNew.H" #include "runTimeSelectionTables.H" @@ -131,11 +131,8 @@ protected: // Data for smMapRegion only - //- Mesh to mesh mapping for map option - autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_; - - //- Name of the model in the neighbour mesh - word nbrModelName_; + //- Mesh to mesh interpolation object + autoPtr<meshToMeshNew> meshInterpPtr_; //- Name of the neighbour region to map word nbrRegionName_; @@ -194,7 +191,8 @@ public: const word& name, const word& modelType, const dictionary& dict, - const fvMesh& mesh + const fvMesh& mesh, + const bool master = false ); //- Return clone @@ -288,15 +286,11 @@ public: //- Return const access to the total cell volume inline scalar V() const; - //- Return const access to the neighbour model name - inline const word& nbrModelName() const; - //- Return const access to the neighbour region name inline const word& nbrRegionName() const; - //- Return const access to the mapToMap Ptr - inline const autoPtr<meshToMesh> - secondaryToPrimaryInterpPtr() const; + //- Return const access to the mapToMap pointer + inline const meshToMeshNew& meshInterp() const; //- Return const access to the cell set inline const labelList& cells() const; diff --git a/src/fvOptions/fvOptions/fvOptionI.H b/src/fvOptions/fvOptions/fvOptionI.H index 8c3bf592331fbdb1429e6695192fb5e766fc56a4..796b2fdbc91a6f5a346598fe1aaf79856794e2e0 100644 --- a/src/fvOptions/fvOptions/fvOptionI.H +++ b/src/fvOptions/fvOptions/fvOptionI.H @@ -126,22 +126,22 @@ inline Foam::scalar& Foam::fv::option::duration() } -inline const Foam::word& Foam::fv::option::nbrModelName() const -{ - return nbrModelName_; -} - - inline const Foam::word& Foam::fv::option::nbrRegionName() const { return nbrRegionName_; } -inline const Foam::autoPtr<Foam::meshToMesh> -Foam::fv::option::secondaryToPrimaryInterpPtr() const +inline const Foam::meshToMeshNew& Foam::fv::option::meshInterp() const { - return secondaryToPrimaryInterpPtr_; + if (!meshInterpPtr_.valid()) + { + FatalErrorIn("const meshToMeshNew& meshInterp() const") + << "Interpolation object not set" + << abort(FatalError); + } + + return meshInterpPtr_(); } diff --git a/src/fvOptions/fvOptions/fvOptionIO.C b/src/fvOptions/fvOptions/fvOptionIO.C index c89c97b864706ebe892e81a76083fa5797e56163..c51b6b9b483e5acbb030c20e7c24056add040fc0 100644 --- a/src/fvOptions/fvOptions/fvOptionIO.C +++ b/src/fvOptions/fvOptions/fvOptionIO.C @@ -90,8 +90,11 @@ void Foam::fv::option::writeData(Ostream& os) const bool Foam::fv::option::read(const dictionary& dict) { active_ = readBool(dict.lookup("active")); - timeStart_ = readScalar(dict.lookup("timeStart")); - duration_ = readScalar(dict.lookup("duration")); + + if (dict.readIfPresent("timeStart", timeStart_)) + { + dict.lookup("duration") >> duration_; + } coeffs_ = dict.subDict(type() + "Coeffs"); diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C new file mode 100644 index 0000000000000000000000000000000000000000..0c0cf7f284dba71aee14c85870798039f91006d1 --- /dev/null +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C @@ -0,0 +1,230 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "interRegionExplicitPorositySource.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "porosityModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(interRegionExplicitPorositySource, 0); + addToRunTimeSelectionTable + ( + option, + interRegionExplicitPorositySource, + dictionary + ); +} +} + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::fv::interRegionExplicitPorositySource::initialise() +{ + if (!firstIter_) + { + return; + } + + const word zoneName(name_ + ".porous"); + + const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); + const cellZoneMesh& cellZones = nbrMesh.cellZones(); + label zoneID = cellZones.findZoneID(zoneName); + + if (zoneID == -1) + { + cellZoneMesh& cz = const_cast<cellZoneMesh&>(cellZones); + + zoneID = cz.size(); + + cz.setSize(zoneID + 1); + + cz.set + ( + zoneID, + new cellZone + ( + zoneName, + nbrMesh.faceNeighbour(), // neighbour internal cells + zoneID, + cellZones + ) + ); + + cz.clearAddressing(); + } + else + { + FatalErrorIn + ( + "void Foam::fv::interRegionExplicitPorositySource::initialise()" + ) + << "Unable to create porous cellZone " << zoneName + << ": zone already exists" + << abort(FatalError); + } + + porosityPtr_.reset + ( + porosityModel::New + ( + name_, + nbrMesh, + coeffs_, + zoneName + ).ptr() + ), + + firstIter_ = false; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::interRegionExplicitPorositySource::interRegionExplicitPorositySource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(name, modelType, dict, mesh, true), + porosityPtr_(NULL), + firstIter_(-1), + UName_(coeffs_.lookupOrDefault<word>("UName", "U")), + rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")), + muName_(coeffs_.lookupOrDefault<word>("muName", "thermo:mu")) +{ + if (active_) + { + fieldNames_.setSize(1, UName_); + applied_.setSize(1, false); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::interRegionExplicitPorositySource::addSup +( + fvMatrix<vector>& eqn, + const label fieldI +) +{ + initialise(); + + const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); + + const volVectorField& U = eqn.psi(); + + volVectorField UNbr + ( + IOobject + ( + name_ + ".UNbr", + nbrMesh.time().timeName(), + nbrMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + nbrMesh, + dimensionedVector("zero", U.dimensions(), vector::zero) + ); + + // map local velocity onto neighbour region + meshInterp().mapSrcToTgt + ( + U.internalField(), + plusEqOp<vector>(), + UNbr.internalField() + ); + + fvMatrix<vector> nbrEqn(UNbr, eqn.dimensions()); + + if (eqn.dimensions() == dimForce) + { + const volScalarField& rhoNbr = + nbrMesh.lookupObject<volScalarField>(rhoName_); + const volScalarField& muNbr = + nbrMesh.lookupObject<volScalarField>(muName_); + + porosityPtr_->addResistance(nbrEqn, rhoNbr, muNbr); + } + else + { + porosityPtr_->addResistance(nbrEqn); + } + + // convert source from neighbour to local region + fvMatrix<vector> porosityEqn(U, eqn.dimensions()); + scalarField& Udiag = porosityEqn.diag(); + vectorField& Usource = porosityEqn.source(); + + Udiag.setSize(eqn.diag().size(), 0.0); + Usource.setSize(eqn.source().size(), vector::zero); + + meshInterp().mapTgtToSrc(nbrEqn.diag(), plusEqOp<scalar>(), Udiag); + meshInterp().mapTgtToSrc(nbrEqn.source(), plusEqOp<vector>(), Usource); + + eqn -= porosityEqn; +} + + +void Foam::fv::interRegionExplicitPorositySource::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::fv::interRegionExplicitPorositySource::read(const dictionary& dict) +{ + if (option::read(dict)) + { + coeffs_.readIfPresent("UName", UName_); + coeffs_.readIfPresent("rhoName", rhoName_); + coeffs_.readIfPresent("muName", muName_); + + // reset the porosity model? + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H new file mode 100644 index 0000000000000000000000000000000000000000..da93314a0a1c58e4541a7f76ce788c282fbdabdd --- /dev/null +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::fv::interRegionExplicitPorositySource + +Description + Inter-region explicit porosity source + + Sources described by, for example using the DarcyForchheimer model: + + interRegionExplicitPorositySourceCoeffs + { + type DarcyForchheimer; + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } + } + +Note: + The porous region must be selected as a cellZone. + +SourceFiles + interRegionExplicitPorositySource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interRegionExplicitPorositySource_H +#define interRegionExplicitPorositySource_H + +#include "fvOption.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class porosityModel; + +namespace fv +{ + + +/*---------------------------------------------------------------------------*\ + Class interRegionExplicitPorositySource Declaration +\*---------------------------------------------------------------------------*/ + +class interRegionExplicitPorositySource +: + public option +{ + +protected: + + // Protected data + + //- Run-time selectable porosity model + autoPtr<porosityModel> porosityPtr_; + + //- First iteration + bool firstIter_; + + //- Velocity field name, default = U + word UName_; + + //- Density field name (compressible case only), default = rho + word rhoName_; + + //- Dynamic viscosity field name (compressible case only) + // default = thermo:mu + word muName_; + + + // Protected Member Functions + + //- Initialise + void initialise(); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + interRegionExplicitPorositySource + ( + const interRegionExplicitPorositySource& + ); + + //- Disallow default bitwise assignment + void operator=(const interRegionExplicitPorositySource&); + + +public: + + //- Runtime type information + TypeName("interRegionExplicitPorositySource"); + + + // Constructors + + //- Construct from components + interRegionExplicitPorositySource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~interRegionExplicitPorositySource() + {} + + + // Member Functions + + // Add explicit and implicit contributions + + //- Vector + virtual void addSup + ( + fvMatrix<vector>& eqn, + const label fieldI + ); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C similarity index 85% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C index e1eb4e2d4acde39406e09090bfaa6387047260fd..1cafec08c466b8e4104078be0c4e9865a191c853 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C @@ -57,7 +57,7 @@ Foam::fv::constantHeatTransfer::constantHeatTransfer htcConst_(), AoV_() { - if (master_) + if (active() && master_) { htcConst_.reset ( @@ -91,19 +91,7 @@ Foam::fv::constantHeatTransfer::constantHeatTransfer ) ); - const DimensionedField<scalar, volMesh>& htcConsti = - htcConst_().dimensionedInternalField(); - const DimensionedField<scalar, volMesh>& AoVi = - AoV_().dimensionedInternalField(); - dimensionedScalar interVol - ( - "V", - dimVolume, - secondaryToPrimaryInterpPtr_->V() - ); - - htc_.dimensionedInternalField() = htcConsti*AoVi*interVol/mesh.V(); - htc_.correctBoundaryConditions(); + htc_ = htcConst_()*AoV_(); } } @@ -116,10 +104,9 @@ Foam::fv::constantHeatTransfer::~constantHeatTransfer() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::tmp<Foam::volScalarField> -Foam::fv::constantHeatTransfer::calculateHtc() +void Foam::fv::constantHeatTransfer::calculateHtc() { - return htc_; + // do nothing } diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H similarity index 98% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H index 52facea986ebf95557c30b6f1cb66e91163a992d..ceb4aaf15a6aa3061de5b7c4d7717e7f13719d41 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H @@ -87,7 +87,7 @@ public: // Public Functions //- Calculate the heat transfer coefficient - virtual const tmp<volScalarField> calculateHtc(); + virtual void calculateHtc(); // I-O diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C similarity index 82% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C index 3a1067bdd74507cff8ae1c3fb0a4fc000fc77b47..710a43cf3eced30de48c54b0d74e14970ec6bb11 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C @@ -25,7 +25,7 @@ License #include "interRegionHeatTransferModel.H" #include "fluidThermo.H" -#include "fvm.H" +#include "fvmSup.H" #include "zeroGradientFvPatchFields.H" #include "fvcVolumeIntegrate.H" #include "fvOptionList.H" @@ -41,10 +41,15 @@ namespace fv } -// * * * * * * * * * * * * Private member functions * * * * * * * * * * * // +// * * * * * * * * * * * * Protected member functions * * * * * * * * * * * // -void Foam::fv::interRegionHeatTransferModel::check() +void Foam::fv::interRegionHeatTransferModel::setNbrModel() { + if (!firstIter_) + { + return; + } + const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); const optionList& fvOptions = nbrMesh.lookupObject<optionList>("fvOptions"); @@ -66,11 +71,31 @@ void Foam::fv::interRegionHeatTransferModel::check() if (!nbrModelFound) { - FatalErrorIn("interRegionHeatTransferModel::check()") - << "Secondary source name not found" << nbrModelName_ + FatalErrorIn("interRegionHeatTransferModel::setNbrModel()") + << "Neighbour model not found" << nbrModelName_ << " in region " << nbrMesh.name() << nl << exit(FatalError); } + + firstIter_ = false; +} + + +void Foam::fv::interRegionHeatTransferModel::correct() +{ + if (master_) + { + if (mesh_.time().timeIndex() != timeIndex_) + { + calculateHtc(); + timeIndex_ = mesh_.time().timeIndex(); + } + } + else + { + nbrModel().correct(); + interpolate(nbrModel().htc(), htc_); + } } @@ -84,9 +109,11 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel const fvMesh& mesh ) : - option(name, modelType, dict, mesh), - nbrModel_(), + option(name, modelType, dict, mesh, readBool(dict.lookup("master"))), + nbrModel_(NULL), + nbrModelName_(word::null), firstIter_(true), + timeIndex_(-1), htc_ ( IOobject @@ -106,10 +133,14 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel ), zeroGradientFvPatchScalarField::typeName ), - semiImplicit_(false) + semiImplicit_(false), + TName_(coeffs_.lookupOrDefault<word>("TName", "T")), + TNbrName_(coeffs_.lookupOrDefault<word>("TNbrName", "T")) { if (active()) { + coeffs_.lookup("nbrModelName") >> nbrModelName_; + coeffs_.lookup("fieldNames") >> fieldNames_; applied_.setSize(fieldNames_.size(), false); @@ -132,19 +163,14 @@ void Foam::fv::interRegionHeatTransferModel::addSup const label fieldI ) { - if (!secondaryToPrimaryInterpPtr_.valid()) - { - return; - } + setNbrModel(); - if (firstIter_) - { - check(); - firstIter_ = false; - } + correct(); const volScalarField& h = eqn.psi(); + const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_); + tmp<volScalarField> tTmapped ( new volScalarField @@ -157,8 +183,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup IOobject::NO_READ, IOobject::NO_WRITE ), - mesh_, - dimensionedScalar("T", dimTemperature, 0.0) + T ) ); @@ -166,26 +191,10 @@ void Foam::fv::interRegionHeatTransferModel::addSup const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); - const volScalarField& Tnbr = nbrMesh.lookupObject<volScalarField>("T"); - - secondaryToPrimaryInterpPtr_->interpolateInternalField - ( - Tmapped, - Tnbr, - meshToMesh::MAP, - eqOp<scalar>() - ); + const volScalarField& Tnbr = + nbrMesh.lookupObject<volScalarField>(TNbrName_); - if (!master_) - { - secondaryToPrimaryInterpPtr_->interpolateInternalField - ( - htc_, - nbrModel_->calculateHtc(), - meshToMesh::CELL_VOLUME_WEIGHT, - eqOp<scalar>() - ); - } + interpolate(Tnbr, Tmapped.internalField()); if (debug) { @@ -226,7 +235,6 @@ void Foam::fv::interRegionHeatTransferModel::addSup } else { - const volScalarField& T = mesh_.lookupObject<volScalarField>("T"); eqn += htc_*(Tmapped - T); } } diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H similarity index 59% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H index 2ced33cacc43a75bbde985411ff9905df3b6afea..55aabd45e1e8ffd16fedb86daa795bb33d06a4d5 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -26,7 +26,12 @@ Class Description Base class for inter region heat exchange. The derived classes must - provide the heat transfer coefficient (htc) + provide the heat transfer coeffisine (htc) which is used as follows + in the energy equation. + + \f[ + -htc*Tmapped + Sp(htc, T) + \f] \*---------------------------------------------------------------------------*/ @@ -60,27 +65,73 @@ private: //- Pointer to neighbour interRegionHeatTransferModel interRegionHeatTransferModel* nbrModel_; + //- Name of the model in the neighbour mesh + word nbrModelName_; + //- First iteration bool firstIter_; - - // Private members - - //- Check coupled interRegionHeatTransferModel - void check(); + //- Time index - used for updating htc + label timeIndex_; protected: // Protected data - //- Heat transfer coefficient [W/m2/k] by area/volume [1/m] - // registered on the master mesh + //- Heat transfer coefficient [W/m2/k] times area/volume [1/m] volScalarField htc_; //- Flag to activate semi-implicit coupling bool semiImplicit_; + //- Name of temperature field; default = "T" + word TName_; + + //- Name of neighbour temperature field; default = "T" + word TNbrName_; + + + // Protected member functions + + //- Set the neighbour interRegionHeatTransferModel + void setNbrModel(); + + //- Correct to calculate the inter-region heat transfer coefficient + void correct(); + + //- Interpolate field with nbrModel specified + template<class Type> + tmp<Field<Type> > interpolate + ( + const interRegionHeatTransferModel& nbrModel, + const Field<Type>& field + ) const; + + //- Interpolate field without nbrModel specified + template<class Type> + tmp<Field<Type> > interpolate + ( + const Field<Type>& field + ) const; + + //- Interpolate field with nbrModel specified + template<class Type> + void interpolate + ( + const interRegionHeatTransferModel& nbrModel, + const Field<Type>& field, + Field<Type>& result + ) const; + + //- Interpolate field without nbrModel specified + template<class Type> + void interpolate + ( + const Field<Type>& field, + Field<Type>& result + ) const; + public: @@ -110,16 +161,19 @@ public: // Access //- Return the heat transfer coefficient - const volScalarField& htc() const - { - return htc_; - } + inline const volScalarField& htc() const; + + //- Return const access to the neighbour model + inline const interRegionHeatTransferModel& nbrModel() const; + + //- Return access to the neighbour model + inline interRegionHeatTransferModel& nbrModel(); //-Source term to fvMatrix<scalar> virtual void addSup(fvMatrix<scalar>& eqn, const label fieldI); //- Calculate heat transfer coefficient - virtual const tmp<volScalarField> calculateHtc() = 0; + virtual void calculateHtc() = 0; // I-O @@ -138,6 +192,17 @@ public: } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "interRegionHeatTransferModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "interRegionHeatTransferModelTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelI.H b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelI.H new file mode 100644 index 0000000000000000000000000000000000000000..6a6cbe550b3c2651b50067d6b10907f0ffd738ff --- /dev/null +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelI.H @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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 const Foam::volScalarField& +Foam::fv::interRegionHeatTransferModel::htc() const +{ + return htc_; +} + + +inline const Foam::fv::interRegionHeatTransferModel& +Foam::fv::interRegionHeatTransferModel::nbrModel() const +{ + if (nbrModel_ == NULL) + { + FatalErrorIn("const interRegionHeatTransferModel& nbrModel() const") + << "Neighbour model not set" + << abort(FatalError); + } + + return *nbrModel_; +} + + +inline Foam::fv::interRegionHeatTransferModel& +Foam::fv::interRegionHeatTransferModel::nbrModel() +{ + if (nbrModel_ == NULL) + { + FatalErrorIn("interRegionHeatTransferModel& nbrModel()") + << "Neighbour model not set" + << abort(FatalError); + } + + return *nbrModel_; +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelTemplates.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..4a5363a2d173af77062c2f212a33400d15fb0caa --- /dev/null +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModelTemplates.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 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/>. + +\*---------------------------------------------------------------------------*/ + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::fv::interRegionHeatTransferModel::interpolate +( + const interRegionHeatTransferModel& nbrModel, + const Field<Type>& field +) const +{ + if (master_) + { + return meshInterp().mapTgtToSrc(field); + } + else + { + return (nbrModel.meshInterp().mapSrcToTgt(field)); + } +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::fv::interRegionHeatTransferModel::interpolate +( + const Field<Type>& field +) const +{ + return interpolate(nbrModel(), field); +} + + +template<class Type> +void Foam::fv::interRegionHeatTransferModel::interpolate +( + const interRegionHeatTransferModel& nbrModel, + const Field<Type>& field, + Field<Type>& result +) const +{ + if (master_) + { + meshInterp().mapTgtToSrc(field, plusEqOp<scalar>(), result); + } + else + { + nbrModel.meshInterp().mapSrcToTgt(field, plusEqOp<scalar>(), result); + } +} + + +template<class Type> +void Foam::fv::interRegionHeatTransferModel::interpolate +( + const Field<Type>& field, + Field<Type>& result +) const +{ + return interpolate(nbrModel(), field, result); +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C similarity index 88% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C index c49001e3884d71d3f7797f1656b4818c0a3a5e29..fd49c31963bdc1fdbd41b990137a77694e4bd6e8 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C @@ -94,6 +94,7 @@ Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer : interRegionHeatTransferModel(name, modelType, dict, mesh), UName_(coeffs_.lookupOrDefault<word>("UName", "U")), + UNbrName_(coeffs_.lookupOrDefault<word>("UNbrName", "U")), hTable_(), AoV_(), startTimeName_(mesh.time().timeName()) @@ -108,22 +109,16 @@ Foam::fv::tabulatedHeatTransfer::~tabulatedHeatTransfer() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::tmp<Foam::volScalarField> -Foam::fv::tabulatedHeatTransfer::calculateHtc() +void Foam::fv::tabulatedHeatTransfer::calculateHtc() { const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName()); - const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>(UName_); + const volVectorField& UNbr = + nbrMesh.lookupObject<volVectorField>(UNbrName_); - scalarField UMagNbrMapped(htc_.internalField().size(), 0.0); + const scalarField UMagNbr(mag(UNbr)); - secondaryToPrimaryInterpPtr_->interpolateInternalField - ( - UMagNbrMapped, - mag(UNbr), - meshToMesh::MAP, - eqOp<scalar>() - ); + const scalarField UMagNbrMapped(interpolate(UMagNbr)); const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_); @@ -134,9 +129,7 @@ Foam::fv::tabulatedHeatTransfer::calculateHtc() htcc[i] = hTable()(mag(U[i]), UMagNbrMapped[i]); } - htcc = htcc*AoV()*secondaryToPrimaryInterpPtr_->V()/mesh_.V(); - - return htc_; + htcc = htcc*AoV(); } diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H similarity index 96% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H index c46f747a14b9dd97bd800481e97bf60be538e7ca..8feb9d68df8ad0f3c2046460af29074757be1d7b 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H @@ -60,6 +60,9 @@ private: //- Name of velocity field; default = U word UName_; + //- Name of neighbour velocity field; default = U + word UNbrName_; + //- 2D look up table autoPtr<interpolation2DTable<scalar> > hTable_; @@ -101,7 +104,7 @@ public: // Public Functions //- Calculate the heat transfer coefficient - virtual const tmp<volScalarField> calculateHtc(); + virtual void calculateHtc(); // I-O diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C similarity index 83% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C index c675e95e94a2a35e1a1b16113280bf05326d334d..cf96fa0433e59eacc29da07a3d32a5dd1d83577e 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C @@ -55,7 +55,7 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer ) : interRegionHeatTransferModel(name, modelType, dict, mesh), - UName_(coeffs_.lookupOrDefault<word>("UName", "U")), + UNbrName_(coeffs_.lookupOrDefault<word>("UNbrName", "U")), a_(0), b_(0), c_(0), @@ -97,8 +97,7 @@ Foam::fv::variableHeatTransfer::~variableHeatTransfer() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::tmp<Foam::volScalarField> -Foam::fv::variableHeatTransfer::calculateHtc() +void Foam::fv::variableHeatTransfer::calculateHtc() { const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName()); @@ -109,26 +108,18 @@ Foam::fv::variableHeatTransfer::calculateHtc() const fluidThermo& nbrThermo = nbrMesh.lookupObject<fluidThermo>("thermophysicalProperties"); - const volVectorField& U = nbrMesh.lookupObject<volVectorField>(UName_); + const volVectorField& UNbr = + nbrMesh.lookupObject<volVectorField>(UNbrName_); - const volScalarField Re(mag(U)*ds_*nbrThermo.rho()/nbrTurb.mut()); + const volScalarField ReNbr(mag(UNbr)*ds_*nbrThermo.rho()/nbrTurb.mut()); - const volScalarField Nu(a_*pow(Re, b_)*pow(Pr_, c_)); + const volScalarField NuNbr(a_*pow(ReNbr, b_)*pow(Pr_, c_)); - scalarField htcNbrMapped(htc_.internalField().size(), 0.0); + const scalarField htcNbr(NuNbr*nbrTurb.kappaEff()/ds_); - secondaryToPrimaryInterpPtr_->interpolateInternalField - ( - htcNbrMapped, - Nu*nbrTurb.kappaEff()/ds_, - meshToMesh::MAP, - eqOp<scalar>() - ); - - htc_.internalField() = - htcNbrMapped*AoV_*secondaryToPrimaryInterpPtr_->V()/mesh_.V(); + const scalarField htcNbrMapped(interpolate(htcNbr)); - return htc_; + htc_.internalField() = htcNbrMapped*AoV_; } @@ -150,7 +141,7 @@ bool Foam::fv::variableHeatTransfer::read(const dictionary& dict) { if (option::read(dict)) { - coeffs_.readIfPresent("UName", UName_); + coeffs_.readIfPresent("UNbrName", UNbrName_); coeffs_.readIfPresent("a", a_); coeffs_.readIfPresent("b", b_); diff --git a/src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H similarity index 96% rename from src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H rename to src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H index cfe0aaffaee8d5135ca0ecc9948aa207fbbacada..57e42be81156b377c4303475563d85fccbba22eb 100644 --- a/src/fvOptions/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H +++ b/src/fvOptions/sources/interRegion/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H @@ -65,8 +65,8 @@ private: // Private data - //- Name of velocity field; default = U - word UName_; + //- Name of neighbour velocity field; default = U + word UNbrName_; //- Model constants scalar a_; @@ -108,7 +108,7 @@ public: // Public Functions //- Calculate the heat transfer coefficient - virtual const tmp<volScalarField> calculateHtc(); + virtual void calculateHtc(); // I-O diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index 6d717bb1747419704390e5242cbd8e17d0dd76b6..6b5969666078c86cdd6c954ac882ec683386b802 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -383,15 +383,25 @@ template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const { scalar T = -GREAT; + scalar n = 0; forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) { const parcelType& p = iter(); T = max(T, p.T()); + n++; } reduce(T, maxOp<scalar>()); + reduce(n, sumOp<label>()); - return max(0.0, T); + if (n > 0) + { + return T; + } + else + { + return 0.0; + } } @@ -399,15 +409,25 @@ template<class CloudType> inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const { scalar T = GREAT; + scalar n = 0; forAllConstIter(typename ThermoCloud<CloudType>, *this, iter) { const parcelType& p = iter(); T = min(T, p.T()); + n++; } reduce(T, minOp<scalar>()); + reduce(n, sumOp<label>()); - return max(0.0, T); + if (n > 0) + { + return T; + } + else + { + return 0.0; + } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index e9bc8153045af85ad40f565aed04d670821859f2..ed60ded9596a6b0545dd8968f5f7782fd2150694 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -510,6 +510,9 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange const CompositionModel<reactingCloudType>& composition = td.cloud().composition(); + const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); + const scalar Tdash = min(T, TMax); + const scalar Tsdash = min(Ts, TMax); // Calculate mass transfer due to phase change td.cloud().phaseChange().calculate @@ -520,8 +523,8 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange Pr, d, nus, - T, - Ts, + Tdash, + Tsdash, pc_, this->Tc_, YComponents, @@ -541,7 +544,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange const label idc = composition.localToGlobalCarrierId(idPhase, i); const label idl = composition.globalIds(idPhase)[i]; - const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, T); + const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash); Sh -= dMassPC[i]*dh/dt; } @@ -558,12 +561,12 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange const label idc = composition.localToGlobalCarrierId(idPhase, i); const label idl = composition.globalIds(idPhase)[i]; - const scalar Cp = composition.carrier().Cp(idc, pc_, Ts); + const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash); const scalar W = composition.carrier().W(idc); const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); const scalar Dab = - composition.liquids().properties()[idl].D(pc_, Ts, Wc); + composition.liquids().properties()[idl].D(pc_, Tsdash, Wc); // Molar flux of species coming from the particle (kmol/m^2/s) N += Ni; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index f1dc7c4ba06db92b2feaa5aeddc402bfea0d1f2f..10bb48d887b9c4e6583f7e3069bb453379ae0e35 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -404,20 +404,23 @@ void Foam::ParticleCollector<CloudType>::write() } - Field<scalar> faceMassTotal(mass_.size()); - Field<scalar> faceMassFlowRate(massFlowRate_.size()); + Field<scalar> faceMassTotal(mass_.size(), 0.0); + this->getModelProperty("massTotal", faceMassTotal); + + Field<scalar> faceMassFlowRate(massFlowRate_.size(), 0.0); + this->getModelProperty("massFlowRate", faceMassFlowRate); forAll(faces_, faceI) { scalarList allProcMass(Pstream::nProcs()); allProcMass[procI] = massTotal_[faceI]; Pstream::gatherList(allProcMass); - faceMassTotal[faceI] = sum(allProcMass); + faceMassTotal[faceI] += sum(allProcMass); scalarList allProcMassFlowRate(Pstream::nProcs()); allProcMassFlowRate[procI] = massFlowRate_[faceI]; Pstream::gatherList(allProcMassFlowRate); - faceMassFlowRate[faceI] = sum(allProcMassFlowRate); + faceMassFlowRate[faceI] += sum(allProcMassFlowRate); Info<< " face " << faceI << ": total mass = " << faceMassTotal[faceI] @@ -470,20 +473,25 @@ void Foam::ParticleCollector<CloudType>::write() if (resetOnWrite_) { - forAll(faces_, faceI) - { - massFlowRate_[faceI] = 0.0; - } + Field<scalar> dummy(faceMassTotal.size(), 0.0); + this->setModelProperty("massTotal", dummy); + this->setModelProperty("massFlowRate", dummy); + timeOld_ = timeNew; totalTime_ = 0.0; } + else + { + this->setModelProperty("massTotal", faceMassTotal); + this->setModelProperty("massFlowRate", faceMassFlowRate); + } forAll(faces_, faceI) { mass_[faceI] = 0.0; + massTotal_[faceI] = 0.0; + massFlowRate_[faceI] = 0.0; } - - // writeProperties(); } @@ -552,8 +560,8 @@ Foam::ParticleCollector<CloudType>::ParticleCollector ( "Foam::ParticleCollector<CloudType>::ParticleCollector" "(" - "const dictionary& dict," - "CloudType& owner" + "const dictionary&," + "CloudType&" ")" ) << "Unknown mode " << mode << ". Available options are " @@ -565,8 +573,6 @@ Foam::ParticleCollector<CloudType>::ParticleCollector massFlowRate_.setSize(faces_.size(), 0.0); makeLogFile(faces_, points_, area_); - - // readProperties(); AND initialise mass... fields } @@ -579,6 +585,7 @@ Foam::ParticleCollector<CloudType>::ParticleCollector CloudFunctionObject<CloudType>(pc), mode_(pc.mode_), parcelType_(pc.parcelType_), + removeCollected_(pc.removeCollected_), points_(pc.points_), faces_(pc.faces_), faceTris_(pc.faceTris_), diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 97b84a6049f5a51924769e9b25162e41a45056b4..b46ea2b5bf18b14ab48c3eb4988c6c84ee723bc0 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -200,8 +200,8 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const { scalar dh = 0; @@ -230,8 +230,8 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh "(" "const label, " "const label, " - "const label, " - "const label" + "const scalar, " + "const scalar" ") const" ) << "Unknown enthalpyTransfer type" << abort(FatalError); } @@ -241,4 +241,21 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh } +template<class CloudType> +Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax +( + const scalar pIn, + const scalar TIn +) const +{ + scalar T = -GREAT; + forAll(liquids_, i) + { + T = max(T, liquids_.properties()[i].pv(pIn, TIn)); + } + + return T; +} + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H index 60db6c63a5dda1a43e6ab7674a9b3c22df144195..5a97dc73944b1a815514fe12a3a10ea8922629a3 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,9 +127,12 @@ public: ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const; + + //- Return maximum/limiting temperature + virtual scalar TMax(const scalar pIn, const scalar TIn) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C index 803b849fa43d9da8a5a766541eeb3ffade6e8855..8a88620992f306524ccb6e9782c2f24d1c6ff21c 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -293,8 +293,8 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const { scalar dh = 0; @@ -329,8 +329,8 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh "(" "const label, " "const label, " - "const label, " - "const label" + "const scalar, " + "const scalar" ") const" ) << "Unknown enthalpyTransfer type" << abort(FatalError); } @@ -340,4 +340,21 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh } +template<class CloudType> +Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::TMax +( + const scalar pIn, + const scalar TIn +) const +{ + scalar T = -GREAT; + forAll(liquids_, i) + { + T = max(T, liquids_.properties()[i].pv(pIn, TIn)); + } + + return T; +} + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H index 48d92292cdcd890a46699dc9f7847651512eaf1b..bf9ca867ce51205a14f641decd8cd12838e0adc1 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,9 +137,12 @@ public: ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const; + + //- Return maximum/limiting temperature + virtual scalar TMax(const scalar pIn, const scalar TIn) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C index c84c7b83f887843521dc1529cc243f5b44adb38c..7141ff98147cb1f6668900e1a59b69ddb5db698b 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -170,14 +170,25 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const { return 0.0; } +template<class CloudType> +Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax +( + const scalar, + const scalar +) const +{ + return GREAT; +} + + template<class CloudType> void Foam::PhaseChangeModel<CloudType>::addToPhaseChangeMass(const scalar dMass) { diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H index 3ee8d4dbd34f0009c869331436838c1384653c1f..ac6c5c06b344f297d37893c481fc25fe5ad162ab 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -180,10 +180,12 @@ public: ( const label idc, const label idl, - const label p, - const label T + const scalar p, + const scalar T ) const; + //- Return maximum/limiting temperature + virtual scalar TMax(const scalar pIn, const scalar TIn) const; //- Add to phase change mass void addToPhaseChangeMass(const scalar dMass); diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C index 3e1a29e988a3fd7dee54e634acba0bee5c94f08a..2d47253de91fb9f1b3fd59d28ab564363a826f10 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -572,7 +572,7 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel regionModels::surfaceFilmModels::surfaceFilmModel& filmModel = const_cast<regionModels::surfaceFilmModels::surfaceFilmModel&> ( - this->owner().db().objectRegistry::template + this->owner().db().time().objectRegistry::template lookupObject<regionModels::surfaceFilmModels::surfaceFilmModel> ( "surfaceFilmProperties" diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C index 75ea3867d1c3d562bd881e60eb2cecefd030ab5c..e3d36bfcb3a3a183d54ace65213372f32708dc65 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,9 +43,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const pointData& wDist) } } + Foam::Istream& Foam::operator>>(Istream& is, pointData& wDist) { return is >> static_cast<pointEdgePoint&>(wDist) >> wDist.s_ >> wDist.v_; } + // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H index b215732e3e72596d6c1b4e4feb069632a9f409d2..c2a83752a2960ee215f8c015fa3c57a2bb20e137 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,6 +148,13 @@ public: TrackingData& td ); + // Member Operators + + // Needed for List IO + inline bool operator==(const pointData&) const; + inline bool operator!=(const pointData&) const; + + // IOstream Operators friend Ostream& operator<<(Ostream&, const pointData&); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H index bab3c51e3ca90247bc6c7ae9aa016df3b6d5b138..b00ca55097d19bc18fe3ceb904f71d268cd74da4 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -215,4 +215,23 @@ inline bool Foam::pointData::updateEdge } +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline bool Foam::pointData::operator==(const Foam::pointData& rhs) +const +{ + return + pointEdgePoint::operator==(rhs) + && (s() == rhs.s()) + && (v() == rhs.v()); +} + + +inline bool Foam::pointData::operator!=(const Foam::pointData& rhs) +const +{ + return !(*this == rhs); +} + + // ************************************************************************* // diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 69cdf234cdb41828140af5bc4553d348a05f2de9..04c5786ea62dc5f0dd23a1e47b4bb7d1526e97bb 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -258,6 +258,106 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces) } +void Foam::meshRefinement::testSyncPointList +( + const string& msg, + const polyMesh& mesh, + const List<scalar>& fld +) +{ + if (fld.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "meshRefinement::testSyncPointList(const polyMesh&" + ", const List<scalar>&)" + ) << msg << endl + << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints() + << abort(FatalError); + } + + Pout<< "Checking field " << msg << endl; + scalarField minFld(fld); + syncTools::syncPointList + ( + mesh, + minFld, + minEqOp<scalar>(), + GREAT + ); + scalarField maxFld(fld); + syncTools::syncPointList + ( + mesh, + maxFld, + maxEqOp<scalar>(), + -GREAT + ); + forAll(minFld, pointI) + { + const scalar& minVal = minFld[pointI]; + const scalar& maxVal = maxFld[pointI]; + if (mag(minVal-maxVal) > SMALL) + { + Pout<< msg << " at:" << mesh.points()[pointI] << nl + << " minFld:" << minVal << nl + << " maxFld:" << maxVal << nl + << endl; + } + } +} + + +void Foam::meshRefinement::testSyncPointList +( + const string& msg, + const polyMesh& mesh, + const List<point>& fld +) +{ + if (fld.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "meshRefinement::testSyncPointList(const polyMesh&" + ", const List<point>&)" + ) << msg << endl + << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints() + << abort(FatalError); + } + + Pout<< "Checking field " << msg << endl; + pointField minFld(fld); + syncTools::syncPointList + ( + mesh, + minFld, + minMagSqrEqOp<point>(), + point(GREAT, GREAT, GREAT) + ); + pointField maxFld(fld); + syncTools::syncPointList + ( + mesh, + maxFld, + maxMagSqrEqOp<point>(), + vector::zero + ); + forAll(minFld, pointI) + { + const point& minVal = minFld[pointI]; + const point& maxVal = maxFld[pointI]; + if (mag(minVal-maxVal) > SMALL) + { + Pout<< msg << " at:" << mesh.points()[pointI] << nl + << " minFld:" << minVal << nl + << " maxFld:" << maxVal << nl + << endl; + } + } +} + + void Foam::meshRefinement::checkData() { Pout<< "meshRefinement::checkData() : Checking refinement structure." diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index c265f05257568c8444f9562991ec6e6cf11c9c3a..899311d90974d964763a674d92bc1a7b76e3d2df 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -879,6 +879,20 @@ public: //- Debugging: check that all faces still obey start()>end() void checkData(); + static void testSyncPointList + ( + const string& msg, + const polyMesh& mesh, + const List<scalar>& fld + ); + + static void testSyncPointList + ( + const string& msg, + const polyMesh& mesh, + const List<point>& fld + ); + //- Compare two lists over all boundary faces template<class T> void testSyncBoundaryFaceList diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index d159b0df0b508aceb9cb5acff35ea8dc6ae27068..401d14a38367addbbc15e06a15be110ec0dcef80 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -201,4 +201,6 @@ regionCoupled/GAMG/interfaces/regionCoupledGAMGInterface/regionCoupledWallGAMGIn regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledGAMGInterfaceField.C regionCoupled/GAMG/interfaceFields/regionCoupledGAMGInterfaceField/regionCoupledWallGAMGInterfaceField.C +tetOverlapVolume/tetOverlapVolume.C + LIB = $(FOAM_LIBBIN)/libmeshTools diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H index d4f4aa062f339a196dee1276a51f3c9fbd326e40..5c323b0a3b17b65f49400b5f749d18bd1f4a1790 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,8 +25,8 @@ Class Foam::pointEdgePoint Description - Holds information regarding nearest wall point. Used in pointEdgeWave. - (so not standard meshWave) + Holds information regarding nearest wall point. Used in PointEdgeWave. + (so not standard FaceCellWave) To be used in wall distance calculation. SourceFiles @@ -116,7 +116,7 @@ public: inline scalar distSqr() const; - // Needed by meshWave + // Needed by PointEdgeWave //- Check whether origin has been changed at all or // still contains original (invalid) value. diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H index f9fe6ca9e393deb5a967df81c65d7ed2fb98d542..b466b268287a92453280bd06326364b43d59aaf7 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H @@ -310,14 +310,14 @@ inline bool Foam::pointEdgePoint::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // inline bool Foam::pointEdgePoint::operator==(const Foam::pointEdgePoint& rhs) - const +const { - return origin() == rhs.origin(); + return (origin() == rhs.origin()) && (distSqr() == rhs.distSqr()); } inline bool Foam::pointEdgePoint::operator!=(const Foam::pointEdgePoint& rhs) - const +const { return !(*this == rhs); } diff --git a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C b/src/meshTools/tetOverlapVolume/tetOverlapVolume.C similarity index 66% rename from src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C rename to src/meshTools/tetOverlapVolume/tetOverlapVolume.C index 219d78ce761c5532b00b5195681451878cf39ffd..692096b8e91dfc9fdea7f84b7e8d9094ddc63a90 100644 --- a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C +++ b/src/meshTools/tetOverlapVolume/tetOverlapVolume.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,9 +54,9 @@ Foam::scalar Foam::tetOverlapVolume::tetTetOverlapVol const tetPoints& tetB ) const { - tetPointRef::tetIntersectionList insideTets; + static tetPointRef::tetIntersectionList insideTets; label nInside = 0; - tetPointRef::tetIntersectionList cutInsideTets; + static tetPointRef::tetIntersectionList cutInsideTets; label nCutInside = 0; tetPointRef::storeOp inside(insideTets, nInside); @@ -130,6 +130,135 @@ Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb // * * * * * * * * * * * Public Member Functions * * * * * * * * * * * * * // +bool Foam::tetOverlapVolume::cellCellOverlapMinDecomp +( + const primitiveMesh& meshA, + const label cellAI, + const primitiveMesh& meshB, + const label cellBI, + const treeBoundBox& cellBbB, + const scalar threshold +) const +{ + const cell& cFacesA = meshA.cells()[cellAI]; + const point& ccA = meshA.cellCentres()[cellAI]; + + const cell& cFacesB = meshB.cells()[cellBI]; + const point& ccB = meshB.cellCentres()[cellBI]; + + scalar vol = 0.0; + + forAll(cFacesA, cFA) + { + label faceAI = cFacesA[cFA]; + + const face& fA = meshA.faces()[faceAI]; + const treeBoundBox pyrA = pyrBb(meshA.points(), fA, ccA); + if (!pyrA.overlaps(cellBbB)) + { + continue; + } + + bool ownA = (meshA.faceOwner()[faceAI] == cellAI); + + label tetBasePtAI = 0; + + const point& tetBasePtA = meshA.points()[fA[tetBasePtAI]]; + + for (label tetPtI = 1; tetPtI < fA.size() - 1; tetPtI++) + { + label facePtAI = (tetPtI + tetBasePtAI) % fA.size(); + label otherFacePtAI = fA.fcIndex(facePtAI); + + label pt0I = -1; + label pt1I = -1; + + if (ownA) + { + pt0I = fA[facePtAI]; + pt1I = fA[otherFacePtAI]; + } + else + { + pt0I = fA[otherFacePtAI]; + pt1I = fA[facePtAI]; + } + + const tetPoints tetA + ( + ccA, + tetBasePtA, + meshA.points()[pt0I], + meshA.points()[pt1I] + ); + const treeBoundBox tetABb(tetA.bounds()); + + + // Loop over tets of cellB + forAll(cFacesB, cFB) + { + label faceBI = cFacesB[cFB]; + + const face& fB = meshB.faces()[faceBI]; + const treeBoundBox pyrB = pyrBb(meshB.points(), fB, ccB); + if (!pyrB.overlaps(pyrA)) + { + continue; + } + + bool ownB = (meshB.faceOwner()[faceBI] == cellBI); + + label tetBasePtBI = 0; + + const point& tetBasePtB = meshB.points()[fB[tetBasePtBI]]; + + for (label tetPtI = 1; tetPtI < fB.size() - 1; tetPtI++) + { + label facePtBI = (tetPtI + tetBasePtBI) % fB.size(); + label otherFacePtBI = fB.fcIndex(facePtBI); + + label pt0I = -1; + label pt1I = -1; + + if (ownB) + { + pt0I = fB[facePtBI]; + pt1I = fB[otherFacePtBI]; + } + else + { + pt0I = fB[otherFacePtBI]; + pt1I = fB[facePtBI]; + } + + const tetPoints tetB + ( + ccB, + tetBasePtB, + meshB.points()[pt0I], + meshB.points()[pt1I] + ); + + if (!tetB.bounds().overlaps(tetABb)) + { + continue; + } + + vol += tetTetOverlapVol(tetA, tetB); + + if (vol > threshold) + { + return true; + } + } + } + } + } + + return false; +} + + Foam::scalar Foam::tetOverlapVolume::cellCellOverlapVolumeMinDecomp ( const primitiveMesh& meshA, diff --git a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.H b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H similarity index 82% rename from src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.H rename to src/meshTools/tetOverlapVolume/tetOverlapVolume.H index e8890a3ee97df7894a7659227d9f7b063985f3cc..58646f2e5a7ce3693391bbdb6d01acfb6f2284c3 100644 --- a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.H +++ b/src/meshTools/tetOverlapVolume/tetOverlapVolume.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ Class Foam::tetOverlapVolume Description - Calculates overlap volume of two tets. + Calculates the overlap volume of two cells using tetrahedral decomposition SourceFiles tetOverlapVolume.C @@ -48,14 +48,14 @@ class polyMesh; class tetPoints; /*---------------------------------------------------------------------------*\ - Class tetOverlapVolume Declaration + Class tetOverlapVolume Declaration \*---------------------------------------------------------------------------*/ class tetOverlapVolume { // Private member functions - //- Tet Overlap Vol + //- Tet overlap volume scalar tetTetOverlapVol ( const tetPoints& tetA, @@ -94,6 +94,16 @@ public: const label cellBI ) const; + //- Return true if olverlap volume is greater than threshold + bool cellCellOverlapMinDecomp + ( + const primitiveMesh& meshA, + const label cellAI, + const primitiveMesh& meshB, + const label cellBI, + const treeBoundBox& cellBbB, + const scalar threshold = 0.0 + ) const; //- Calculates the overlap volume scalar cellCellOverlapVolumeMinDecomp @@ -112,7 +122,6 @@ public: } // End namespace Foam - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/parallel/decompose/decompositionMethods/structuredDecomp/topoDistanceDataI.H b/src/parallel/decompose/decompositionMethods/structuredDecomp/topoDistanceDataI.H index 9ce5c90c5f621135f8a6fe96cf780e3ffc929c98..388c923a2ae0d63808b88bf3888c71b2987a3fcb 100644 --- a/src/parallel/decompose/decompositionMethods/structuredDecomp/topoDistanceDataI.H +++ b/src/parallel/decompose/decompositionMethods/structuredDecomp/topoDistanceDataI.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -124,8 +124,7 @@ inline bool Foam::topoDistanceData::updateCell { if (distance_ == -1) { - data_ = neighbourInfo.data_; - distance_ = neighbourInfo.distance_ + 1; + operator=(neighbourInfo); return true; } else @@ -151,7 +150,8 @@ inline bool Foam::topoDistanceData::updateFace if (distance_ == -1) { - operator=(neighbourInfo); + data_ = neighbourInfo.data_; + distance_ = neighbourInfo.distance_ + 1; return true; } else diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H index a77459f82f5961a7810f02fae84fa737bde9ce17..f8b689757dce8d3804491e558962289682a7e950 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,6 +77,8 @@ Description mean on; prime2Mean on; base time; + window 10.0; + windowName w1; } p { diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverageTemplates.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverageTemplates.C index 0fdf344531da8efeaabfbcb1e610c3f31d16db82..f4b03dd4b4a2ced4d6c060b2bea8781c7302ba02 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverageTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverageTemplates.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,15 @@ void Foam::fieldAverage::addMeanField const word& fieldName = faItems_[fieldI].fieldName(); - const word meanFieldName = fieldName + EXT_MEAN; + word meanFieldName = fieldName + EXT_MEAN; + if + ( + (faItems_[fieldI].window() > 0) + && (faItems_[fieldI].windowName() != "") + ) + { + meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName(); + } Info<< "Reading/calculating field " << meanFieldName << nl << endl; @@ -100,7 +108,16 @@ void Foam::fieldAverage::addPrime2MeanField const word& fieldName = faItems_[fieldI].fieldName(); - const word meanFieldName = fieldName + EXT_PRIME2MEAN; + word meanFieldName = fieldName + EXT_PRIME2MEAN; + if + ( + (faItems_[fieldI].window() > 0) + && (faItems_[fieldI].windowName() != "") + ) + { + meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName(); + } + Info<< "Reading/calculating field " << meanFieldName << nl << endl; if (obr_.foundObject<fieldType2>(meanFieldName)) diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C index 39bbfb4fa983c67f9fb288a8667f2dc3bf505983..3b01b2159498e500d3c251e94c9c90395448b7ea 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,7 +54,8 @@ Foam::fieldAverageItem::fieldAverageItem() mean_(0), prime2Mean_(0), base_(ITER), - window_(-1.0) + window_(-1.0), + windowName_("") {} @@ -64,7 +65,8 @@ Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem) mean_(faItem.mean_), prime2Mean_(faItem.prime2Mean_), base_(faItem.base_), - window_(faItem.window_) + window_(faItem.window_), + windowName_(faItem.windowName_) {} @@ -94,6 +96,7 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs) prime2Mean_ = rhs.prime2Mean_; base_ = rhs.base_; window_ = rhs.window_; + windowName_ = rhs.windowName_; } diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H index 992b5e393f677cc82f8f12629ac3b89b0819f58e..7fe21a9aef2e152162ac5b6dc737d6de7e8a89ab 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.H +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,6 +34,7 @@ Description prime2Mean on; base time; // iteration window 200; // optional averaging window + windowName w1; // optional window name (default = "") } \endverbatim @@ -107,6 +108,9 @@ private: //- Averaging window - defaults to -1 for 'all iters/time' scalar window_; + //- Averaging window name - defaults to 'window' + word windowName_; + public: @@ -171,6 +175,11 @@ public: return window_; } + const word& windowName() const + { + return windowName_; + } + // Member Operators @@ -190,7 +199,8 @@ public: && a.mean_ == b.mean_ && a.prime2Mean_ == b.prime2Mean_ && a.base_ == b.base_ - && a.window_ == b.window_; + && a.window_ == b.window_ + && a.windowName_ == b.windowName_; } friend bool operator!= diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C index 4ebad485a7d1a0530685f55bd981b0ba51f91576..af293ff989b5137fccbadbb9e6a642c31fdc3d9a 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,6 +46,7 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is) entry.lookup("prime2Mean") >> prime2Mean_; base_ = baseTypeNames_[entry.lookup("base")]; window_ = entry.lookupOrDefault<scalar>("window", -1.0); + windowName_ = entry.lookupOrDefault<word>("windowName", ""); } @@ -66,6 +67,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem) entry.lookup("prime2Mean") >> faItem.prime2Mean_; faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")]; faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0); + faItem.windowName_ = entry.lookupOrDefault<word>("windowName", ""); return is; } @@ -90,6 +92,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem) { os.writeKeyword("window") << faItem.window_ << token::END_STATEMENT << nl; + + if (faItem.windowName_ != "") + { + os.writeKeyword("windowName") << faItem.windowName_ + << token::END_STATEMENT << nl; + } } os << token::END_BLOCK << nl; diff --git a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C index 0593e2d49f4b0a6adfbecb791dcb5a279ea0c069..b0a13a83997061bddae86c0c2520c82d8071ea01 100644 --- a/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C +++ b/src/renumber/renumberMethods/structuredRenumber/structuredRenumber.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -198,7 +198,7 @@ Foam::labelList Foam::structuredRenumber::renumber } else { - label layerI = cellData[cellI].distance()-1; + label layerI = cellData[cellI].distance(); if (depthFirst_) { orderedToOld[nLayers*cellData[cellI].data()+layerI] = cellI; diff --git a/src/sampling/Make/files b/src/sampling/Make/files index ef0415f0f24848e1ea802c699731ac6587d69a29..747097a781c5c26d52c5ae82c95b484bed4cd0ae 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -59,8 +59,8 @@ $(meshToMesh)/meshToMesh.C $(meshToMesh)/calculateMeshToMeshAddressing.C $(meshToMesh)/calculateMeshToMeshWeights.C -tetOverlapVolume = meshToMeshInterpolation/tetOverlapVolume -$(tetOverlapVolume)/tetOverlapVolume.C - +meshToMeshNew = meshToMeshInterpolation/meshToMeshNew +$(meshToMeshNew)/meshToMeshNew.C +$(meshToMeshNew)/meshToMeshNewParallelOps.C LIB = $(FOAM_LIBBIN)/libsampling diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H index 9344f75ba0efe37ea62afc15edc311a49d99e079..b99c0629ccb2fc5646367c3732da84bf33a78fcb 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H @@ -27,6 +27,9 @@ Class Description mesh to mesh interpolation class. +Note + This class is due to be deprecated in favour of meshToMeshNew + SourceFiles meshToMesh.C calculateMeshToMeshAddressing.C diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C new file mode 100644 index 0000000000000000000000000000000000000000..9ecda6cb4fb537e1cd349501d775e055edccad30 --- /dev/null +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C @@ -0,0 +1,987 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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 "meshToMeshNew.H" +#include "OFstream.H" +#include "Time.H" +#include "globalIndex.H" +#include "mergePoints.H" +#include "treeBoundBox.H" +#include "tetOverlapVolume.H" +#include "indexedOctree.H" +#include "treeDataCell.H" +#include "ListOps.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(meshToMeshNew, 0); + + template<> + const char* Foam::NamedEnum + < + Foam::meshToMeshNew::interpolationMethod, + 2 + >::names[] = + { + "map", + "cellVolumeWeight" + }; + + const NamedEnum<meshToMeshNew::interpolationMethod, 2> + meshToMeshNew::interpolationMethodNames_; +} + +Foam::scalar Foam::meshToMeshNew::tolerance_ = 1e-6; + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::meshToMeshNew::writeConnectivity +( + const polyMesh& src, + const polyMesh& tgt, + const labelListList& srcToTargetAddr +) const +{ + Pout<< "Source size = " << src.nCells() << endl; + Pout<< "Target size = " << tgt.nCells() << endl; + + word fName("addressing_" + src.name() + "_to_" + tgt.name()); + + if (Pstream::parRun()) + { + fName = fName + "_proc" + Foam::name(Pstream::myProcNo()); + } + + OFstream os(src.time().path()/fName + ".obj"); + + label vertI = 0; + forAll(srcToTargetAddr, i) + { + const labelList& tgtAddress = srcToTargetAddr[i]; + forAll(tgtAddress, j) + { + label tgtI = tgtAddress[j]; + const vector& c0 = src.cellCentres()[i]; + + const cell& c = tgt.cells()[tgtI]; + const pointField pts(c.points(tgt.faces(), tgt.points())); + forAll(pts, j) + { + const point& p = pts[j]; + os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl; + vertI++; + os << "v " << c0.x() << ' ' << c0.y() << ' ' << c0.z() + << nl; + vertI++; + os << "l " << vertI - 1 << ' ' << vertI << nl; + } + } + } +} + + +Foam::labelList Foam::meshToMeshNew::maskCells +( + const polyMesh& src, + const polyMesh& tgt +) const +{ + boundBox intersectBb + ( + max(src.bounds().min(), tgt.bounds().min()), + min(src.bounds().max(), tgt.bounds().max()) + ); + + intersectBb.inflate(0.01); + + const cellList& srcCells = src.cells(); + const faceList& srcFaces = src.faces(); + const pointField& srcPts = src.points(); + + DynamicList<label> cells(src.size()); + forAll(srcCells, srcI) + { + boundBox cellBb(srcCells[srcI].points(srcFaces, srcPts), false); + if (intersectBb.overlaps(cellBb)) + { + cells.append(srcI); + } + } + + if (debug) + { + Pout<< "participating source mesh cells: " << cells.size() << endl; + } + + return cells; +} + + +bool Foam::meshToMeshNew::findInitialSeeds +( + const polyMesh& src, + const polyMesh& tgt, + const labelList& srcCellIDs, + const boolList& mapFlag, + const label startSeedI, + label& srcSeedI, + label& tgtSeedI +) const +{ + const cellList& srcCells = src.cells(); + const faceList& srcFaces = src.faces(); + const pointField& srcPts = src.points(); + + for (label i = startSeedI; i < srcCellIDs.size(); i++) + { + label srcI = srcCellIDs[i]; + + if (mapFlag[srcI]) + { + const pointField + pts(srcCells[srcI].points(srcFaces, srcPts).xfer()); + + forAll(pts, ptI) + { + const point& pt = pts[ptI]; + label tgtI = tgt.cellTree().findInside(pt); + + if (tgtI != -1 && intersect(src, tgt, srcI, tgtI)) + { + srcSeedI = srcI; + tgtSeedI = tgtI; + + return true; + } + } + } + } + + if (debug) + { + Pout<< "could not find starting seed" << endl; + } + + return false; +} + + +void Foam::meshToMeshNew::appendToDirectSeeds +( + const polyMesh& src, + const polyMesh& tgt, + boolList& mapFlag, + labelList& srcTgtSeed, + DynamicList<label>& srcSeeds, + label& srcSeedI, + label& tgtSeedI +) const +{ + const labelList& srcNbr = src.cellCells()[srcSeedI]; + const labelList& tgtNbr = tgt.cellCells()[tgtSeedI]; + + const vectorField& srcCentre = src.cellCentres(); + + forAll(srcNbr, i) + { + label srcI = srcNbr[i]; + + if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1)) + { + // source cell srcI not yet mapped + + // identfy if target cell exists for source cell srcI + bool found = false; + forAll(tgtNbr, j) + { + label tgtI = tgtNbr[j]; + + if (tgt.pointInCell(srcCentre[srcI], tgtI)) + { + // new match - append to lists + found = true; + + srcTgtSeed[srcI] = tgtI; + srcSeeds.append(srcI); + + break; + } + } + + if (!found) + { + // no match available for source cell srcI + mapFlag[srcI] = false; + } + } + } + + if (srcSeeds.size()) + { + srcSeedI = srcSeeds.remove(); + tgtSeedI = srcTgtSeed[srcSeedI]; + } + else + { + srcSeedI = -1; + tgtSeedI = -1; + } +} + + +void Foam::meshToMeshNew::calcDirect +( + const polyMesh& src, + const polyMesh& tgt, + const label srcSeedI, + const label tgtSeedI +) +{ + // store a list of src cells already mapped + boolList srcSeedFlag(src.nCells(), true); + labelList srcTgtSeed(src.nCells(), -1); + + List<DynamicList<label> > srcToTgt(src.nCells()); + List<DynamicList<label> > tgtToSrc(tgt.nCells()); + + DynamicList<label> srcSeeds; + + const scalarField& srcVc = src.cellVolumes(); + + label srcCellI = srcSeedI; + label tgtCellI = tgtSeedI; + + do + { + // store src/tgt cell pair + srcToTgt[srcCellI].append(tgtCellI); + tgtToSrc[tgtCellI].append(srcCellI); + + // mark source cell srcSeedI as matched + srcSeedFlag[srcCellI] = false; + + // accumulate intersection volume + V_ += srcVc[srcCellI]; + + // find new source seed cell + appendToDirectSeeds + ( + src, + tgt, + srcSeedFlag, + srcTgtSeed, + srcSeeds, + srcCellI, + tgtCellI + ); + + } + while (srcCellI >= 0); + + // transfer addressing into persistent storage + forAll(srcToTgtCellAddr_, i) + { + srcToTgtCellAddr_[i].transfer(srcToTgt[i]); + srcToTgtCellWght_[i] = scalarList(srcToTgtCellAddr_[i].size(), 1.0); + } + + forAll(tgtToSrcCellAddr_, i) + { + tgtToSrcCellAddr_[i].transfer(tgtToSrc[i]); + tgtToSrcCellWght_[i] = scalarList(tgtToSrcCellAddr_[i].size(), 1.0); + } +} + + +void Foam::meshToMeshNew::normaliseWeights +( + const word& descriptor, + const scalarField& cellVolumes, + const labelListList& addr, + scalarListList& wght +) const +{ + const label nCell = returnReduce(wght.size(), sumOp<label>()); + + if (nCell > 0) + { + scalar minW = GREAT; + scalar maxW = -GREAT; + + forAll(wght, cellI) + { + scalarList& w = wght[cellI]; + scalar s = sum(w); + scalar Vc = cellVolumes[cellI]; + + forAll(w, i) + { + w[i] /= Vc; + } + + minW = min(minW, s/Vc); + maxW = max(maxW, s/Vc); + } + + Info<< type() << ": " << descriptor << " weights min/max = " + << returnReduce(minW, minOp<scalar>()) << ", " + << returnReduce(maxW, maxOp<scalar>()) << endl; + } +} + + +void Foam::meshToMeshNew::appendNbrTgtCells +( + const label tgtCellI, + const polyMesh& tgt, + const DynamicList<label>& visitedTgtCells, + DynamicList<label>& nbrTgtCellIDs +) const +{ + const labelList& nbrCells = tgt.cellCells()[tgtCellI]; + + // filter out cells already visited from cell neighbours + forAll(nbrCells, i) + { + label nbrCellI = nbrCells[i]; + + if + ( + (findIndex(visitedTgtCells, nbrCellI) == -1) + && (findIndex(nbrTgtCellIDs, nbrCellI) == -1) + ) + { + nbrTgtCellIDs.append(nbrCellI); + } + } +} + + +void Foam::meshToMeshNew::setNextCells +( + label& startSeedI, + label& srcCellI, + label& tgtCellI, + const polyMesh& src, + const polyMesh& tgt, + const labelList& srcCellIDs, + const boolList& mapFlag, + const DynamicList<label>& visitedCells, + labelList& seedCells +) const +{ + const labelList& srcNbrCells = src.cellCells()[srcCellI]; + + // set possible seeds for later use by querying all src cell neighbours + // with all visited target cells + bool valuesSet = false; + forAll(srcNbrCells, i) + { + label cellS = srcNbrCells[i]; + + if (mapFlag[cellS] && seedCells[cellS] == -1) + { + forAll(visitedCells, j) + { + label cellT = visitedCells[j]; + + if (intersect(src, tgt, cellS, cellT)) + { + seedCells[cellS] = cellT; + + if (!valuesSet) + { + srcCellI = cellS; + tgtCellI = cellT; + valuesSet = true; + } + } + } + } + } + + // set next src and tgt cells if not set above + if (valuesSet) + { + return; + } + else + { + // try to use existing seed + bool foundNextSeed = false; + for (label i = startSeedI; i < srcCellIDs.size(); i++) + { + label cellS = srcCellIDs[i]; + + if (mapFlag[cellS]) + { + if (!foundNextSeed) + { + startSeedI = i; + foundNextSeed = true; + } + + if (seedCells[cellS] != -1) + { + srcCellI = cellS; + tgtCellI = seedCells[cellS]; + + return; + } + } + } + + // perform new search to find match + if (debug) + { + Pout<< "Advancing front stalled: searching for new " + << "target cell" << endl; + } + + bool restart = + findInitialSeeds + ( + src, + tgt, + srcCellIDs, + mapFlag, + startSeedI, + srcCellI, + tgtCellI + ); + + if (restart) + { + // successfully found new starting seed-pair + return; + } + } + + // if we have got to here, there are no more src/tgt cell intersections + srcCellI = -1; + tgtCellI = -1; +} + + +bool Foam::meshToMeshNew::intersect +( + const polyMesh& src, + const polyMesh& tgt, + const label srcCellI, + const label tgtCellI +) const +{ + scalar threshold = tolerance_*src.cellVolumes()[srcCellI]; + + tetOverlapVolume overlapEngine; + + treeBoundBox bbTgtCell + ( + pointField + ( + tgt.points(), + tgt.cellPoints()[tgtCellI] + ) + ); + + return overlapEngine.cellCellOverlapMinDecomp + ( + src, + srcCellI, + tgt, + tgtCellI, + bbTgtCell, + threshold + ); +} + + +Foam::scalar Foam::meshToMeshNew::interVol +( + const polyMesh& src, + const polyMesh& tgt, + const label srcCellI, + const label tgtCellI +) const +{ + tetOverlapVolume overlapEngine; + + treeBoundBox bbTgtCell + ( + pointField + ( + tgt.points(), + tgt.cellPoints()[tgtCellI] + ) + ); + + scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp + ( + src, + srcCellI, + tgt, + tgtCellI, + bbTgtCell + ); + + return vol; +} + + +void Foam::meshToMeshNew::calcIndirect +( + const polyMesh& src, + const polyMesh& tgt, + const label srcSeedI, + const label tgtSeedI, + const labelList& srcCellIDs, + boolList& mapFlag, + label& startSeedI +) +{ + label srcCellI = srcSeedI; + label tgtCellI = tgtSeedI; + + List<DynamicList<label> > srcToTgtAddr(src.nCells()); + List<DynamicList<scalar> > srcToTgtWght(src.nCells()); + + List<DynamicList<label> > tgtToSrcAddr(tgt.nCells()); + List<DynamicList<scalar> > tgtToSrcWght(tgt.nCells()); + + // list of tgt cell neighbour cells + DynamicList<label> nbrTgtCells(10); + + // list of tgt cells currently visited for srcCellI to avoid multiple hits + DynamicList<label> visitedTgtCells(10); + + // list to keep track of tgt cells used to seed src cells + labelList seedCells(src.nCells(), -1); + seedCells[srcCellI] = tgtCellI; + + const scalarField& srcVol = src.cellVolumes(); + + do + { + nbrTgtCells.clear(); + visitedTgtCells.clear(); + + // append initial target cell and neighbours + nbrTgtCells.append(tgtCellI); + appendNbrTgtCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells); + + do + { + tgtCellI = nbrTgtCells.remove(); + visitedTgtCells.append(tgtCellI); + + scalar vol = interVol(src, tgt, srcCellI, tgtCellI); + + // accumulate addressing and weights for valid intersection + if (vol/srcVol[srcCellI] > tolerance_) + { + // store src/tgt cell pair + srcToTgtAddr[srcCellI].append(tgtCellI); + srcToTgtWght[srcCellI].append(vol); + + tgtToSrcAddr[tgtCellI].append(srcCellI); + tgtToSrcWght[tgtCellI].append(vol); + + appendNbrTgtCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells); + + // accumulate intersection volume + V_ += vol; + } + } + while (!nbrTgtCells.empty()); + + mapFlag[srcCellI] = false; + + // find new source seed cell + setNextCells + ( + startSeedI, + srcCellI, + tgtCellI, + src, + tgt, + srcCellIDs, + mapFlag, + visitedTgtCells, + seedCells + ); + } + while (srcCellI != -1); + + // transfer addressing into persistent storage + forAll(srcToTgtCellAddr_, i) + { + srcToTgtCellAddr_[i].transfer(srcToTgtAddr[i]); + srcToTgtCellWght_[i].transfer(srcToTgtWght[i]); + } + + forAll(tgtToSrcCellAddr_, i) + { + tgtToSrcCellAddr_[i].transfer(tgtToSrcAddr[i]); + tgtToSrcCellWght_[i].transfer(tgtToSrcWght[i]); + } +} + + +void Foam::meshToMeshNew::calcAddressing +( + const polyMesh& src, + const polyMesh& tgt +) +{ + srcToTgtCellAddr_.setSize(src.nCells()); + srcToTgtCellWght_.setSize(src.nCells()); + + tgtToSrcCellAddr_.setSize(tgt.nCells()); + tgtToSrcCellWght_.setSize(tgt.nCells()); + + if (!src.nCells() || !tgt.nCells()) + { + if (debug) + { + Pout<< "mesh interpolation: cells not on processor: Source cells = " + << src.nCells() << ", target cells = " << tgt.nCells() + << endl; + } + } + + if (!src.nCells()) + { + return; + } + else if (!tgt.nCells()) + { + if (debug) + { + Pout<< "mesh interpolation: hhave " << src.nCells() << " source " + << " cells but no target cells" << endl; + } + + return; + } + + // (potentially) participating source mesh cells + const labelList srcCellIDs = maskCells(src, tgt); + + // list to keep track of whether src cell can be mapped + boolList mapFlag(src.nCells(), false); + UIndirectList<bool>(mapFlag, srcCellIDs) = true; + + // find initial point in tgt mesh + label srcSeedI = -1; + label tgtSeedI = -1; + label startSeedI = 0; + + bool startWalk = + findInitialSeeds + ( + src, + tgt, + srcCellIDs, + mapFlag, + startSeedI, + srcSeedI, + tgtSeedI + ); + + if (!startWalk) + { + // if meshes are collocated, after inflating the source mesh bounding + // box tgt mesh cells may be transferred, but may still not overlap + // with the source mesh + return; + } + + + switch (method_) + { + case imMap: + { + calcDirect(src, tgt, srcSeedI, tgtSeedI); + break; + } + case imCellVolumeWeight: + { + calcIndirect + ( + src, + tgt, + srcSeedI, + tgtSeedI, + srcCellIDs, + mapFlag, + startSeedI + ); + break; + } + default: + { + FatalErrorIn + ( + "void Foam::meshToMeshNew::calcAddressing" + "(" + "const polyMesh&, " + "const polyMesh&" + ")" + ) + << "Unknown interpolation method" + << abort(FatalError); + } + } + + + if (debug) + { + writeConnectivity(src, tgt, srcToTgtCellAddr_); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::meshToMeshNew::meshToMeshNew +( + const polyMesh& src, + const polyMesh& tgt, + const interpolationMethod& method +) +: + srcRegionName_(src.name()), + tgtRegionName_(tgt.name()), + srcToTgtCellAddr_(), + tgtToSrcCellAddr_(), + srcToTgtCellWght_(), + tgtToSrcCellWght_(), + method_(method), + V_(0.0), + singleMeshProc_(-1), + srcMapPtr_(NULL), + tgtMapPtr_(NULL) +{ + Info<< "Creating mesh-to-mesh addressing for " << src.name() + << " and " << tgt.name() << " regions" << endl; + + singleMeshProc_ = calcDistribution(src, tgt); + + if (singleMeshProc_ == -1) + { + // create global indexing for src and tgt meshes + globalIndex globalSrcCells(src.nCells()); + globalIndex globalTgtCells(tgt.nCells()); + + // Create processor map of overlapping cells. This map gets + // (possibly remote) cells from the tgt mesh such that they (together) + // cover all of the src mesh + autoPtr<mapDistribute> mapPtr = calcProcMap(src, tgt); + const mapDistribute& map = mapPtr(); + + pointField newTgtPoints; + faceList newTgtFaces; + labelList newTgtFaceOwners; + labelList newTgtFaceNeighbours; + labelList newTgtCellIDs; + + distributeAndMergeCells + ( + map, + tgt, + globalTgtCells, + newTgtPoints, + newTgtFaces, + newTgtFaceOwners, + newTgtFaceNeighbours, + newTgtCellIDs + ); + + + // create a new target mesh + polyMesh newTgt + ( + IOobject + ( + "newTgt::" + Foam::name(Pstream::myProcNo()), + tgt.time().timeName(), + tgt.time(), + IOobject::NO_READ + ), + xferMove(newTgtPoints), + xferMove(newTgtFaces), + xferMove(newTgtFaceOwners), + xferMove(newTgtFaceNeighbours), + false // no parallel comms + ); + + // create some dummy patch info + List<polyPatch*> patches(1); + patches[0] = new polyPatch + ( + "defaultFaces", + newTgt.nFaces() - newTgt.nInternalFaces(), + newTgt.nInternalFaces(), + 0, + newTgt.boundaryMesh(), + word::null + ); + + newTgt.addPatches(patches); + + // force calculation of tet-base points used for point-in-cell + (void)newTgt.tetBasePtIs(); + + // force construction of cell tree +// (void)newTgt.cellTree(); + + if (debug) + { + Pout<< "Created newTgt mesh:" << nl + << " old cells = " << tgt.nCells() + << ", new cells = " << newTgt.nCells() << nl + << " old faces = " << tgt.nFaces() + << ", new faces = " << newTgt.nFaces() << endl; + + if (debug > 1) + { + Pout<< "Writing newTgt mesh: " << newTgt.name() << endl; + newTgt.write(); + } + } + + calcAddressing(src, newTgt); + + // per source cell the target cell address in newTgt mesh + forAll(srcToTgtCellAddr_, i) + { + labelList& addressing = srcToTgtCellAddr_[i]; + forAll(addressing, addrI) + { + addressing[addrI] = newTgtCellIDs[addressing[addrI]]; + } + } + + // convert target addresses in newTgtMesh into global cell numbering + forAll(tgtToSrcCellAddr_, i) + { + labelList& addressing = tgtToSrcCellAddr_[i]; + forAll(addressing, addrI) + { + addressing[addrI] = globalSrcCells.toGlobal(addressing[addrI]); + } + } + + // set up as a reverse distribute + mapDistribute::distribute + ( + Pstream::nonBlocking, + List<labelPair>(), + tgt.nCells(), + map.constructMap(), + map.subMap(), + tgtToSrcCellAddr_, + ListPlusEqOp<label>(), + labelList() + ); + + // set up as a reverse distribute + mapDistribute::distribute + ( + Pstream::nonBlocking, + List<labelPair>(), + tgt.nCells(), + map.constructMap(), + map.subMap(), + tgtToSrcCellWght_, + ListPlusEqOp<scalar>(), + scalarList() + ); + + // weights normalisation + normaliseWeights + ( + "source", + src.cellVolumes(), + srcToTgtCellAddr_, + srcToTgtCellWght_ + ); + + normaliseWeights + ( + "target", + tgt.cellVolumes(), + tgtToSrcCellAddr_, + tgtToSrcCellWght_ + ); + + // cache maps and reset addresses + List<Map<label> > cMap; + srcMapPtr_.reset + ( + new mapDistribute(globalSrcCells, tgtToSrcCellAddr_, cMap) + ); + tgtMapPtr_.reset + ( + new mapDistribute(globalTgtCells, srcToTgtCellAddr_, cMap) + ); + + // collect volume intersection contributions + reduce(V_, sumOp<scalar>()); + } + else + { + calcAddressing(src, tgt); + + normaliseWeights + ( + "source", + src.cellVolumes(), + srcToTgtCellAddr_, + srcToTgtCellWght_ + ); + + normaliseWeights + ( + "target", + tgt.cellVolumes(), + tgtToSrcCellAddr_, + tgtToSrcCellWght_ + ); + } + + Info<< " Overlap volume: " << V_ << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::meshToMeshNew::~meshToMeshNew() +{} + + +// ************************************************************************* // diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H new file mode 100644 index 0000000000000000000000000000000000000000..85f0c1332e9e5857008d54553a6fe38a0b6ff7f8 --- /dev/null +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H @@ -0,0 +1,511 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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::meshToMeshNew + +Description + Class to calculate the cell-addressing between two overlapping meshes + +SourceFiles + meshToMeshNew.C + meshToMeshNewTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef meshToMeshNew_H +#define meshToMeshNew_H + +#include "polyMesh.H" +#include "boundBox.H" +#include "mapDistribute.H" +#include "volFieldsFwd.H" +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class meshToMeshNew Declaration +\*---------------------------------------------------------------------------*/ + +class meshToMeshNew +{ +public: + + // Public data types + + //- Enumeration specifying required accuracy + enum interpolationMethod + { + imMap, + imCellVolumeWeight + }; + + static const NamedEnum<interpolationMethod, 2> + interpolationMethodNames_; + +private: + + // Private data + + //- Name of source mesh region + const word srcRegionName_; + + //- Name of target mesh region + const word tgtRegionName_; + + //- Source to target cell addressing + labelListList srcToTgtCellAddr_; + + //- Target to source cell addressing + labelListList tgtToSrcCellAddr_; + + //- Source to target cell interplation weights + scalarListList srcToTgtCellWght_; + + //- Target to source cell interpolation weights + scalarListList tgtToSrcCellWght_; + + //- Interpolation method + interpolationMethod method_; + + //- Cell total volume in overlap region [m3] + scalar V_; + + //- Index of processor that holds all of both sides. -1 in all other + // cases + label singleMeshProc_; + + //- Source map pointer - parallel running only + autoPtr<mapDistribute> srcMapPtr_; + + //- Target map pointer - parallel running only + autoPtr<mapDistribute> tgtMapPtr_; + + //- Tolerance used in volume overlap calculations + static scalar tolerance_; + + + // Private Member Functions + + //- Helper function to add a constant offset to a list + template<class Type> + void add(UList<Type>& fld, const label offset) const; + + //- Write the connectivity (debugging) + void writeConnectivity + ( + const polyMesh& src, + const polyMesh& tgt, + const labelListList& srcToTargetAddr + ) const; + + //- Return src cell IDs for the overlap region + labelList maskCells(const polyMesh& src, const polyMesh& tgt) const; + + //- Find indices of overlapping cells in src and tgt meshes - returns + // true if found a matching pair + bool findInitialSeeds + ( + const polyMesh& src, + const polyMesh& tgt, + const labelList& srcCellIDs, + const boolList& mapFlag, + const label startSeedI, + label& srcSeedI, + label& tgtSeedI + ) const; + + + // Direct (one-to-one) mapping + + //- Append to list of src mesh seed indices + void appendToDirectSeeds + ( + const polyMesh& src, + const polyMesh& tgt, + boolList& mapFlag, + labelList& srcTgtSeed, + DynamicList<label>& srcSeeds, + label& srcSeedI, + label& tgtSeedI + ) const; + + //- Main driver routine for direct mapping + void calcDirect + ( + const polyMesh& src, + const polyMesh& tgt, + const label srcSeedI, + const label tgtSeedI + ); + + + // Indirect (non-conformal) mapping + + //- Normalise the interpolation weights + void normaliseWeights + ( + const word& descriptor, + const scalarField& cellVolumes, + const labelListList& addr, + scalarListList& wght + ) const; + + //- Append target cell neihgbour cells to cellIDs list + void appendNbrTgtCells + ( + const label tgtCellI, + const polyMesh& tgt, + const DynamicList<label>& visitedTgtCells, + DynamicList<label>& nbrTgtCellIDs + ) const; + + //- Set the next cells in the advancing front algorithm + void setNextCells + ( + label& startSeedI, + label& srcCellI, + label& tgtCellI, + const polyMesh& src, + const polyMesh& tgt, + const labelList& srcCellIDs, + const boolList& mapFlag, + const DynamicList<label>& visitedCells, + labelList& seedCells + ) const; + + //- Return the true if cells intersect + bool intersect + ( + const polyMesh& src, + const polyMesh& tgt, + const label srcCellI, + const label tgtCellI + ) const; + + //- Return the intersection volume between two cells + scalar interVol + ( + const polyMesh& src, + const polyMesh& tgt, + const label srcCellI, + const label tgtCellI + ) const; + + //- Main driver routine for indirect mapping + void calcIndirect + ( + const polyMesh& src, + const polyMesh& tgt, + const label srcSeedI, + const label tgtSeedI, + const labelList& srcCellIDs, + boolList& mapFlag, + label& startSeedI + ); + + + //- Calculate the addressing between overalping regions of src and tgt + // meshes - main driver function + void calcAddressing(const polyMesh& src, const polyMesh& tgt); + + + // Parallel operations + + //- Determine whether the meshes are split across multiple pocessors + label calcDistribution + ( + const polyMesh& src, + const polyMesh& tgt + ) const; + + //- Determine which processor bounding-boxes overlap + label calcOverlappingProcs + ( + const List<boundBox>& procBb, + const boundBox& bb, + boolList& overlaps + ) const; + + //- Calculate the mapping between processors + autoPtr<mapDistribute> calcProcMap + ( + const polyMesh& src, + const polyMesh& tgt + ) const; + + //- Distribute mesh info from 'my' processor to others + void distributeCells + ( + const mapDistribute& map, + const polyMesh& tgtMesh, + const globalIndex& globalI, + List<pointField>& points, + List<label>& nInternalFaces, + List<faceList>& faces, + List<labelList>& faceOwner, + List<labelList>& faceNeighbour, + List<labelList>& cellIDs, + List<labelList>& nbrProcIDs, + List<labelList>& procLocalFaceIDs + ) const; + + //- Collect pieces of tgt mesh from other procssors and restructure + void distributeAndMergeCells + ( + const mapDistribute& map, + const polyMesh& tgt, + const globalIndex& globalI, + pointField& tgtPoints, + faceList& tgtFaces, + labelList& tgtFaceOwners, + labelList& tgtFaceNeighbours, + labelList& tgtCellIDs + ) const; + + + //- Disallow default bitwise copy construct + meshToMeshNew(const meshToMeshNew&); + + //- Disallow default bitwise assignment + void operator=(const meshToMeshNew&); + + +public: + + //- Run-time type information + TypeName("meshToMeshNew"); + + + //- Construct from source and target meshes + meshToMeshNew + ( + const polyMesh& src, + const polyMesh& tgt, + const interpolationMethod& method + ); + + + //- Destructor + virtual ~meshToMeshNew(); + + + // Member Functions + + // Access + + //- Return const access to the source to target cell addressing + inline const labelListList& srcToTgtCellAddr() const; + + //- Return const access to the target to source cell addressing + inline const labelListList& tgtToSrcCellAddr() const; + + //- Return const access to the source to target cell weights + inline const scalarListList& srcToTgtCellWght() const; + + //- Return const access to the target to source cell weights + inline const scalarListList& tgtToSrcCellWght() const; + + //- Return const access to the overlap volume + inline scalar V() const; + + + // Evaluation + + // Source-to-target field mapping + + //- Map field from src to tgt mesh with defined operation + // Values passed in via 'result' are used to initialise the + // return value + template<class Type, class CombineOp> + void mapSrcToTgt + ( + const UList<Type>& srcFld, + const CombineOp& cop, + List<Type>& result + ) const; + + //- Return the src field mapped to the tgt mesh with a defined + // operation. Initial values of the result are set to zero + template<class Type, class CombineOp> + tmp<Field<Type> > mapSrcToTgt + ( + const Field<Type>& srcFld, + const CombineOp& cop + ) const; + + //- Convenience function to map a tmp field to the tgt mesh + // with a defined operation + template<class Type, class CombineOp> + tmp<Field<Type> > mapSrcToTgt + ( + const tmp<Field<Type> >& tsrcFld, + const CombineOp& cop + ) const; + + //- Convenience function to map a field to the tgt mesh with a + // default operation (plusEqOp) + template<class Type> + tmp<Field<Type> > mapSrcToTgt + ( + const Field<Type>& srcFld + ) const; + + //- Convenience function to map a tmp field to the tgt mesh + // with a default operation (plusEqOp) + template<class Type> + tmp<Field<Type> > mapSrcToTgt + ( + const tmp<Field<Type> >& tsrcFld + ) const; + + + // Target-to-source field mapping + + //- Map field from tgt to src mesh with defined operation + // Values passed in via 'result' are used to initialise the + // return value + template<class Type, class CombineOp> + void mapTgtToSrc + ( + const UList<Type>& tgtFld, + const CombineOp& cop, + List<Type>& result + ) const; + + //- Return the tgt field mapped to the src mesh with a defined + // operation. Initial values of the result are set to zero + template<class Type, class CombineOp> + tmp<Field<Type> > mapTgtToSrc + ( + const Field<Type>& tgtFld, + const CombineOp& cop + ) const; + + //- Convenience function to map a tmp field to the src mesh + // with a defined operation + template<class Type, class CombineOp> + tmp<Field<Type> > mapTgtToSrc + ( + const tmp<Field<Type> >& ttgtFld, + const CombineOp& cop + ) const; + + //- Convenience function to map a field to the src mesh with a + // default operation (plusEqOp) + template<class Type> + tmp<Field<Type> > mapTgtToSrc + ( + const Field<Type>& tgtFld + ) const; + + //- Convenience function to map a tmp field to the src mesh + // with a default operation (plusEqOp) + template<class Type> + tmp<Field<Type> > mapTgtToSrc + ( + const tmp<Field<Type> >& ttgtFld + ) const; + + + // Volume field mapping + + //- Interpolare a field with a defined operation. Values + // passed in via 'result' are used to initialise the return + // value. Optionally interpolate patch values + template<class Type, class CombineOp> + void interpolate + ( + const GeometricField<Type, fvPatchField, volMesh>& field, + const CombineOp& cop, + GeometricField<Type, fvPatchField, volMesh>& result, + const bool interpPatches = true + ) const; + + //- Interpolare a field with a defined operation. The initial + // values of the result are set to zero. Optionally + // interpolate patch values + template<class Type, class CombineOp> + tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate + ( + const GeometricField<Type, fvPatchField, volMesh>& field, + const CombineOp& cop, + const bool interpPatches = true + ) const; + + //- Interpolare a tmp field with a defined operation. The + // initial values of the result are set to zero. Optionally + // interpolate patch values + template<class Type, class CombineOp> + tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate + ( + const tmp<GeometricField<Type, fvPatchField, volMesh> >& + tfield, + const CombineOp& cop, + const bool interpPatches = true + ) const; + + //- Convenience function to map a field with a default + // operation (plusEqOp). Optionally interpolate patch values + template<class Type> + tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate + ( + const GeometricField<Type, fvPatchField, volMesh>& field, + const bool interpPatches = true + ) const; + + //- Convenience function to map a tmp field with a default + // operation (plusEqOp). Optionally interpolate patch values + template<class Type> + tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate + ( + const tmp<GeometricField<Type, fvPatchField, volMesh> >& + tfield, + const bool interpPatches = true + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "meshToMeshNewI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "meshToMeshNewTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H new file mode 100644 index 0000000000000000000000000000000000000000..41068e8c455e4e9f5b8d7737acc2fde589df618c --- /dev/null +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewI.H @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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 "meshToMeshNew.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +inline const Foam::labelListList& +Foam::meshToMeshNew::srcToTgtCellAddr() const +{ + return srcToTgtCellAddr_; +} + + +inline const Foam::labelListList& +Foam::meshToMeshNew::tgtToSrcCellAddr() const +{ + return tgtToSrcCellAddr_; +} + + +inline const Foam::scalarListList& +Foam::meshToMeshNew::srcToTgtCellWght() const +{ + return srcToTgtCellWght_; +} + + +inline const Foam::scalarListList& +Foam::meshToMeshNew::tgtToSrcCellWght() const +{ + return tgtToSrcCellWght_; +} + + +inline Foam::scalar Foam::meshToMeshNew::V() const +{ + return V_; +} + + +// ************************************************************************* // diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewParallelOps.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewParallelOps.C new file mode 100644 index 0000000000000000000000000000000000000000..3cb9d0597d84988b6550b8589f1dde97d94e485a --- /dev/null +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewParallelOps.C @@ -0,0 +1,884 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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 "meshToMeshNew.H" +#include "OFstream.H" +#include "Time.H" +#include "globalIndex.H" +#include "mergePoints.H" +#include "processorPolyPatch.H" +#include "SubField.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::label Foam::meshToMeshNew::calcDistribution +( + const polyMesh& src, + const polyMesh& tgt +) const +{ + label procI = 0; + + if (Pstream::parRun()) + { + List<label> cellsPresentOnProc(Pstream::nProcs(), 0); + if ((src.nCells() > 0) || (tgt.nCells() > 0)) + { + cellsPresentOnProc[Pstream::myProcNo()] = 1; + } + else + { + cellsPresentOnProc[Pstream::myProcNo()] = 0; + } + + Pstream::gatherList(cellsPresentOnProc); + Pstream::scatterList(cellsPresentOnProc); + + label nHaveCells = sum(cellsPresentOnProc); + + if (nHaveCells > 1) + { + procI = -1; + if (debug) + { + Info<< "meshToMeshNew::calcDistribution: " + << "Meshes split across multiple processors" << endl; + } + } + else if (nHaveCells == 1) + { + procI = findIndex(cellsPresentOnProc, 1); + if (debug) + { + Info<< "meshToMeshNew::calcDistribution: " + << "Meshes local to processor" << procI << endl; + } + } + } + + return procI; +} + + +Foam::label Foam::meshToMeshNew::calcOverlappingProcs +( + const List<boundBox>& procBb, + const boundBox& bb, + boolList& overlaps +) const +{ + overlaps = false; + + label nOverlaps = 0; + + forAll(procBb, procI) + { + const boundBox& bbp = procBb[procI]; + + if (bbp.overlaps(bb)) + { + overlaps[procI] = true; + nOverlaps++; + } + } + + return nOverlaps; +} + + +Foam::autoPtr<Foam::mapDistribute> Foam::meshToMeshNew::calcProcMap +( + const polyMesh& src, + const polyMesh& tgt +) const +{ + // get decomposition of cells on src mesh + List<boundBox> procBb(Pstream::nProcs()); + + if (src.nCells() > 0) + { + // bounding box for my mesh - do not parallel reduce + procBb[Pstream::myProcNo()] = boundBox(src.points(), false); + + // slightly increase size of bounding boxes to allow for cases where + // bounding boxes are perfectly alligned + procBb[Pstream::myProcNo()].inflate(0.01); + } + else + { + procBb[Pstream::myProcNo()] = boundBox(); + } + + + Pstream::gatherList(procBb); + Pstream::scatterList(procBb); + + + if (debug) + { + Info<< "Determining extent of src mesh per processor:" << nl + << "\tproc\tbb" << endl; + forAll(procBb, procI) + { + Info<< '\t' << procI << '\t' << procBb[procI] << endl; + } + } + + + // determine which cells of tgt mesh overlaps src mesh per proc + const cellList& cells = tgt.cells(); + const faceList& faces = tgt.faces(); + const pointField& points = tgt.points(); + + labelListList sendMap; + + { + // per processor indices into all segments to send + List<DynamicList<label> > dynSendMap(Pstream::nProcs()); + label iniSize = floor(tgt.nCells()/Pstream::nProcs()); + + forAll(dynSendMap, procI) + { + dynSendMap[procI].setCapacity(iniSize); + } + + // work array - whether src processor bb overlaps the tgt cell bounds + boolList procBbOverlaps(Pstream::nProcs()); + forAll(cells, cellI) + { + const cell& c = cells[cellI]; + + // determine bounding box of tgt cell + boundBox cellBb(point::max, point::min); + forAll(c, faceI) + { + const face& f = faces[c[faceI]]; + forAll(f, fp) + { + cellBb.min() = min(cellBb.min(), points[f[fp]]); + cellBb.max() = max(cellBb.max(), points[f[fp]]); + } + } + + // find the overlapping tgt cells on each src processor + (void)calcOverlappingProcs(procBb, cellBb, procBbOverlaps); + + forAll(procBbOverlaps, procI) + { + if (procBbOverlaps[procI]) + { + dynSendMap[procI].append(cellI); + } + } + } + + // convert dynamicList to labelList + sendMap.setSize(Pstream::nProcs()); + forAll(sendMap, procI) + { + sendMap[procI].transfer(dynSendMap[procI]); + } + } + + // debug printing + if (debug) + { + Pout<< "Of my " << cells.size() << " target cells I need to send to:" + << nl << "\tproc\tcells" << endl; + forAll(sendMap, procI) + { + Pout<< '\t' << procI << '\t' << sendMap[procI].size() << endl; + } + } + + + // send over how many tgt cells I need to receive from each processor + labelListList sendSizes(Pstream::nProcs()); + sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs()); + forAll(sendMap, procI) + { + sendSizes[Pstream::myProcNo()][procI] = sendMap[procI].size(); + } + Pstream::gatherList(sendSizes); + Pstream::scatterList(sendSizes); + + + // determine order of receiving + labelListList constructMap(Pstream::nProcs()); + + label segmentI = 0; + forAll(constructMap, procI) + { + // what I need to receive is what other processor is sending to me + label nRecv = sendSizes[procI][Pstream::myProcNo()]; + constructMap[procI].setSize(nRecv); + + for (label i = 0; i < nRecv; i++) + { + constructMap[procI][i] = segmentI++; + } + } + + autoPtr<mapDistribute> mapPtr + ( + new mapDistribute + ( + segmentI, // size after construction + sendMap.xfer(), + constructMap.xfer() + ) + ); + + return mapPtr; +} + + +void Foam::meshToMeshNew::distributeCells +( + const mapDistribute& map, + const polyMesh& tgtMesh, + const globalIndex& globalI, + List<pointField>& points, + List<label>& nInternalFaces, + List<faceList>& faces, + List<labelList>& faceOwner, + List<labelList>& faceNeighbour, + List<labelList>& cellIDs, + List<labelList>& nbrProcIDs, + List<labelList>& procLocalFaceIDs +) const +{ + PstreamBuffers pBufs(Pstream::nonBlocking); + + points.setSize(Pstream::nProcs()); + nInternalFaces.setSize(Pstream::nProcs(), 0); + faces.setSize(Pstream::nProcs()); + faceOwner.setSize(Pstream::nProcs()); + faceNeighbour.setSize(Pstream::nProcs()); + cellIDs.setSize(Pstream::nProcs()); + + nbrProcIDs.setSize(Pstream::nProcs());; + procLocalFaceIDs.setSize(Pstream::nProcs());; + + + for (label domain = 0; domain < Pstream::nProcs(); domain++) + { + const labelList& sendElems = map.subMap()[domain]; + + if (sendElems.size()) + { + // reverse cell map + labelList reverseCellMap(tgtMesh.nCells(), -1); + forAll(sendElems, subCellI) + { + reverseCellMap[sendElems[subCellI]] = subCellI; + } + + DynamicList<face> subFaces(tgtMesh.nFaces()); + DynamicList<label> subFaceOwner(tgtMesh.nFaces()); + DynamicList<label> subFaceNeighbour(tgtMesh.nFaces()); + + DynamicList<label> subNbrProcIDs(tgtMesh.nFaces()); + DynamicList<label> subProcLocalFaceIDs(tgtMesh.nFaces()); + + label nInternal = 0; + + // internal faces + forAll(tgtMesh.faceNeighbour(), faceI) + { + label own = tgtMesh.faceOwner()[faceI]; + label nbr = tgtMesh.faceNeighbour()[faceI]; + label subOwn = reverseCellMap[own]; + label subNbr = reverseCellMap[nbr]; + + if (subOwn != -1 && subNbr != -1) + { + nInternal++; + + if (subOwn < subNbr) + { + subFaces.append(tgtMesh.faces()[faceI]); + subFaceOwner.append(subOwn); + subFaceNeighbour.append(subNbr); + subNbrProcIDs.append(-1); + subProcLocalFaceIDs.append(-1); + } + else + { + subFaces.append(tgtMesh.faces()[faceI].reverseFace()); + subFaceOwner.append(subNbr); + subFaceNeighbour.append(subOwn); + subNbrProcIDs.append(-1); + subProcLocalFaceIDs.append(-1); + } + } + } + + // boundary faces for new region + forAll(tgtMesh.faceNeighbour(), faceI) + { + label own = tgtMesh.faceOwner()[faceI]; + label nbr = tgtMesh.faceNeighbour()[faceI]; + label subOwn = reverseCellMap[own]; + label subNbr = reverseCellMap[nbr]; + + if (subOwn != -1 && subNbr == -1) + { + subFaces.append(tgtMesh.faces()[faceI]); + subFaceOwner.append(subOwn); + subFaceNeighbour.append(subNbr); + subNbrProcIDs.append(-1); + subProcLocalFaceIDs.append(-1); + } + else if (subOwn == -1 && subNbr != -1) + { + subFaces.append(tgtMesh.faces()[faceI].reverseFace()); + subFaceOwner.append(subNbr); + subFaceNeighbour.append(subOwn); + subNbrProcIDs.append(-1); + subProcLocalFaceIDs.append(-1); + } + } + + // boundary faces of existing region + forAll(tgtMesh.boundaryMesh(), patchI) + { + const polyPatch& pp = tgtMesh.boundaryMesh()[patchI]; + + label nbrProcI = -1; + + // store info for faces on processor patches + if (isA<processorPolyPatch>(pp)) + { + const processorPolyPatch& ppp = + dynamic_cast<const processorPolyPatch&>(pp); + + nbrProcI = ppp.neighbProcNo(); + } + + forAll(pp, i) + { + label faceI = pp.start() + i; + label own = tgtMesh.faceOwner()[faceI]; + + if (reverseCellMap[own] != -1) + { + subFaces.append(tgtMesh.faces()[faceI]); + subFaceOwner.append(reverseCellMap[own]); + subFaceNeighbour.append(-1); + subNbrProcIDs.append(nbrProcI); + subProcLocalFaceIDs.append(i); + } + } + } + + // reverse point map + labelList reversePointMap(tgtMesh.nPoints(), -1); + DynamicList<point> subPoints(tgtMesh.nPoints()); + forAll(subFaces, subFaceI) + { + face& f = subFaces[subFaceI]; + forAll(f, fp) + { + label pointI = f[fp]; + if (reversePointMap[pointI] == -1) + { + reversePointMap[pointI] = subPoints.size(); + subPoints.append(tgtMesh.points()[pointI]); + } + + f[fp] = reversePointMap[pointI]; + } + } + + // tgt cells into global numbering + labelList globalElems(sendElems.size()); + forAll(sendElems, i) + { + if (debug) + { + Pout<< "tgtProc:" << Pstream::myProcNo() + << " sending tgt cell " << sendElems[i] + << "[" << globalI.toGlobal(sendElems[i]) << "]" + << " to srcProc " << domain << endl; + } + + globalElems[i] = globalI.toGlobal(sendElems[i]); + } + + // pass data + if (domain == Pstream::myProcNo()) + { + // allocate my own data + points[Pstream::myProcNo()] = subPoints; + nInternalFaces[Pstream::myProcNo()] = nInternal; + faces[Pstream::myProcNo()] = subFaces; + faceOwner[Pstream::myProcNo()] = subFaceOwner; + faceNeighbour[Pstream::myProcNo()] = subFaceNeighbour; + cellIDs[Pstream::myProcNo()] = globalElems; + nbrProcIDs[Pstream::myProcNo()] = subNbrProcIDs; + procLocalFaceIDs[Pstream::myProcNo()] = subProcLocalFaceIDs; + } + else + { + // send data to other processor domains + UOPstream toDomain(domain, pBufs); + + toDomain + << subPoints + << nInternal + << subFaces + << subFaceOwner + << subFaceNeighbour + << globalElems + << subNbrProcIDs + << subProcLocalFaceIDs; + } + } + } + + // Start receiving + pBufs.finishedSends(); + + // Consume + for (label domain = 0; domain < Pstream::nProcs(); domain++) + { + const labelList& recvElems = map.constructMap()[domain]; + + if (domain != Pstream::myProcNo() && recvElems.size()) + { + UIPstream str(domain, pBufs); + + str >> points[domain] + >> nInternalFaces[domain] + >> faces[domain] + >> faceOwner[domain] + >> faceNeighbour[domain] + >> cellIDs[domain] + >> nbrProcIDs[domain] + >> procLocalFaceIDs[domain]; + } + + if (debug) + { + Pout<< "Target mesh send sizes[" << domain << "]" + << ": points="<< points[domain].size() + << ", faces=" << faces[domain].size() + << ", nInternalFaces=" << nInternalFaces[domain] + << ", faceOwn=" << faceOwner[domain].size() + << ", faceNbr=" << faceNeighbour[domain].size() + << ", cellIDs=" << cellIDs[domain].size() << endl; + } + } +} + + +void Foam::meshToMeshNew::distributeAndMergeCells +( + const mapDistribute& map, + const polyMesh& tgt, + const globalIndex& globalI, + pointField& tgtPoints, + faceList& tgtFaces, + labelList& tgtFaceOwners, + labelList& tgtFaceNeighbours, + labelList& tgtCellIDs +) const +{ + // Exchange per-processor data + List<pointField> allPoints; + List<label> allNInternalFaces; + List<faceList> allFaces; + List<labelList> allFaceOwners; + List<labelList> allFaceNeighbours; + List<labelList> allTgtCellIDs; + + // Per target mesh face the neighbouring proc and index in + // processor patch (all -1 for normal boundary face) + List<labelList> allNbrProcIDs; + List<labelList> allProcLocalFaceIDs; + + distributeCells + ( + map, + tgt, + globalI, + allPoints, + allNInternalFaces, + allFaces, + allFaceOwners, + allFaceNeighbours, + allTgtCellIDs, + allNbrProcIDs, + allProcLocalFaceIDs + ); + + // Convert lists into format that can be used to generate a valid polyMesh + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // + // Points and cells are collected into single flat lists: + // - i.e. proc0, proc1 ... procN + // + // Faces need to be sorted after collection to that internal faces are + // contiguous, followed by all boundary faces + // + // Processor patch faces between included cells on neighbouring processors + // are converted into internal faces + // + // Face list structure: + // - Per processor: + // - internal faces + // - processor faces that have been converted into internal faces + // - Followed by all boundary faces + // - from 'normal' boundary faces + // - from singularly-sided processor patch faces + + + // Number of internal+coupled faces + labelList allNIntCoupledFaces(allNInternalFaces); + + // Starting offset for points + label nPoints = 0; + labelList pointOffset(Pstream::nProcs(), 0); + forAll(allPoints, procI) + { + pointOffset[procI] = nPoints; + nPoints += allPoints[procI].size(); + } + + // Starting offset for cells + label nCells = 0; + labelList cellOffset(Pstream::nProcs(), 0); + forAll(allTgtCellIDs, procI) + { + cellOffset[procI] = nCells; + nCells += allTgtCellIDs[procI].size(); + } + + // Count any coupled faces + typedef FixedList<label, 3> label3; + typedef HashTable<label, label3, label3::Hash<> > procCoupleInfo; + procCoupleInfo procFaceToGlobalCell; + + forAll(allNbrProcIDs, procI) + { + const labelList& nbrProcI = allNbrProcIDs[procI]; + const labelList& localFaceI = allProcLocalFaceIDs[procI]; + + forAll(nbrProcI, i) + { + if (nbrProcI[i] != -1 && localFaceI[i] != -1) + { + label3 key; + key[0] = min(procI, nbrProcI[i]); + key[1] = max(procI, nbrProcI[i]); + key[2] = localFaceI[i]; + + procCoupleInfo::const_iterator fnd = + procFaceToGlobalCell.find(key); + + if (fnd == procFaceToGlobalCell.end()) + { + procFaceToGlobalCell.insert(key, -1); + } + else + { + if (debug) + { + Pout<< "Additional internal face between procs:" + << key[0] << " and " << key[1] + << " across local face " << key[2] << endl; + } + + allNIntCoupledFaces[procI]++; + } + } + } + } + + + // Starting offset for internal faces + label nIntFaces = 0; + label nFacesTotal = 0; + labelList internalFaceOffset(Pstream::nProcs(), 0); + forAll(allNIntCoupledFaces, procI) + { + label nCoupledFaces = + allNIntCoupledFaces[procI] - allNInternalFaces[procI]; + + internalFaceOffset[procI] = nIntFaces; + nIntFaces += allNIntCoupledFaces[procI]; + nFacesTotal += allFaceOwners[procI].size() - nCoupledFaces; + } + + tgtPoints.setSize(nPoints); + tgtFaces.setSize(nFacesTotal); + tgtFaceOwners.setSize(nFacesTotal); + tgtFaceNeighbours.setSize(nFacesTotal); + tgtCellIDs.setSize(nCells); + + // Insert points + forAll(allPoints, procI) + { + const pointField& pts = allPoints[procI]; + SubList<point>(tgtPoints, pts.size(), pointOffset[procI]).assign(pts); + } + + // Insert cellIDs + forAll(allTgtCellIDs, procI) + { + const labelList& cellIDs = allTgtCellIDs[procI]; + SubList<label>(tgtCellIDs, cellIDs.size(), cellOffset[procI]).assign + ( + cellIDs + ); + } + + + // Insert internal faces (from internal faces) + forAll(allFaces, procI) + { + const faceList& fcs = allFaces[procI]; + const labelList& faceOs = allFaceOwners[procI]; + const labelList& faceNs = allFaceNeighbours[procI]; + + SubList<face> slice + ( + tgtFaces, + allNInternalFaces[procI], + internalFaceOffset[procI] + ); + slice.assign(SubList<face>(fcs, allNInternalFaces[procI])); + forAll(slice, i) + { + add(slice[i], pointOffset[procI]); + } + + SubField<label> ownSlice + ( + tgtFaceOwners, + allNInternalFaces[procI], + internalFaceOffset[procI] + ); + ownSlice.assign(SubField<label>(faceOs, allNInternalFaces[procI])); + add(ownSlice, cellOffset[procI]); + + SubField<label> nbrSlice + ( + tgtFaceNeighbours, + allNInternalFaces[procI], + internalFaceOffset[procI] + ); + nbrSlice.assign(SubField<label>(faceNs, allNInternalFaces[procI])); + add(nbrSlice, cellOffset[procI]); + + internalFaceOffset[procI] += allNInternalFaces[procI]; + } + + + // Insert internal faces (from coupled face-pairs) + forAll(allNbrProcIDs, procI) + { + const labelList& nbrProcI = allNbrProcIDs[procI]; + const labelList& localFaceI = allProcLocalFaceIDs[procI]; + const labelList& faceOs = allFaceOwners[procI]; + const faceList& fcs = allFaces[procI]; + + forAll(nbrProcI, i) + { + if (nbrProcI[i] != -1 && localFaceI[i] != -1) + { + label3 key; + key[0] = min(procI, nbrProcI[i]); + key[1] = max(procI, nbrProcI[i]); + key[2] = localFaceI[i]; + + procCoupleInfo::iterator fnd = procFaceToGlobalCell.find(key); + + if (fnd != procFaceToGlobalCell.end()) + { + label tgtFaceI = fnd(); + if (tgtFaceI == -1) + { + // on first visit store the new cell on this side + fnd() = cellOffset[procI] + faceOs[i]; + } + else + { + // get owner and neighbour in new cell numbering + label newOwn = cellOffset[procI] + faceOs[i]; + label newNbr = fnd(); + label tgtFaceI = internalFaceOffset[procI]++; + + if (debug) + { + Pout<< " proc " << procI + << "\tinserting face:" << tgtFaceI + << " connection between owner " << newOwn + << " and neighbour " << newNbr + << endl; + } + + if (newOwn < newNbr) + { + // we have correct orientation + tgtFaces[tgtFaceI] = fcs[i]; + tgtFaceOwners[tgtFaceI] = newOwn; + tgtFaceNeighbours[tgtFaceI] = newNbr; + } + else + { + // reverse orientation + tgtFaces[tgtFaceI] = fcs[i].reverseFace(); + tgtFaceOwners[tgtFaceI] = newNbr; + tgtFaceNeighbours[tgtFaceI] = newOwn; + } + + add(tgtFaces[tgtFaceI], pointOffset[procI]); + + // mark with unique value + fnd() = -2; + } + } + } + } + } + + + forAll(allNbrProcIDs, procI) + { + const labelList& nbrProcI = allNbrProcIDs[procI]; + const labelList& localFaceI = allProcLocalFaceIDs[procI]; + const labelList& faceOs = allFaceOwners[procI]; + const labelList& faceNs = allFaceNeighbours[procI]; + const faceList& fcs = allFaces[procI]; + + forAll(nbrProcI, i) + { + // coupled boundary face + if (nbrProcI[i] != -1 && localFaceI[i] != -1) + { + label3 key; + key[0] = min(procI, nbrProcI[i]); + key[1] = max(procI, nbrProcI[i]); + key[2] = localFaceI[i]; + + label tgtFaceI = procFaceToGlobalCell[key]; + + if (tgtFaceI == -1) + { + FatalErrorIn + ( + "void Foam::meshToMeshNew::" + "distributeAndMergeCells" + "(" + "const mapDistribute&, " + "const polyMesh&, " + "const globalIndex&, " + "pointField&, " + "faceList&, " + "labelList&, " + "labelList&, " + "labelList&" + ") const" + ) + << "Unvisited " << key + << abort(FatalError); + } + else if (tgtFaceI != -2) + { + label newOwn = cellOffset[procI] + faceOs[i]; + label tgtFaceI = nIntFaces++; + + if (debug) + { + Pout<< " proc " << procI + << "\tinserting boundary face:" << tgtFaceI + << " from coupled face " << key + << endl; + } + + tgtFaces[tgtFaceI] = fcs[i]; + add(tgtFaces[tgtFaceI], pointOffset[procI]); + + tgtFaceOwners[tgtFaceI] = newOwn; + tgtFaceNeighbours[tgtFaceI] = -1; + } + } + // normal boundary face + else + { + label own = faceOs[i]; + label nbr = faceNs[i]; + if ((own != -1) && (nbr == -1)) + { + label newOwn = cellOffset[procI] + faceOs[i]; + label tgtFaceI = nIntFaces++; + + tgtFaces[tgtFaceI] = fcs[i]; + add(tgtFaces[tgtFaceI], pointOffset[procI]); + + tgtFaceOwners[tgtFaceI] = newOwn; + tgtFaceNeighbours[tgtFaceI] = -1; + } + } + } + } + + + if (debug) + { + // only merging points in debug mode + + labelList oldToNew; + pointField newTgtPoints; + bool hasMerged = mergePoints + ( + tgtPoints, + SMALL, + false, + oldToNew, + newTgtPoints + ); + + if (hasMerged) + { + if (debug) + { + Pout<< "Merged from " << tgtPoints.size() + << " down to " << newTgtPoints.size() << " points" << endl; + } + + tgtPoints.transfer(newTgtPoints); + forAll(tgtFaces, i) + { + inplaceRenumber(oldToNew, tgtFaces[i]); + } + } + } +} + + +// ************************************************************************* // diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..69bbc69667b466985a055d3c424b925eec0ca38f --- /dev/null +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNewTemplates.C @@ -0,0 +1,542 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2013 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 "fvMesh.H" +#include "volFields.H" +//#include "ops.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + //- Helper class for list + template<class Type> + class ListPlusEqOp + { + public: + void operator()(List<Type>& x, const List<Type> y) const + { + if (y.size()) + { + if (x.size()) + { + label sz = x.size(); + x.setSize(sz + y.size()); + forAll(y, i) + { + x[sz++] = y[i]; + } + } + else + { + x = y; + } + } + } + }; + + //- Combine operator for maps/interpolations + template<class Type, class CombineOp> + class combineBinaryOp + { + const CombineOp& cop_; + + public: + + combineBinaryOp(const CombineOp& cop) + : + cop_(cop) + {} + + void operator() + ( + Type& x, + const label faceI, + const Type& y, + const scalar weight + ) const + { + cop_(x, weight*y); + } + }; +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template<class Type> +void Foam::meshToMeshNew::add +( + UList<Type>& fld, + const label offset +) const +{ + forAll(fld, i) + { + fld[i] += offset; + } +} + + +template<class Type, class CombineOp> +void Foam::meshToMeshNew::mapSrcToTgt +( + const UList<Type>& srcField, + const CombineOp& cop, + List<Type>& result +) const +{ + if (result.size() != tgtToSrcCellAddr_.size()) + { + FatalErrorIn + ( + "void Foam::meshToMeshNew::mapSrcToTgt" + "(" + "const UList<Type>&, " + "const CombineOp&, " + "List<Type>&" + ") const" + ) << "Supplied field size is not equal to target mesh size" << nl + << " source mesh = " << srcToTgtCellAddr_.size() << nl + << " target mesh = " << tgtToSrcCellAddr_.size() << nl + << " supplied field = " << result.size() + << abort(FatalError); + } + + combineBinaryOp<Type, CombineOp> cbop(cop); + + if (singleMeshProc_ == -1) + { + const mapDistribute& map = srcMapPtr_(); + + List<Type> work(srcField); + map.distribute(work); + + forAll(result, cellI) + { + const labelList& srcAddress = tgtToSrcCellAddr_[cellI]; + const scalarList& srcWeight = tgtToSrcCellWght_[cellI]; + + if (srcAddress.size()) + { +// result[cellI] = pTraits<Type>::zero; + result[cellI] *= (1.0 - sum(srcWeight)); + forAll(srcAddress, i) + { + label srcI = srcAddress[i]; + scalar w = srcWeight[i]; + cbop(result[cellI], cellI, work[srcI], w); + } + } + } + } + else + { + forAll(result, cellI) + { + const labelList& srcAddress = tgtToSrcCellAddr_[cellI]; + const scalarList& srcWeight = tgtToSrcCellWght_[cellI]; + + if (srcAddress.size()) + { +// result[cellI] = pTraits<Type>::zero; + result[cellI] *= (1.0 - sum(srcWeight)); + forAll(srcAddress, i) + { + label srcI = srcAddress[i]; + scalar w = srcWeight[i]; + cbop(result[cellI], cellI, srcField[srcI], w); + } + } + } + } +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapSrcToTgt +( + const Field<Type>& srcField, + const CombineOp& cop +) const +{ + tmp<Field<Type> > tresult + ( + new Field<Type> + ( + tgtToSrcCellAddr_.size(), + pTraits<Type>::zero + ) + ); + + mapSrcToTgt(srcField, cop, tresult()); + + return tresult; +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapSrcToTgt +( + const tmp<Field<Type> >& tsrcField, + const CombineOp& cop +) const +{ + return mapSrcToTgt(tsrcField(), cop); +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapSrcToTgt +( + const Field<Type>& srcField +) const +{ + return mapSrcToTgt(srcField, plusEqOp<Type>()); +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapSrcToTgt +( + const tmp<Field<Type> >& tsrcField +) const +{ + return mapSrcToTgt(tsrcField()); +} + + +template<class Type, class CombineOp> +void Foam::meshToMeshNew::mapTgtToSrc +( + const UList<Type>& tgtField, + const CombineOp& cop, + List<Type>& result +) const +{ + if (result.size() != srcToTgtCellAddr_.size()) + { + FatalErrorIn + ( + "void Foam::meshToMeshNew::mapTgtToSrc" + "(" + "const UList<Type>&, " + "const CombineOp&, " + "List<Type>&" + ") const" + ) << "Supplied field size is not equal to source mesh size" << nl + << " source mesh = " << srcToTgtCellAddr_.size() << nl + << " target mesh = " << tgtToSrcCellAddr_.size() << nl + << " supplied field = " << result.size() + << abort(FatalError); + } + + combineBinaryOp<Type, CombineOp> cbop(cop); + + if (singleMeshProc_ == -1) + { + const mapDistribute& map = tgtMapPtr_(); + + List<Type> work(tgtField); + map.distribute(work); + + forAll(result, cellI) + { + const labelList& tgtAddress = srcToTgtCellAddr_[cellI]; + const scalarList& tgtWeight = srcToTgtCellWght_[cellI]; + + if (tgtAddress.size()) + { +// result[cellI] = pTraits<Type>::zero; + result[cellI] *= (1.0 - sum(tgtWeight)); + forAll(tgtAddress, i) + { + label tgtI = tgtAddress[i]; + scalar w = tgtWeight[i]; + cbop(result[cellI], cellI, work[tgtI], w); + } + } + } + } + else + { + forAll(result, cellI) + { + const labelList& tgtAddress = srcToTgtCellAddr_[cellI]; + const scalarList& tgtWeight = srcToTgtCellWght_[cellI]; + + if (tgtAddress.size()) + { +// result[cellI] = pTraits<Type>::zero; + result[cellI] *= (1.0 - sum(tgtWeight)); + forAll(tgtAddress, i) + { + label tgtI = tgtAddress[i]; + scalar w = tgtWeight[i]; + cbop(result[cellI], cellI, tgtField[tgtI], w); + } + } + } + } +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapTgtToSrc +( + const Field<Type>& tgtField, + const CombineOp& cop +) const +{ + tmp<Field<Type> > tresult + ( + new Field<Type> + ( + srcToTgtCellAddr_.size(), + pTraits<Type>::zero + ) + ); + + mapTgtToSrc(tgtField, cop, tresult()); + + return tresult; +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapTgtToSrc +( + const tmp<Field<Type> >& ttgtField, + const CombineOp& cop +) const +{ + return mapTgtToSrc(ttgtField(), cop); +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapTgtToSrc +( + const Field<Type>& tgtField +) const +{ + return mapTgtToSrc(tgtField, plusEqOp<Type>()); +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::meshToMeshNew::mapTgtToSrc +( + const tmp<Field<Type> >& ttgtField +) const +{ + return mapTgtToSrc(ttgtField(), plusEqOp<Type>()); +} + + +template<class Type, class CombineOp> +void Foam::meshToMeshNew::interpolate +( + const GeometricField<Type, fvPatchField, volMesh>& field, + const CombineOp& cop, + GeometricField<Type, fvPatchField, volMesh>& result, + const bool interpPatches +) const +{ + const fvMesh& mesh = field.mesh(); + + if (mesh.name() == srcRegionName_) + { + mapSrcToTgt(field, cop, result.internalField()); + } + else if (mesh.name() == tgtRegionName_) + { + mapTgtToSrc(field, cop, result.internalField()); + } + else + { + FatalErrorIn + ( + "void Foam::meshToMeshNew::interpolate" + "(" + "const GeometricField<Type, fvPatchField, volMesh>&, " + "const CombineOp&, " + "GeometricField<Type, fvPatchField, volMesh>&, " + "const bool" + ") const" + ) + << "Supplied field " << field.name() << " did not originate from " + << "either the source or target meshes used to create this " + << "interpolation object" + << abort(FatalError); + } + + if (interpPatches) + { + switch (method_) + { + case imMap: + { + result.boundaryField() == field.boundaryField(); + break; + } + default: + { + notImplemented + ( + "void Foam::meshToMeshNew::interpolate" + "(" + "const GeometricField<Type, fvPatchField, volMesh>&, " + "const CombineOp&, " + "GeometricField<Type, fvPatchField, volMesh>&, " + "const bool" + ") const - non-conformal patches" + ) + + // do something... + } + } + } +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > +Foam::meshToMeshNew::interpolate +( + const GeometricField<Type, fvPatchField, volMesh>& field, + const CombineOp& cop, + const bool interpPatches +) const +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const fvMesh& mesh = field.mesh(); + + tmp<fieldType> tresult; + + if (mesh.name() == srcRegionName_) + { + const fvMesh& tgtMesh = + mesh.time().lookupObject<fvMesh>(tgtRegionName_); + + tresult = + new fieldType + ( + IOobject + ( + type() + "::interpolate(" + field.name() + ")", + tgtMesh.time().timeName(), + tgtMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + tgtMesh, + dimensioned<Type> + ( + "zero", + field.dimensions(), + pTraits<Type>::zero + ) + ); + + interpolate(field, cop, tresult(), interpPatches); + } + else if (mesh.name() == tgtRegionName_) + { + const fvMesh& srcMesh = + mesh.time().lookupObject<fvMesh>(srcRegionName_); + + tresult = + new fieldType + ( + IOobject + ( + type() + "::interpolate(" + field.name() + ")", + srcMesh.time().timeName(), + srcMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + srcMesh, + dimensioned<Type> + ( + "zero", + field.dimensions(), + pTraits<Type>::zero + ) + ); + + interpolate(field, cop, tresult(), interpPatches); + } + + return tresult; +} + + +template<class Type, class CombineOp> +Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > +Foam::meshToMeshNew::interpolate +( + const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield, + const CombineOp& cop, + const bool interpPatches +) const +{ + return + interpolate + ( + tfield(), + combineBinaryOp<Type, CombineOp>(cop), + interpPatches + ); +} + + +template<class Type> +Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > +Foam::meshToMeshNew::interpolate +( + const GeometricField<Type, fvPatchField, volMesh>& field, + const bool interpPatches +) const +{ + return interpolate(field, plusEqOp<Type>(), interpPatches); +} + + +template<class Type> +Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > +Foam::meshToMeshNew::interpolate +( + const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfield, + const bool interpPatches +) const +{ + return interpolate(tfield(), plusEqOp<Type>(), interpPatches); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C index 3edfd4ce38415dcdcd4965987d83caaee292d324..08dd1e3764ec870d6b275cc47ba2965006e421db 100644 --- a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C +++ b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.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) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -312,7 +312,30 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const { const volScalarField& dQ = mesh_.lookupObject<volScalarField>("dQ"); - E().internalField() = EhrrCoeff_*dQ; + + if (dQ.dimensions() == dimEnergy/dimTime) + { + E().internalField() = EhrrCoeff_*dQ/mesh_.V(); + } + else if (dQ.dimensions() == dimEnergy/dimTime/dimVolume) + { + E().internalField() = EhrrCoeff_*dQ; + } + else + { + if (debug) + { + WarningIn + ( + "tmp<volScalarField>" + "radiation::greyMeanAbsorptionEmission::ECont" + "(" + "const label" + ") const" + ) + << "Incompatible dimensions for dQ field" << endl; + } + } } return E; diff --git a/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions index 5b2d93ccfa1bbc34143631728df3e7ae76bee04d..246601aa16809058e5c22005e82551c4f7c21e38 100644 --- a/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions +++ b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvOptions b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvOptions index f0a9fed5d801da8e29cc5b1ca71fe2bb290495e7..4f0ffe9c1b35ac294dd47d191ab7067ee24208bc 100644 --- a/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvOptions +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions index 9f8e69357aea15da91458f0c556bd183c7798b0b..d75a43c56502a9b451c820f3e98561755f44fcf6 100644 --- a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/T b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/T new file mode 100644 index 0000000000000000000000000000000000000000..fcb0067f35b9fc36dccb95aa1a362afc7601ca4f --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/T @@ -0,0 +1,46 @@ +/*--------------------------------*- 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; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + walls + { + type zeroGradient; + } + inlet + { + type fixedValue; + value uniform 300; + } + outlet + { + type inletOutlet; + inletValue uniform 300; + value uniform 300; + } + blades + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/U b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/U new file mode 100644 index 0000000000000000000000000000000000000000..a5466e363623cb28d2f8cd959e184f6ada5be9a6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/U @@ -0,0 +1,48 @@ +/*--------------------------------*- 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 volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + walls + { + type fixedValue; + value uniform (0 0 0); + } + inlet + { + type fixedValue; + value uniform (0 0 5); + } + outlet + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + blades + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/epsilon b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..46cfcab3a224cb4d925d3b113fbc112ec14f098d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/epsilon @@ -0,0 +1,46 @@ +/*--------------------------------*- 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; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 0.54; + +boundaryField +{ + walls + { + type compressible::epsilonWallFunction; + value $internalField; + } + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type zeroGradient; + } + blades + { + type compressible::epsilonWallFunction; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/k b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/k new file mode 100644 index 0000000000000000000000000000000000000000..6a2ab6f9406ff84ea976a052b0f27c58407de619 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/k @@ -0,0 +1,46 @@ +/*--------------------------------*- 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; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.375; + +boundaryField +{ + walls + { + type compressible::kqRWallFunction; + value $internalField; + } + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type zeroGradient; + } + blades + { + type compressible::kqRWallFunction; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p new file mode 100644 index 0000000000000000000000000000000000000000..f20dd774efa6707a313a9344bae12c4739f355dd --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p @@ -0,0 +1,47 @@ +/*--------------------------------*- 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; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + walls + { + type calculated; + value uniform 100000; + } + inlet + { + type calculated; + value uniform 100000; + } + outlet + { + type calculated; + value uniform 100000; + } + blades + { + type calculated; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p_rgh b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..7561126b389bd57f873cbf7ba2967af8e703ee3b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/air/p_rgh @@ -0,0 +1,49 @@ +/*--------------------------------*- 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; + location "0"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + walls + { + type buoyantPressure; + gradient uniform 0; + value uniform 100000; + } + inlet + { + type buoyantPressure; + gradient uniform 0; + value uniform 100000; + } + outlet + { + type fixedValue; + value uniform 100000; + } + blades + { + type buoyantPressure; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/AoV b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/AoV new file mode 100644 index 0000000000000000000000000000000000000000..0791bb96bedf9955098c921cf38b09f3a90c339f --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/AoV @@ -0,0 +1,31 @@ +/*--------------------------------*- 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; + location "0"; + object AoV; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 -1 0 0 0 0 0]; + +internalField uniform 200; + +boundaryField +{ + ".*" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/T b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/T new file mode 100644 index 0000000000000000000000000000000000000000..bd86a29732db424fae8ef694c3fac7f0e0b4f79d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/T @@ -0,0 +1,42 @@ +/*--------------------------------*- 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; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 350; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 400; + } + outlet + { + type inletOutlet; + inletValue uniform 350; + value uniform 350; + } + fixedWalls + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/U b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/U new file mode 100644 index 0000000000000000000000000000000000000000..23454ad6de0aef276ddc6eafea8ca0566c8047ae --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/U @@ -0,0 +1,43 @@ +/*--------------------------------*- 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 volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0.01 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0.01 0 0); + } + outlet + { + type inletOutlet; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + fixedWalls + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/htcConst b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/htcConst new file mode 100644 index 0000000000000000000000000000000000000000..4f3040e85a7b6e7d9b305ce7069aa1a82e0a4a7c --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/htcConst @@ -0,0 +1,31 @@ +/*--------------------------------*- 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; + location "0"; + object htcConst; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 0 -3 -1 0 0 0]; + +internalField uniform 10; + +boundaryField +{ + ".*" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p new file mode 100644 index 0000000000000000000000000000000000000000..db0ae810f970124f1f6719d1b811636b47a140fb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p @@ -0,0 +1,42 @@ +/*--------------------------------*- 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; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + inlet + { + type calculated; + value uniform 100000; + } + outlet + { + type calculated; + value uniform 100000; + } + fixedWalls + { + type calculated; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p_rgh b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..6b4bc21fb3bfd235b1a911d38348e0ff4a4a388d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/0.org/porous/p_rgh @@ -0,0 +1,44 @@ +/*--------------------------------*- 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; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + inlet + { + type buoyantPressure; + gradient uniform 0; + value uniform 100000; + } + outlet + { + type fixedValue; + value uniform 100000; + } + fixedWalls + { + type buoyantPressure; + gradient uniform 0; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allclean b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..a91545168934941ec0bbab344bdff15bb8c9c435 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allclean @@ -0,0 +1,15 @@ +#!/bin/bash + +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +foamClearPolyMesh -region air +foamClearPolyMesh -region porous + +rm -f *.OpenFOAM + +rm -rf 0 diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..c01a61be8175b8691190be4d60817cb8cdef111a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun @@ -0,0 +1,10 @@ +#!/bin/bash + +cd ${0%/*} || exit 1 # run from this directory + +./Allrun.pre + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication $(getApplication) diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel new file mode 100755 index 0000000000000000000000000000000000000000..6c26ff780125f04f5a3ec8c6d71b319b9944243b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun-parallel @@ -0,0 +1,22 @@ +#!/bin/bash + +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +runApplication decomposePar -region air +mv log.decomposePar log.decomposePar.air + +runApplication decomposePar -region porous +mv log.decomposePar log.decomposePar.porous + +runParallel $(getApplication) 4 + +runApplication reconstructPar -latestTime -region air +mv log.reconstructPar log.reconstructPar.air + +runApplication reconstructPar -latestTime -region porous +mv log.reconstructPar log.reconstructPar.porous diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..99db2af1b64ef9f0978e7474d6ff0b150c1542ff --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/Allrun.pre @@ -0,0 +1,31 @@ +#!/bin/bash + +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +#create meshes +runApplication blockMesh -region air +mv log.blockMesh log.blockMesh.air +runApplication blockMesh -region porous +mv log.blockMesh log.blockMesh.porous + +# create rotor blades in air region +runApplication topoSet -region air -dict system/topoSetDict.1 +mv log.topoSet log.topoSet.air.1 + +runApplication createBaffles -region air -overwrite + +# create rotor zone in air region for MRF +runApplication topoSet -region air -dict system/topoSetDict.2 +mv log.topoSet log.topoSet.air.2 + +rm -rf constant/air/polyMesh/sets + +# create dummy files for post-processing +paraFoam -touch -region porous +paraFoam -touch -region air + + +cp -rf 0.org 0 diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/RASProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..a4937b503a46850b2626f0d301e4a07b9f691507 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- 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; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/g b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/g new file mode 100644 index 0000000000000000000000000000000000000000..6343b983a806838548c091fa3ec5d6b8be7e2725 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/g @@ -0,0 +1,23 @@ +/*--------------------------------*- 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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +//value ( 0 0 9.81); +value ( 0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/polyMesh/blockMeshDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..d0439108c7c61a85f821ab4b75b03424feced8bf --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/polyMesh/blockMeshDict @@ -0,0 +1,149 @@ +/*--------------------------------*- 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 blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.05; + +vertices +( + (0 0 0) // 0 + (10 0 0) // 1 + (10 10 0) // 2 + (0 10 0) // 3 + + (2.879 2.879 0) // 4 + (7.121 2.879 0) // 5 + (7.121 7.121 0) // 6 + (2.879 7.121 0) // 7 + + (4.293 4.293 0) // 8 + (5.707 4.293 0) // 9 + (5.707 5.707 0) // 10 + (4.293 5.707 0) // 11 + + + (0 0 10) // 12 + (10 0 10) // 13 + (10 10 10) // 14 + (0 10 10) // 15 + + (2.879 2.879 10) // 16 + (7.121 2.879 10) // 17 + (7.121 7.121 10) // 18 + (2.879 7.121 10) // 19 + + (4.293 4.293 10) // 20 + (5.707 4.293 10) // 20 + (5.707 5.707 10) // 22 + (4.293 5.707 10) // 23 +); + +blocks +( + hex (0 1 5 4 12 13 17 16) (30 30 30) simpleGrading (1 1 1) + hex (1 2 6 5 13 14 18 17) (30 30 30) simpleGrading (1 1 1) + hex (2 3 7 6 14 15 19 18) (30 30 30) simpleGrading (1 1 1) + hex (3 0 4 7 15 12 16 19) (30 30 30) simpleGrading (1 1 1) + hex (4 5 9 8 16 17 21 20) cylinder (30 30 30) simpleGrading (1 1 1) + hex (5 6 10 9 17 18 22 21) cylinder (30 30 30) simpleGrading (1 1 1) + hex (6 7 11 10 18 19 23 22) cylinder (30 30 30) simpleGrading (1 1 1) + hex (7 4 8 11 19 16 20 23) cylinder (30 30 30) simpleGrading (1 1 1) + hex (8 9 10 11 20 21 22 23) innerCylinder (30 30 30) simpleGrading (1 1 1) +); + +edges +( + arc 4 5 (5 2 0) + arc 5 6 (8 5 0) + arc 6 7 (5 8 0) + arc 7 4 (2 5 0) + + arc 8 9 (5 4 0) + arc 9 10 (6 5 0) + arc 10 11 (5 6 0) + arc 11 8 (4 5 0) + + arc 16 17 (5 2 10) + arc 17 18 (8 5 10) + arc 18 19 (5 8 10) + arc 19 16 (2 5 10) + + arc 20 21 (5 4 10) + arc 21 22 (6 5 10) + arc 22 23 (5 6 10) + arc 23 20 (4 5 10) +); + +boundary +( + walls + { + type wall; + faces + ( + (0 4 5 1) + (1 5 6 2) + (2 6 7 3) + (3 7 4 0) + + (12 13 17 16) + (13 14 18 17) + (14 15 19 18) + (15 12 16 19) + + (0 12 13 1) + (1 13 14 2) + (2 14 15 3) + (3 15 12 0) + ); + } + inlet + { + type patch; + faces + ( + (4 8 9 5) + (5 9 10 6) + (6 10 11 7) + (7 11 8 4) + (8 11 10 9) + ); + } + outlet + { + type patch; + faces + ( + (16 17 21 20) + (17 18 22 21) + (18 19 23 22) + (19 16 20 23) + (20 21 22 23) + ); + } + + blades + { + type wall; + faces + (); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/radiationProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/radiationProperties new file mode 100644 index 0000000000000000000000000000000000000000..aa0a16678fffa3432de0ed92160ddd832061c2ef --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/radiationProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- 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; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..b3c0a5899815e6b8b2b403e0684b651639cdd822 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/thermophysicalProperties @@ -0,0 +1,55 @@ +/*--------------------------------*- 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; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport polynomial; + thermo hPolynomial; + equationOfState icoPolynomial; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + // coefficients for air + + specie + { + nMoles 1; + molWeight 28.85; + } + equationOfState + { + rhoCoeffs<8> ( 4.0097 -0.016954 3.3057e-05 -3.0042e-08 1.0286e-11 0 0 0 ); + } + thermodynamics + { + Hf 0; + Sf 0; + CpCoeffs<8> ( 948.76 0.39171 -0.00095999 1.393e-06 -6.2029e-10 0 0 0 ); + } + transport + { + muCoeffs<8> ( 1.5061e-06 6.16e-08 -1.819e-11 0 0 0 0 0 ); + kappaCoeffs<8> ( 0.0025219 8.506e-05 -1.312e-08 0 0 0 0 0 ); + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..3721a46a2ead37eb2bf10434bcde59afa9fe9bf6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/air/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- 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; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/RASProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..1cc42b8af81227d09c91f3d1cfe899e474a5236b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/RASProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- 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 RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel laminar; + +turbulence off; + +printCoeffs off; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/g b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/g new file mode 100644 index 0000000000000000000000000000000000000000..6343b983a806838548c091fa3ec5d6b8be7e2725 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/g @@ -0,0 +1,23 @@ +/*--------------------------------*- 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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +//value ( 0 0 9.81); +value ( 0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/polyMesh/blockMeshDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..f32b1c76217233732b5d3515caa2da74edcad0c2 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/polyMesh/blockMeshDict @@ -0,0 +1,76 @@ +/*--------------------------------*- 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 blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.05; + +vertices +( + (-2 2 6) // 0 + (12 2 6) // 1 + (12 8 6) // 2 + (-2 8 6) // 3 + + (-2 2 7) // 4 + (12 2 7) // 5 + (12 8 7) // 6 + (-2 8 7) // 7 +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (40 30 30) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + outlet + { + type patch; + faces + ( + (1 2 6 5) + ); + } + fixedWalls + { + type wall; + faces + ( + (0 1 2 3) + (4 5 6 7) + (3 2 6 7) + (0 1 5 4) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..41e355a66bf6ba1ba57b1d39d918658f5d0d47d5 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/thermophysicalProperties @@ -0,0 +1,55 @@ +/*--------------------------------*- 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 heRhoThermo; + mixture pureMixture; + transport polynomial; + thermo hPolynomial; + equationOfState icoPolynomial; + specie specie; + energy sensibleEnthalpy; +} + + +mixture +{ + // coefficients for water + + specie + { + nMoles 1; + molWeight 18; + } + equationOfState + { + rhoCoeffs<8> ( 1000 0 0 0 0 0 0 0 ); + } + thermodynamics + { + Hf 0; + Sf 0; + CpCoeffs<8> ( 4183 0 0 0 0 0 0 0 ); + } + transport + { + muCoeffs<8> ( 0.001 0 0 0 0 0 0 0 ); + kappaCoeffs<8> ( 0.58 0 0 0 0 0 0 0 ); + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e63bbc50815e89dfc7ef93352a3228a18620220d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/porous/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- 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 turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/regionProperties new file mode 100644 index 0000000000000000000000000000000000000000..749edd93d52f44760b55a0c57c1588b9fce9ce55 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/constant/regionProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- 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; + location "constant"; + object regionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +regions +( + fluid (air porous) + solid () +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/createBafflesDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..818b3b232044067fa203f5c2c3aa34ddc0d41257 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/createBafflesDict @@ -0,0 +1,52 @@ +/*--------------------------------*- 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 createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + + +// Baffles to create. +baffles +{ + baffleFaces + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName rotorBlades; + + + patches + { + master + { + //- Master side patch + name blades; + type patch; + } + slave + { + //- Slave side patch + name blades; + type patch; + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..645728dc500f665c9e1e372fdf2124b85c2ffcaa --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/decomposeParDict @@ -0,0 +1,45 @@ +/*--------------------------------*- 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; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 1 1 1 ); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions new file mode 100644 index 0000000000000000000000000000000000000000..00978429d9b793b60ee8a71b46e1991097ba27ff --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions @@ -0,0 +1,76 @@ +/*--------------------------------*- 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; + location "system"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +airToporous +{ + type constantHeatTransfer; + active on; + selectionMode mapRegion; + interpolationMethod cellVolumeWeight; + nbrRegionName porous; + master false; + + constantHeatTransferCoeffs + { + nbrModelName porousToair; + fieldNames (h); + semiImplicit no; + } +} + +porosityBlockage +{ + type interRegionExplicitPorositySource; + active on; + selectionMode mapRegion; + interpolationMethod cellVolumeWeight; + nbrRegionName porous; + + interRegionExplicitPorositySourceCoeffs + { + type DarcyForchheimer; + + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0] (10 -1000 -1000); + f f [0 -1 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0 1 0); + e2 (0 0 1); + } + } + } +} + +MRF1 +{ + type MRFSource; + active true; + selectionMode cellZone; + cellZone rotor; + + MRFSourceCoeffs + { + origin (0.25 0.25 0.25); + axis (0 0 1); + omega 5.305; // 500 rpm + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..a39397c7c31c55c99376c2fa1f2823d12a7304bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSchemes @@ -0,0 +1,63 @@ +/*--------------------------------*- 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; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(U) cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss upwind; + div(phi,h) bounded Gauss upwind; + div(phi,e) bounded Gauss upwind; + div(phi,K) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; + div((muEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited 0.333; +} + +fluxRequired +{ + default no; + p_rgh; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..36d404271f4b361b2d2656d17203955648bfe1ba --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvSolution @@ -0,0 +1,70 @@ +/*--------------------------------*- 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; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother DIC; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + maxIter 100; + } + + "(U|h|e|k|epsilon)" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; + rhoMax rhoMax [ 1 -3 0 0 0 ] 2; + rhoMin rhoMin [ 1 -3 0 0 0 ] 1; +} + + +relaxationFactors +{ + fields + { + rho 1; + p_rgh 0.7; + } + equations + { + U 0.3; + "(h|e)" 0.3; + k 0.3; + epsilon 0.3; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1 b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1 new file mode 100644 index 0000000000000000000000000000000000000000..36dc18f95f2eee79c3e4386020564b18cde51344 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.1 @@ -0,0 +1,120 @@ +/*--------------------------------*- 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 topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + // rotor faces + { + name rotorCells; + type cellSet; + action new; + source zoneToCell; + sourceInfo + { + name cylinder; + } + } + { + name rotorFaces; + type faceSet; + action new; + source cellToFace; + sourceInfo + { + set rotorCells; + option all; + } + } + { + name rotorFaces; + type faceSet; + action subset; + source boxToFace; + sourceInfo + { + box (-100 -100 0.1) (100 100 0.15); + } + } + + { + name rotorBlades; + type faceSet; + action new; + source faceToFace; + sourceInfo + { + set rotorFaces; + } + } + + { + name rotorBlades; + type faceSet; + action subset; + source boxToFace; + sourceInfo + { + box (-100 0.249 -100) (100 0.251 100); + } + } + + { + name rotorBlades2; + type faceSet; + action new; + source faceToFace; + sourceInfo + { + set rotorFaces; + } + } + + { + name rotorBlades2; + type faceSet; + action subset; + source boxToFace; + sourceInfo + { + box (0.249 -100 -100) (0.251 100 100); + } + } + + { + name rotorBlades; + type faceSet; + action add; + source faceToFace; + sourceInfo + { + set rotorBlades2; + } + } + { + name rotorBlades; + type faceZoneSet; + action new; + source setToFaceZone; + sourceInfo + { + faceSet rotorBlades; + } + } +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2 b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2 new file mode 100644 index 0000000000000000000000000000000000000000..f9f33b10954b47fea34ac866b6404346040551d8 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/topoSetDict.2 @@ -0,0 +1,64 @@ +/*--------------------------------*- 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 topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + // rotor cell zone + { + name rotorCells; + type cellSet; + action new; + source zoneToCell; + sourceInfo + { + name cylinder; + } + } + { + name rotorCells; + type cellSet; + action add; + source zoneToCell; + sourceInfo + { + name innerCylinder; + } + } + { + name rotorCells; + type cellSet; + action subset; + source boxToCell; + sourceInfo + { + box (-100 -100 0.1) (100 100 0.15); + } + } + { + name rotor; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set rotorCells; + } + } +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/controlDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..afc00df3f20eb8fd209399f3547dc7c0760a05a7 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- 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; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionSimpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 2000; + +deltaT 1; + +writeControl timeStep; + +writeInterval 50; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..645728dc500f665c9e1e372fdf2124b85c2ffcaa --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/decomposeParDict @@ -0,0 +1,45 @@ +/*--------------------------------*- 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; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 1 1 1 ); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..e7d321e95943268ef62b4a5e1d25ebbc469551bb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSchemes @@ -0,0 +1,46 @@ +/*--------------------------------*- 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 fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ +} + +gradSchemes +{ +} + +divSchemes +{ +} + +laplacianSchemes +{ +} + +interpolationSchemes +{ +} + +snGradSchemes +{ +} + +fluxRequired +{ +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..cde9e49189fb2cd3795d3a5649417e7390f543e3 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/fvSolution @@ -0,0 +1,22 @@ +/*--------------------------------*- 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 fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +PIMPLE +{ + nOuterCorrectors 1; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/decomposeParDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..e7e490bf74b1a3f58a34923b4f98569f1b09e483 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/decomposeParDict @@ -0,0 +1,45 @@ +/*--------------------------------*- 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; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + +hierarchicalCoeffs +{ + n ( 1 1 1 ); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvOptions b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvOptions new file mode 100644 index 0000000000000000000000000000000000000000..f2f64e4882f1e48e05b28dc60cbbfda7e218fa5f --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvOptions @@ -0,0 +1,35 @@ +/*--------------------------------*- 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; + location "system"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +porousToair +{ + type constantHeatTransfer; + active on; + selectionMode mapRegion; + interpolationMethod cellVolumeWeight; + nbrRegionName air; + master true; + + constantHeatTransferCoeffs + { + nbrModelName airToporous; + fieldNames (h); + semiImplicit no; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSchemes b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..f787aa1bb47da4a177e1e12f8fa090c5625d8641 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSchemes @@ -0,0 +1,61 @@ +/*--------------------------------*- 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 fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss upwind; + div(phi,h) bounded Gauss upwind; + div(phi,e) bounded Gauss upwind; + div(phi,Ekp) bounded Gauss upwind; + div(phi,K) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; + div((muEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + +fluxRequired +{ + default no; + p_rgh; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSolution b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..fd6da4016c5f88d16188fa4e1a3762d94be588bd --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/porous/fvSolution @@ -0,0 +1,68 @@ +/*--------------------------------*- 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 fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother DIC; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + maxIter 100; + } + + "(U|h|e|k|epsilon)" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-7; + relTol 0.1; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; + rhoMax rhoMax [ 1 -3 0 0 0 ] 1100; + rhoMin rhoMin [ 1 -3 0 0 0 ] 900; +} + +relaxationFactors +{ + fields + { + rho 1; + p_rgh 0.7; + } + equations + { + U 0.3; + "(h|e)" 0.3; + k 0.3; + epsilon 0.3; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/channel395/system/fvOptions b/tutorials/incompressible/pimpleFoam/channel395/system/fvOptions index 97bf730df962c78470214f8f4786a3b79ca35a2d..681d7e39ff0d3f1bf8b9aabfb3932547c2474ba0 100644 --- a/tutorials/incompressible/pimpleFoam/channel395/system/fvOptions +++ b/tutorials/incompressible/pimpleFoam/channel395/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions index 594e280853b285ae417c146b786c21baf1db1478..f55734732b96e85b72e33e33272d51a004205fb2 100644 --- a/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions +++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/fvOptions b/tutorials/incompressible/simpleFoam/turbineSiting/system/fvOptions index a09b67dc9f070d8389748c3f77f8918834186145..61e7340025490ccf9f6ac9187d5b5ef76d51c49f 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/system/fvOptions +++ b/tutorials/incompressible/simpleFoam/turbineSiting/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvOptions b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvOptions index ee4efec416d6a6bfc9dab30f4070fff72fdba605..82e5c6b4b02bdfa1641c107e64de005db2aa0330 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvOptions +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/system/fvOptions b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/system/fvOptions index ee4efec416d6a6bfc9dab30f4070fff72fdba605..82e5c6b4b02bdfa1641c107e64de005db2aa0330 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/system/fvOptions +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvOptions b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvOptions index ef873bfa2531f4a15a8e78d0e6ecb313a2e93c28..f3194e5954812930428b174be96efd323a9dec44 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvOptions +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties index 42ddef823562d0f19e64ba22fa74c97fc5496bfb..bcb3e3e80d63667f4ed013fb1be631777cff6e33 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties @@ -133,7 +133,24 @@ subModels cloudFunctions -{} +{ + particleCollector + { + mode concentricCircle; + + origin (0.05 0.025 0.005); + radius (0.01 0.025 0.05); + nSector 10; + refDir (1 0 0); + normal (0 0 1); + + negateParcelsOppositeNormal no; + removeCollected no; + surfaceFormat vtk; + resetOnWrite no; + log yes; + } +} // ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions index 82c4f9ed19fe73eac476ba9eebe488ee2628f369..c7dd4992aa7e4c03c46cff585984fe7162ecde89 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvOptions b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvOptions index ee4efec416d6a6bfc9dab30f4070fff72fdba605..82e5c6b4b02bdfa1641c107e64de005db2aa0330 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvOptions +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvOptions @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class dictionary; - location "constant"; + location "system"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/H2O b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/H2O new file mode 100644 index 0000000000000000000000000000000000000000..baa8dd215249e6e3f0fe64afc48765f538351869 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/H2O @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object H2O; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.01; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 0.0; + } + inletSides + { + type fixedValue; + value uniform 0.01; + } + inletCentral + { + type fixedValue; + value uniform 0.01; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/T b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/T new file mode 100644 index 0000000000000000000000000000000000000000..df744edb03e1e986aec2b3d1b5f622e209bb44d0 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/T @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 473.0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 473.0; + } + inletSides + { + type fixedValue; + value uniform 473.0; + } + inletCentral + { + type fixedValue; + value uniform 573.0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/U b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/U new file mode 100644 index 0000000000000000000000000000000000000000..401e7ced02b50c284bd6f29860de5283660b49c2 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/U @@ -0,0 +1,59 @@ +/*--------------------------------*- 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 volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type flowRateInletVelocity; + rhoInlet 1.2; + massFlowRate constant 0.00379; + value uniform (0 14.68 0); + } + inletSides + { + type flowRateInletVelocity; + rhoInlet 1.2; + massFlowRate constant 0.00832; + value uniform (0 17.79 0); + } + outlet + { + type inletOutlet; + inletValue uniform (0 0 0); + } + walls + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/air b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/air new file mode 100644 index 0000000000000000000000000000000000000000..81541afef9ba8bd7dce383d397ed237ab2babffb --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/air @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object air; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.99; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 1.0; + } + inletSides + { + type fixedValue; + value uniform 0.99; + } + inletCentral + { + type fixedValue; + value uniform 0.99; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/alphat b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/alphat new file mode 100644 index 0000000000000000000000000000000000000000..33d260bf7c08ac66cd93e39c7ffe42695a15258f --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/alphat @@ -0,0 +1,56 @@ +/*--------------------------------*- 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; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type calculated; + value uniform 0; + } + inletSides + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + walls + { + type alphatWallFunction; + Prt 0.85; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/k b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/k new file mode 100644 index 0000000000000000000000000000000000000000..2a76936893757ac6bb3379bc2dcf737d40fb1b69 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/k @@ -0,0 +1,57 @@ +/*--------------------------------*- 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; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 3.75e-9; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.15; + value uniform 3.75e-9; + } + inletSides + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.16; + value uniform 3.75e-9; + } + outlet + { + type inletOutlet; + inletValue uniform 3.75e-9; + } + walls + { + type compressible::kqRWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/mut b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/mut new file mode 100644 index 0000000000000000000000000000000000000000..7cfeaae133d7fe8289f4a415540c45b7a6a9b5fe --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/mut @@ -0,0 +1,58 @@ +/*--------------------------------*- 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; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type calculated; + value uniform 0; + } + inletSides + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + walls + { + type mutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/omega b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/omega new file mode 100644 index 0000000000000000000000000000000000000000..efd2924775d02edef8c912c48bed1fab405616a0 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/omega @@ -0,0 +1,62 @@ +/*--------------------------------*- 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; + location "0"; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 4.5e-3; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type compressible::turbulentMixingLengthFrequencyInlet; + mixingLength 0.007; + k k; + value uniform 4.5e-3; + } + inletSides + { + type compressible::turbulentMixingLengthFrequencyInlet; + mixingLength 0.007; + k k; + value uniform 4.5e-3; + } + outlet + { + type inletOutlet; + inletValue uniform 4.5e-3; + } + walls + { + type compressible::omegaWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/p b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/p new file mode 100644 index 0000000000000000000000000000000000000000..921f06d7a1410ee338d624c9c455acf38976d7ca --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0.org/p @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type zeroGradient; + } + inletSides + { + type zeroGradient; + } + outlet + { + type fixedValue; + value uniform 100000; + } + walls + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O new file mode 100644 index 0000000000000000000000000000000000000000..baa8dd215249e6e3f0fe64afc48765f538351869 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/H2O @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object H2O; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.01; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 0.0; + } + inletSides + { + type fixedValue; + value uniform 0.01; + } + inletCentral + { + type fixedValue; + value uniform 0.01; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T new file mode 100644 index 0000000000000000000000000000000000000000..df744edb03e1e986aec2b3d1b5f622e209bb44d0 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/T @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 473.0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 473.0; + } + inletSides + { + type fixedValue; + value uniform 473.0; + } + inletCentral + { + type fixedValue; + value uniform 573.0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U new file mode 100644 index 0000000000000000000000000000000000000000..401e7ced02b50c284bd6f29860de5283660b49c2 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/U @@ -0,0 +1,59 @@ +/*--------------------------------*- 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 volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type flowRateInletVelocity; + rhoInlet 1.2; + massFlowRate constant 0.00379; + value uniform (0 14.68 0); + } + inletSides + { + type flowRateInletVelocity; + rhoInlet 1.2; + massFlowRate constant 0.00832; + value uniform (0 17.79 0); + } + outlet + { + type inletOutlet; + inletValue uniform (0 0 0); + } + walls + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air new file mode 100644 index 0000000000000000000000000000000000000000..81541afef9ba8bd7dce383d397ed237ab2babffb --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/air @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + location "0"; + object air; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.99; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + outlet + { + type inletOutlet; + inletValue uniform 1.0; + } + inletSides + { + type fixedValue; + value uniform 0.99; + } + inletCentral + { + type fixedValue; + value uniform 0.99; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat new file mode 100644 index 0000000000000000000000000000000000000000..33d260bf7c08ac66cd93e39c7ffe42695a15258f --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/alphat @@ -0,0 +1,56 @@ +/*--------------------------------*- 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; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type calculated; + value uniform 0; + } + inletSides + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + walls + { + type alphatWallFunction; + Prt 0.85; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k new file mode 100644 index 0000000000000000000000000000000000000000..2a76936893757ac6bb3379bc2dcf737d40fb1b69 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/k @@ -0,0 +1,57 @@ +/*--------------------------------*- 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; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 3.75e-9; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.15; + value uniform 3.75e-9; + } + inletSides + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.16; + value uniform 3.75e-9; + } + outlet + { + type inletOutlet; + inletValue uniform 3.75e-9; + } + walls + { + type compressible::kqRWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/mut b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/mut new file mode 100644 index 0000000000000000000000000000000000000000..7cfeaae133d7fe8289f4a415540c45b7a6a9b5fe --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/mut @@ -0,0 +1,58 @@ +/*--------------------------------*- 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; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type calculated; + value uniform 0; + } + inletSides + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + walls + { + type mutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega new file mode 100644 index 0000000000000000000000000000000000000000..efd2924775d02edef8c912c48bed1fab405616a0 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/omega @@ -0,0 +1,62 @@ +/*--------------------------------*- 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; + location "0"; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 4.5e-3; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type compressible::turbulentMixingLengthFrequencyInlet; + mixingLength 0.007; + k k; + value uniform 4.5e-3; + } + inletSides + { + type compressible::turbulentMixingLengthFrequencyInlet; + mixingLength 0.007; + k k; + value uniform 4.5e-3; + } + outlet + { + type inletOutlet; + inletValue uniform 4.5e-3; + } + walls + { + type compressible::omegaWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p new file mode 100644 index 0000000000000000000000000000000000000000..921f06d7a1410ee338d624c9c455acf38976d7ca --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/0/p @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + back + { + type symmetryPlane; + } + front + { + type symmetryPlane; + } + inletCentral + { + type zeroGradient; + } + inletSides + { + type zeroGradient; + } + outlet + { + type fixedValue; + value uniform 100000; + } + walls + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..d0839b002eb376e2de9b5aa131643eb374dcb7a2 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allclean @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +# remove old time and post-processing folders +rm -rf 0 *[1-9]* processor* postProcessing + +# copy 0.org to 0 +cp -r 0.org 0 + +cleanCase + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..36e8545b8433fc1700f3b5d5da6d44f0802b54e7 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/Allrun @@ -0,0 +1,19 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +rm -rf 0 +cp -rf 0.org 0 + +runApplication blockMesh + +runApplication potentialFoam + +# remove incompatible (volumetric) flux field +rm -f 0/phi + +runApplication $(getApplication) + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/RASProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..568821b00def4945fcf168421ab44c7f7cd3c15a --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/RASProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- 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 RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kOmegaSST; // kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/chemistryProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/chemistryProperties new file mode 100644 index 0000000000000000000000000000000000000000..0fbd9de5dcc424374b17d62042e5db08e9365fb8 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/chemistryProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- 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; + location "constant"; + object chemistryProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +chemistryType +{ + chemistrySolver noChemistrySolver; + chemistryThermo rho; +} + +chemistry off; + +initialChemicalTimeStep 1e-07; // NOT USED + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/combustionProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/combustionProperties new file mode 100644 index 0000000000000000000000000000000000000000..5ede7572c37fca677e4af0a3151992688cdaaa60 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/combustionProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- 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; + location "constant"; + object combustionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +combustionModel PaSR<rhoChemistryCombustion>; + +active false; + +PaSRCoeffs +{ + Cmix 0.1; + turbulentReaction off; + useReactionRate true; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/g b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..e0ac2653b5b370ad62f6770588121d30cac51627 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- 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 uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/particleTrackDict b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/particleTrackDict new file mode 100644 index 0000000000000000000000000000000000000000..bf4c329856e92a8c3a82b861504bef6caa21be96 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/particleTrackDict @@ -0,0 +1,28 @@ +/*--------------------------------*- 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; + location "constant"; + object particleTrackDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +cloudName reactingCloud1Tracks; + +fields +( + d + U + T +); + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/blockMeshDict b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..47e0eb9f8ca7322211c430642fd596037deb7940 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/blockMeshDict @@ -0,0 +1,223 @@ +/*--------------------------------*- 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; + location ""; + note "Created Wed Jul 1 19:20:21 2009. Blocks = 8, cells = 9340, vertices = 36"; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + // front vertices + ( 0.00000e+00 -2.30000e+02 2.50000e+01) // v0 0 + ( 0.00000e+00 -3.00000e+01 2.50000e+01) // v1 1 + ( 0.00000e+00 0.00000e+00 2.50000e+01) // v2 2 + ( 0.00000e+00 1.05000e+03 2.50000e+01) // v3 3 + ( 9.00000e+00 1.05000e+03 2.50000e+01) // v4 4 + ( 1.60000e+01 1.05000e+03 2.50000e+01) // v5 5 + ( 2.50000e+01 1.05000e+03 2.50000e+01) // v6 6 + ( 2.50000e+01 0.00000e+00 2.50000e+01) // v7 7 + ( 2.50000e+01 -3.00000e+01 2.50000e+01) // v8 8 + ( 2.50000e+01 -2.30000e+02 2.50000e+01) // v9 9 + ( 1.80000e+01 -2.30000e+02 2.50000e+01) // v10 10 + ( 1.80000e+01 -3.00000e+01 2.50000e+01) // v11 11 + ( 1.60000e+01 0.00000e+00 2.50000e+01) // v12 12 + ( 1.60000e+01 -2.30000e+02 2.50000e+01) // v13 13 + ( 9.00000e+00 -2.30000e+02 2.50000e+01) // v14 14 + ( 9.00000e+00 0.00000e+00 2.50000e+01) // v15 15 + ( 7.00000e+00 -3.00000e+01 2.50000e+01) // v16 16 + ( 7.00000e+00 -2.30000e+02 2.50000e+01) // v17 17 + + // back vertices + ( 0.00000e+00 -2.30000e+02 -2.50000e+01) // v0 18 + ( 0.00000e+00 -3.00000e+01 -2.50000e+01) // v1 19 + ( 0.00000e+00 0.00000e+00 -2.50000e+01) // v2 20 + ( 0.00000e+00 1.05000e+03 -2.50000e+01) // v3 21 + ( 9.00000e+00 1.05000e+03 -2.50000e+01) // v4 22 + ( 1.60000e+01 1.05000e+03 -2.50000e+01) // v5 23 + ( 2.50000e+01 1.05000e+03 -2.50000e+01) // v6 24 + ( 2.50000e+01 0.00000e+00 -2.50000e+01) // v7 25 + ( 2.50000e+01 -3.00000e+01 -2.50000e+01) // v8 26 + ( 2.50000e+01 -2.30000e+02 -2.50000e+01) // v9 27 + ( 1.80000e+01 -2.30000e+02 -2.50000e+01) // v10 28 + ( 1.80000e+01 -3.00000e+01 -2.50000e+01) // v11 29 + ( 1.60000e+01 0.00000e+00 -2.50000e+01) // v12 30 + ( 1.60000e+01 -2.30000e+02 -2.50000e+01) // v13 31 + ( 9.00000e+00 -2.30000e+02 -2.50000e+01) // v14 32 + ( 9.00000e+00 0.00000e+00 -2.50000e+01) // v15 33 + ( 7.00000e+00 -3.00000e+01 -2.50000e+01) // v16 34 + ( 7.00000e+00 -2.30000e+02 -2.50000e+01) // v17 35 +); + +edges +( +); + +blocks +( + // block 0 + hex (0 1 16 17 18 19 34 35) + (67 10 10) + edgeGrading + ( + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 1 + hex (1 2 15 16 19 20 33 34) + (10 10 10) + edgeGrading + ( + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 2 + hex (2 3 4 15 20 21 22 33) + (234 10 10) + edgeGrading + ( + 4.00000e+00 4.00000e+00 4.00000e+00 4.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 3 + hex (14 15 12 13 32 33 30 31) + (77 10 10) + edgeGrading + ( + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 4 + hex (15 4 5 12 33 22 23 30) + (234 10 10) + edgeGrading + ( + 4.00000e+00 4.00000e+00 4.00000e+00 4.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 5 + hex (10 11 8 9 28 29 26 27) + (67 10 10) + edgeGrading + ( + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 6 + hex (11 12 7 8 29 30 25 26) + (11 10 10) + edgeGrading + ( + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + + // block 7 + hex (12 5 6 7 30 23 24 25) + (234 10 10) + edgeGrading + ( + 4.00000e+00 4.00000e+00 4.00000e+00 4.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + 1.00000e+00 1.00000e+00 1.00000e+00 1.00000e+00 + ) + +); + +defaultPatch +{ + name walls; + type wall; +} + +boundary +( + back + { + type symmetryPlane; + faces + ( + (0 1 16 17) + (1 2 15 16) + (2 3 4 15) + (14 15 12 13) + (15 4 5 12) + (10 11 8 9) + (11 12 7 8) + (12 5 6 7) + ); + } + + front + { + type symmetryPlane; + faces + ( + (18 19 34 35) + (19 20 33 34) + (20 21 22 33) + (32 33 30 31) + (33 22 23 30) + (28 29 26 27) + (29 30 25 26) + (30 23 24 25) + ); + } + + inletCentral + { + type patch; + faces + ( + (13 14 32 31) + ); + } + + inletSides + { + type patch; + faces + ( + (17 0 18 35) + (9 10 28 27) + ); + } + + outlet + { + type patch; + faces + ( + (3 4 22 21) + (4 5 23 22) + (5 6 24 23) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/boundary b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..1319b623261803836c97f2fc155849db5acaa923 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/polyMesh/boundary @@ -0,0 +1,60 @@ +/*--------------------------------*- 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 polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +6 +( + back + { + type symmetryPlane; + inGroups 1(symmetryPlane); + nFaces 9340; + startFace 265900; + } + front + { + type symmetryPlane; + inGroups 1(symmetryPlane); + nFaces 9340; + startFace 275240; + } + inletCentral + { + type patch; + nFaces 100; + startFace 284580; + } + inletSides + { + type patch; + nFaces 200; + startFace 284680; + } + outlet + { + type patch; + nFaces 300; + startFace 284880; + } + walls + { + type wall; + nFaces 9320; + startFace 285180; + } +) + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/radiationProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/radiationProperties new file mode 100644 index 0000000000000000000000000000000000000000..0ebf90015aa8be5e375757e509a1b724fbfdfcfc --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/radiationProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- 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; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties new file mode 100644 index 0000000000000000000000000000000000000000..aa8b02241a5b7ed42e112ad151f2340bb5ea59db --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -0,0 +1,206 @@ +/*--------------------------------*- 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; + location "constant"; + object reactingCloud1Properties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solution +{ + active yes; + + transient no; // yes; + calcFrequency 10; + maxTrackTime 5.0; + maxCo 0.3; + + coupled true; + cellValueSourceCorrection off; + + sourceTerms + { + resetOnStartup false; + schemes + { + rho semiImplicit 1; + U semiImplicit 1; + Yi semiImplicit 1; + h semiImplicit 1; + radiation semiImplicit 1; + } + } + + interpolationSchemes + { + rho cell; + U cellPoint; + thermo:mu cell; + T cell; + Cp cell; + p cell; + } + + integrationSchemes + { + U Euler; + T analytical; + } +} + + +constantProperties +{ + rho0 1000; + T0 350; + Cp0 4100; + + youngsModulus 1e9; + poissonsRatio 0.35; + + epsilon0 1; + f0 0.5; + + Tvap 273; + Tbp 373; + Pr 0.7; + LDevol 0; + hRetentionCoeff 1; + + constantVolume false; +} + + +subModels +{ + particleForces + { + sphereDrag; + gravity; + } + + injectionModels + { + model1 + { + type patchInjection; + massFlowRate 0.8e-03; + parcelBasisType mass; + patchName inletCentral; + parcelsPerSecond 100; + duration 1; // NOTE: set to 1 for steady state + U0 (0 40 0); + flowRateProfile constant 1; + sizeDistribution + { + type general; + generalDistribution + { + distribution + ( + (10e-06 0.0025) + (15e-06 0.0528) + (20e-06 0.2795) + (25e-06 1.0918) + (30e-06 2.3988) + (35e-06 4.4227) + (40e-06 6.3888) + (45e-06 8.6721) + (50e-06 10.3153) + (55e-06 11.6259) + (60e-06 12.0030) + (65e-06 10.4175) + (70e-06 10.8427) + (75e-06 8.0016) + (80e-06 6.1333) + (85e-06 3.8827) + (90e-06 3.4688) + ); + } + } + } + } + + dispersionModel stochasticDispersionRAS; + + patchInteractionModel standardWallInteraction; + + heatTransferModel RanzMarshall; + + compositionModel singleMixtureFraction; + + phaseChangeModel liquidEvaporation; + + devolatilisationModel none; + + surfaceReactionModel none; + + surfaceFilmModel none; + + radiation off; + + standardWallInteractionCoeffs + { + type rebound; + } + + RanzMarshallCoeffs + { + BirdCorrection off; + } + + singleMixtureFractionCoeffs + { + phases + ( + gas + { + } + liquid + { + H2O 1; + } + solid + { + } + ); + YGasTot0 0; + YLiquidTot0 1; + YSolidTot0 0; + } + + liquidEvaporationCoeffs + { + enthalpyTransfer enthalpyDifference; + activeLiquids ( H2O ); + } +} + + +cloudFunctions +{ + patchPostProcessing + { + maxStoredParcels 100; + patches ( outlet ); + } + + particleTracks + { + trackInterval 5; + maxSamples 1000000; + resetOnWrite yes; + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactions b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactions new file mode 100644 index 0000000000000000000000000000000000000000..228f5f836b5e29d41329266f82c2fcbef7044135 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactions @@ -0,0 +1,8 @@ +species +( + air + H2O +); + +reactions +{} diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermo.incompressiblePoly b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermo.incompressiblePoly new file mode 100644 index 0000000000000000000000000000000000000000..3b8bf27dfe8f02b4e8dd0363b6c13f85f7ff1f74 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermo.incompressiblePoly @@ -0,0 +1,91 @@ +/*--------------------------------*- 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; + location "constant"; + object thermo.incompressiblePoly; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +N2 +{ + specie + { + nMoles 1; + molWeight 28.0134; + } + equationOfState + { + rhoCoeffs<8> ( 3.8936 -0.016463 3.2101e-05 -2.9174e-08 9.9889e-12 0 0 0 ); + } + thermodynamics + { + Hf 0; + Sf 0; + CpCoeffs<8> ( 979.08 0.41787 -0.0011761 1.6742e-06 -7.2559e-10 0 0 0 ); + } + transport + { + muCoeffs<8> ( 1.5068e-06 6.1598e-08 -1.8188e-11 0 0 0 0 0 ); + kappaCoeffs<8> ( 0.0031494 8.4997e-05 -1.2621e-08 0 0 0 0 0 ); + } +} + +H2O +{ + specie + { + nMoles 1; + molWeight 18.0153; + } + equationOfState + { + rhoCoeffs<8> ( 2.5039 -0.010587 2.0643e-05 -1.8761e-08 6.4237e-12 0 0 0 ); + } + thermodynamics + { + Hf -13423000; + Sf 10482; + CpCoeffs<8> ( 1563.1 1.604 -0.0029334 3.2168e-06 -1.1571e-09 0 0 0 ); + } + transport + { + muCoeffs<8> ( 1.5068e-06 6.1598e-08 -1.8188e-11 0 0 0 0 0 ); + kappaCoeffs<8> ( 0.0037972 0.00015336 -1.1859e-08 0 0 0 0 0 ); + } +} + +air +{ + specie + { + nMoles 1; + molWeight 28.85; + } + equationOfState + { + rhoCoeffs<8> ( 4.0097 -0.016954 3.3057e-05 -3.0042e-08 1.0286e-11 0 0 0 ); + } + thermodynamics + { + Hf 0; + Sf 0; + CpCoeffs<8> ( 948.76 0.39171 -0.00095999 1.393e-06 -6.2029e-10 0 0 0 ); + } + transport + { + muCoeffs<8> ( 1.5061e-06 6.16e-08 -1.819e-11 0 0 0 0 0 ); + kappaCoeffs<8> ( 0.0025219 8.506e-05 -1.312e-08 0 0 0 0 0 ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermophysicalProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..9b63bc18b377f17d1f016206567f66bcbe76470f --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/thermophysicalProperties @@ -0,0 +1,51 @@ +/*--------------------------------*- 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; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture reactingMixture; + transport polynomial; + thermo hPolynomial; + energy sensibleEnthalpy; + equationOfState icoPolynomial; + specie specie; +} + +chemistryReader foamChemistryReader; + +foamChemistryFile "$FOAM_CASE/constant/reactions"; + +foamChemistryThermoFile "$FOAM_CASE/constant/thermo.incompressiblePoly"; + +inertSpecie air; + +liquids +{ + H2O + { + defaultCoeffs yes; + } +} + +solids +{ + // none +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/turbulenceProperties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..aaccd5feb0f9b868f458ca63411e1a59b376d567 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- 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 turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/controlDict b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..273cb3b23dc920e6f1e8787c2079eca32eb49d89 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/controlDict @@ -0,0 +1,72 @@ +/*--------------------------------*- 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; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleReactingParcelFoam; + +startFoam latestTime; + +startTime 0; + +stopAt endTime; + +endTime 500; + +deltaT 1; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 10; + +writeFormat ascii; + +writePrecision 10; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + + +functions +{ + faceSource1 + { + type faceSource; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled yes; + outputControl outputTime; + log yes; + valueOutput no; + source patch; + sourceName outlet; + operation weightedAverage; + weightField phi; + fields + ( + H2O + T + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvOptions b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvOptions new file mode 100644 index 0000000000000000000000000000000000000000..82e5c6b4b02bdfa1641c107e64de005db2aa0330 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvOptions @@ -0,0 +1,20 @@ +/*--------------------------------*- 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; + location "system"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSchemes b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..45390e50dc2ef75e9f4782913e654569838ac88c --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSchemes @@ -0,0 +1,65 @@ +/*--------------------------------*- 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; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss upwind; + div(phid,p) bounded Gauss upwind; + div(phi,K) bounded Gauss linear; + div(phi,h) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; + div(phi,omega) bounded Gauss upwind; + div(phi,Yi_h) Gauss upwind; + div((muEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + +fluxRequired +{ + default no; + p; +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSolution b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..a1c90c36c68a11d7c95089c81110e04e06f3cda0 --- /dev/null +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/system/fvSolution @@ -0,0 +1,79 @@ +/*--------------------------------*- 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; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + + tolerance 0; + relTol 0.05; + + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + + cacheAgglomeration true; + + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + maxIter 50; + }; + + "(U|Yi|h|k|omega)" + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 0; + relTol 0.1; + maxIter 20; + } +} + +potentialFlow +{ + nNonOrthogonalCorrectors 5; +} + +SIMPLE +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + rhoMin rhoMin [1 -3 0 0 0] 0.1; + rhoMax rhoMax [1 -3 0 0 0] 1.5; +} + +relaxationFactors +{ + fields + { + p 0.3; + rho 1; + } + equations + { + U 0.7; + h 0.7; + ".*" 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Tair similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T1 rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Tair index b07ba8e4080e6d222a80228aa49f6880ee0f895e..25bc08d671014e05362550e22ecd36921d254728 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T1 +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Tair @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object T1; + object Tair; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -27,7 +27,7 @@ boundaryField outlet { type inletOutlet; - phi phi1; + phi phiair; inletValue $internalField; value $internalField; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Twater similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T2 rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Twater index cc4307a53689ef43412a13c49df25ccc731623c6..f0f366c7dc27735b261b92c9eb7e2570dcaff136 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/T2 +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Twater @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object T2; + object Twater; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -27,7 +27,7 @@ boundaryField outlet { type inletOutlet; - phi phi2; + phi phiwater; inletValue uniform 300; value $internalField; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uair similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U1 rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uair index 2cf5dec2bc7111419b65e3a82852df94d550df37..ac6020947e16d1537f7ed05c0878183567bac15c 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U1 +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uair @@ -10,7 +10,7 @@ FoamFile version 2.0; format binary; class volVectorField; - object U1; + object Uair; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -28,7 +28,7 @@ boundaryField outlet { type pressureInletOutletVelocity; - phi phi1; + phi phiair; value $internalField; } walls diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U2 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uwater similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U2 rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uwater index 68e9f354a6e5cab2f825bfd1e3b28d601d791e4d..22ed59a0ef3e78143b36a455a5c2d9f41f09df3a 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/U2 +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/Uwater @@ -10,7 +10,7 @@ FoamFile version 2.0; format binary; class volVectorField; - object U2; + object Uwater; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -28,7 +28,7 @@ boundaryField outlet { type pressureInletOutletVelocity; - phi phi2; + phi phiwater; value $internalField; } walls diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1 b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair similarity index 99% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1 rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair index 9a514b78074968c1df0cd3b7baa6ae041996ef8a..a2224f95c3c32f38ce0e3e0dd361b3fabc5bf60f 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1 +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair @@ -1908,7 +1908,7 @@ boundaryField outlet { type inletOutlet; - phi phi1; + phi phiair; inletValue uniform 1; value uniform 1; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1.org b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair.org similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1.org rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair.org index 4b871e21b9da4e1ddd6159564e28dbf7f303b297..62088eca2323cb4b66162a3131679877f60bb945 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alpha1.org +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/alphaair.org @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object alphaair; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -28,7 +28,7 @@ boundaryField outlet { type inletOutlet; - phi phi1; + phi phiair; inletValue uniform 1; value uniform 1; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/interfacialProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/interfacialProperties index 03a3a667a3d8c1ee3e013766f338b7928053cabc..5964adcedc85ce4cfb8757b6dd2f652ba6cd9b88 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/interfacialProperties +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/interfacialProperties @@ -15,13 +15,13 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dragModel1 SchillerNaumann; -dragModel2 SchillerNaumann; +dragModelair SchillerNaumann; +dragModelwater SchillerNaumann; -heatTransferModel1 RanzMarshall; -heatTransferModel2 RanzMarshall; +heatTransferModelair RanzMarshall; +heatTransferModelwater RanzMarshall; -dispersedPhase both; +dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/polyMesh/boundary b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/polyMesh/boundary index 56e0a545c15839416fcd3beca616ce0f609c5879..bf47f69643c9925d3a1ef19c6b4ddc67cf604e0a 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/polyMesh/boundary +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/polyMesh/boundary @@ -38,6 +38,7 @@ FoamFile defaultFaces { type empty; + inGroups 1(empty); nFaces 3750; startFace 3850; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertiesair b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertiesair new file mode 100644 index 0000000000000000000000000000000000000000..11c033af59bbfbf08d2b11244e50f0fd00c1542f --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertiesair @@ -0,0 +1,49 @@ +/*--------------------------------*- 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; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + transport + { + mu 1.84e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater new file mode 100644 index 0000000000000000000000000000000000000000..672b24a98b365f170f3f2567723294befd79a06e --- /dev/null +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/thermophysicalPropertieswater @@ -0,0 +1,53 @@ +/*--------------------------------*- 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; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectFluid; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + equationOfState + { + rho0 1027; + } + thermodynamics + { + Cp 4195; + Hf 0; + } + transport + { + mu 3.645e-4; + Pr 2.289; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/transportProperties b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/transportProperties index d469dc706f932ef77a08bd0aa00f6cd9ec867c91..408d5f97d66a726605f89ae7c8b5a3e18711f2a6 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/transportProperties +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/transportProperties @@ -15,16 +15,10 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -phase1 -{ - rho 1; - rho0 0; - R 287; - Cp 1007; - - nu 1.589e-05; - kappa 2.63e-2; +phases (air water); +air +{ diameterModel isothermal; isothermalCoeffs { @@ -33,15 +27,9 @@ phase1 } } -phase2 +water { - rho 1027; - rho0 1027; - R 1e10; - Cp 4195; - - nu 3.55e-7; - kappa 0.668; + //R 1e10; diameterModel constant; constantCoeffs diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/controlDict b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/controlDict index f28ade7e84c4a5d839fed48c74b21ffbdca6b371..24d66f91c7d44dfeb7b24b508c2593511edb6ed9 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/controlDict +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/controlDict @@ -60,21 +60,21 @@ functions outputControl outputTime; fields ( - U1 + Uair { mean on; prime2Mean off; base time; } - U2 + Uwater { mean on; prime2Mean off; base time; } - alpha1 + alphaair { mean on; prime2Mean off; diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes index 34b14edfcce7676bc1e185e87f785fc2ab086c56..d53ef42583a230181a0d5bc0a16d73acdc017ce2 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSchemes @@ -29,23 +29,23 @@ divSchemes { default none; - div(phi,alpha1) Gauss limitedLinear01 1; - div(phir,alpha1) Gauss limitedLinear01 1; - div(alphaPhi1,U1) Gauss limitedLinearV 1; - div(alphaPhi2,U2) Gauss limitedLinearV 1; - div(phi1,U1) Gauss limitedLinearV 1; - div(phi2,U2) Gauss limitedLinearV 1; - div((alpha1*Rc1)) Gauss linear; - div((alpha2*Rc2)) Gauss linear; - div(alphaPhi1,T1) Gauss limitedLinear 1; - div(alphaPhi2,T2) Gauss limitedLinear 1; - div(alphaPhi2,k) Gauss limitedLinear 1; - div(alphaPhi2,epsilon) Gauss limitedLinear 1; + div(phi,alpha) Gauss limitedLinear01 1; + div(phir,alpha) Gauss limitedLinear01 1; + div(alphaPhi,Uair) Gauss limitedLinearV 1; + div(alphaPhi,Uwater) Gauss limitedLinearV 1; + div(phiair,Uair) Gauss limitedLinearV 1; + div(phiwater,Uwater) Gauss limitedLinearV 1; + div((alphaair*Rc)) Gauss linear; + div((alphawater*Rc)) Gauss linear; + div(alphaPhi,hair) Gauss limitedLinear 1; + div(alphaPhi,hwater) Gauss limitedLinear 1; + div(alphaPhiwater,k) Gauss limitedLinear 1; + div(alphaPhiwater,epsilon) Gauss limitedLinear 1; div(phi,Theta) Gauss limitedLinear 1; - div(phid1,p) Gauss upwind; - div(phid2,p) Gauss upwind; - div(phi1,K1) Gauss limitedLinear 1; - div(phi2,K2) Gauss limitedLinear 1; + div(phidair,p) Gauss upwind; + div(phidwater,p) Gauss upwind; + div(phiair,Kair) Gauss limitedLinear 1; + div(phiwater,Kwater) Gauss limitedLinear 1; } laplacianSchemes @@ -67,7 +67,7 @@ fluxRequired { default no; p ; - alpha1 ; + alphaair ; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution index d09194f954dde0ac71cc6201ac1cb1f475455c51..96e43b3c1d253411d40e8e71b59a2c071ad2f124 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/fvSolution @@ -47,10 +47,10 @@ solvers relTol 0; } - "T.*" + "h.*" { - solver PBiCG; - preconditioner DILU; + solver PCG; //PBiCG; + preconditioner DIC; //DILU; tolerance 1e-8; relTol 0; } @@ -105,7 +105,7 @@ relaxationFactors equations { "U.*" 1; - "T.*" 1; + "h.*" 1; "alpha.*" 1; "Theta.*" 1; "k.*" 1; diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/setFieldsDict b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/setFieldsDict index 5b6d65bbecb7870ba8626ebd335c4a8f8d75d8d9..85996cf966762c6ca3a7c37a1eaa8ae462ecdb19 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/setFieldsDict +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/system/setFieldsDict @@ -27,7 +27,7 @@ regions box (0 0 -0.1) (0.15 0.701 0.1); fieldValues ( - volScalarFieldValue alpha1 0 + volScalarFieldValue alphaair 0 ); } );