diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/files b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/files new file mode 100644 index 000000000..979ccc40f --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/files @@ -0,0 +1,4 @@ +VoFPatchTransfer/VoFPatchTransfer.C +compressibleInterFilmFoam.C + +EXE = $(FOAM_APPBIN)/compressibleInterFilmFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/options new file mode 100644 index 000000000..aa0967b1b --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/Make/options @@ -0,0 +1,43 @@ +EXE_INC = -ggdb3 \ + -I. \ + -I.. \ + -I../../VoF \ + -I../twoPhaseMixtureThermo \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + +EXE_LIBS = \ + -ltwoPhaseMixtureThermo \ + -ltwoPhaseSurfaceTension \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie \ + -ltwoPhaseMixture \ + -ltwoPhaseProperties \ + -linterfaceProperties \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -lSLGThermo \ + -lsurfaceFilmModels \ + -lsurfaceFilmDerivedFvPatchFields \ + -ldynamicMesh \ + -lmeshTools \ + -ldynamicFvMesh \ + -lfiniteVolume \ + -lfvOptions diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H new file mode 100644 index 000000000..11475fa4b --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/TEqn.H @@ -0,0 +1,36 @@ +{ + fvScalarMatrix TEqn + ( + fvm::ddt(rho, T) + fvm::div(rhoPhi, T) + - fvm::Sp(contErr, T) + - fvm::laplacian(mixture.alphaEff(turbulence->mut()), T) + + ( + ( + fvc::div(fvc::absolute(phi, U), p) + + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) + )()() - contErr*K + ) + *( + alpha1/mixture.thermo1().Cv() + + alpha2/mixture.thermo2().Cv() + )()() + == + fvOptions(rho, T) + + pos(Srho) + *( + surfaceFilm.Sh()()/mixture.thermo1().Cp()() + + surfaceFilm.Tref*Srho + ) + ); + + TEqn.relax(); + + fvOptions.constrain(TEqn); + + TEqn.solve(); + + fvOptions.correct(T); + + mixture.correctThermo(); + mixture.correct(); +} diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C new file mode 100644 index 000000000..a84a3a91c --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "VoFPatchTransfer.H" +#include "twoPhaseMixtureThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(VoFPatchTransfer, 0); +addToRunTimeSelectionTable(transferModel, VoFPatchTransfer, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +VoFPatchTransfer::VoFPatchTransfer +( + surfaceFilmModel& film, + const dictionary& dict +) +: + transferModel(type(), film, dict), + deltaFactorToVoF_ + ( + coeffDict_.lookupOrDefault("deltaFactorToVoF", 1.0) + ), + deltaFactorToFilm_ + ( + coeffDict_.lookupOrDefault("deltaFactorToFilm", 0.5) + ), + alphaToVoF_ + ( + coeffDict_.lookupOrDefault("alphaToVoF", 0.5) + ), + alphaToFilm_ + ( + coeffDict_.lookupOrDefault("alphaToFilm", 0.1) + ), + transferRateCoeff_ + ( + coeffDict_.lookupOrDefault("transferRateCoeff", 0.1) + ) +{ + const polyBoundaryMesh& pbm = film.regionMesh().boundaryMesh(); + patchIDs_.setSize(pbm.size()); + + if (coeffDict_.found("patches")) + { + const wordReList patchNames(coeffDict_.lookup("patches")); + const labelHashSet patchSet = pbm.patchSet(patchNames); + + Info<< " applying to patches:" << nl; + + label pidi = 0; + forAllConstIter(labelHashSet, patchSet, iter) + { + const label patchi = iter.key(); + patchIDs_[pidi++] = patchi; + Info<< " " << pbm[patchi].name() << endl; + } + patchIDs_.setSize(pidi); + patchTransferredMasses_.setSize(pidi, 0); + } + else + { + Info<< " applying to all patches" << endl; + + forAll(patchIDs_, patchi) + { + patchIDs_[patchi] = patchi; + } + + patchTransferredMasses_.setSize(pbm.size(), 0); + } + + if (!patchIDs_.size()) + { + FatalErrorInFunction + << "No patches selected" + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +VoFPatchTransfer::~VoFPatchTransfer() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void VoFPatchTransfer::correct +( + scalarField& availableMass, + scalarField& massToTransfer +) +{ + NotImplemented; +} + + +void VoFPatchTransfer::correct +( + scalarField& availableMass, + scalarField& massToTransfer, + scalarField& energyToTransfer +) +{ + // Do not correct if no patches selected + if (!patchIDs_.size()) return; + + const scalarField& delta = film().delta(); + const scalarField& rho = film().rho(); + const scalarField& magSf = film().magSf(); + + const polyBoundaryMesh& pbm = film().regionMesh().boundaryMesh(); + + + const twoPhaseMixtureThermo& thermo + ( + film().primaryMesh().lookupObject + ( + twoPhaseMixtureThermo::dictName + ) + ); + + const volScalarField& heVoF = thermo.thermo1().he(); + const volScalarField& TVoF = thermo.thermo1().T(); + volScalarField CpVoF = thermo.thermo1().Cp(); + const volScalarField& rhoVoF = thermo.thermo1().rho()(); + const volScalarField& alphaVoF = thermo.alpha1(); + + forAll(patchIDs_, pidi) + { + const label patchi = patchIDs_[pidi]; + label primaryPatchi = -1; + + forAll(film().intCoupledPatchIDs(), i) + { + const label filmPatchi = film().intCoupledPatchIDs()[i]; + + if (filmPatchi == patchi) + { + primaryPatchi = film().primaryPatchIDs()[i]; + } + } + + if (primaryPatchi != -1) + { + scalarField deltaCoeffs + ( + film().primaryMesh().boundary()[primaryPatchi].deltaCoeffs() + ); + film().toRegion(patchi, deltaCoeffs); + + scalarField hp(heVoF.boundaryField()[primaryPatchi]); + film().toRegion(patchi, hp); + + scalarField Tp(TVoF.boundaryField()[primaryPatchi]); + film().toRegion(patchi, Tp); + + scalarField Cpp(CpVoF.boundaryField()[primaryPatchi]); + film().toRegion(patchi, Cpp); + + scalarField rhop(rhoVoF.boundaryField()[primaryPatchi]); + film().toRegion(patchi, rhop); + + scalarField alphap(alphaVoF.boundaryField()[primaryPatchi]); + film().toRegion(patchi, alphap); + + scalarField Vp + ( + film().primaryMesh().boundary()[primaryPatchi] + .patchInternalField(film().primaryMesh().V()) + ); + film().toRegion(patchi, Vp); + + const polyPatch& pp = pbm[patchi]; + const labelList& faceCells = pp.faceCells(); + + // Accumulate the total mass removed from patch + scalar dMassPatch = 0; + + forAll(faceCells, facei) + { + const label celli = faceCells[facei]; + + scalar dMass = 0; + + if + ( + delta[celli] > 2*deltaFactorToVoF_/deltaCoeffs[facei] + || alphap[facei] > alphaToVoF_ + ) + { + dMass = + transferRateCoeff_*delta[celli]*rho[celli]*magSf[celli]; + + massToTransfer[celli] += dMass; + energyToTransfer[celli] += dMass*film().hs()[celli]; + } + + if + ( + alphap[facei] > 0 + && delta[celli] > 0 + && delta[celli] < 2*deltaFactorToFilm_/deltaCoeffs[facei] + && alphap[facei] < alphaToFilm_ + ) + { + dMass = + -transferRateCoeff_*alphap[facei]*rhop[facei]*Vp[facei]; + + massToTransfer[celli] += dMass; + energyToTransfer[celli] += dMass*hp[facei]; + } + + availableMass[celli] -= dMass; + dMassPatch += dMass; + } + + patchTransferredMasses_[pidi] += dMassPatch; + addToTransferredMass(dMassPatch); + } + } + + transferModel::correct(); + + if (writeTime()) + { + scalarField patchTransferredMasses0 + ( + getModelProperty + ( + "patchTransferredMasses", + scalarField(patchTransferredMasses_.size(), 0) + ) + ); + + scalarField patchTransferredMassTotals(patchTransferredMasses_); + Pstream::listCombineGather + ( + patchTransferredMassTotals, + plusEqOp() + ); + patchTransferredMasses0 += patchTransferredMassTotals; + + setModelProperty + ( + "patchTransferredMasses", + patchTransferredMasses0 + ); + + patchTransferredMasses_ = 0; + } +} + + +void VoFPatchTransfer::patchTransferredMassTotals +( + scalarField& patchMasses +) const +{ + // Do not correct if no patches selected + if (!patchIDs_.size()) return; + + scalarField patchTransferredMasses + ( + getModelProperty + ( + "patchTransferredMasses", + scalarField(patchTransferredMasses_.size(), 0) + ) + ); + + scalarField patchTransferredMassTotals(patchTransferredMasses_); + Pstream::listCombineGather(patchTransferredMassTotals, plusEqOp()); + + forAll(patchIDs_, pidi) + { + const label patchi = patchIDs_[pidi]; + patchMasses[patchi] += + patchTransferredMasses[pidi] + patchTransferredMassTotals[pidi]; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.H new file mode 100644 index 000000000..4ad8817c6 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::regionModels::surfaceFilmModels::VoFPatchTransfer + +Description + Transfer mass between the film and the VoF in the continuous phase. + +SourceFiles + VoFPatchTransfer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef VoFPatchTransfer_H +#define VoFPatchTransfer_H + +#include "transferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class VoFPatchTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class VoFPatchTransfer +: + public transferModel +{ + // Private member functions + + //- Disallow default bitwise copy construct + VoFPatchTransfer(const VoFPatchTransfer&); + + //- Disallow default bitwise assignment + void operator=(const VoFPatchTransfer&); + + +protected: + + //- Factor of the cell height above which the film is transferred + // to the VoF + scalar deltaFactorToVoF_; + + //- Factor of the cell height below which the VoF may be transferred + // to the film + scalar deltaFactorToFilm_; + + //- VoF limit above which all of the film is transferred to the VoF + scalar alphaToVoF_; + + //- VoF limit below which the VoF may be transferred to the film + scalar alphaToFilm_; + + //- Transfer rate coefficient + scalar transferRateCoeff_; + + //- List of patch IDs at which the film is removed + labelList patchIDs_; + + //- Transferred mass for each patch at which the film is removed + scalarField patchTransferredMasses_; + + +public: + + //- Runtime type information + TypeName("VoFPatchTransfer"); + + + // Constructors + + //- Construct from surface film model + VoFPatchTransfer(surfaceFilmModel& film, const dictionary& dict); + + + //- Destructor + virtual ~VoFPatchTransfer(); + + + // Member Functions + + //- Correct + virtual void correct + ( + scalarField& availableMass, + scalarField& massToTransfer + ); + + //- Correct kinematic and thermodynamic transfers + virtual void correct + ( + scalarField& availableMass, + scalarField& massToTransfer, + scalarField& energyToTransfer + ); + + //- Accumulate the total mass injected for the patches into the + // scalarField provided + virtual void patchTransferredMassTotals + ( + scalarField& patchMasses + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/compressibleInterFilmFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/compressibleInterFilmFoam.C new file mode 100644 index 000000000..6241555c4 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/compressibleInterFilmFoam.C @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2017 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 . + +Application + compressibleInterFoam + +Description + Solver for 2 compressible, non-isothermal immiscible fluids using a VOF + (volume of fluid) phase-fraction based interface capturing approach. + + The momentum and other fluid properties are of the "mixture" and a single + momentum equation is solved. + + Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "CMULES.H" +#include "EulerDdtScheme.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" +#include "subCycle.H" +#include "rhoThermo.H" +#include "twoPhaseMixture.H" +#include "twoPhaseMixtureThermo.H" +#include "turbulentFluidThermoModel.H" +#include "SLGThermo.H" +#include "surfaceFilmModel.H" +#include "pimpleControl.H" +#include "fvOptions.H" +#include "fvcSmooth.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "postProcess.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createControl.H" + #include "createTimeControls.H" + #include "createFields.H" + #include "createAlphaFluxes.H" + #include "createSurfaceFilmModel.H" + #include "createFvOptions.H" + + volScalarField& p = mixture.p(); + volScalarField& T = mixture.T(); + const volScalarField& psi1 = mixture.thermo1().psi(); + const volScalarField& psi2 = mixture.thermo2().psi(); + + filmModelType& surfaceFilm = tsurfaceFilm(); + + turbulence->validate(); + + if (!LTS) + { + #include "readTimeControls.H" + #include "CourantNo.H" + #include "setInitialDeltaT.H" + } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "CourantNo.H" + #include "alphaCourantNo.H" + #include "setDeltaT.H" + } + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + surfaceFilm.evolve(); + + // --- Pressure-velocity PIMPLE corrector loop + while (pimple.loop()) + { + #include "alphaControls.H" + #include "compressibleAlphaEqnSubCycle.H" + + volScalarField::Internal Srho(surfaceFilm.Srho()); + contErr -= posPart(Srho); + + #include "UEqn.H" + #include "TEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H new file mode 100644 index 000000000..ddb05b3b0 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/createSurfaceFilmModel.H @@ -0,0 +1,6 @@ +Info<< "\nConstructing surface film model" << endl; + +typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType; + +SLGThermo slgThermo(mesh, mixture.thermo1()); +autoPtr tsurfaceFilm(filmModelType::New(mesh, g)); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H new file mode 100644 index 000000000..27196f0ee --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/pEqn.H @@ -0,0 +1,129 @@ +{ + volScalarField rAU("rAU", 1.0/UEqn.A()); + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU)); + volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::flux(HbyA) + + fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi) + ); + MRF.makeRelative(phiHbyA); + + surfaceScalarField phig + ( + ( + mixture.surfaceTensionForce() + - ghf*fvc::snGrad(rho) + )*rAUf*mesh.magSf() + ); + + phiHbyA += phig; + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); + + tmp p_rghEqnComp1; + tmp p_rghEqnComp2; + + if (pimple.transonic()) + { + surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi); + surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi); + + p_rghEqnComp1 = + fvc::ddt(rho1) + fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1) + + correction + ( + psi1*fvm::ddt(p_rgh) + + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) + ); + deleteDemandDrivenData(p_rghEqnComp1.ref().faceFluxCorrectionPtr()); + p_rghEqnComp1.ref().relax(); + + p_rghEqnComp2 = + fvc::ddt(rho2) + fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2) + + correction + ( + psi2*fvm::ddt(p_rgh) + + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + ); + deleteDemandDrivenData(p_rghEqnComp2.ref().faceFluxCorrectionPtr()); + p_rghEqnComp2.ref().relax(); + } + else + { + #include "rhofs.H" + + p_rghEqnComp1 = + pos(alpha1) + *( + ( + fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f) + - (fvOptions(alpha1, mixture.thermo1().rho())&rho1) + )/rho1 + - fvc::ddt(alpha1) - fvc::div(alphaPhi1) + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)) + ) - surfaceFilm.Srho()/rho1; + + p_rghEqnComp2 = + pos(alpha2) + *( + ( + fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f) + - (fvOptions(alpha2, mixture.thermo2().rho())&rho2) + )/rho2 + - fvc::ddt(alpha2) - fvc::div(alphaPhi2) + + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)) + ); + } + + // Cache p_rgh prior to solve for density update + volScalarField p_rgh_0(p_rgh); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqnIncomp + ( + fvc::div(phiHbyA) + - fvm::laplacian(rAUf, p_rgh) + ); + + solve + ( + p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp, + mesh.solver(p_rgh.select(pimple.finalInnerIter())) + ); + + if (pimple.finalNonOrthogonalIter()) + { + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; + + dgdt = + ( + alpha1*(p_rghEqnComp2 & p_rgh) + - alpha2*(p_rghEqnComp1 & p_rgh) + ); + + phi = phiHbyA + p_rghEqnIncomp.flux(); + + U = HbyA + + rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf); + U.correctBoundaryConditions(); + fvOptions.correct(U); + } + } + + // Update densities from change in p_rgh + mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0)); + mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0)); + + rho = alpha1*rho1 + alpha2*rho2; + + // Correct p_rgh for consistency with p and the updated densities + p_rgh = p - rho*gh; + p_rgh.correctBoundaryConditions(); + + K = 0.5*magSqr(U); +} diff --git a/applications/solvers/multiphase/compressibleInterFoam/createFields.H b/applications/solvers/multiphase/compressibleInterFoam/createFields.H index 16873d5a5..6feb294cf 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterFoam/createFields.H @@ -87,10 +87,7 @@ surfaceScalarField rhoPhi fvc::interpolate(rho)*phi ); -volScalarField dgdt -( - pos0(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001)) -); +volScalarField dgdt(alpha1*fvc::div(phi)); // Construct compressible turbulence model autoPtr turbulence diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index 6274ad1c3..063db6258 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -63,8 +63,8 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo thermo1_ = rhoThermo::New(U.mesh(), phase1Name()); thermo2_ = rhoThermo::New(U.mesh(), phase2Name()); - thermo1_->validate(phase1Name(), "e"); - thermo2_->validate(phase2Name(), "e"); + // thermo1_->validate(phase1Name(), "e"); + // thermo2_->validate(phase2Name(), "e"); correct(); } diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index f53e0a038..7a9fd19f7 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -27,6 +27,10 @@ $(KINEMATICMODELS)/injectionModel/BrunDrippingInjection/BrunDrippingInjection.C $(KINEMATICMODELS)/injectionModel/patchInjection/patchInjection.C $(KINEMATICMODELS)/injectionModel/curvatureSeparation/curvatureSeparation.C +$(KINEMATICMODELS)/transferModels/transferModel/transferModel.C +$(KINEMATICMODELS)/transferModels/transferModel/transferModelNew.C +$(KINEMATICMODELS)/transferModels/transferModelList/transferModelList.C + $(KINEMATICMODELS)/filmThermoModel/filmThermoModel/filmThermoModel.C $(KINEMATICMODELS)/filmThermoModel/filmThermoModel/filmThermoModelNew.C $(KINEMATICMODELS)/filmThermoModel/constantFilmThermo/constantFilmThermo.C diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index f06b44f0e..cea2a2f0f 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,7 +204,7 @@ tmp kinematicSingleLayer::pp() void kinematicSingleLayer::correctAlpha() { - alpha_ == pos(delta_ - deltaSmall_); + alpha_ == pos0(delta_ - deltaSmall_); } @@ -218,9 +218,11 @@ void kinematicSingleLayer::updateSubmodels() // Update injection model - mass returned is mass available for injection injection_.correct(availableMass_, cloudMassTrans_, cloudDiameterTrans_); - // Update source fields - const dimensionedScalar deltaT = time().deltaT(); - rhoSp_ += cloudMassTrans_/magSf()/deltaT; + // Update transfer model - mass returned is mass available for transfer + transfer_.correct(availableMass_, cloudMassTrans_); + + // Update mass source field + rhoSp_ += cloudMassTrans_/magSf()/time().deltaT(); turbulence_->correct(); } @@ -792,6 +794,8 @@ kinematicSingleLayer::kinematicSingleLayer injection_(*this, coeffs_), + transfer_(*this, coeffs_), + turbulence_(filmTurbulenceModel::New(*this, coeffs_)), forces_(*this, coeffs_), @@ -882,6 +886,7 @@ void kinematicSingleLayer::preEvolveRegion() availableMass_ = netMass(); cloudMassTrans_ == dimensionedScalar("zero", dimMass, 0.0); cloudDiameterTrans_ == dimensionedScalar("zero", dimLength, 0.0); + primaryMassTrans_ == dimensionedScalar("zero", dimMass, 0.0); } @@ -1025,6 +1030,15 @@ const volScalarField& kinematicSingleLayer::Tw() const } +const volScalarField& kinematicSingleLayer::hs() const +{ + FatalErrorInFunction + << "hs field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + const volScalarField& kinematicSingleLayer::Cp() const { FatalErrorInFunction @@ -1098,6 +1112,7 @@ void kinematicSingleLayer::info() << gSum(alpha_.primitiveField()*magSf())/gSum(magSf()) << nl; injection_.info(Info); + transfer_.info(Info); } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 9ecdf418e..b1a90b4fc 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,7 @@ SourceFiles #include "fvMatrices.H" #include "injectionModelList.H" +#include "transferModelList.H" #include "forceList.H" #include "filmTurbulenceModel.H" @@ -108,37 +109,37 @@ protected: // Fields - //- Density / [kg/m3] + //- Density [kg/m3] volScalarField rho_; - //- Dynamic viscosity / [Pa.s] + //- Dynamic viscosity [Pa.s] volScalarField mu_; - //- Surface tension / [m/s2] + //- Surface tension [m/s2] volScalarField sigma_; // Fields - //- Film thickness / [m] + //- Film thickness [m] volScalarField delta_; - //- Film coverage indicator, 1 = covered, 0 = uncovered / [] + //- Film coverage indicator, 1 = covered, 0 = uncovered [] volScalarField alpha_; - //- Velocity - mean / [m/s] + //- Velocity - mean [m/s] volVectorField U_; - //- Velocity - surface / [m/s] + //- Velocity - surface [m/s] volVectorField Us_; - //- Velocity - wall / [m/s] + //- Velocity - wall [m/s] volVectorField Uw_; - //- Film thickness*density (helper field) / [kg/m2] + //- Film thickness*density (helper field) [kg/m2] volScalarField deltaRho_; - //- Mass flux (includes film thickness) / [kg.m/s] + //- Mass flux (includes film thickness) [kg.m/s] surfaceScalarField phi_; @@ -160,42 +161,42 @@ protected: // Note: need boundary value mapped from primary region, and then // pushed into the patch internal field - //- Momementum / [kg/m/s2] + //- Momementum [kg/m/s2] volVectorField USp_; - //- Pressure / [Pa] + //- Pressure [Pa] volScalarField pSp_; - //- Mass / [kg/m2/s] + //- Mass [kg/m2/s] volScalarField rhoSp_; // Primary region - registered to the primary region mesh // Internal use only - not read-in - //- Momementum / [kg/m/s2] + //- Momementum [kg/m/s2] volVectorField USpPrimary_; - //- Pressure / [Pa] + //- Pressure [Pa] volScalarField pSpPrimary_; - //- Mass / [kg/m2/s] + //- Mass [kg/m2/s] volScalarField rhoSpPrimary_; // Fields mapped from primary region - registered to the film region // Note: need both boundary AND patch internal fields to be mapped - //- Velocity / [m/s] + //- Velocity [m/s] volVectorField UPrimary_; - //- Pressure / [Pa] + //- Pressure [Pa] volScalarField pPrimary_; - //- Density / [kg/m3] + //- Density [kg/m3] volScalarField rhoPrimary_; - //- Viscosity / [Pa.s] + //- Viscosity [Pa.s] volScalarField muPrimary_; @@ -210,6 +211,9 @@ protected: //- Cloud injection injectionModelList injection_; + //- Transfer with the continuous phase + transferModelList transfer_; + //- Turbulence model autoPtr turbulence_; @@ -337,19 +341,19 @@ public: // Thermo properties - //- Return const access to the dynamic viscosity / [Pa.s] + //- Return const access to the dynamic viscosity [Pa.s] inline const volScalarField& mu() const; - //- Return const access to the surface tension / [kg/s2] + //- Return const access to the surface tension [kg/s2] inline const volScalarField& sigma() const; // Fields - //- Return const access to the film thickness / [m] + //- Return const access to the film thickness [m] inline const volScalarField& delta() const; - //- Return the film coverage, 1 = covered, 0 = uncovered / [] + //- Return the film coverage, 1 = covered, 0 = uncovered [] inline const volScalarField& alpha() const; //- Return the film velocity [m/s] @@ -379,6 +383,9 @@ public: //- Return the film wall temperature [K] virtual const volScalarField& Tw() const; + //- Return the film surface enthalpy [J/kg] + virtual const volScalarField& hs() const; + //- Return the film specific heat capacity [J/kg/K] virtual const volScalarField& Cp() const; @@ -416,49 +423,49 @@ public: // Primary region - //- Momementum / [kg/m/s2] + //- Momementum [kg/m/s2] inline volVectorField& USpPrimary(); - //- Pressure / [Pa] + //- Pressure [Pa] inline volScalarField& pSpPrimary(); - //- Mass / [kg/m2/s] + //- Mass [kg/m2/s] inline volScalarField& rhoSpPrimary(); // Film region - //- Momentum / [kg/m/s2] + //- Momentum [kg/m/s2] inline volVectorField& USp(); - //- Pressure / [Pa] + //- Pressure [Pa] inline volScalarField& pSp(); - //- Mass / [kg/m2/s] + //- Mass [kg/m2/s] inline volScalarField& rhoSp(); - //- Momentum / [kg/m/s2] + //- Momentum [kg/m/s2] inline const volVectorField& USp() const; - //- Pressure / [Pa] + //- Pressure [Pa] inline const volScalarField& pSp() const; - //- Mass / [kg/m2/s] + //- Mass [kg/m2/s] inline const volScalarField& rhoSp() const; // Fields mapped from primary region - //- Velocity / [m/s] + //- Velocity [m/s] inline const volVectorField& UPrimary() const; - //- Pressure / [Pa] + //- Pressure [Pa] inline const volScalarField& pPrimary() const; - //- Density / [kg/m3] + //- Density [kg/m3] inline const volScalarField& rhoPrimary() const; - //- Viscosity / [Pa.s] + //- Viscosity [Pa.s] inline const volScalarField& muPrimary() const; @@ -470,6 +477,9 @@ public: //- Injection inline injectionModelList& injection(); + //- Transfer + inline transferModelList& transfer(); + //- Turbulence inline const filmTurbulenceModel& turbulence() const; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index e7647ec9e..1aea14d3c 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,6 +182,12 @@ inline injectionModelList& kinematicSingleLayer::injection() } +inline transferModelList& kinematicSingleLayer::transfer() +{ + return transfer_; +} + + inline const filmTurbulenceModel& kinematicSingleLayer::turbulence() const { return turbulence_(); @@ -197,8 +203,10 @@ inline tmp kinematicSingleLayer::mass() const inline tmp kinematicSingleLayer::netMass() const { return - fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + deltaSmall_)) - *time().deltaT() + fvc::surfaceSum + ( + pos0(phi_)*phi_/(fvc::interpolate(delta_) + deltaSmall_) + )*time().deltaT() + rho_*delta_*magSf(); } diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 65a775bd9..6082dc495 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C @@ -173,6 +173,15 @@ const volScalarField& noFilm::Tw() const } +const volScalarField& noFilm::hs() const +{ + FatalErrorInFunction + << "hs field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + const volScalarField& noFilm::Cp() const { FatalErrorInFunction diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H index 20e115fec..f664eb89c 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,9 @@ public: //- Return the film wall temperature [K] virtual const volScalarField& Tw() const; + //- Return the film surface enthalpy [J/kg] + virtual const volScalarField& hs() const; + //- Return the film specific heat capacity [J/kg/K] virtual const volScalarField& Cp() const; diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C index 957b571e4..197880fe9 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C @@ -85,7 +85,7 @@ void contactAngleForce::initialise() ); dist.correct(y); - mask_ = pos(y - dimensionedScalar("dLim", dimLength, dLim)); + mask_ = pos0(y - dimensionedScalar("dLim", dimLength, dLim)); } } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.C new file mode 100644 index 000000000..80070fe1a --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.C @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "transferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(transferModel, 0); +defineRunTimeSelectionTable(transferModel, dictionary); + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void transferModel::addToTransferredMass(const scalar dMass) +{ + transferredMass_ += dMass; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +transferModel::transferModel(surfaceFilmModel& film) +: + filmSubModelBase(film), + transferredMass_(0.0) +{} + + +transferModel::transferModel +( + const word& modelType, + surfaceFilmModel& film, + const dictionary& dict +) +: + filmSubModelBase(film, dict, typeName, modelType), + transferredMass_(0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +transferModel::~transferModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void transferModel::correct() +{ + if (writeTime()) + { + scalar transferredMass0 = getModelProperty("transferredMass"); + transferredMass0 += returnReduce(transferredMass_, sumOp()); + setModelProperty("transferredMass", transferredMass0); + transferredMass_ = 0.0; + } +} + +void transferModel::correct +( + scalarField& availableMass, + scalarField& massToTransfer, + scalarField& energyToTransfer +) +{ + scalarField massToTransfer0(massToTransfer.size(), scalar(0)); + correct(availableMass, massToTransfer0); + massToTransfer += massToTransfer0; + energyToTransfer += massToTransfer0*film().hs(); +} + +scalar transferModel::transferredMassTotal() const +{ + scalar transferredMass0 = getModelProperty("transferredMass"); + return transferredMass0 + returnReduce(transferredMass_, sumOp()); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.H new file mode 100644 index 000000000..9fb79538c --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModel.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::regionModels::surfaceFilmModels::transferModel + +Description + Base class for film transfer models, handling mass transfer between the + film and the continuous phase. + +SourceFiles + transferModel.C + transferModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef transferModel_H +#define transferModel_H + +#include "filmSubModelBase.H" +#include "runTimeSelectionTables.H" +#include "scalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class transferModel Declaration +\*---------------------------------------------------------------------------*/ + +class transferModel +: + public filmSubModelBase +{ + // Private data + + //- Transferred mass + scalar transferredMass_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + transferModel(const transferModel&); + + //- Disallow default bitwise assignment + void operator=(const transferModel&); + + +protected: + + // Protected Member Functions + + //- Add to transferred mass + void addToTransferredMass(const scalar dMass); + + //- Correct + void correct(); + + +public: + + //- Runtime type information + TypeName("transferModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + transferModel, + dictionary, + ( + surfaceFilmModel& film, + const dictionary& dict + ), + (film, dict) + ); + + + // Constructors + + //- Construct for film + transferModel(surfaceFilmModel& film); + + //- Construct from type name, dictionary and surface film model + transferModel + ( + const word& modelType, + surfaceFilmModel& film, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected injection model + static autoPtr New + ( + surfaceFilmModel& film, + const dictionary& dict, + const word& modelType + ); + + + //- Destructor + virtual ~transferModel(); + + + // Member Functions + + //- Correct kinematic transfers + virtual void correct + ( + scalarField& availableMass, + scalarField& massToTransfer + ) = 0; + + //- Correct kinematic and thermodynamic transfers + virtual void correct + ( + scalarField& availableMass, + scalarField& massToTransfer, + scalarField& energyToTransfer + ); + + //- Return the total mass transferred + virtual scalar transferredMassTotal() const; + + //- Accumulate the total mass transferred for the patches into the + // scalarField provided + virtual void patchTransferredMassTotals(scalarField& patchMasses) const + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModelNew.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModelNew.C new file mode 100644 index 000000000..bd4392f1b --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModel/transferModelNew.C @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "transferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +autoPtr transferModel::New +( + surfaceFilmModel& model, + const dictionary& dict, + const word& modelType +) +{ + Info<< " " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown transferModel type " << modelType + << nl << nl << "Valid transferModel types are:" << nl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(model, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C new file mode 100644 index 000000000..1bef3d5c5 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.C @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "transferModelList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +transferModelList::transferModelList(surfaceFilmModel& film) +: + PtrList(), + filmSubModelBase(film) +{} + + +transferModelList::transferModelList +( + surfaceFilmModel& film, + const dictionary& dict +) +: + PtrList(), + filmSubModelBase + ( + "transferModelList", + film, + dict, + "transferModelList", + "transferModelList" + ), + massTransferred_(film.intCoupledPatchIDs().size(), 0.0) +{ + const wordList activeModels(dict.lookup("transferModels")); + + wordHashSet models; + forAll(activeModels, i) + { + models.insert(activeModels[i]); + } + + Info<< " Selecting film transfer models" << endl; + if (models.size() > 0) + { + this->setSize(models.size()); + + label i = 0; + forAllConstIter(wordHashSet, models, iter) + { + const word& model = iter.key(); + set(i, transferModel::New(film, dict, model)); + i++; + } + } + else + { + Info<< " none" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +transferModelList::~transferModelList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void transferModelList::correct +( + scalarField& availableMass, + volScalarField& massToTransfer +) +{ + // Correct models that accumulate mass and diameter transfers + forAll(*this, i) + { + operator[](i).correct(availableMass, massToTransfer); + } + + // Push values to boundaries ready for transfer to the primary region + massToTransfer.correctBoundaryConditions(); + + const labelList& patchIDs = film().intCoupledPatchIDs(); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + massTransferred_[i] = + massTransferred_[i] + sum(massToTransfer.boundaryField()[patchi]); + } +} + + +void transferModelList::correct +( + scalarField& availableMass, + volScalarField& massToTransfer, + volScalarField& energyToTransfer +) +{ + // Correct models that accumulate mass and diameter transfers + forAll(*this, i) + { + operator[](i).correct(availableMass, massToTransfer, energyToTransfer); + } + + // Push values to boundaries ready for transfer to the primary region + massToTransfer.correctBoundaryConditions(); + energyToTransfer.correctBoundaryConditions(); + + const labelList& patchIDs = film().intCoupledPatchIDs(); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + massTransferred_[i] = + massTransferred_[i] + sum(massToTransfer.boundaryField()[patchi]); + } +} + + +void transferModelList::info(Ostream& os) +{ + const polyBoundaryMesh& pbm = film().regionMesh().boundaryMesh(); + + scalar transferredMass = 0; + scalarField patchTransferredMasses(pbm.size(), 0); + + forAll(*this, i) + { + const transferModel& im = operator[](i); + transferredMass += im.transferredMassTotal(); + im.patchTransferredMassTotals(patchTransferredMasses); + } + + os << indent << "transferred mass = " << transferredMass << nl; + + forAll(pbm, patchi) + { + if (mag(patchTransferredMasses[patchi]) > VSMALL) + { + os << indent << indent << "from patch " << pbm[patchi].name() + << " = " << patchTransferredMasses[patchi] << nl; + } + } + + scalarField mass0(massTransferred_.size(), 0.0); + this->getBaseProperty("massTransferred", mass0); + + scalarField mass(massTransferred_); + Pstream::listCombineGather(mass, plusEqOp()); + mass += mass0; + + const labelList& patchIDs = film().intCoupledPatchIDs(); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + Info<< indent << " - patch: " << pbm[patchi].name() << ": " + << mass[i] << endl; + } + + if (film().time().writeTime()) + { + setBaseProperty("massTransferred", mass); + massTransferred_ = 0.0; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.H new file mode 100644 index 000000000..fd244fab1 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/transferModels/transferModelList/transferModelList.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::transferModelList + +Description + List container for film transfer models + +SourceFiles + transferModelList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef transferModelList_H +#define transferModelList_H + +#include "PtrList.H" +#include "transferModel.H" +#include "filmSubModelBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class transferModelList Declaration +\*---------------------------------------------------------------------------*/ + +class transferModelList +: + public PtrList, + public filmSubModelBase +{ + // Private data + + //- List of mass transferred per patch + scalarField massTransferred_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + transferModelList(const transferModelList&); + + //- Disallow default bitwise assignment + void operator=(const transferModelList&); + + +public: + + // Constructors + + //- Construct null + transferModelList(surfaceFilmModel& film); + + //- Construct from type name, dictionary and surface film model + transferModelList + ( + surfaceFilmModel& film, + const dictionary& dict + ); + + + //- Destructor + virtual ~transferModelList(); + + + // Member Functions + + //- Correct kinematic transfers + virtual void correct + ( + scalarField& availableMass, + volScalarField& massToTransfer + ); + + //- Correct kinematic and thermodynamic transfers + virtual void correct + ( + scalarField& availableMass, + volScalarField& massToTransfer, + volScalarField& energyToTransfer + ); + + //- Provide some info + virtual void info(Ostream& os); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C index 64c6be611..d25f2dbc2 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C @@ -85,7 +85,7 @@ constantRadiation::constantRadiation timeStart_(readScalar(coeffDict_.lookup("timeStart"))), duration_(readScalar(coeffDict_.lookup("duration"))) { - mask_ = pos(mask_); + mask_ = pos0(mask_); } diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C index 2ac323d0f..13b664778 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,8 @@ namespace surfaceFilmModels defineTypeNameAndDebug(surfaceFilmModel, 0); defineRunTimeSelectionTable(surfaceFilmModel, mesh); +const dimensionedScalar surfaceFilmModel::Tref("Tref", dimTemperature, 298.15); + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // bool surfaceFilmModel::read() diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 9d4360d8c..2f2690c25 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,6 +94,9 @@ public: //- Runtime type information TypeName("surfaceFilmModel"); + //- Reference temperature for enthalpy + static const dimensionedScalar Tref; + // Declare runtime constructor selection table @@ -192,6 +195,9 @@ public: //- Return the film wall temperature [K] virtual const volScalarField& Tw() const = 0; + //- Return the film surface temperature [J/kg] + virtual const volScalarField& hs() const = 0; + //- Return the film specific heat capacity [J/kg/K] virtual const volScalarField& Cp() const = 0; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 23c43f6a1..f6e7dd901 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -180,10 +180,12 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields() const scalar deltaT = time_.deltaTValue(); forAll(hsSpPrimaryBf, patchi) { - const scalarField& priMagSf = - primaryMesh().magSf().boundaryField()[patchi]; + scalarField rpriMagSfdeltaT + ( + (1.0/deltaT)/primaryMesh().magSf().boundaryField()[patchi] + ); - hsSpPrimaryBf[patchi] /= priMagSf*deltaT; + hsSpPrimaryBf[patchi] *= rpriMagSfdeltaT; } // Retrieve the source fields from the primary region via direct mapped @@ -191,9 +193,6 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields() // - fields require transfer of values for both patch AND to push the // values into the first layer of internal cells hsSp_.correctBoundaryConditions(); - - // Apply enthalpy source as difference between incoming and actual states - hsSp_ -= rhoSp_*hs_; } @@ -221,7 +220,7 @@ void thermoSingleLayer::correctAlpha() else { alpha_ == - pos(delta_ - dimensionedScalar("deltaWet", dimLength, deltaWet_)); + pos0(delta_ - dimensionedScalar("deltaWet", dimLength, deltaWet_)); } } @@ -237,26 +236,33 @@ void thermoSingleLayer::updateSubmodels() htcs_->correct(); htcw_->correct(); + // Update radiation + radiation_->correct(); + + // Update injection model - mass returned is mass available for injection + injection_.correct(availableMass_, cloudMassTrans_, cloudDiameterTrans_); + phaseChange_->correct ( time_.deltaTValue(), availableMass_, - primaryMassPCTrans_, - primaryEnergyPCTrans_ + primaryMassTrans_, + primaryEnergyTrans_ ); - // Update radiation - radiation_->correct(); - - // Update kinematic sub-models - kinematicSingleLayer::updateSubmodels(); - - // Update source fields - hsSp_ += primaryEnergyPCTrans_/magSf()/time().deltaT(); - rhoSp_ += primaryMassPCTrans_/magSf()/time().deltaT(); + const volScalarField rMagSfDt((1/time().deltaT())/magSf()); // Vapour recoil pressure - pSp_ -= sqr(primaryMassPCTrans_/magSf()/time().deltaT())/2.0/rhoPrimary_; + pSp_ -= sqr(rMagSfDt*primaryMassTrans_)/(2*rhoPrimary_); + + // Update transfer model - mass returned is mass available for transfer + transfer_.correct(availableMass_, primaryMassTrans_, primaryEnergyTrans_); + + // Update source fields + rhoSp_ += rMagSfDt*(cloudMassTrans_ + primaryMassTrans_); + hsSp_ += rMagSfDt*(cloudMassTrans_*hs_ + primaryEnergyTrans_); + + turbulence_->correct(); } @@ -290,7 +296,6 @@ void thermoSingleLayer::solveEnergy() + fvm::div(phi_, hs_) == - hsSp_ - - rhoSp_*hs_ + q(hs_) + radiation_->Shs() ); @@ -402,25 +407,11 @@ thermoSingleLayer::thermoSingleLayer hsBoundaryTypes() ), - primaryMassPCTrans_ + primaryEnergyTrans_ ( IOobject ( - "primaryMassPCTrans", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimMass, 0), - zeroGradientFvPatchScalarField::typeName - ), - primaryEnergyPCTrans_ - ( - IOobject - ( - "primaryEnergyPCTrans", + "primaryEnergyTrans", time().timeName(), regionMesh(), IOobject::NO_READ, @@ -619,10 +610,7 @@ void thermoSingleLayer::preEvolveRegion() } kinematicSingleLayer::preEvolveRegion(); - - // Update phase change - primaryMassPCTrans_ == dimensionedScalar("zero", dimMass, 0.0); - primaryEnergyPCTrans_ == dimensionedScalar("zero", dimEnergy, 0.0); + primaryEnergyTrans_ == dimensionedScalar("zero", dimEnergy, 0.0); } @@ -717,12 +705,6 @@ const volScalarField& thermoSingleLayer::hs() const } -tmp thermoSingleLayer::primaryMassTrans() const -{ - return primaryMassPCTrans_; -} - - void thermoSingleLayer::info() { kinematicSingleLayer::info(); @@ -767,7 +749,7 @@ tmp thermoSingleLayer::Srho() const const label filmPatchi = intCoupledPatchIDs()[i]; scalarField patchMass = - primaryMassPCTrans_.boundaryField()[filmPatchi]; + primaryMassTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchMass); @@ -777,7 +759,7 @@ tmp thermoSingleLayer::Srho() const forAll(patchMass, j) { - Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt); + Srho[cells[j]] += patchMass[j]/(V[cells[j]]*dt); } } @@ -821,7 +803,7 @@ tmp thermoSingleLayer::Srho const label filmPatchi = intCoupledPatchIDs_[i]; scalarField patchMass = - primaryMassPCTrans_.boundaryField()[filmPatchi]; + primaryMassTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchMass); @@ -831,7 +813,7 @@ tmp thermoSingleLayer::Srho forAll(patchMass, j) { - Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt); + Srho[cells[j]] += patchMass[j]/(V[cells[j]]*dt); } } } @@ -859,8 +841,6 @@ tmp thermoSingleLayer::Sh() const dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0) ) ); -/* - phase change energy fed back into the film... scalarField& Sh = tSh.ref(); const scalarField& V = primaryMesh().V(); @@ -871,20 +851,19 @@ tmp thermoSingleLayer::Sh() const const label filmPatchi = intCoupledPatchIDs_[i]; scalarField patchEnergy = - primaryEnergyPCTrans_.boundaryField()[filmPatchi]; + primaryEnergyTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchEnergy); - const label primaryPatchi = primaryPatchIDs()[i]; const unallocLabelList& cells = - primaryMesh().boundaryMesh()[primaryPatchi].faceCells(); + primaryMesh().boundaryMesh()[primaryPatchIDs()[i]].faceCells(); forAll(patchEnergy, j) { Sh[cells[j]] += patchEnergy[j]/(V[cells[j]]*dt); } } -*/ + return tSh; } diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index 941aa7314..8847cf86d 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,9 @@ Description Note: defining enthalpy as Cp(T - Tstd) - when using liquids from the thermophysical library, their enthalpies are calculated similarly, where - Tstd = 298.15 K + Tstd = 298.15K. This is clearly non-conservative unless the heat-capacity + is constant and should be rewritten to use the standard thermodynamics + packages. SourceFiles thermoSingleLayer.C @@ -89,32 +91,29 @@ protected: // Fields - //- Specific heat capacity / [J/kg/K] + //- Specific heat capacity [J/kg/K] volScalarField Cp_; - //- Thermal conductivity / [W/m/K] + //- Thermal conductivity [W/m/K] volScalarField kappa_; - //- Temperature - mean / [K] + //- Temperature - mean [K] volScalarField T_; - //- Temperature - surface / [K] + //- Temperature - surface [K] volScalarField Ts_; - //- Temperature - wall / [K] + //- Temperature - wall [K] volScalarField Tw_; - //- Sensible enthalpy / [J/kg] + //- Sensible enthalpy [J/kg] volScalarField hs_; // Transfer fields - to the primary region - //- Film mass evolved via phase change - volScalarField primaryMassPCTrans_; - - //- Film energy evolved via phase change - volScalarField primaryEnergyPCTrans_; + //- Film energy transfer + volScalarField primaryEnergyTrans_; //- Threshold film thickness beyond which the film is considered 'wet' @@ -141,24 +140,24 @@ protected: // Note: need boundary value mapped from primary region, and then // pushed into the patch internal field - //- Energy / [J/m2/s] + //- Energy [J/m2/s] volScalarField hsSp_; // Primary region - registered to the primary region mesh // Internal use only - not read-in - //- Energy / [J/m2/s] + //- Energy [J/m2/s] volScalarField hsSpPrimary_; // Fields mapped from primary region - registered to the film region // Note: need both boundary AND patch internal fields to be mapped - //- Temperature / [K] + //- Temperature [K] volScalarField TPrimary_; - //- List of specie mass fractions / [0-1] + //- List of specie mass fractions [0-1] PtrList YPrimary_; @@ -281,13 +280,6 @@ public: virtual const volScalarField& hs() const; - - // Transfer fields - to the primary region - - //- Return mass transfer source - Eulerian phase only - virtual tmp primaryMassTrans() const; - - // Helper functions //- Return sensible enthalpy as a function of temperature @@ -329,22 +321,22 @@ public: // Film region - //- Energy / [J/m2/s] + //- Energy [J/m2/s] inline const volScalarField& hsSp() const; // Primary region - //- Energy / [J/m2/s] + //- Energy [J/m2/s] inline const volScalarField& hsSpPrimary() const; // Fields mapped from the primary region - //- Temperature / [K] + //- Temperature [K] inline const volScalarField& TPrimary() const; - //- Specie mass fractions / [0-1] + //- Specie mass fractions [0-1] inline const PtrList& YPrimary() const; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index bf9f8e60c..527a4bc20 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ inline tmp thermoSingleLayer::hs ) const { const scalarField& Cp = Cp_.boundaryField()[patchi]; - return Cp*(T - 298.15); + return Cp*(T - Tref.value()); } @@ -73,7 +73,7 @@ inline tmp thermoSingleLayer::hs IOobject::NO_READ, IOobject::NO_WRITE ), - Cp_*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))) + Cp_*(T - Tref) ) ); } @@ -96,7 +96,7 @@ inline tmp thermoSingleLayer::T IOobject::NO_READ, IOobject::NO_WRITE ), - hs/Cp_ + dimensionedScalar("Tstd", dimTemperature, 298.15) + hs/Cp_ + Tref ) ); diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C index de4a576b1..a62ab3133 100644 --- a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C @@ -62,6 +62,35 @@ addToRunTimeSelectionTable ); +defineTemplateTypeNameAndDebugWithName +( + heRhoThermopureMixtureEnthalpyliquidProperties, + "heRhoThermo>", + 0 +); + +addToRunTimeSelectionTable +( + basicThermo, + heRhoThermopureMixtureEnthalpyliquidProperties, + fvMesh +); + +addToRunTimeSelectionTable +( + fluidThermo, + heRhoThermopureMixtureEnthalpyliquidProperties, + fvMesh +); + +addToRunTimeSelectionTable +( + rhoThermo, + heRhoThermopureMixtureEnthalpyliquidProperties, + fvMesh +); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H index de5aed514..0a223095d 100644 --- a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H @@ -28,6 +28,7 @@ License #include "pureMixture.H" #include "thermo.H" #include "sensibleInternalEnergy.H" +#include "sensibleEnthalpy.H" #include "thermophysicalPropertiesSelector.H" #include "liquidProperties.H" @@ -52,6 +53,20 @@ typedef heRhoThermo > heRhoThermopureMixtureliquidProperties; +typedef heRhoThermo +< + rhoThermo, + pureMixture + < + species::thermo + < + thermophysicalPropertiesSelector, + sensibleEnthalpy + > + > +> heRhoThermopureMixtureEnthalpyliquidProperties; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam