diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/multiphase/compressibleInterFoam/Allwclean index b02e598e8b..48f27227e1 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwclean +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwclean @@ -5,6 +5,7 @@ wclean libso twoPhaseMixtureThermo wclean libso surfaceTensionModels wclean libso twoPhaseChange wclean libso compressibleInterPhaseTransportModel +wclean libso VoFSurfaceFilm wclean diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 44d3ecea15..036016c29d 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -8,6 +8,7 @@ wmake $targetType twoPhaseMixtureThermo wmake $targetType surfaceTensionModels wmake $targetType twoPhaseChange wmake $targetType compressibleInterPhaseTransportModel +wmake $targetType VoFSurfaceFilm wmake $targetType diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/files b/applications/solvers/multiphase/compressibleInterFoam/Make/files index f13e9f515a..b812d006bb 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/files +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/files @@ -1,5 +1,3 @@ -VoFSurfaceFilm/VoFSurfaceFilm.C -VoFPatchTransfer/VoFPatchTransfer.C VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C compressibleInterFoam.C diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index 77d5ac0568..ad285d6040 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -13,8 +13,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ - -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ @@ -33,8 +31,6 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lcompressibleInterPhaseTransportModel \ - -lsurfaceFilmModels \ - -lsurfaceFilmDerivedFvPatchFields \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/VoFPatchTransfer/VoFPatchTransfer.C deleted file mode 100644 index 70cd344d33..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFPatchTransfer/VoFPatchTransfer.C +++ /dev/null @@ -1,345 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 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 "thermoSingleLayer.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace regionModels -{ -namespace surfaceFilmModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(VoFPatchTransfer, 0); -addToRunTimeSelectionTable(transferModel, VoFPatchTransfer, dictionary); - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -VoFPatchTransfer::VoFPatchTransfer -( - surfaceFilmRegionModel& 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() - film.regionMesh().globalData().processorPatches().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(patchIDs_.size(), 0); - } - - if (!patchIDs_.size()) - { - FatalErrorInFunction - << "No patches selected" - << exit(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -VoFPatchTransfer::~VoFPatchTransfer() -{} - - -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -void VoFPatchTransfer::correct -( - scalarField& availableMass, - scalarField& massToTransfer, - vectorField& momentumToTransfer -) -{ - NotImplemented; -} - - -void VoFPatchTransfer::correct -( - scalarField& availableMass, - scalarField& massToTransfer, - vectorField& momentumToTransfer, - scalarField& energyToTransfer -) -{ - // Do not correct if no patches selected - if (!patchIDs_.size()) return; - - const thermoSingleLayer& film = filmType(); - - 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 volVectorField& UVoF - ( - film.primaryMesh().lookupObject("U") - ); - - const volScalarField& alphaVoF = thermo.alpha1(); - const volScalarField& rhoVoF = thermo.thermo1().rho()(); - const volScalarField& heVoF = thermo.thermo1().he(); - const volScalarField& TVoF = thermo.thermo1().T(); - const volScalarField CpVoF(thermo.thermo1().Cp()); - - 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 alphap(alphaVoF.boundaryField()[primaryPatchi]); - film.toRegion(patchi, alphap); - - scalarField rhop(rhoVoF.boundaryField()[primaryPatchi]); - film.toRegion(patchi, rhop); - - vectorField Up(UVoF.boundaryField()[primaryPatchi]); - film.toRegion(patchi, Up); - - 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 Vp - ( - film.primaryMesh().boundary()[primaryPatchi] - .patchInternalField(film.primaryMesh().V()) - ); - film.toRegion(patchi, Vp); - - const polyPatch& pp = pbm[patchi]; - const labelList& faceCells = pp.faceCells(); - - const vectorField& U = film.U(); - const scalarField& he = film.thermo().he(); - - // 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; - momentumToTransfer[celli] += dMass*U[celli]; - energyToTransfer[celli] += dMass*he[celli]; - } - - if - ( - alphap[facei] > 0 - && delta[celli] < 2*deltaFactorToFilm_/deltaCoeffs[facei] - && alphap[facei] < alphaToFilm_ - ) - { - dMass = - -transferRateCoeff_*alphap[facei]*rhop[facei]*Vp[facei]; - - massToTransfer[celli] += dMass; - momentumToTransfer[celli] += dMass*Up[facei]; - 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/VoFPatchTransfer/VoFPatchTransfer.H b/applications/solvers/multiphase/compressibleInterFoam/VoFPatchTransfer/VoFPatchTransfer.H deleted file mode 100644 index 0d022ecddb..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFPatchTransfer/VoFPatchTransfer.H +++ /dev/null @@ -1,146 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 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 -{ -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(surfaceFilmRegionModel& film, const dictionary& dict); - - //- Disallow default bitwise copy construction - VoFPatchTransfer(const VoFPatchTransfer&) = delete; - - - //- Destructor - virtual ~VoFPatchTransfer(); - - - // Member Functions - - //- Correct - virtual void correct - ( - scalarField& availableMass, - scalarField& massToTransfer, - vectorField& momentumToTransfer - ); - - //- Correct kinematic and thermodynamic transfers - virtual void correct - ( - scalarField& availableMass, - scalarField& massToTransfer, - vectorField& momentumToTransfer, - scalarField& energyToTransfer - ); - - //- Accumulate the total mass injected for the patches into the - // scalarField provided - virtual void patchTransferredMassTotals - ( - scalarField& patchMasses - ) const; - - - // Member Operators - - //- Disallow default bitwise assignment - void operator=(const VoFPatchTransfer&) = delete; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace surfaceFilmModels -} // End namespace regionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C b/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C index 1011f27953..c3904f80b2 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C +++ b/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C @@ -58,6 +58,14 @@ Foam::fv::VoFSurfaceFilm::VoFSurfaceFilm ) : fvModel(sourceName, modelType, dict, mesh), + phaseName_(dict.lookup("phase")), + thermo_ + ( + mesh.lookupObject + ( + IOobject::groupName(basicThermo::dictName, phaseName_) + ) + ), film_ ( regionModels::surfaceFilmModel::New @@ -66,14 +74,6 @@ Foam::fv::VoFSurfaceFilm::VoFSurfaceFilm mesh.lookupObject("g") ) ), - phaseName_(dict.lookup("phase")), - thermo_ - ( - mesh.lookupObject - ( - IOobject::groupName(basicThermo::dictName, phaseName_) - ) - ), curTimeIndex_(-1) {} diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H b/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H index 5c9b5bc37a..154d9fdba7 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H +++ b/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H @@ -46,7 +46,7 @@ SourceFiles #define VoFSurfaceFilm_H #include "fvModel.H" -#include "rhoThermo.H" +#include "fluidThermo.H" #include "surfaceFilmModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,15 +66,15 @@ class VoFSurfaceFilm { // Private Data - //- The surface film model pointer - mutable autoPtr film_; - //- The name of the phase which transfers to the film word phaseName_; //- Reference to the primary region thermo const fluidThermo& thermo_; + //- The surface film model pointer + mutable autoPtr film_; + //- Current time index (used for updating) mutable label curTimeIndex_; diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/plateFilm/system/controlDict b/tutorials/multiphase/compressibleInterFoam/laminar/plateFilm/system/controlDict index f6b8cb5a96..cf47676641 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/plateFilm/system/controlDict +++ b/tutorials/multiphase/compressibleInterFoam/laminar/plateFilm/system/controlDict @@ -52,5 +52,6 @@ maxAlphaCo 1; maxDeltaT 1; +libs ("libVoFSurfaceFilm.so"); // ************************************************************************* //