diff --git a/applications/solvers/modules/fluid/multiphaseEuler/Allwclean b/applications/solvers/modules/fluid/multiphaseEuler/Allwclean new file mode 100755 index 0000000000..7040d013f8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/Allwclean @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +wclean libso phaseSystems +wclean libso interfacialModels +wclean libso interfacialCompositionModels +wclean libso multiphaseCompressibleMomentumTransportModels +wclean libso multiphaseReactions +multiphaseEuler/Allwclean +wclean libso fvModels +wclean libso functionObjects + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/modules/fluid/multiphaseEuler/Allwmake b/applications/solvers/modules/fluid/multiphaseEuler/Allwmake new file mode 100755 index 0000000000..019aba50de --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/Allwmake @@ -0,0 +1,16 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +wmake $targetType phaseSystems +wmake $targetType interfacialModels +wmake $targetType interfacialCompositionModels +wmake $targetType multiphaseCompressibleMomentumTransportModels +wmake $targetType multiphaseReactions +multiphaseEuler/Allwmake $targetType $* +wmake $targetType fvModels +wmake $targetType functionObjects + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/modules/fluid/multiphaseEuler/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/Make/files new file mode 100644 index 0000000000..1f0d6fd7dc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/Make/files @@ -0,0 +1,10 @@ +setRDeltaT.C +moveMesh.C +alphaPredictor.C +momentumPredictor.C +thermophysicalPredictor.C +compressibilityEqns.C +pressureCorrector.C +multiphaseEuler.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseEuler diff --git a/applications/solvers/modules/fluid/multiphaseEuler/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/Make/options new file mode 100644 index 0000000000..41a7aab42e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/Make/options @@ -0,0 +1,28 @@ +EXE_INC = \ + -I$(FOAM_SOLVERS)/modules/fluid/fluidSolver/lnInclude \ + -IcompressibleTwoPhaseMixture \ + -IcompressibleInterPhaseTransportModel/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \ + -I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfluidSolver \ + -lcompressibleTwoPhaseMixture \ + -ltwoPhaseSurfaceTension \ + -lfluidThermophysicalModels \ + -ltwoPhaseMixture \ + -ltwoPhaseProperties \ + -linterfaceProperties \ + -lcompressibleInterPhaseTransportModel \ + -lfiniteVolume \ + -lfvModels \ + -lfvConstraints \ + -lmeshTools \ + -lsampling diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/files new file mode 100644 index 0000000000..839b339b15 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/files @@ -0,0 +1,6 @@ +populationBalanceMoments/populationBalanceMoments.C +populationBalanceSizeDistribution/populationBalanceSizeDistribution.C +phaseForces/phaseForces.C +phaseMap/phaseMap.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseEulerFoamFunctionObjects diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/options new file mode 100644 index 0000000000..b8345e0763 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/Make/options @@ -0,0 +1,28 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I../interfacialModels/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/functionObjects/field/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lphaseSystem \ + -lmultiphaseSystems \ + -leulerianInterfacialModels \ + -leulerianInterfacialCompositionModels \ + -lmultiphaseMomentumTransportModels \ + -lmultiphaseReactions \ + -lmultiphaseProperties \ + -lphaseFluidThermophysicalTransportModels \ + -lphaseFluidMulticomponentThermophysicalTransportModels \ + -lfiniteVolume \ + -lmeshTools \ + -lfileFormats \ + -lfieldFunctionObjects diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.C b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.C new file mode 100644 index 0000000000..8d31721ea9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.C @@ -0,0 +1,303 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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 "phaseForces.H" +#include "addToRunTimeSelectionTable.H" +#include "fvcGrad.H" +#include "dragModel.H" +#include "virtualMassModel.H" +#include "liftModel.H" +#include "wallLubricationModel.H" +#include "turbulentDispersionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(phaseForces, 0); + addToRunTimeSelectionTable(functionObject, phaseForces, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::phaseForces::phaseForces +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + phase_ + ( + mesh_.lookupObject + ( + IOobject::groupName("alpha", dict.lookup("phase")) + ) + ), + fluid_(mesh_.lookupObject(phaseSystem::propertiesName)) +{ + read(dict); + + forAll(fluid_.phases(), phasei) + { + const phaseModel& otherPhase = fluid_.phases()[phasei]; + + if (&otherPhase == &phase_) continue; + + const phaseInterface interface(phase_, otherPhase); + + if (fluid_.foundInterfacialModel(interface)) + { + forceFields_.insert + ( + dragModel::typeName, + new volVectorField + ( + IOobject + ( + IOobject::groupName("dragForce", phase_.name()), + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector(dimForce/dimVolume, Zero) + ) + ); + } + + if (fluid_.foundInterfacialModel(interface)) + { + forceFields_.insert + ( + virtualMassModel::typeName, + new volVectorField + ( + IOobject + ( + IOobject::groupName + ( + "virtualMassForce", + phase_.name() + ), + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector(dimForce/dimVolume, Zero) + ) + ); + } + + if (fluid_.foundInterfacialModel(interface)) + { + forceFields_.insert + ( + liftModel::typeName, + new volVectorField + ( + IOobject + ( + IOobject::groupName("liftForce", phase_.name()), + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector(dimForce/dimVolume, Zero) + ) + ); + } + + if + ( + fluid_.foundInterfacialModel + (interface) + ) + { + forceFields_.insert + ( + wallLubricationModel::typeName, + new volVectorField + ( + IOobject + ( + IOobject::groupName + ( + "wallLubricationForce", + phase_.name() + ), + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector(dimForce/dimVolume, Zero) + ) + ); + } + + if + ( + fluid_.foundInterfacialModel + (interface) + ) + { + forceFields_.insert + ( + turbulentDispersionModel::typeName, + new volVectorField + ( + IOobject + ( + IOobject::groupName + ( + "turbulentDispersionForce", + phase_.name() + ), + mesh_.time().timeName(), + mesh_ + ), + mesh_, + dimensionedVector(dimForce/dimVolume, Zero) + ) + ); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::functionObjects::phaseForces::~phaseForces() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionObjects::phaseForces::read(const dictionary& dict) +{ + fvMeshFunctionObject::read(dict); + + return true; +} + + +bool Foam::functionObjects::phaseForces::execute() +{ + // Zero the force fields + forAllConstIter + ( + HashPtrTable, + forceFields_, + forceFieldIter + ) + { + *forceFieldIter() = Zero; + } + + // Add the forces from all the interfaces which contain this phase + forAll(fluid_.phases(), phasei) + { + const phaseModel& otherPhase = fluid_.phases()[phasei]; + + if (&otherPhase == &phase_) continue; + + const phaseInterface interface(phase_, otherPhase); + + if (fluid_.foundInterfacialModel(interface)) + { + *forceFields_[dragModel::typeName] += + fluid_.lookupInterfacialModel(interface).K() + *(otherPhase.U() - phase_.U()); + } + + if (fluid_.foundInterfacialModel(interface)) + { + *forceFields_[virtualMassModel::typeName] += + fluid_.lookupInterfacialModel + (interface).K() + *(otherPhase.DUDt() - phase_.DUDt()); + } + + if (fluid_.foundInterfacialModel(interface)) + { + *forceFields_[liftModel::typeName] += + (&interface.phase1() == &phase_ ? -1 : +1) + *fluid_.lookupInterfacialModel(interface).F(); + } + + if + ( + fluid_.foundInterfacialModel + (interface) + ) + { + *forceFields_[wallLubricationModel::typeName] += + (&interface.phase1() == &phase_ ? -1 : +1) + *fluid_.lookupInterfacialModel + (interface).F(); + } + + if + ( + fluid_.foundInterfacialModel + (interface) + ) + { + *forceFields_[turbulentDispersionModel::typeName] += + fluid_.lookupInterfacialModel + (interface).D() + *fvc::grad + ( + otherPhase + /max(phase_ + otherPhase, otherPhase.residualAlpha()) + ); + } + } + + return true; +} + + +bool Foam::functionObjects::phaseForces::write() +{ + forAllConstIter + ( + HashPtrTable, + forceFields_, + forceFieldIter + ) + { + writeObject(forceFieldIter()->name()); + } + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.H b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.H new file mode 100644 index 0000000000..bad37f4a26 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseForces/phaseForces.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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::functionObjects::phaseForces + +Description + This functionObject calculates and outputs the blended interfacial forces + acting on a given phase, i.e. drag, virtual mass, lift, wall-lubrication and + turbulent dispersion. Note that it works only in run-time processing mode + and in combination with the multiphaseEulerFoam solver. + + For a simulation involving more than two phases, the accumulated force is + calculated by looping over all interfaces involving that phase. The fields + are stored in the database so that they can be processed further, e.g. with + the fieldAveraging functionObject. + + Example of function object specification: + \verbatim + phaseForces.water + { + type phaseForces; + + libs ("libmultiphaseEulerFoamFunctionObjects.so"); + + phase water; + } + \endverbatim + +Usage + \table + Property | Description | Required | Default value + type | type name: phaseForces | yes | + phase | Name of evaluated phase | yes | + \endtable + +See also + Foam::BlendedInterfacialModel + Foam::functionObjects::fvMeshFunctionObject + Foam::functionObject + +SourceFiles + phaseForces.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjects_phaseForces_H +#define functionObjects_phaseForces_H + +#include "fvMeshFunctionObject.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class phaseForces Declaration +\*---------------------------------------------------------------------------*/ + +class phaseForces +: + public fvMeshFunctionObject +{ +protected: + + // Protected data + + //- Force fields + HashPtrTable forceFields_; + + //- Phase for which forces are evaluated + const phaseModel& phase_; + + //- Constant access to phaseSystem + const phaseSystem& fluid_; + + +public: + + //- Runtime type information + TypeName("phaseForces"); + + + // Constructors + + //- Construct from Time and dictionary + phaseForces + ( + const word& name, + const Time& runTime, + const dictionary& + ); + + //- Disallow default bitwise copy construction + phaseForces(const phaseForces&) = delete; + + + //- Destructor + virtual ~phaseForces(); + + + // Member Functions + + //- Read the input data + virtual bool read(const dictionary& dict); + + //- Return the list of fields required + virtual wordList fields() const + { + return wordList::null(); + } + + //- Calculate the force fields + virtual bool execute(); + + //- Write the force fields + virtual bool write(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const phaseForces&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.C b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.C new file mode 100644 index 0000000000..5567d3c5da --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-2022 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 "phaseMap.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(phaseMap, 0); + addToRunTimeSelectionTable(functionObject, phaseMap, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::phaseMap::phaseMap +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + phases_ + ( + mesh_.lookupObject(phaseSystem::propertiesName).phases() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::functionObjects::phaseMap::~phaseMap() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionObjects::phaseMap::execute() +{ + return true; +} + + +bool Foam::functionObjects::phaseMap::write() +{ + volScalarField phaseMap + ( + IOobject + ( + IOobject::groupName(phases_[0].member(), "map"), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensionedScalar(dimless, 0) + ); + + scalar level = 0; + + forAll(phases_, i) + { + phaseMap += level*phases_[i]; + level += 1; + } + + phaseMap.write(); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.H b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.H new file mode 100644 index 0000000000..955355d4d3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/phaseMap/phaseMap.H @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-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::functionObjects::phaseMap + +Description + This functionObject writes the phase-fraction map field alpha.map with + incremental value ranges for each phase + e.g., with values 0 for water, 1 for air, 2 for oil etc. + + Example of function object specification: + \verbatim + phaseMap + { + type phaseMap; + libs ("libmultiphaseEulerFoamFunctionObjects.so"); + writeControl writeTime; + } + \endverbatim + +Usage + \table + Property | Description | Required | Default value + type | type name: phaseMap | yes | + \endtable + +See also + Foam::functionObjects::fvMeshFunctionObject + Foam::functionObject + +SourceFiles + phaseMap.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjects_phaseMap_H +#define functionObjects_phaseMap_H + +#include "fvMeshFunctionObject.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class phaseMap Declaration +\*---------------------------------------------------------------------------*/ + +class phaseMap +: + public fvMeshFunctionObject +{ +protected: + + // Protected data + + //- Constant access to phases + const phaseSystem::phaseModelList& phases_; + + +public: + + //- Runtime type information + TypeName("phaseMap"); + + + // Constructors + + //- Construct from Time and dictionary + phaseMap + ( + const word& name, + const Time& runTime, + const dictionary& + ); + + //- Disallow default bitwise copy construction + phaseMap(const phaseMap&) = delete; + + + //- Destructor + virtual ~phaseMap(); + + + // Member Functions + + //- Return the list of fields required + virtual wordList fields() const + { + return wordList::null(); + } + + //- Calculate the force fields + virtual bool execute(); + + //- Write the force fields + virtual bool write(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const phaseMap&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.C b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.C new file mode 100644 index 0000000000..e9125285da --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.C @@ -0,0 +1,983 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "populationBalanceMoments.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(populationBalanceMoments, 0); + addToRunTimeSelectionTable + ( + functionObject, + populationBalanceMoments, + dictionary + ); +} +} + + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::functionObjects::populationBalanceMoments::momentType, + 4 + >::names[] = {"integerMoment", "mean", "variance", "stdDev"}; +} + + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceMoments::momentType, + 4 +> +Foam::functionObjects::populationBalanceMoments::momentTypeNames_; + + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::functionObjects::populationBalanceMoments::coordinateType, + 3 + >::names[] = {"volume", "area", "diameter"}; +} + + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceMoments::coordinateType, + 3 +> +Foam::functionObjects::populationBalanceMoments::coordinateTypeNames_; + + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::functionObjects::populationBalanceMoments::weightType, + 3 + >::names[] = + { + "numberConcentration", + "volumeConcentration", + "areaConcentration" + }; +} + + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceMoments::weightType, + 3 +> +Foam::functionObjects::populationBalanceMoments::weightTypeNames_; + + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::functionObjects::populationBalanceMoments::meanType, + 3 + >::names[] = {"arithmetic", "geometric", "notApplicable"}; +} + + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceMoments::meanType, + 3 +> +Foam::functionObjects::populationBalanceMoments::meanTypeNames_; + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::word +Foam::functionObjects::populationBalanceMoments::coordinateTypeSymbolicName() +{ + word coordinateTypeSymbolicName(word::null); + + switch (coordinateType_) + { + case coordinateType::volume: + { + coordinateTypeSymbolicName = "v"; + + break; + } + case coordinateType::area: + { + coordinateTypeSymbolicName = "a"; + + break; + } + case coordinateType::diameter: + { + coordinateTypeSymbolicName = "d"; + + break; + } + } + + return coordinateTypeSymbolicName; +} + + +Foam::word +Foam::functionObjects::populationBalanceMoments::weightTypeSymbolicName() +{ + word weightTypeSymbolicName(word::null); + + switch (weightType_) + { + case weightType::numberConcentration: + { + weightTypeSymbolicName = "N"; + + break; + } + case weightType::volumeConcentration: + { + weightTypeSymbolicName = "V"; + + break; + } + case weightType::areaConcentration: + { + weightTypeSymbolicName = "A"; + + break; + } + } + + return weightTypeSymbolicName; +} + + +Foam::word Foam::functionObjects::populationBalanceMoments::defaultFldName() +{ + word meanName + ( + meanType_ == meanType::geometric + ? word(meanTypeNames_[meanType_]).capitalise() + : word("") + ); + + return + word + ( + IOobject::groupName + ( + "weighted" + + meanName + + word(momentTypeNames_[momentType_]).capitalise() + + "(" + + weightTypeSymbolicName() + + "," + + coordinateTypeSymbolicName() + + ")", + popBal_.name() + ) + ); +} + + +Foam::word +Foam::functionObjects::populationBalanceMoments::integerMomentFldName() +{ + return + word + ( + IOobject::groupName + ( + word(momentTypeNames_[momentType_]) + + Foam::name(order_) + + "(" + + weightTypeSymbolicName() + + "," + + coordinateTypeSymbolicName() + + ")", + popBal_.name() + ) + ); +} + + +void Foam::functionObjects::populationBalanceMoments::setDimensions +( + volScalarField& fld, + momentType momType +) +{ + switch (momType) + { + case momentType::integerMoment: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + fld.dimensions().reset + ( + pow(dimVolume, order_)/dimVolume + ); + + break; + } + case coordinateType::area: + { + fld.dimensions().reset + ( + pow(dimArea, order_)/dimVolume + ); + + break; + } + case coordinateType::diameter: + { + fld.dimensions().reset + ( + pow(dimLength, order_)/dimVolume + ); + + break; + } + } + + switch (weightType_) + { + case weightType::volumeConcentration: + { + fld.dimensions().reset(fld.dimensions()*dimVolume); + + break; + } + case weightType::areaConcentration: + { + fld.dimensions().reset(fld.dimensions()*dimArea); + + break; + } + default: + { + break; + } + } + + break; + } + case momentType::mean: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + fld.dimensions().reset(dimVolume); + + break; + } + case coordinateType::area: + { + fld.dimensions().reset(dimArea); + + break; + } + case coordinateType::diameter: + { + fld.dimensions().reset(dimLength); + + break; + } + } + + break; + } + case momentType::variance: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + fld.dimensions().reset(sqr(dimVolume)); + + break; + } + case coordinateType::area: + { + fld.dimensions().reset(sqr(dimArea)); + + break; + } + case coordinateType::diameter: + { + fld.dimensions().reset(sqr(dimLength)); + + break; + } + } + + if (meanType_ == meanType::geometric) + { + fld.dimensions().reset(dimless); + } + + break; + } + case momentType::stdDev: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + fld.dimensions().reset(dimVolume); + + break; + } + case coordinateType::area: + { + fld.dimensions().reset(dimArea); + + break; + } + case coordinateType::diameter: + { + fld.dimensions().reset(dimLength); + + break; + } + } + + if (meanType_ == meanType::geometric) + { + fld.dimensions().reset(dimless); + } + + break; + } + } +} + + +Foam::tmp +Foam::functionObjects::populationBalanceMoments::totalConcentration() +{ + tmp tTotalConcentration + ( + volScalarField::New + ( + "totalConcentration", + mesh_, + dimensionedScalar(inv(dimVolume), Zero) + ) + ); + + volScalarField& totalConcentration = tTotalConcentration.ref(); + + switch (weightType_) + { + case weightType::volumeConcentration: + { + totalConcentration.dimensions().reset + ( + totalConcentration.dimensions()*dimVolume + ); + + break; + } + case weightType::areaConcentration: + { + totalConcentration.dimensions().reset + ( + totalConcentration.dimensions()*dimArea + ); + + break; + } + default: + { + break; + } + } + + forAll(popBal_.sizeGroups(), i) + { + const Foam::diameterModels::sizeGroup& fi = popBal_.sizeGroups()[i]; + + switch (weightType_) + { + case weightType::numberConcentration: + { + totalConcentration += fi*fi.phase()/fi.x(); + + break; + } + case weightType::volumeConcentration: + { + totalConcentration += fi*fi.phase(); + + break; + } + case weightType::areaConcentration: + { + totalConcentration += fi.a()*fi*fi.phase()/fi.x(); + + break; + } + } + } + + return tTotalConcentration; +} + + +Foam::tmp +Foam::functionObjects::populationBalanceMoments::mean() +{ + tmp tMean + ( + volScalarField::New + ( + "mean", + mesh_, + dimensionedScalar(dimless, Zero) + ) + ); + + volScalarField& mean = tMean.ref(); + + setDimensions(mean, momentType::mean); + + volScalarField totalConcentration(this->totalConcentration()); + + forAll(popBal_.sizeGroups(), i) + { + const Foam::diameterModels::sizeGroup& fi = popBal_.sizeGroups()[i]; + + volScalarField concentration(fi*fi.phase()/fi.x()); + + switch (weightType_) + { + case weightType::volumeConcentration: + { + concentration *= fi.x(); + + break; + } + case weightType::areaConcentration: + { + concentration *= fi.a(); + + break; + } + default: + { + break; + } + } + + switch (meanType_) + { + case meanType::geometric: + { + mean.dimensions().reset(dimless); + + switch (coordinateType_) + { + case coordinateType::volume: + { + dimensionedScalar unitVolume(dimVolume, 1); + + mean += + Foam::log(fi.x()/unitVolume) + *concentration/totalConcentration; + + break; + } + case coordinateType::area: + { + dimensionedScalar unitArea(dimArea, 1); + + mean += + Foam::log(fi.a()/unitArea) + *concentration/totalConcentration; + + break; + } + case coordinateType::diameter: + { + dimensionedScalar unitLength(dimLength, 1); + + mean += + Foam::log(fi.d()/unitLength) + *concentration/totalConcentration; + + break; + } + } + + break; + } + default: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + mean += fi.x()*concentration/totalConcentration; + + break; + } + case coordinateType::area: + { + mean += fi.a()*concentration/totalConcentration; + + break; + } + case coordinateType::diameter: + { + mean += fi.d()*concentration/totalConcentration; + + break; + } + } + + break; + } + } + } + + if (meanType_ == meanType::geometric) + { + mean = exp(mean); + + setDimensions(mean, momentType::mean); + } + + return tMean; +} + + +Foam::tmp +Foam::functionObjects::populationBalanceMoments::variance() +{ + tmp tVariance + ( + volScalarField::New + ( + "variance", + mesh_, + dimensionedScalar(dimless, Zero) + ) + ); + + volScalarField& variance = tVariance.ref(); + + setDimensions(variance, momentType::variance); + + volScalarField totalConcentration(this->totalConcentration()); + volScalarField mean(this->mean()); + + forAll(popBal_.sizeGroups(), i) + { + const Foam::diameterModels::sizeGroup& fi = popBal_.sizeGroups()[i]; + + volScalarField concentration(fi*fi.phase()/fi.x()); + + switch (weightType_) + { + case weightType::volumeConcentration: + { + concentration *= fi.x(); + + break; + } + case weightType::areaConcentration: + { + concentration *= fi.a(); + + break; + } + default: + { + break; + } + } + + switch (meanType_) + { + case meanType::geometric: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + variance += + sqr(Foam::log(fi.x()/mean)) + *concentration/totalConcentration; + + break; + } + case coordinateType::area: + { + variance += + sqr(Foam::log(fi.a()/mean)) + *concentration/totalConcentration; + + break; + } + case coordinateType::diameter: + { + variance += + sqr(Foam::log(fi.d()/mean)) + *concentration/totalConcentration; + + break; + } + } + + break; + } + default: + { + switch (coordinateType_) + { + case coordinateType::volume: + { + variance += + sqr(fi.x() - mean)*concentration/totalConcentration; + + + break; + } + case coordinateType::area: + { + variance += + sqr(fi.a() - mean)*concentration/totalConcentration; + + break; + } + case coordinateType::diameter: + { + variance += + sqr(fi.d() - mean)*concentration/totalConcentration; + + break; + } + } + + break; + } + } + } + + return tVariance; +} + + +Foam::tmp +Foam::functionObjects::populationBalanceMoments::stdDev() +{ + switch (meanType_) + { + case meanType::geometric: + { + return exp(sqrt(this->variance())); + } + default: + { + return sqrt(this->variance()); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::populationBalanceMoments::populationBalanceMoments +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + popBal_ + ( + obr_.lookupObject + ( + dict.lookup("populationBalance") + ) + ), + momentType_(momentTypeNames_.read(dict.lookup("momentType"))), + coordinateType_(coordinateTypeNames_.read(dict.lookup("coordinateType"))), + weightType_ + ( + dict.found("weightType") + ? weightTypeNames_.read(dict.lookup("weightType")) + : weightType::numberConcentration + ), + meanType_(meanType::notApplicable), + order_(-1), + fldPtr_(nullptr) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::functionObjects::populationBalanceMoments::~populationBalanceMoments() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool +Foam::functionObjects::populationBalanceMoments::read(const dictionary& dict) +{ + fvMeshFunctionObject::read(dict); + + switch (momentType_) + { + case momentType::integerMoment: + { + order_ = dict.lookup("order"); + + break; + } + default: + { + meanType_ = + dict.found("meanType") + ? meanTypeNames_.read(dict.lookup("meanType")) + : meanType::arithmetic; + + break; + } + } + + switch (momentType_) + { + case momentType::integerMoment: + { + fldPtr_.set + ( + new volScalarField + ( + IOobject + ( + this->integerMomentFldName(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar(dimless, Zero) + ) + ); + + volScalarField& integerMoment = fldPtr_(); + + setDimensions(integerMoment, momentType::integerMoment); + + break; + } + case momentType::mean: + { + fldPtr_.set + ( + new volScalarField + ( + IOobject + ( + this->defaultFldName(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mean() + ) + ); + + break; + } + case momentType::variance: + { + fldPtr_.set + ( + new volScalarField + ( + IOobject + ( + this->defaultFldName(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->variance() + ) + ); + + break; + } + case momentType::stdDev: + { + fldPtr_.set + ( + new volScalarField + ( + IOobject + ( + this->defaultFldName(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->stdDev() + ) + ); + + break; + } + } + + return true; +} + + +bool Foam::functionObjects::populationBalanceMoments::execute() +{ + switch (momentType_) + { + case momentType::integerMoment: + { + volScalarField& integerMoment = fldPtr_(); + + integerMoment = Zero; + + forAll(popBal_.sizeGroups(), i) + { + const Foam::diameterModels::sizeGroup& fi = + popBal_.sizeGroups()[i]; + + volScalarField concentration(fi*fi.phase()/fi.x()); + + switch (weightType_) + { + case weightType::volumeConcentration: + { + concentration *= fi.x(); + + break; + } + case weightType::areaConcentration: + { + concentration *= fi.a(); + + break; + } + default: + { + break; + } + } + + switch (coordinateType_) + { + case coordinateType::volume: + { + integerMoment += + pow(fi.x(), order_)*concentration; + + break; + } + case coordinateType::area: + { + integerMoment += + pow(fi.a(), order_)*concentration; + + break; + } + case coordinateType::diameter: + { + integerMoment += + pow(fi.d(), order_)*concentration; + + break; + } + } + } + + break; + } + case momentType::mean: + { + fldPtr_() = this->mean(); + + break; + } + case momentType::variance: + { + fldPtr_() = this->variance(); + + break; + } + case momentType::stdDev: + { + fldPtr_() = sqrt(this->variance()); + + break; + } + } + + return true; +} + + +bool Foam::functionObjects::populationBalanceMoments::write() +{ + writeObject(fldPtr_->name()); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.H b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.H new file mode 100644 index 0000000000..858b1f0074 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceMoments/populationBalanceMoments.H @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::functionObjects::populationBalanceMoments + +Description + Calculates and writes out integral (integer moments) or mean properties + (mean, variance, standard deviation) of a size distribution determined by a + population balance model. Requires solver post-processing. + + The following function object specification for example returns the first + moment of the volume-based number density function which is equivalent to + the phase fraction of the particulate phase: + + \verbatim + populationBalanceMoments + { + type populationBalanceMoments; + libs ("libmultiphaseEulerFoamFunctionObjects.so"); + executeControl timeStep; + writeControl writeTime; + populationBalance bubbles; + momentType integerMoment; + coordinateType volume; + order 1; + } + \endverbatim + +Usage + \table + Property | Description | Required | Default + populationBalance | population balance name | yes | + momentType | desired moment of the distribution\\ + | yes | + coordinateType | particle property | yes | + weightType | number/volume/area concentration\\ + | no\\ + | numberConcentration + order | order of integer moment | for integer moments | + meanType | arithmetic or geometric | for non-integer moments\\ + | arithmetic + \endtable + +See also + Foam::diameterModels::populationBalanceModel + Foam::functionObjects::fvMeshFunctionObject + Foam::functionObject + +SourceFiles + populationBalanceMoments.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjects_populationBalanceMoments_H +#define functionObjects_populationBalanceMoments_H + +#include "fvMeshFunctionObject.H" +#include "populationBalanceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class populationBalanceMoments Declaration +\*---------------------------------------------------------------------------*/ + +class populationBalanceMoments +: + public fvMeshFunctionObject +{ +public: + + //- Enumeration for the moment types + enum class momentType + { + integerMoment, + mean, + variance, + stdDev + }; + + //- Names of the moment types + static const NamedEnum momentTypeNames_; + + //- Enumeration for the coordinate types + enum class coordinateType + { + volume, + area, + diameter + }; + + //- Names of the coordinate types + static const NamedEnum coordinateTypeNames_; + + //- Enumeration for the weight types + enum class weightType + { + numberConcentration, + volumeConcentration, + areaConcentration + }; + + //- Names of the weight types + static const NamedEnum weightTypeNames_; + + //- Enumeration for the mean types + enum class meanType + { + arithmetic, + geometric, + notApplicable + }; + + //- Names of the mean types + static const NamedEnum meanTypeNames_; + + +private: + + // Private Data + + //- Reference to population balance + const Foam::diameterModels::populationBalanceModel& popBal_; + + //- Moment type + momentType momentType_; + + //- Coordinate type + coordinateType coordinateType_; + + //- Weight type + weightType weightType_; + + //- Mean type + meanType meanType_; + + //- Integer moment order + int order_; + + //- Result field + autoPtr fldPtr_; + + + // Private Member Functions + + //- Coordinate type symbolic name for shorter field names + word coordinateTypeSymbolicName(); + + //- Weight type symbolic name for shorter field names + word weightTypeSymbolicName(); + + //- Default field name + word defaultFldName(); + + //- Integer moment field name + word integerMomentFldName(); + + //- Set dimensions + void setDimensions(volScalarField& fld, momentType momType); + + //- Total concentration + tmp totalConcentration(); + + //- Mean value + tmp mean(); + + //- Variance + tmp variance(); + + //- Standard deviation + tmp stdDev(); + + +public: + + //- Runtime type information + TypeName("populationBalanceMoments"); + + + // Constructors + + //- Construct from Time and dictionary + populationBalanceMoments + ( + const word& name, + const Time& runTime, + const dictionary& + ); + + //- Disallow default bitwise copy construction + populationBalanceMoments(const populationBalanceMoments&) = delete; + + + //- Destructor + virtual ~populationBalanceMoments(); + + + // Member Functions + + //- Read the data + virtual bool read(const dictionary&); + + //- Return the list of fields required + virtual wordList fields() const + { + return wordList::null(); + } + + //- Calculate the moment fields + virtual bool execute(); + + //- Write the moment fields + virtual bool write(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const populationBalanceMoments&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.C b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.C new file mode 100644 index 0000000000..c95a7fe5b6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.C @@ -0,0 +1,664 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2022 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 "populationBalanceSizeDistribution.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(populationBalanceSizeDistribution, 0); + addToRunTimeSelectionTable + ( + functionObject, + populationBalanceSizeDistribution, + dictionary + ); +} +} + +template<> +const char* +Foam::NamedEnum +< + Foam::functionObjects::populationBalanceSizeDistribution::functionType, + 6 +>::names[] = +{ + "numberConcentration", + "numberDensity", + "volumeConcentration", + "volumeDensity", + "areaConcentration", + "areaDensity" +}; + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceSizeDistribution::functionType, + 6 +> Foam::functionObjects::populationBalanceSizeDistribution::functionTypeNames_; + +template<> +const char* +Foam::NamedEnum +< + Foam::functionObjects::populationBalanceSizeDistribution::coordinateType, + 4 +>::names[] = +{ + "volume", + "area", + "diameter", + "projectedAreaDiameter" +}; + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceSizeDistribution::coordinateType, + 4 +> Foam::functionObjects::populationBalanceSizeDistribution:: + coordinateTypeNames_; + + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::functionObjects::populationBalanceSizeDistribution::weightType, + 4 + >::names[] = + { + "numberConcentration", + "volumeConcentration", + "areaConcentration", + "cellVolume" + }; +} + + +const Foam::NamedEnum +< + Foam::functionObjects::populationBalanceSizeDistribution::weightType, + 4 +> +Foam::functionObjects::populationBalanceSizeDistribution::weightTypeNames_; + +using Foam::constant::mathematical::pi; + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::word +Foam::functionObjects::populationBalanceSizeDistribution:: +functionTypeSymbolicName() +{ + word functionTypeSymbolicName(word::null); + + switch (functionType_) + { + case functionType::numberConcentration: + { + functionTypeSymbolicName = "N"; + + break; + } + case functionType::numberDensity: + { + functionTypeSymbolicName = "n"; + + break; + } + case functionType::volumeConcentration: + { + functionTypeSymbolicName = "V"; + + break; + } + case functionType::volumeDensity: + { + functionTypeSymbolicName = "v"; + + break; + } + case functionType::areaConcentration: + { + functionTypeSymbolicName = "A"; + + break; + } + case functionType::areaDensity: + { + functionTypeSymbolicName = "a"; + + break; + } + } + + return functionTypeSymbolicName; +} + + +Foam::word +Foam::functionObjects::populationBalanceSizeDistribution:: +coordinateTypeSymbolicName +( + const coordinateType& cType +) +{ + word coordinateTypeSymbolicName(word::null); + + switch (cType) + { + case coordinateType::volume: + { + coordinateTypeSymbolicName = "v"; + + break; + } + case coordinateType::area: + { + coordinateTypeSymbolicName = "a"; + + break; + } + case coordinateType::diameter: + { + coordinateTypeSymbolicName = "d"; + + break; + } + case coordinateType::projectedAreaDiameter: + { + coordinateTypeSymbolicName = "dPa"; + + break; + } + } + + return coordinateTypeSymbolicName; +} + + +Foam::tmp +Foam::functionObjects::populationBalanceSizeDistribution::filterField +( + const scalarField& field +) const +{ + if (isNull(cellIDs())) + { + return field; + } + else + { + return tmp(new scalarField(field, cellIDs())); + } +} + + +Foam::scalar +Foam::functionObjects::populationBalanceSizeDistribution::averageCoordinateValue +( + const Foam::diameterModels::sizeGroup& fi, + const coordinateType& cType +) +{ + scalar averageCoordinateValue(Zero); + + switch (cType) + { + case coordinateType::volume: + { + averageCoordinateValue = fi.x().value(); + + break; + } + case coordinateType::area: + { + averageCoordinateValue = + weightedAverage(fi.a(), fi); + + break; + } + case coordinateType::diameter: + { + averageCoordinateValue = + weightedAverage(fi.d(), fi); + + break; + } + case coordinateType::projectedAreaDiameter: + { + averageCoordinateValue = + weightedAverage(sqrt(fi.a()/pi), fi); + + break; + } + } + + return averageCoordinateValue; +} + + +Foam::scalar +Foam::functionObjects::populationBalanceSizeDistribution::weightedAverage +( + const Foam::scalarField& fld, + const Foam::diameterModels::sizeGroup& fi +) +{ + scalar weightedAverage(Zero); + + switch (weightType_) + { + case weightType::numberConcentration: + { + scalarField Ni(filterField(fi*fi.phase()/fi.x().value())); + + if (gSum(Ni) == 0) + { + weightedAverage = + gSum(filterField(mesh_.V()*fld))/this->V(); + } + else + { + weightedAverage = + gSum(Ni*filterField(fld))/gSum(Ni); + } + + break; + } + case weightType::volumeConcentration: + { + scalarField Vi(filterField(fi*fi.phase())); + + if (gSum(Vi) == 0) + { + weightedAverage = + gSum(filterField(mesh_.V()*fld))/this->V(); + } + else + { + weightedAverage = + gSum(Vi*filterField(fld))/gSum(Vi); + } + + break; + } + case weightType::areaConcentration: + { + scalarField Ai(filterField(fi.a().ref()*fi.phase())); + + if (gSum(Ai) == 0) + { + weightedAverage = + gSum(filterField(mesh_.V()*fld))/this->V(); + } + else + { + weightedAverage = + gSum(Ai*filterField(fld))/gSum(Ai); + } + + break; + } + case weightType::cellVolume: + { + weightedAverage = + gSum(filterField(mesh_.V()*fld))/this->V(); + + break; + } + } + + return weightedAverage; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::populationBalanceSizeDistribution:: +populationBalanceSizeDistribution +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + volRegion(fvMeshFunctionObject::mesh_, dict), + file_(obr_, name), + mesh_(fvMeshFunctionObject::mesh_), + popBal_ + ( + obr_.lookupObject + ( + dict.lookup("populationBalance") + ) + ), + functionType_(functionTypeNames_.read(dict.lookup("functionType"))), + coordinateType_(coordinateTypeNames_.read(dict.lookup("coordinateType"))), + allCoordinates_ + ( + dict.lookupOrDefault("allCoordinates", false) + ), + normalise_(dict.lookupOrDefault("normalise", false)), + logTransform_ + ( + dict.lookupOrDefaultBackwardsCompatible + ( + {"logTransform", "geometric"}, + false + ) + ), + weightType_ + ( + dict.found("weightType") + ? weightTypeNames_.read(dict.lookup("weightType")) + : weightType::numberConcentration + ), + formatterPtr_(nullptr) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::functionObjects::populationBalanceSizeDistribution:: +~populationBalanceSizeDistribution() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionObjects::populationBalanceSizeDistribution::read +( + const dictionary& dict +) +{ + Log << type() << " " << name() << ":" << nl; + + fvMeshFunctionObject::read(dict); + + formatterPtr_ = setWriter::New(dict.lookup("setFormat"), dict); + + return false; +} + + +bool Foam::functionObjects::populationBalanceSizeDistribution::execute() +{ + return true; +} + + +bool Foam::functionObjects::populationBalanceSizeDistribution::write() +{ + Log << type() << " " << name() << " write:" << nl; + + const UPtrList& sizeGroups = + popBal_.sizeGroups(); + + scalarField coordinateValues(sizeGroups.size()); + scalarField boundaryValues(sizeGroups.size() + 1); + scalarField resultValues(sizeGroups.size()); + + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + coordinateValues[i] = averageCoordinateValue(fi, coordinateType_); + } + + if + ( + functionType_ == functionType::numberDensity + || functionType_ == functionType::volumeDensity + || functionType_ == functionType::areaDensity + ) + { + boundaryValues.first() = coordinateValues.first(); + boundaryValues.last() = coordinateValues.last(); + + for (label i = 1; i < boundaryValues.size() - 1; i++) + { + boundaryValues[i] = + 0.5*(coordinateValues[i] + coordinateValues[i-1]); + } + + if (logTransform_) + { + boundaryValues = Foam::log(boundaryValues); + } + } + + switch (functionType_) + { + case functionType::numberConcentration: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum(filterField(mesh_.V()*fi*fi.phase()/fi.x()))/this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + break; + } + case functionType::numberDensity: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum(filterField(mesh_.V()*fi*fi.phase()/fi.x()))/this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + forAll(resultValues, i) + { + resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]); + } + + break; + } + case functionType::volumeConcentration: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum(filterField(mesh_.V()*fi*fi.phase()))/this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + break; + } + case functionType::volumeDensity: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum(filterField(mesh_.V()*fi*fi.phase()))/this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + forAll(resultValues, i) + { + resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]); + } + + break; + } + case functionType::areaConcentration: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum + ( + filterField(mesh_.V()*fi.a().ref()*fi*fi.phase()/fi.x()) + ) + /this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + break; + } + case functionType::areaDensity: + { + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + resultValues[i] = + gSum + ( + filterField(mesh_.V()*fi.a().ref()*fi*fi.phase()/fi.x()) + ) + /this->V(); + } + + if (normalise_ && sum(resultValues) != 0) + { + resultValues /= sum(resultValues); + } + + forAll(resultValues, i) + { + resultValues[i] /= (boundaryValues[i+1] - boundaryValues[i]); + } + + break; + } + } + + + if (allCoordinates_) + { + wordList otherCoordinateSymbolicNames(coordinateTypeNames_.size()); + PtrList otherCoordinateValues(coordinateTypeNames_.size()); + typedef NamedEnum namedEnumCoordinateType; + + forAllConstIter(namedEnumCoordinateType, coordinateTypeNames_, iter) + { + const coordinateType cType = coordinateTypeNames_[iter.key()]; + + otherCoordinateSymbolicNames[cType] = + coordinateTypeSymbolicName(cType); + + otherCoordinateValues.set + ( + cType, + new scalarField(popBal_.sizeGroups().size()) + ); + + forAll(sizeGroups, i) + { + const diameterModels::sizeGroup& fi = sizeGroups[i]; + + otherCoordinateValues[cType][i] = + averageCoordinateValue(fi, cType); + } + } + + if (Pstream::master()) + { + formatterPtr_->write + ( + file_.baseTimeDir(), + name(), + coordSet + ( + true, + coordinateTypeSymbolicName(coordinateType_), + coordinateValues + ), + functionTypeSymbolicName(), + resultValues, + otherCoordinateSymbolicNames, + otherCoordinateValues + ); + } + } + else + { + if (Pstream::master()) + { + formatterPtr_->write + ( + file_.baseTimeDir(), + name(), + coordSet + ( + true, + coordinateTypeSymbolicName(coordinateType_), + coordinateValues + ), + functionTypeSymbolicName(), + resultValues + ); + } + } + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.H b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.H new file mode 100644 index 0000000000..d9b8832b03 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/functionObjects/populationBalanceSizeDistribution/populationBalanceSizeDistribution.H @@ -0,0 +1,268 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2022 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::functionObjects::populationBalanceSizeDistribution + +Description + Writes out the size distribution determined by a population balance model, + either for the entire domain or a cell zone. Requires solver post- + processing. + + The following function object specification for example returns the volume- + based number density function: + + Example of function object specification: + \verbatim + numberDensity + { + type populationBalanceSizeDistribution; + libs ("libmultiphaseEulerFoamFunctionObjects.so"); + writeControl writeTime; + populationBalance bubbles; + functionType numberDensity; + coordinateType volume; + setFormat raw; + } + \endverbatim + +Usage + \table + Property | Description | Required | Default + populationBalance | population balance name | yes | + functionType | function type | yes | + coordinateType | particle property | yes | + allCoordinates | write all coordinate values | no | false + normalise | divide by total concentration | no | false + logTransform | class width based on log of coordinate\\ + | no | false + weightType | weighting in case of field-dependent particle\\ + properties | no\\ + | numberConcentration + regionType | cellZone or all | no | all + name | name of cellZone if required | no | + setFormat | output format | yes | + \endtable + +See also + Foam::diameterModels::populationBalanceModel + Foam::functionObjects::fvMeshFunctionObject + Foam::functionObjects::volRegion + Foam::functionObject + +SourceFiles + populationBalanceSizeDistribution.C + +\*---------------------------------------------------------------------------*/ + +#ifndef populationBalanceSizeDistribution_H +#define populationBalanceSizeDistribution_H + +#include "fvMeshFunctionObject.H" +#include "volRegion.H" +#include "populationBalanceModel.H" +#include "writeFile.H" +#include "setWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class populationBalanceSizeDistribution Declaration +\*---------------------------------------------------------------------------*/ + +class populationBalanceSizeDistribution +: + public fvMeshFunctionObject, + public volRegion +{ +public: + + // Public Data Types + + //- Function type enumeration + enum functionType + { + numberConcentration, + numberDensity, + volumeConcentration, + volumeDensity, + areaConcentration, + areaDensity + }; + + //- Function type names + static const NamedEnum functionTypeNames_; + + //- Coordinate type enumeration + enum coordinateType + { + volume, + area, + diameter, + projectedAreaDiameter + }; + + //- Coordinate type names + static const NamedEnum coordinateTypeNames_; + + //- Enumeration for the weight types + enum class weightType + { + numberConcentration, + volumeConcentration, + areaConcentration, + cellVolume + }; + + //- Names of the weight types + static const NamedEnum weightTypeNames_; + + +private: + + // Private Data + + //- Write file + writeFile file_; + + //- Reference to mesh + const fvMesh& mesh_; + + //- Reference to population balance + const Foam::diameterModels::populationBalanceModel& popBal_; + + //- Function type + functionType functionType_; + + //- Coordinate type + coordinateType coordinateType_; + + //- Add values for all coordinate types to output + Switch allCoordinates_; + + //- Normalise result through division by sum + Switch normalise_; + + //- Log transform + Switch logTransform_; + + //- Weight types, relevant if particle properties are field dependent + weightType weightType_; + + //- Set formatter + autoPtr formatterPtr_; + + + // Private Member Functions + + //- Function type symbolic name for shorter file header + word functionTypeSymbolicName(); + + //- Coordinate type symbolic name for shorter file header + word coordinateTypeSymbolicName(const coordinateType& cType); + + //- Filter a field according to cellIds + tmp filterField(const scalarField& field) const; + + //- Field averaged coordinate value + scalar averageCoordinateValue + ( + const diameterModels::sizeGroup& fi, + const coordinateType& cType + ); + + //- Weighted average + scalar weightedAverage + ( + const scalarField& fld, + const diameterModels::sizeGroup& fi + ); + + +public: + + //- Runtime type information + TypeName("populationBalanceSizeDistribution"); + + + // Constructors + + //- Construct from Time and dictionary + populationBalanceSizeDistribution + ( + const word& name, + const Time& runTime, + const dictionary& dict + ); + + //- Disallow default bitwise copy construction + populationBalanceSizeDistribution + ( + const populationBalanceSizeDistribution& + ) = delete; + + + //- Destructor + virtual ~populationBalanceSizeDistribution(); + + + // Member Functions + + //- Return the list of fields required + virtual wordList fields() const + { + return wordList::null(); + } + + //- Read the populationBalanceSizeDistribution data + virtual bool read(const dictionary&); + + //- Execute, currently does nothing + virtual bool execute(); + + //- Calculate and write the size distribution + virtual bool write(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const populationBalanceSizeDistribution&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/files new file mode 100644 index 0000000000..44e83034b9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/files @@ -0,0 +1,4 @@ +phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.C +interfaceTurbulenceDamping/interfaceTurbulenceDamping.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseEulerFoamFvModels diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/options new file mode 100644 index 0000000000..ae9e6b5ce9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/Make/options @@ -0,0 +1,23 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lphaseSystem \ + -lmultiphaseSystems \ + -leulerianInterfacialModels \ + -leulerianInterfacialCompositionModels \ + -lmultiphaseMomentumTransportModels \ + -lmultiphaseReactions \ + -lmultiphaseProperties \ + -lphaseFluidThermophysicalTransportModels \ + -lphaseFluidMulticomponentThermophysicalTransportModels \ + -lfiniteVolume \ + -lfvModels \ + -lmeshTools diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C new file mode 100644 index 0000000000..fd33527ddc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C @@ -0,0 +1,321 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "interfaceTurbulenceDamping.H" +#include "surfaceInterpolate.H" +#include "fvcGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ + namespace fv + { + defineTypeNameAndDebug(interfaceTurbulenceDamping, 0); + + addToRunTimeSelectionTable + ( + fvModel, + interfaceTurbulenceDamping, + dictionary + ); + } +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::fv::interfaceTurbulenceDamping::interfaceFraction +( + const volScalarField& alpha +) const +{ + const fvMesh& mesh = this->mesh(); + + tmp tA + ( + volScalarField::Internal::New + ( + "A", + mesh, + dimensionedScalar(dimless, 0) + ) + ); + volScalarField::Internal& A = tA.ref(); + + const surfaceVectorField& Sf = mesh.Sf(); + const labelUList& own = mesh.owner(); + const labelUList& nei = mesh.neighbour(); + + const surfaceScalarField alphaf(fvc::interpolate(alpha)); + + const volVectorField gradAlpha(fvc::grad(alpha)); + const volVectorField::Internal n + ( + gradAlpha()/(mag(gradAlpha()) + phase_.fluid().deltaN()) + ); + + const scalarField& ialpha = alpha; + const scalarField& ialphaf = alphaf; + scalarField sumnSf(mesh.nCells(), 0); + + forAll(own, facei) + { + { + const scalar nSf(mag(n[own[facei]] & Sf[facei])); + A[own[facei]] += nSf*(ialphaf[facei] - ialpha[own[facei]]); + sumnSf[own[facei]] += nSf; + } + { + const scalar nSf(mag(n[nei[facei]] & Sf[facei])); + A[nei[facei]] += nSf*(ialphaf[facei] - ialpha[nei[facei]]); + sumnSf[nei[facei]] += nSf; + } + } + + forAll(mesh.boundary(), patchi) + { + const labelUList& own = mesh.boundary()[patchi].faceCells(); + const fvsPatchScalarField& palphaf = alphaf.boundaryField()[patchi]; + + forAll(mesh.boundary()[patchi], facei) + { + const scalar nSf(mag(n[own[facei]] & Sf[facei])); + A[own[facei]] += nSf*(palphaf[facei] - ialpha[own[facei]]); + sumnSf[own[facei]] += nSf; + } + } + + scalarField& a = A.field(); + forAll(a, i) + { + if (sumnSf[i] > small) + { + a[i] = 2*mag(a[i])/sumnSf[i]; + } + else + { + a[i] = 0; + } + } + + return tA; +} + + +template +void Foam::fv::interfaceTurbulenceDamping::addRhoSup +( + const RhoType& rho, + fvMatrix& eqn, + const word& fieldName +) const +{ + if (debug) + { + Info<< type() << ": applying source to " << eqn.psi().name() << endl; + } + + const phaseSystem::phaseModelPartialList& movingPhases = + phase_.fluid().movingPhases(); + + volScalarField::Internal aSqrnu + ( + movingPhases[0]*sqr(movingPhases[0].thermo().nu()()()) + ); + + for (label phasei=1; phasei(IOobject::groupName("alpha", phaseName_)) + ), + turbulence_ + ( + mesh.lookupType(phaseName_) + ), + C2_("C2", dimless, 0), + betaStar_("betaStar", dimless, 0), + beta_("beta", dimless, 0) +{ + const word epsilonName(IOobject::groupName("epsilon", phaseName_)); + const word omegaName(IOobject::groupName("omega", phaseName_)); + + if (mesh.foundObject(epsilonName)) + { + fieldName_ = epsilonName; + C2_.read(turbulence_.coeffDict()); + } + else if (mesh.foundObject(omegaName)) + { + fieldName_ = omegaName; + betaStar_.read(turbulence_.coeffDict()); + + // Read beta for k-omega models or beta1 for k-omega SST + if (turbulence_.coeffDict().found("beta")) + { + beta_.read(turbulence_.coeffDict()); + } + else + { + beta_ = + dimensionedScalar("beta1", dimless, turbulence_.coeffDict()); + } + } + else + { + FatalIOErrorInFunction(dict) + << "Cannot find either " << epsilonName << " or " << omegaName + << " field for fvModel " << typeName << exit(FatalIOError); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::wordList Foam::fv::interfaceTurbulenceDamping::addSupFields() const +{ + return wordList(1, fieldName_); +} + + +void Foam::fv::interfaceTurbulenceDamping::addSup +( + fvMatrix& eqn, + const word& fieldName +) const +{ + addRhoSup(one(), eqn, fieldName); +} + + +void Foam::fv::interfaceTurbulenceDamping::addSup +( + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName +) const +{ + addRhoSup(rho(), eqn, fieldName); +} + + +void Foam::fv::interfaceTurbulenceDamping::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName +) const +{ + if (debug) + { + Info<< type() << ": applying source to " << eqn.psi().name() << endl; + } + + volScalarField::Internal aSqrnu + ( + alpha*sqr(phase_.thermo().nu()()()) + ); + + if (fieldName == IOobject::groupName("epsilon", phaseName_)) + { + eqn += rho()*interfaceFraction(alpha) + *C2_*aSqrnu*turbulence_.k()()/pow4(delta_); + } + else if (fieldName == IOobject::groupName("omega", phaseName_)) + { + eqn += rho()*interfaceFraction(alpha) + *beta_*aSqrnu/(sqr(betaStar_)*pow4(delta_)); + } + else + { + FatalErrorInFunction + << "Support for field " << fieldName << " is not implemented" + << exit(FatalError); + } +} + + +void Foam::fv::interfaceTurbulenceDamping::topoChange(const polyTopoChangeMap&) +{} + + +void Foam::fv::interfaceTurbulenceDamping::mapMesh(const polyMeshMap& map) +{} + + +void Foam::fv::interfaceTurbulenceDamping::distribute +( + const polyDistributionMap& +) +{} + + +bool Foam::fv::interfaceTurbulenceDamping::movePoints() +{ + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.H b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.H new file mode 100644 index 0000000000..b8b0a7504b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.H @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::fv::interfaceTurbulenceDamping + +Description + Free-surface phase turbulence damping function + + Adds an extra source term to the mixture or phase epsilon or omega + equation to reduce turbulence generated near a free-surface. The + implementation is based on + + Reference: + \verbatim + Frederix, E. M. A., Mathur, A., Dovizio, D., Geurts, B. J., + & Komen, E. M. J. (2018). + Reynolds-averaged modeling of turbulence damping + near a large-scale interface in two-phase flow. + Nuclear engineering and design, 333, 122-130. + \endverbatim + + but with an improved formulation for the coefficient \c A appropriate for + unstructured meshes including those with split-cell refinement patterns. + However the dimensioned length-scale coefficient \c delta remains and must + be set appropriately for the case by performing test runs and comparing with + known results. Clearly this model is far from general and more research is + needed in order that \c delta can be obtained directly from the interface + flow and turbulence conditions. + +Usage + Example usage: + \verbatim + interfaceTurbulenceDamping + { + type interfaceTurbulenceDamping; + + libs ("libmultiphaseEulerFoamFvModels.so"); + + phase water; + + // Interface turbulence damping length scale + // This is a required input as described in section 3.3 of the paper + delta 1e-4; + } + \endverbatim + +SourceFiles + interfaceTurbulenceDamping.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interfaceTurbulenceDamping_H +#define interfaceTurbulenceDamping_H + +#include "fvModel.H" +#include "phaseSystem.H" +#include "phaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class interfaceTurbulenceDamping Declaration +\*---------------------------------------------------------------------------*/ + +class interfaceTurbulenceDamping +: + public fvModel +{ + // Private Data + + //- The name of the Lagrangian phase + word phaseName_; + + //- Field name + word fieldName_; + + //- Interface turbulence damping length scale + // This is a required input as described in section 3.3 of the paper + dimensionedScalar delta_; + + //- Reference to the phase + const phaseModel& phase_; + + //- Reference to the mixture turbulence model + const phaseCompressible::momentumTransportModel& turbulence_; + + // Turbulence model coefficients + + dimensionedScalar C2_; + dimensionedScalar betaStar_; + dimensionedScalar beta_; + + + // Private Member Functions + + //- Interface fraction in a cell + tmp interfaceFraction + ( + const volScalarField& alpha + ) const; + + //- Add explicit contribution to incompressible or compressible + // mixture epsilon or omega equation + template + void addRhoSup + ( + const RhoType& rho, + fvMatrix& eqn, + const word& fieldName + ) const; + + +public: + + //- Runtime type information + TypeName("interfaceTurbulenceDamping"); + + + // Constructors + + //- Construct from explicit source name and mesh + interfaceTurbulenceDamping + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- Disallow default bitwise copy construction + interfaceTurbulenceDamping + ( + const interfaceTurbulenceDamping& + ) = delete; + + + // Member Functions + + //- Return the list of fields for which the option adds source term + // to the transport equation + virtual wordList addSupFields() const; + + //- Add explicit contribution to mixture epsilon or omega equation + virtual void addSup + ( + fvMatrix& eqn, + const word& fieldName + ) const; + + //- Add explicit contribution to compressible + // mixture epsilon or omega equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName + ) const; + + //- Add explicit contribution to phase epsilon or omega equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName + ) const; + + + // Mesh changes + + //- Update topology using the given map + virtual void topoChange(const polyTopoChangeMap&); + + //- Update from another mesh using the given map + virtual void mapMesh(const polyMeshMap&); + + //- Redistribute or update using the given distribution map + virtual void distribute(const polyDistributionMap&); + + //- Update for mesh motion + virtual bool movePoints(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const interfaceTurbulenceDamping&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.C b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.C new file mode 100644 index 0000000000..91eb6fe04d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.C @@ -0,0 +1,254 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "phaseTurbulenceStabilisation.H" +#include "phaseSystem.H" +#include "surfaceInterpolate.H" +#include "fvcGrad.H" +#include "fvmSup.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ + namespace fv + { + defineTypeNameAndDebug(phaseTurbulenceStabilisation, 0); + + addToRunTimeSelectionTable + ( + fvModel, + phaseTurbulenceStabilisation, + dictionary + ); + } +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::fv::phaseTurbulenceStabilisation::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + tmp + (phaseCompressible::momentumTransportModel::*psi)() const +) const +{ + if (debug) + { + Info<< type() << ": applying source to " << eqn.psi().name() << endl; + } + + const fvMesh& mesh = this->mesh(); + + const phaseSystem::phaseModelPartialList& movingPhases = + phase_.fluid().movingPhases(); + + volScalarField::Internal transferRate + ( + volScalarField::Internal::New + ( + "transferRate", + mesh, + dimensionedScalar(dimless/dimTime, 0) + ) + ); + volScalarField::Internal psiTransferRate + ( + volScalarField::Internal::New + ( + "psiTransferRate", + mesh, + dimensionedScalar((turbulence_.*psi)()().dimensions()/dimTime, 0) + ) + ); + + forAll(movingPhases, phasei) + { + if (movingPhases[phasei] != phase_) + { + const phaseCompressible::momentumTransportModel& turbulence = + mesh.lookupType + ( + phaseName_ + ); + + if (notNull(turbulence)) + { + const volScalarField::Internal phaseTransferRate + ( + movingPhases[phasei] + *min + ( + turbulence.epsilon()/turbulence.k(), + 1.0/phase_.time().deltaT() + ) + ); + + transferRate += phaseTransferRate; + psiTransferRate += phaseTransferRate*(turbulence.*psi)()(); + } + } + } + + const volScalarField::Internal transferCoeff + ( + max(alphaInversion_ - alpha(), scalar(0))*rho() + ); + + eqn += transferCoeff*psiTransferRate; + eqn -= fvm::Sp(transferCoeff*transferRate, eqn.psi()); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::phaseTurbulenceStabilisation::phaseTurbulenceStabilisation +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + fvModel(sourceName, modelType, dict, mesh), + phaseName_(dict.lookup("phase")), + alphaInversion_("alphaInversion", dimless, dict), + phase_ + ( + mesh.lookupObject(IOobject::groupName("alpha", phaseName_)) + ), + turbulence_ + ( + mesh.lookupType + ( + phaseName_ + ) + ) +{ + const word kName(IOobject::groupName("k", phaseName_)); + const word epsilonName(IOobject::groupName("epsilon", phaseName_)); + const word omegaName(IOobject::groupName("omega", phaseName_)); + + if (mesh.foundObject(kName)) + { + fieldNames_.append(kName); + } + + if (mesh.foundObject(epsilonName)) + { + fieldNames_.append(epsilonName); + } + + if (mesh.foundObject(omegaName)) + { + fieldNames_.append(omegaName); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::wordList Foam::fv::phaseTurbulenceStabilisation::addSupFields() const +{ + return fieldNames_; +} + + +void Foam::fv::phaseTurbulenceStabilisation::addSup +( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName +) const +{ + if (fieldName == IOobject::groupName("k", phaseName_)) + { + addSup + ( + alpha, + rho, + eqn, + &phaseCompressible::momentumTransportModel::k + ); + } + else if (fieldName == IOobject::groupName("epsilon", phaseName_)) + { + addSup + ( + alpha, + rho, + eqn, + &phaseCompressible::momentumTransportModel::epsilon + ); + } + else if (fieldName == IOobject::groupName("omega", phaseName_)) + { + addSup + ( + alpha, + rho, + eqn, + &phaseCompressible::momentumTransportModel::omega + ); + } + else + { + FatalErrorInFunction + << "Support for field " << fieldName << " is not implemented" + << exit(FatalError); + } +} + + +void Foam::fv::phaseTurbulenceStabilisation::topoChange +( + const polyTopoChangeMap& +) +{} + + +void Foam::fv::phaseTurbulenceStabilisation::mapMesh(const polyMeshMap& map) +{} + + +void Foam::fv::phaseTurbulenceStabilisation::distribute +( + const polyDistributionMap& +) +{} + + +bool Foam::fv::phaseTurbulenceStabilisation::movePoints() +{ + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.H b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.H new file mode 100644 index 0000000000..12546a7ba9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/fvModels/phaseTurbulenceStabilisation/phaseTurbulenceStabilisation.H @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::fv::phaseTurbulenceStabilisation + +Description + Phase turbulence stabilisation + + In the limit of a phase-fraction->0 the turbulence properties cannot be + obtained from the phase turbulence model, coupling to the other phase/phases + is required. The phaseTurbulenceStabilisation fvModel stabilises the phase + turbulence properties by adding transfer terms from the corresponding + properties of the other phases when the phase-fraction is less than the + specified \c alphaInversion. This implementation is a generalisation of + the approach used in the Foam::RASModels::LaheyKEpsilon and + Foam::RASModels::continuousGasKEpsilon models to handle phase-inversion and + free-surface flow and can be used with any combination of RAS turbulence + models. + + To stabilise the solution of the phase turbulence equations \c + alphaInversion can be set to a small value e.g. 1e-2, but unless the phase + turbulence model is specifically designed to handle phase-inversion and both + continuous and dispersed regimes it may be useful to set \c alphaInversion + to a higher value, corresponding to the phase-fraction at which transition + from continuous to dispersed happens and effectively use the turbulence + properties of the other phase when the phase is dispersed. This is of + course an approximation to the real system and if accurate handling of both + the continuous and dispersed phase regimes is required specially developed + models should be used. + +Usage + Example usage: + \verbatim + phaseTurbulenceStabilisation + { + type phaseTurbulenceStabilisation; + + libs ("libmultiphaseEulerFoamFvModels.so"); + + phase air; + + alphaInversion 0.1; + } + \endverbatim + +SourceFiles + phaseTurbulenceStabilisation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseTurbulenceStabilisation_H +#define phaseTurbulenceStabilisation_H + +#include "fvModel.H" +#include "phaseModel.H" +#include "phaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class phaseTurbulenceStabilisation Declaration +\*---------------------------------------------------------------------------*/ + +class phaseTurbulenceStabilisation +: + public fvModel +{ + // Private Data + + //- The name of the Lagrangian phase + word phaseName_; + + //- Field names + wordList fieldNames_; + + //- Phase-fraction below which turbulence property blending is applied + dimensionedScalar alphaInversion_; + + //- Reference to the phase + const phaseModel& phase_; + + //- Reference to the mixture turbulence model + const phaseCompressible::momentumTransportModel& turbulence_; + + + // Private Member Functions + + //- Add contribution to phase psi equation + void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + tmp + (phaseCompressible::momentumTransportModel::*psi)() const + ) const; + + +public: + + //- Runtime type information + TypeName("phaseTurbulenceStabilisation"); + + + // Constructors + + //- Construct from explicit source name and mesh + phaseTurbulenceStabilisation + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- Disallow default bitwise copy construction + phaseTurbulenceStabilisation + ( + const phaseTurbulenceStabilisation& + ) = delete; + + + // Member Functions + + //- Return the list of fields for which the option adds source term + // to the transport equation + virtual wordList addSupFields() const; + + using fvModel::addSup; + + //- Add contribution to phase k, epsilon or omega equation + virtual void addSup + ( + const volScalarField& alpha, + const volScalarField& rho, + fvMatrix& eqn, + const word& fieldName + ) const; + + + // Mesh changes + + //- Update topology using the given map + virtual void topoChange(const polyTopoChangeMap&); + + //- Update from another mesh using the given map + virtual void mapMesh(const polyMeshMap&); + + //- Redistribute or update using the given distribution map + virtual void distribute(const polyDistributionMap&); + + //- Update for mesh motion + virtual bool movePoints(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const phaseTurbulenceStabilisation&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/include/createRDeltaTf.H b/applications/solvers/modules/fluid/multiphaseEuler/include/createRDeltaTf.H new file mode 100644 index 0000000000..64c9f7354e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/include/createRDeltaTf.H @@ -0,0 +1,21 @@ +tmp trDeltaTf; + +if (LTS && faceMomentum) +{ + trDeltaTf = tmp + ( + new surfaceScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTfName, + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1) + ) + ); +} diff --git a/applications/solvers/modules/fluid/multiphaseEuler/include/setRDeltaTf.H b/applications/solvers/modules/fluid/multiphaseEuler/include/setRDeltaTf.H new file mode 100644 index 0000000000..1c0366dc3b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/include/setRDeltaTf.H @@ -0,0 +1 @@ +trDeltaTf.ref() = fvc::interpolate(fv::localEulerDdt::localRDeltaT(mesh)); diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/files new file mode 100644 index 0000000000..a841a22219 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/files @@ -0,0 +1,26 @@ +diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.C +diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModelNew.C +diffusiveMassTransferModels/Frossling/Frossling.C +diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.C + +interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.C +interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModelNew.C +interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.C + +interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C +interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelNew.C +interfaceCompositionModels/Henry/Henry.C +interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C +interfaceCompositionModels/Raoult/Raoult.C +interfaceCompositionModels/saturated/saturated.C + +saturationModels/saturationModel/saturationModel.C +saturationModels/saturationModel/saturationModelNew.C +saturationModels/Antoine/Antoine.C +saturationModels/AntoineExtended/AntoineExtended.C +saturationModels/ArdenBuck/ArdenBuck.C +saturationModels/polynomial/polynomial.C +saturationModels/function1/function1.C +saturationModels/constantSaturationConditions/constantSaturationConditions.C + +LIB = $(FOAM_LIBBIN)/libeulerianInterfacialCompositionModels diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/options new file mode 100644 index 0000000000..c9e25ee486 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/Make/options @@ -0,0 +1,18 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfluidThermophysicalModels \ + -lmulticomponentThermophysicalModels \ + -lspecie diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.C new file mode 100644 index 0000000000..e7fc7954b3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "Frossling.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diffusiveMassTransferModels +{ + defineTypeNameAndDebug(Frossling, 0); + addToRunTimeSelectionTable + ( + diffusiveMassTransferModel, + Frossling, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModels::Frossling::Frossling +( + const dictionary& dict, + const phaseInterface& interface +) +: + diffusiveMassTransferModel(dict, interface), + interface_ + ( + interface.modelCast + < + diffusiveMassTransferModel, + dispersedPhaseInterface + >() + ), + Le_("Le", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModels::Frossling::~Frossling() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::diffusiveMassTransferModels::Frossling::K() const +{ + const volScalarField Sh + ( + 2 + 0.552*sqrt(interface_.Re())*cbrt(Le_*interface_.Pr()) + ); + + return 6*interface_.dispersed()*Sh/sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.H new file mode 100644 index 0000000000..6fb982e21f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/Frossling/Frossling.H @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::diffusiveMassTransferModels::Frossling + +Description + Frossling correlation for turbulent mass transfer from the surface of a + sphere to the surrounding fluid. + +SourceFiles + Frossling.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Frossling_H +#define Frossling_H + +#include "diffusiveMassTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace diffusiveMassTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class Frossling Declaration +\*---------------------------------------------------------------------------*/ + +class Frossling +: + public diffusiveMassTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Lewis number + const dimensionedScalar Le_; + + +public: + + //- Runtime type information + TypeName("Frossling"); + + + // Constructors + + //- Construct from a dictionary and an interface + Frossling + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Frossling(); + + + // Member Functions + + //- The implicit mass transfer coefficient + virtual tmp K() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace diffusiveMassTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.C new file mode 100644 index 0000000000..714534275c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "diffusiveMassTransferModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(diffusiveMassTransferModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug + ( + diffusiveMassTransferModel, + 0 + ); + defineSidedInterfacialModelTypeNameAndDebug + ( + blendedDiffusiveMassTransferModel, + 0 + ); + defineRunTimeSelectionTable(diffusiveMassTransferModel, dictionary); +} + +const Foam::dimensionSet Foam::diffusiveMassTransferModel::dimK(0, -2, 0, 0, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModel::diffusiveMassTransferModel +( + const dictionary& dict, + const phaseInterface& interface +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModel::~diffusiveMassTransferModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::blendedDiffusiveMassTransferModel::K() const +{ + tmp (diffusiveMassTransferModel::*k)() const = + &diffusiveMassTransferModel::K; + return evaluate(k, "K", diffusiveMassTransferModel::dimK, false); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.H new file mode 100644 index 0000000000..108156f8c3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModel.H @@ -0,0 +1,189 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::diffusiveMassTransferModel + +Description + Model for diffusive mass transfer coefficients between two phases + +SourceFiles + diffusiveMassTransferModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef diffusiveMassTransferModel_H +#define diffusiveMassTransferModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" +#include "SidedInterfacialModel.H" + +namespace Foam +{ + +class phaseSystem; + +/*---------------------------------------------------------------------------*\ + Class diffusiveMassTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class diffusiveMassTransferModel +{ +public: + + //- Runtime type information + TypeName("diffusiveMassTransferModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + diffusiveMassTransferModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimK; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = false; + + + // Constructors + + //- Construct from a dictionary and an interface + diffusiveMassTransferModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~diffusiveMassTransferModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- The implicit mass transfer coefficient + // Note: this has had the species mass diffusivity factored out + virtual tmp K() const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedDiffusiveMassTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedDiffusiveMassTransferModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel:: + BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return the heatTransfer coefficient K + tmp K() const; +}; + + + +/*---------------------------------------------------------------------------*\ + Class sidedBlendedDiffusiveMassTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class sidedBlendedDiffusiveMassTransferModel +: + public SidedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + SidedInterfacialModel:: + SidedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModelNew.C new file mode 100644 index 0000000000..086fc1352c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/diffusiveMassTransferModel/diffusiveMassTransferModelNew.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "diffusiveMassTransferModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::diffusiveMassTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + const dictionary& modelDict = + interface.fluid().modelSubDict(dict); + + const word diffusiveMassTransferModelType(modelDict.lookup("type")); + + Info<< "Selecting diffusiveMassTransferModel for " + << interface.name() << ": " << diffusiveMassTransferModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(diffusiveMassTransferModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown diffusiveMassTransferModelType type " + << diffusiveMassTransferModelType << endl << endl + << "Valid diffusiveMassTransferModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::blendedDiffusiveMassTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new blendedDiffusiveMassTransferModel(dict, interface) + ); +} + + +Foam::autoPtr +Foam::sidedBlendedDiffusiveMassTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new sidedBlendedDiffusiveMassTransferModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.C new file mode 100644 index 0000000000..3576ae2f10 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "sphericalDiffusiveMassTransfer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diffusiveMassTransferModels +{ + defineTypeNameAndDebug(sphericalDiffusiveMassTransfer, 0); + addToRunTimeSelectionTable + ( + diffusiveMassTransferModel, + sphericalDiffusiveMassTransfer, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModels::sphericalDiffusiveMassTransfer:: +sphericalDiffusiveMassTransfer +( + const dictionary& dict, + const phaseInterface& interface +) +: + diffusiveMassTransferModel(dict, interface), + interface_ + ( + interface.modelCast + < + diffusiveMassTransferModel, + dispersedPhaseInterface + >() + ), + Le_("Le", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::diffusiveMassTransferModels::sphericalDiffusiveMassTransfer:: +~sphericalDiffusiveMassTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::diffusiveMassTransferModels::sphericalDiffusiveMassTransfer::K() const +{ + return 60*interface_.dispersed()/sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.H new file mode 100644 index 0000000000..c5ab8f9b84 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/diffusiveMassTransferModels/sphericalDiffusiveMassTransfer/sphericalDiffusiveMassTransfer.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::diffusiveMassTransferModels::sphericalDiffusiveMassTransfer + +Description + Model which applies an analytical solution for mass transfer from the + surface of a sphere to the fluid within the sphere. + +SourceFiles + sphericalDiffusiveMassTransfer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sphericalDiffusiveMassTransfer_H +#define sphericalDiffusiveMassTransfer_H + +#include "diffusiveMassTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diffusiveMassTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class sphericalDiffusiveMassTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class sphericalDiffusiveMassTransfer +: + public diffusiveMassTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Lewis number + const dimensionedScalar Le_; + + +public: + + //- Runtime type information + TypeName("spherical"); + + + // Constructors + + //- Construct from a dictionary and an interface + sphericalDiffusiveMassTransfer + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~sphericalDiffusiveMassTransfer(); + + + // Member Functions + + //- The implicit mass transfer coefficient + virtual tmp K() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace diffusiveMassTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C new file mode 100644 index 0000000000..7b3ebb3c33 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "Henry.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + defineTypeNameAndDebug(Henry, 0); + addToRunTimeSelectionTable(interfaceCompositionModel, Henry, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::Henry::Henry +( + const dictionary& dict, + const phaseInterface& interface +) +: + interfaceCompositionModel(dict, interface), + k_(dict.lookup("k")), + YSolvent_ + ( + IOobject + ( + IOobject::groupName("YSolvent", this->interface().name()), + interface.mesh().time().timeName(), + interface.mesh() + ), + interface.mesh(), + dimensionedScalar(dimless, 1) + ) +{ + if (k_.size() != species().size()) + { + FatalErrorInFunction + << "Differing number of species and solubilities" + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::Henry::~Henry() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::interfaceCompositionModels::Henry::update(const volScalarField& Tf) +{ + YSolvent_ = scalar(1); + + forAllConstIter(hashedWordList, species(), iter) + { + YSolvent_ -= Yf(*iter, Tf); + } +} + + +Foam::tmp Foam::interfaceCompositionModels::Henry::Yf +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (species().found(speciesName)) + { + const label index = species()[speciesName]; + + return + k_[index] + *otherComposition().Y(speciesName) + *otherThermo().rho() + /thermo().rho(); + } + else + { + return YSolvent_*composition().Y(speciesName); + } +} + + +Foam::tmp Foam::interfaceCompositionModels::Henry::YfPrime +( + const word& speciesName, + const volScalarField& Tf +) const +{ + return volScalarField::New + ( + IOobject::groupName("YfPrime", interface().name()), + interface().mesh(), + dimensionedScalar(dimless/dimTemperature, 0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.H new file mode 100644 index 0000000000..d610f2bd86 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceCompositionModels::Henry + +Description + Henry's law for gas solubility in liquid. The concentration of a dissolved + species in the liquid is proportional to its partial pressure in the gas. A + dimensionless solubility, \f$k\f$, is given for each species. This is the + ratio of the concentration of the species in the liquid to the + corresponding concentration in the gas; i.e., \f$k = + c_{i,liq}/c_{i,gas}\f$. Mixing in the gas is assumed to be ideal. + +SourceFiles + Henry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Henry_H +#define Henry_H + +#include "interfaceCompositionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + +/*---------------------------------------------------------------------------*\ + Class Henry Declaration +\*---------------------------------------------------------------------------*/ + +class Henry +: + public interfaceCompositionModel +{ + // Private Data + + //- Dimensionless solubility coefficients + const scalarList k_; + + //- The remaining solvent species fraction + volScalarField YSolvent_; + + +public: + + //- Runtime type information + TypeName("Henry"); + + + // Constructors + + //- Construct from a dictionary and an interface + Henry + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Henry(); + + + // Member Functions + + //- Update the composition + virtual void update(const volScalarField& Tf); + + //- The interface species fraction + virtual tmp Yf + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- The interface species fraction derivative w.r.t. temperature + virtual tmp YfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace interfaceCompositionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C new file mode 100644 index 0000000000..e5abf194cf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "Raoult.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + defineTypeNameAndDebug(Raoult, 0); + addToRunTimeSelectionTable(interfaceCompositionModel, Raoult, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::Raoult::Raoult +( + const dictionary& dict, + const phaseInterface& interface +) +: + interfaceCompositionModel(dict, interface), + YNonVapour_ + ( + IOobject + ( + IOobject::groupName("YNonVapour", this->interface().name()), + interface.mesh().time().timeName(), + interface.mesh() + ), + interface.mesh(), + dimensionedScalar(dimless, 1) + ), + YNonVapourPrime_ + ( + IOobject + ( + IOobject::groupName("YNonVapourPrime", this->interface().name()), + interface.mesh().time().timeName(), + interface.mesh() + ), + interface.mesh(), + dimensionedScalar(dimless/dimTemperature, 0) + ) +{ + forAllConstIter(hashedWordList, species(), iter) + { + speciesModels_.insert + ( + *iter, + autoPtr + ( + interfaceCompositionModel::New + ( + dict.subDict(*iter), + interface + ) + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::Raoult::~Raoult() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::interfaceCompositionModels::Raoult::update(const volScalarField& Tf) +{ + YNonVapour_ = scalar(1); + + forAllIter + ( + HashTable>, + speciesModels_, + iter + ) + { + iter()->update(Tf); + + YNonVapour_ -= + otherComposition().Y(iter.key()) + *iter()->Yf(iter.key(), Tf); + + YNonVapourPrime_ -= + otherComposition().Y(iter.key()) + *iter()->YfPrime(iter.key(), Tf); + } +} + + +Foam::tmp Foam::interfaceCompositionModels::Raoult::Yf +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (species().found(speciesName)) + { + return + otherComposition().Y(speciesName) + *speciesModels_[speciesName]->Yf(speciesName, Tf); + } + else + { + return composition().Y(speciesName)*YNonVapour_; + } +} + + +Foam::tmp +Foam::interfaceCompositionModels::Raoult::YfPrime +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (species().found(speciesName)) + { + return + otherComposition().Y(speciesName) + *speciesModels_[speciesName]->YfPrime(speciesName, Tf); + } + else + { + return composition().Y(speciesName)*YNonVapourPrime_; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.H new file mode 100644 index 0000000000..d9feb8d5e8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceCompositionModels::Raoult + +Description + Raoult's law of ideal mixing. A separate composition model is given for + each species. The composition of a species is equal to the value given by + the model scaled by the species fraction in the bulk of the other phase. + +SourceFiles + Raoult.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Raoult_H +#define Raoult_H + +#include "interfaceCompositionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + +/*---------------------------------------------------------------------------*\ + Class Raoult Declaration +\*---------------------------------------------------------------------------*/ + +class Raoult +: + public interfaceCompositionModel +{ + // Private Data + + //- Non-vapour species fraction + volScalarField YNonVapour_; + + //- Non-vapour species fraction derivative w.r.t. temperature + volScalarField YNonVapourPrime_; + + //- Species' individual composition models + HashTable> speciesModels_; + + +public: + + //- Runtime type information + TypeName("Raoult"); + + + // Constructors + + //- Construct from a dictionary and an interface + Raoult + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Raoult(); + + + // Member Functions + + //- Update the composition + virtual void update(const volScalarField& Tf); + + //- The interface species fraction + virtual tmp Yf + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- The interface species fraction derivative w.r.t. temperature + virtual tmp YfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace interfaceCompositionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C new file mode 100644 index 0000000000..3b2ce82ef2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "interfaceCompositionModel.H" +#include "phaseModel.H" +#include "phaseSystem.H" +#include "rhoMulticomponentThermo.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(interfaceCompositionModel, 0); + defineSidedInterfacialModelTypeNameAndDebug(interfaceCompositionModel, 0); + defineRunTimeSelectionTable(interfaceCompositionModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModel::interfaceCompositionModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + interface_ + ( + interface.modelCast() + ), + species_(dict.lookup("species")), + Le_("Le", dimless, dict), + thermo_ + ( + refCast(interface_.phase().thermo()) + ), + otherThermo_(interface_.otherPhase().thermo()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModel::~interfaceCompositionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::interfaceCompositionModel::dY +( + const word& speciesName, + const volScalarField& Tf +) const +{ + const label speciei = composition().species()[speciesName]; + + return Yf(speciesName, Tf) - composition().Y()[speciei]; +} + + +Foam::tmp Foam::interfaceCompositionModel::dYfPrime +( + const word& speciesName, + const volScalarField& Tf +) const +{ + return YfPrime(speciesName, Tf); +} + + +Foam::tmp Foam::interfaceCompositionModel::D +( + const word& speciesName +) const +{ + const label speciei = composition().species()[speciesName]; + const volScalarField& p(thermo_.p()); + const volScalarField& T(thermo_.T()); + + return volScalarField::New + ( + IOobject::groupName("D" + speciesName, interface_.name()), + composition().kappa(speciei, p, T) + /composition().Cp(speciei, p, T) + /composition().rho(speciei, p, T) + /Le_ + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H new file mode 100644 index 0000000000..36be57c8bb --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H @@ -0,0 +1,231 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceCompositionModel + +Description + Generic base class for interface composition models. These models describe + the composition in phase 1 of the supplied pair at the interface with phase + 2. + +SourceFiles + interfaceCompositionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interfaceCompositionModel_H +#define interfaceCompositionModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "hashedWordList.H" +#include "rhoMulticomponentThermo.H" +#include "runTimeSelectionTables.H" +#include "sidedPhaseInterface.H" +#include "SidedInterfacialModel.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interfaceCompositionModel Declaration +\*---------------------------------------------------------------------------*/ + +class interfaceCompositionModel +{ + // Private data + + //- Interface + const sidedPhaseInterface interface_; + + //- Names of the transferring species + const hashedWordList species_; + + //- Lewis number + const dimensionedScalar Le_; + + //- Multi-component thermo model for this side of the interface + const rhoMulticomponentThermo& thermo_; + + //- General thermo model for the other side of the interface + const rhoThermo& otherThermo_; + + +public: + + //- Runtime type information + TypeName("interfaceCompositionModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + interfaceCompositionModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + interfaceCompositionModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~interfaceCompositionModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + // Access + + //- Return the interface + inline const sidedPhaseInterface& interface() const; + + //- Return the transferring species names + inline const hashedWordList& species() const; + + //- Return the thermo + inline const rhoMulticomponentThermo& thermo() const; + + //- Return the composition + inline const basicSpecieMixture& composition() const; + + //- Return the other thermo + inline const rhoThermo& otherThermo() const; + + //- Return whether the other side has a multi-specie composition + inline bool otherHasComposition() const; + + //- Return the other composition + inline const basicSpecieMixture& otherComposition() const; + + + // Evaluation + + //- Interface mass fraction + virtual tmp Yf + ( + const word& speciesName, + const volScalarField& Tf + ) const = 0; + + //- The interface mass fraction derivative w.r.t. temperature + virtual tmp YfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const = 0; + + //- Mass fraction difference between the interface and the field + tmp dY + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- Mass fraction difference between the interface and the field + // derivative w.r.t. temperature + tmp dYfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- Mass diffusivity + tmp D + ( + const word& speciesName + ) const; + + + //- Update the composition + virtual void update(const volScalarField& Tf) = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class sidedInterfaceCompositionModel Declaration +\*---------------------------------------------------------------------------*/ + +class sidedInterfaceCompositionModel +: + public SidedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + SidedInterfacialModel:: + SidedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "interfaceCompositionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H new file mode 100644 index 0000000000..a3a1d2382d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "interfaceCompositionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const Foam::sidedPhaseInterface& +Foam::interfaceCompositionModel::interface() const +{ + return interface_; +} + + +const Foam::hashedWordList& Foam::interfaceCompositionModel::species() const +{ + return species_; +} + + +const Foam::rhoMulticomponentThermo& +Foam::interfaceCompositionModel::thermo() const +{ + return thermo_; +} + + +const Foam::basicSpecieMixture& +Foam::interfaceCompositionModel::composition() const +{ + return thermo_.composition(); +} + + +const Foam::rhoThermo& Foam::interfaceCompositionModel::otherThermo() const +{ + return otherThermo_; +} + + +bool Foam::interfaceCompositionModel::otherHasComposition() const +{ + return isA(otherThermo_); +} + + +const Foam::basicSpecieMixture& +Foam::interfaceCompositionModel::otherComposition() const +{ + return refCast(otherThermo_).composition(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelNew.C new file mode 100644 index 0000000000..9ded750a4e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelNew.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "interfaceCompositionModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::interfaceCompositionModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer + ? interface.fluid().modelSubDict(dict) + : dict; + + const word interfaceCompositionModelType(modelDict.lookup("type")); + + Info<< "Selecting interfaceCompositionModel for " + << interface.name() << ": " << interfaceCompositionModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(interfaceCompositionModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown interfaceCompositionModelType type " + << interfaceCompositionModelType << endl << endl + << "Valid interfaceCompositionModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::sidedInterfaceCompositionModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new sidedInterfaceCompositionModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C new file mode 100644 index 0000000000..cfcf4b17e5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C @@ -0,0 +1,288 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "nonRandomTwoLiquid.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + defineTypeNameAndDebug(nonRandomTwoLiquid, 0); + addToRunTimeSelectionTable + ( + interfaceCompositionModel, + nonRandomTwoLiquid, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::nonRandomTwoLiquid::nonRandomTwoLiquid +( + const dictionary& dict, + const phaseInterface& interface +) +: + interfaceCompositionModel(dict, interface), + gamma1_ + ( + IOobject + ( + IOobject::groupName("gamma1", this->interface().name()), + interface.mesh().time().timeName(), + interface.mesh() + ), + interface.mesh(), + dimensionedScalar(dimless, 1) + ), + gamma2_ + ( + IOobject + ( + IOobject::groupName("gamma2", this->interface().name()), + interface.mesh().time().timeName(), + interface.mesh() + ), + interface.mesh(), + dimensionedScalar(dimless, 1) + ), + beta12_("", dimless/dimTemperature, 0), + beta21_("", dimless/dimTemperature, 0) +{ + if (species().size() != 2) + { + FatalErrorInFunction + << "nonRandomTwoLiquid model is suitable for two species only." + << exit(FatalError); + } + + species1Name_ = species()[0]; + species2Name_ = species()[1]; + + species1Index_ = composition().species()[species1Name_]; + species2Index_ = composition().species()[species2Name_]; + + alpha12_ = dimensionedScalar + ( + "alpha12", + dimless, + dict.subDict(species1Name_).lookup("alpha") + ); + alpha21_ = dimensionedScalar + ( + "alpha21", + dimless, + dict.subDict(species2Name_).lookup("alpha") + ); + + beta12_ = dimensionedScalar + ( + "beta12", + dimless/dimTemperature, + dict.subDict(species1Name_).lookup("beta") + ); + beta21_ = dimensionedScalar + ( + "beta21", + dimless/dimTemperature, + dict.subDict(species2Name_).lookup("beta") + ); + + saturationModel12_.reset + ( + saturationModel::New + ( + dict.subDict(species1Name_).subDict("interaction"), + interface, + false + ).ptr() + ); + saturationModel21_.reset + ( + saturationModel::New + ( + dict.subDict(species2Name_).subDict("interaction"), + interface, + false + ).ptr() + ); + + speciesModel1_.reset + ( + interfaceCompositionModel::New + ( + dict.subDict(species1Name_), + interface, + false + ).ptr() + ); + speciesModel2_.reset + ( + interfaceCompositionModel::New + ( + dict.subDict(species2Name_), + interface, + false + ).ptr() + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::nonRandomTwoLiquid::~nonRandomTwoLiquid() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::interfaceCompositionModels::nonRandomTwoLiquid::update +( + const volScalarField& Tf +) +{ + const volScalarField W(thermo().W()); + + const volScalarField X1 + ( + composition().Y(species1Index_) + *W + /dimensionedScalar + ( + "W", + dimMass/dimMoles, + composition().Wi(species1Index_) + ) + ); + + const volScalarField X2 + ( + composition().Y(species2Index_) + *W + /dimensionedScalar + ( + "W", + dimMass/dimMoles, + composition().Wi(species2Index_) + ) + ); + + const volScalarField alpha12(alpha12_ + Tf*beta12_); + const volScalarField alpha21(alpha21_ + Tf*beta21_); + + const volScalarField tau12(saturationModel12_->lnPSat(Tf)); + const volScalarField tau21(saturationModel21_->lnPSat(Tf)); + + const volScalarField G12(exp(- alpha12*tau12)); + const volScalarField G21(exp(- alpha21*tau21)); + + gamma1_ = + exp + ( + sqr(X2) + *( + tau21*sqr(G21)/max(sqr(X1 + X2*G21), small) + + tau12*G12/max(sqr(X2 + X1*G12), small) + ) + ); + gamma2_ = + exp + ( + sqr(X1) + *( + tau12*sqr(G12)/max(sqr(X2 + X1*G12), small) + + tau21*G21/max(sqr(X1 + X2*G21), small) + ) + ); +} + + +Foam::tmp +Foam::interfaceCompositionModels::nonRandomTwoLiquid::Yf +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (speciesName == species1Name_) + { + return + otherComposition().Y(speciesName) + *speciesModel1_->Yf(speciesName, Tf) + *gamma1_; + } + else if (speciesName == species2Name_) + { + return + otherComposition().Y(speciesName) + *speciesModel2_->Yf(speciesName, Tf) + *gamma2_; + } + else + { + return + composition().Y(speciesName) + *(scalar(1) - Yf(species1Name_, Tf) - Yf(species2Name_, Tf)); + } +} + + +Foam::tmp +Foam::interfaceCompositionModels::nonRandomTwoLiquid::YfPrime +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (speciesName == species1Name_) + { + return + otherComposition().Y(speciesName) + *speciesModel1_->YfPrime(speciesName, Tf) + *gamma1_; + } + else if (speciesName == species2Name_) + { + return + otherComposition().Y(speciesName) + *speciesModel2_->YfPrime(speciesName, Tf) + *gamma2_; + } + else + { + return + - composition().Y(speciesName) + *(YfPrime(species1Name_, Tf) + YfPrime(species2Name_, Tf)); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.H new file mode 100644 index 0000000000..e65dfaa3ea --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.H @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceCompositionModels::nonRandomTwoLiquid + +Description + Non ideal law for the mixing of two species. A separate composition model + is given for each species. The composition of a species is equal to the + value given by the model, scaled by the species fraction in the bulk of the + other phase, and multiplied by the activity coefficient for that species. + The gas behaviour is assumed ideal; i.e. the fugacity coefficient is taken + as equal to 1. + +SourceFiles + nonRandomTwoLiquid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nonRandomTwoLiquid_H +#define nonRandomTwoLiquid_H + +#include "interfaceCompositionModel.H" +#include "saturationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + +/*---------------------------------------------------------------------------*\ + Class nonRandomTwoLiquid Declaration +\*---------------------------------------------------------------------------*/ + +class nonRandomTwoLiquid +: + public interfaceCompositionModel +{ + // Private Data + + //- Activity coefficient for species 1 + volScalarField gamma1_; + + //- Activity coefficient for species 2 + volScalarField gamma2_; + + //- Name of species 1 + word species1Name_; + + //- Name of species 2 + word species2Name_; + + //- Index of species 1 within this thermo + label species1Index_; + + //- Index of species 2 within this thermo + label species2Index_; + + //- Non-randomness constant parameter for species 1 + dimensionedScalar alpha12_; + + //- Non-randomness constant parameter for species 2 + dimensionedScalar alpha21_; + + //- Non-randomness linear parameter for species 1 + dimensionedScalar beta12_; + + //- Non-randomness linear parameter for species 2 + dimensionedScalar beta21_; + + //- Interaction parameter model for species 1 + autoPtr saturationModel12_; + + //- Interaction parameter model for species 2 + autoPtr saturationModel21_; + + //- Composition model for species 1 + autoPtr speciesModel1_; + + //- Composition model for species 2 + autoPtr speciesModel2_; + + +public: + + //- Runtime type information + TypeName("nonRandomTwoLiquid"); + + + // Constructors + + //- Construct from a dictionary and an interface + nonRandomTwoLiquid + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~nonRandomTwoLiquid(); + + + // Member Functions + + //- Update the composition + virtual void update(const volScalarField& Tf); + + //- The interface species fraction + virtual tmp Yf + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- The interface species fraction derivative w.r.t. temperature + virtual tmp YfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace interfaceCompositionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C new file mode 100644 index 0000000000..c0423cb0bb --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "saturated.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + defineTypeNameAndDebug(saturated, 0); + addToRunTimeSelectionTable + ( + interfaceCompositionModel, + saturated, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::interfaceCompositionModels::saturated::wRatioByP() const +{ + const dimensionedScalar Wi + ( + "W", + dimMass/dimMoles, + composition().Wi(saturatedIndex_) + ); + + return Wi/thermo().W()/thermo().p(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::saturated::saturated +( + const dictionary& dict, + const phaseInterface& interface +) +: + interfaceCompositionModel(dict, interface), + saturatedName_(species()[0]), + saturatedIndex_(composition().species()[saturatedName_]), + saturationModel_ + ( + saturationModel::New + ( + dict.subDict("saturationPressure"), + interface, + false + ) + ) +{ + if (species().size() != 1) + { + FatalErrorInFunction + << "saturated model is suitable for one species only." + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceCompositionModels::saturated::~saturated() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::interfaceCompositionModels::saturated::update +( + const volScalarField& Tf +) +{} + + +Foam::tmp Foam::interfaceCompositionModels::saturated::Yf +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (saturatedName_ == speciesName) + { + return wRatioByP()*saturationModel_->pSat(Tf); + } + else + { + const label speciesIndex = composition().species()[speciesName]; + + return + composition().Y()[speciesIndex] + *(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf)) + /max(scalar(1) - composition().Y()[saturatedIndex_], small); + } +} + + +Foam::tmp +Foam::interfaceCompositionModels::saturated::YfPrime +( + const word& speciesName, + const volScalarField& Tf +) const +{ + if (saturatedName_ == speciesName) + { + return wRatioByP()*saturationModel_->pSatPrime(Tf); + } + else + { + const label speciesIndex = composition().species()[speciesName]; + + return + - composition().Y()[speciesIndex] + *wRatioByP()*saturationModel_->pSatPrime(Tf) + /max(scalar(1) - composition().Y()[saturatedIndex_], small); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.H new file mode 100644 index 0000000000..431cbee58b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.H @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceCompositionModels::saturated + +Description + Model which uses a saturation pressure model for a single species to + calculate the interface composition. + +SourceFiles + saturated.C + +\*---------------------------------------------------------------------------*/ + +#ifndef saturated_H +#define saturated_H + +#include "interfaceCompositionModel.H" +#include "saturationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceCompositionModels +{ + +/*---------------------------------------------------------------------------*\ + Class saturated Declaration +\*---------------------------------------------------------------------------*/ + +class saturated +: + public interfaceCompositionModel +{ +protected: + + // Private Data + + //- saturated species name + word saturatedName_; + + //- saturated species index + label saturatedIndex_; + + //- Saturation pressure model + autoPtr saturationModel_; + + + // Private Member Functions + + //- Constant of proportionality between partial pressure and mass + // fraction + tmp wRatioByP() const; + + +public: + + //- Runtime type information + TypeName("saturated"); + + + // Constructors + + //- Construct from a dictionary and an interface + saturated + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~saturated(); + + + // Member Functions + + //- Update the composition + virtual void update(const volScalarField& Tf); + + //- The interface species fraction + virtual tmp Yf + ( + const word& speciesName, + const volScalarField& Tf + ) const; + + //- The interface species fraction derivative w.r.t. temperature + virtual tmp YfPrime + ( + const word& speciesName, + const volScalarField& Tf + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace interfaceCompositionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.C new file mode 100644 index 0000000000..1bcf894f7a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "constantSurfaceTensionCoefficient.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceSurfaceTensionModels +{ + defineTypeNameAndDebug(constantSurfaceTensionCoefficient, 0); + addToRunTimeSelectionTable + ( + interfaceSurfaceTensionModel, + constantSurfaceTensionCoefficient, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceSurfaceTensionModels::constantSurfaceTensionCoefficient:: +constantSurfaceTensionCoefficient +( + const dictionary& dict, + const phaseInterface& interface +) +: + interfaceSurfaceTensionModel(dict, interface), + sigma_("sigma", dimSigma, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceSurfaceTensionModels::constantSurfaceTensionCoefficient:: +~constantSurfaceTensionCoefficient() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::interfaceSurfaceTensionModels::constantSurfaceTensionCoefficient:: +sigma() const +{ + return volScalarField::New + ( + "sigma", + interface_.mesh(), + sigma_ + ); +} + + +Foam::tmp +Foam::interfaceSurfaceTensionModels::constantSurfaceTensionCoefficient::sigma +( + const label patchi +) const +{ + return tmp + ( + new scalarField + ( + interface_.mesh().boundary()[patchi].size(), + sigma_.value() + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H new file mode 100644 index 0000000000..a9508720f3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceSurfaceTensionModels::constantSurfaceTensionCoefficient + +Description + Constant value surface tension model. + +SourceFiles + constantSurfaceTensionCoefficient.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantSurfaceTensionCoefficient_H +#define constantSurfaceTensionCoefficient_H + +#include "interfaceSurfaceTensionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace interfaceSurfaceTensionModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantSurfaceTensionCoefficient Declaration +\*---------------------------------------------------------------------------*/ + +class constantSurfaceTensionCoefficient +: + public interfaceSurfaceTensionModel +{ + // Private Data + + //- Constant surface tension value + const dimensionedScalar sigma_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantSurfaceTensionCoefficient + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantSurfaceTensionCoefficient(); + + + // Member Functions + + //- Surface tension + virtual tmp sigma() const; + + //- Surface tension for a patch + virtual tmp sigma(const label patchi) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace interfaceSurfaceTensionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.C new file mode 100644 index 0000000000..1853d63ddc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "interfaceSurfaceTensionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(interfaceSurfaceTensionModel, 0); + defineRunTimeSelectionTable(interfaceSurfaceTensionModel, dictionary); +} + +const Foam::dimensionSet Foam::interfaceSurfaceTensionModel::dimSigma +( + 1, 0, -2, 0, 0 +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interfaceSurfaceTensionModel::interfaceSurfaceTensionModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interfaceSurfaceTensionModel::~interfaceSurfaceTensionModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.H new file mode 100644 index 0000000000..f76092d2ca --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModel.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::interfaceSurfaceTensionModel + +Description + Abstract base-class for interface surface-tension models which can be + used when interface compression is applied between two phases. + +SourceFiles + interfaceSurfaceTensionModel.C + interfaceSurfaceTensionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interfaceSurfaceTensionModel_H +#define interfaceSurfaceTensionModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "phaseInterface.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interfaceSurfaceTensionModel Declaration +\*---------------------------------------------------------------------------*/ + +class interfaceSurfaceTensionModel +{ +protected: + + // Protected data + + //- Interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("surfaceTensionModel"); + + + // Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + interfaceSurfaceTensionModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimSigma; + + + // Constructors + + //- Construct from a dictionary and an interface + interfaceSurfaceTensionModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~interfaceSurfaceTensionModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + //- Surface tension + virtual tmp sigma() const = 0; + + //- Surface tension for a patch + virtual tmp sigma(const label patchi) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModelNew.C new file mode 100644 index 0000000000..df718b6414 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/interfaceSurfaceTensionModels/interfaceSurfaceTensionModel/interfaceSurfaceTensionModelNew.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "interfaceSurfaceTensionModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::interfaceSurfaceTensionModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer + ? interface.fluid().modelSubDict(dict) + : dict; + + const word interfaceSurfaceTensionModelType(modelDict.lookup("type")); + + Info<< "Selecting interfaceSurfaceTensionModel for " + << interface.name() << ": " << interfaceSurfaceTensionModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(interfaceSurfaceTensionModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown interfaceSurfaceTensionModelType type " + << interfaceSurfaceTensionModelType << endl << endl + << "Valid interfaceSurfaceTensionModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.C new file mode 100644 index 0000000000..8862c41b62 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "Antoine.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(Antoine, 0); + addToRunTimeSelectionTable(saturationModel, Antoine, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::Antoine::Antoine +( + const dictionary& dict, + const phaseInterface& interface +) +: + saturationModel(dict, interface), + A_("A", dimless, dict), + B_("B", dimTemperature, dict), + C_("C", dimTemperature, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::Antoine::~Antoine() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::Antoine::pSat +( + const volScalarField& T +) const +{ + return + dimensionedScalar(dimPressure, 1) + *exp(A_ + B_/(C_ + T)); +} + + +Foam::tmp +Foam::saturationModels::Antoine::pSatPrime +( + const volScalarField& T +) const +{ + return - pSat(T)*B_/sqr(C_ + T); +} + + +Foam::tmp +Foam::saturationModels::Antoine::lnPSat +( + const volScalarField& T +) const +{ + return A_ + B_/(C_ + T); +} + + +Foam::tmp +Foam::saturationModels::Antoine::Tsat +( + const volScalarField& p +) const +{ + return + B_/(log(p*dimensionedScalar(dimless/dimPressure, 1)) - A_) + - C_; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.H new file mode 100644 index 0000000000..89e33c7953 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/Antoine/Antoine.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModels::Antoine + +Description + Antoine equation for the vapour pressure. + + \f[ + \log p = A + \frac{B}{C + T} + \f] + + Coefficients \f$A\f$, \f$B\f$ and \f$C\f$ are to be supplied and should be + suitable for natural logarithms and temperatures in Kelvin. + +SourceFiles + Antoine.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Antoine_H +#define Antoine_H + +#include "saturationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class Antoine Declaration +\*---------------------------------------------------------------------------*/ + +class Antoine +: + public saturationModel +{ +protected: + + // Protected data + + //- Constant A + dimensionedScalar A_; + + //- Constant B + dimensionedScalar B_; + + //- Constant C + dimensionedScalar C_; + + +public: + + //- Runtime type information + TypeName("Antoine"); + + + // Constructors + + //- Construct from a dictionary and an interface + Antoine + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Antoine(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.C new file mode 100644 index 0000000000..aeef821600 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.C @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "AntoineExtended.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(AntoineExtended, 0); + addToRunTimeSelectionTable + ( + saturationModel, + AntoineExtended, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::AntoineExtended::AntoineExtended +( + const dictionary& dict, + const phaseInterface& interface +) +: + Antoine(dict, interface), + D_("D", dimless, dict), + F_("F", dimless, dict), + E_("E", dimless/pow(dimTemperature, F_), dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::AntoineExtended::~AntoineExtended() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::AntoineExtended::pSat +( + const volScalarField& T +) const +{ + return + dimensionedScalar(dimPressure/pow(dimTemperature, D_), 1) + *exp(A_ + B_/(C_ + T) + E_*pow(T, F_)) + *pow(T, D_); +} + + +Foam::tmp +Foam::saturationModels::AntoineExtended::pSatPrime +( + const volScalarField& T +) const +{ + return pSat(T)*((D_ + E_*F_*pow(T, F_))/T - B_/sqr(C_ + T)); +} + + +Foam::tmp +Foam::saturationModels::AntoineExtended::lnPSat +( + const volScalarField& T +) const +{ + return + A_ + + B_/(C_ + T) + + D_*log(T*dimensionedScalar(dimless/dimTemperature, 1)) + + E_*pow(T, F_); +} + + +Foam::tmp +Foam::saturationModels::AntoineExtended::Tsat +( + const volScalarField& p +) const +{ + NotImplemented; + + return volScalarField::null(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.H new file mode 100644 index 0000000000..f5f3eb1616 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/AntoineExtended/AntoineExtended.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModels::AntoineExtended + +Description + Extended Antoine equation for the vapour pressure. + + \f[ + \log (p) = A + \frac{B}{C + T} + D \log (T) + E T^F + \f] + + Coefficients \f$A\f$, \f$B\f$, \f$C\f$, \f$D\f$, \f$E\f$ and \f$F\f$ are + to be supplied and should be suitable for natural logarithms and + temperatures in Kelvin. + +SourceFiles + AntoineExtended.C + +\*---------------------------------------------------------------------------*/ + +#ifndef AntoineExtended_H +#define AntoineExtended_H + +#include "Antoine.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class AntoineExtended Declaration +\*---------------------------------------------------------------------------*/ + +class AntoineExtended +: + public Antoine +{ + // Private Data + + //- Constant D + dimensionedScalar D_; + + //- Constant F + dimensionedScalar F_; + + //- Constant E + // (after F so F's dimensions can be used in the construction) + dimensionedScalar E_; + + +public: + + //- Runtime type information + TypeName("AntoineExtended"); + + + // Constructors + + //- Construct from a dictionary and an interface + AntoineExtended + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~AntoineExtended(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.C new file mode 100644 index 0000000000..c7a8f9a10e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "ArdenBuck.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(ArdenBuck, 0); + addToRunTimeSelectionTable(saturationModel, ArdenBuck, dictionary); +} +} + + +static const Foam::dimensionedScalar zeroC("", Foam::dimTemperature, 273.15); +static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21); +static const Foam::dimensionedScalar B("", Foam::dimless, 18.678); +static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5); +static const Foam::dimensionedScalar D("", Foam::dimTemperature, 257.14); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::ArdenBuck::xByTC +( + const volScalarField& TC +) const +{ + return (B - TC/C)/(D + TC); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::ArdenBuck::ArdenBuck +( + const dictionary& dict, + const phaseInterface& interface +) +: + saturationModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::ArdenBuck::~ArdenBuck() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::ArdenBuck::pSat +( + const volScalarField& T +) const +{ + volScalarField TC(T - zeroC); + + return A*exp(TC*xByTC(TC)); +} + + +Foam::tmp +Foam::saturationModels::ArdenBuck::pSatPrime +( + const volScalarField& T +) const +{ + volScalarField TC(T - zeroC); + + volScalarField x(xByTC(TC)); + + return A*exp(TC*x)*(D*x - TC/C)/(D + TC); +} + + +Foam::tmp +Foam::saturationModels::ArdenBuck::lnPSat +( + const volScalarField& T +) const +{ + volScalarField TC(T - zeroC); + + return log(A.value()) + TC*xByTC(TC); +} + + +Foam::tmp +Foam::saturationModels::ArdenBuck::Tsat +( + const volScalarField& p +) const +{ + NotImplemented; + + return volScalarField::null(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.H new file mode 100644 index 0000000000..4b8b374263 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/ArdenBuck/ArdenBuck.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModels::ArdenBuck + +Description + ArdenBuck equation for the vapour pressure of moist air. + +SourceFiles + ArdenBuck.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ArdenBuck_H +#define ArdenBuck_H + +#include "saturationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class ArdenBuck Declaration +\*---------------------------------------------------------------------------*/ + +class ArdenBuck +: + public saturationModel +{ + // Private Member Functions + + //- Exponent divided by the temperature + tmp xByTC(const volScalarField& TC) const; + + +public: + + //- Runtime type information + TypeName("ArdenBuck"); + + + // Constructors + + //- Construct from a dictionary and an interface + ArdenBuck + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~ArdenBuck(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.C new file mode 100644 index 0000000000..3d8f4467a8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "constantSaturationConditions.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(constantSaturationConditions, 0); + addToRunTimeSelectionTable + ( + saturationModel, + constantSaturationConditions, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::constantSaturationConditions:: +constantSaturationConditions +( + const dictionary& dict, + const phaseInterface& interface +) +: + saturationModel(dict, interface), + pSat_("pSat", dimPressure, dict), + Tsat_("Tsat", dimTemperature, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::constantSaturationConditions:: +~constantSaturationConditions() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::constantSaturationConditions::pSat +( + const volScalarField& T +) const +{ + return volScalarField::New + ( + "pSat", + T.mesh(), + pSat_ + ); +} + + +Foam::tmp +Foam::saturationModels::constantSaturationConditions::pSatPrime +( + const volScalarField& T +) const +{ + return volScalarField::New + ( + "pSatPrime", + T.mesh(), + dimensionedScalar(dimPressure/dimTemperature, 0) + ); +} + + +Foam::tmp +Foam::saturationModels::constantSaturationConditions::lnPSat +( + const volScalarField& T +) const +{ + return volScalarField::New + ( + "lnPSat", + T.mesh(), + dimensionedScalar(dimless, log(pSat_.value())) + ); +} + + +Foam::tmp +Foam::saturationModels::constantSaturationConditions::Tsat +( + const volScalarField& p +) const +{ + return volScalarField::New + ( + "Tsat", + p.mesh(), + Tsat_ + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.H new file mode 100644 index 0000000000..1f761e4307 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/constantSaturationConditions/constantSaturationConditions.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModels::constantSaturationConditions + +Description + Constant saturation pressure and temperature. + +SourceFiles + constantSaturationConditions.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantSaturationConditions_H +#define constantSaturationConditions_H + +#include "saturationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantSaturationConditions Declaration +\*---------------------------------------------------------------------------*/ + +class constantSaturationConditions +: + public saturationModel +{ +protected: + + // Private Data + + //- Constant saturation pressure + dimensionedScalar pSat_; + + //- Constant saturation temperature + dimensionedScalar Tsat_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantSaturationConditions + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantSaturationConditions(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.C new file mode 100644 index 0000000000..6f54b40006 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.C @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2022 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 "function1.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(function1, 0); + addToRunTimeSelectionTable(saturationModel, function1, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::function1::function1 +( + const dictionary& dict, + const phaseInterface& interface +) +: + saturationModel(dict, interface), + function_(Function1::New("function", dict)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::function1::~function1() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::function1::pSat +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::function1::pSatPrime +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::function1::lnPSat +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::function1::Tsat +( + const volScalarField& p +) const +{ + tmp tTsat + ( + volScalarField::New + ( + "Tsat", + p.mesh(), + dimensionedScalar(dimTemperature, 0) + ) + ); + + volScalarField& Tsat = tTsat.ref(); + + forAll(Tsat, celli) + { + Tsat[celli] = function_->value(p[celli]); + } + + volScalarField::Boundary& TsatBf = Tsat.boundaryFieldRef(); + + forAll(Tsat.boundaryField(), patchi) + { + scalarField& Tsatp = TsatBf[patchi]; + const scalarField& pp = p.boundaryField()[patchi]; + + forAll(Tsatp, facei) + { + Tsatp[facei] = function_->value(pp[facei]); + + } + } + + return tTsat; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.H new file mode 100644 index 0000000000..11a51dd5fd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/function1/function1.H @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2022 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::saturationModels::function1 + +Description + Saturation vapour temperature in terms of + the vapour pressure (in Pa). The saturation temperature in Kelvins is + specified as a Foam::Function1 type, to enable use of, e.g. constant, + polynomial, table values. + + Currently this class only provides \f$T_sat\f$, the inverse function to + return the vapour pressure for a given temperature are not implemented. + + Examples: + + \verbatim + type function1; + function polynomial + ( + (308.0422 0) + (0.0015096 1) + (-1.61589e-8 2) + (1.114106e-13 3) + (-4.52216e-19 4) + (1.05192e-24 5) + (-1.2953e-30 6) + (6.5365e-37 7) + ) + \endverbatim + + \verbatim + type function1; + function table; + functionCoeffs + { + file "filename.csv"; + format csv; + nHeaderLine 1; + refColumn 0; + componentColumns (1); + separator ","; + mergeSeparators no; + outOfBounds clamp; + interpolationScheme linear; + }; + \endverbatim + +SourceFiles + function1.C + +\*---------------------------------------------------------------------------*/ + +#ifndef function1_H +#define function1_H + +#include "saturationModel.H" +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class function1 Declaration +\*---------------------------------------------------------------------------*/ + +class function1 +: + public saturationModel +{ + // Private Data + + //- Saturation temperature as a function of pressure + autoPtr> function_; + + +public: + + //- Runtime type information + TypeName("function1"); + + + // Constructors + + //- Construct from a dictionary and an interface + function1 + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~function1(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.C new file mode 100644 index 0000000000..e735e7f12f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "polynomial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + defineTypeNameAndDebug(polynomial, 0); + addToRunTimeSelectionTable(saturationModel, polynomial, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModels::polynomial::polynomial +( + const dictionary& dict, + const phaseInterface& interface +) +: + saturationModel(dict, interface), + C_(dict.lookup("C<8>")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModels::polynomial::~polynomial() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::saturationModels::polynomial::pSat +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::polynomial::pSatPrime +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::polynomial::lnPSat +( + const volScalarField& T +) const +{ + NotImplemented; + return volScalarField::null(); +} + + +Foam::tmp +Foam::saturationModels::polynomial::Tsat +( + const volScalarField& p +) const +{ + tmp tTsat + ( + volScalarField::New + ( + "Tsat", + p.mesh(), + dimensionedScalar(dimTemperature, 0) + ) + ); + + volScalarField& Tsat = tTsat.ref(); + + forAll(Tsat, celli) + { + Tsat[celli] = C_.value(p[celli]); + } + + volScalarField::Boundary& TsatBf = Tsat.boundaryFieldRef(); + + forAll(Tsat.boundaryField(), patchi) + { + scalarField& Tsatp = TsatBf[patchi]; + const scalarField& pp = p.boundaryField()[patchi]; + + forAll(Tsatp, facei) + { + Tsatp[facei] = C_.value(pp[facei]); + } + } + + return tTsat; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.H new file mode 100644 index 0000000000..d7204109a3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/polynomial/polynomial.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModels::polynomial + +Description + Polynomial equation for the saturation vapour temperature in terms of + the vapour pressure (in Pa). + + \f[ + T_sat = \sum_i C_i p^i + \f] + + where \f$p\f$ is the pressure in Pa and \f$C\f$ are the coefficients. + + Currently this class only provides \f$T_sat\f$, the inverse function to + return the vapour pressure for a given temperature are not implemented. + +SourceFiles + polynomial.C + +\*---------------------------------------------------------------------------*/ + +#ifndef polynomial_H +#define polynomial_H + +#include "saturationModel.H" +#include "Polynomial.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace saturationModels +{ + +/*---------------------------------------------------------------------------*\ + Class polynomial Declaration +\*---------------------------------------------------------------------------*/ + +class polynomial +: + public saturationModel +{ + // Private Data + + //- Polynomial coefficients + Polynomial<8> C_; + + +public: + + //- Runtime type information + TypeName("polynomial"); + + + // Constructors + + //- Construct from a dictionary and an interface + polynomial + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~polynomial(); + + + // Member Functions + + //- Saturation pressure + virtual tmp pSat(const volScalarField& T) const; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime(const volScalarField& T) const; + + //- Natural log of the saturation pressure + virtual tmp lnPSat(const volScalarField& T) const; + + //- Saturation temperature + virtual tmp Tsat(const volScalarField& p) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace saturationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.C new file mode 100644 index 0000000000..d0d8a80761 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "saturationModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(saturationModel, 0); + defineRunTimeSelectionTable(saturationModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::saturationModel::saturationModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + regIOobject + ( + IOobject + ( + IOobject::groupName("saturationModel", interface.name()), + interface.mesh().time().constant(), + interface.mesh() + ) + ), + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::saturationModel::~saturationModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::phaseInterface& Foam::saturationModel::interface() const +{ + return interface_; +} + + +bool Foam::saturationModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.H new file mode 100644 index 0000000000..ed98fe0f2f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModel.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::saturationModel + +Description + Model to describe the dependence of saturation pressure on temperature, and + vice versa + +SourceFiles + saturationModel.C + saturationModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef saturationModel_H +#define saturationModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "phaseInterface.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class saturationModel Declaration +\*---------------------------------------------------------------------------*/ + +class saturationModel +: + public regIOobject +{ + // Private Data + + //- The interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("saturationModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + saturationModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + saturationModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + //- Destructor + virtual ~saturationModel(); + + + // Member Functions + + //- Access the interface + const phaseInterface& interface() const; + + //- Saturation pressure + virtual tmp pSat + ( + const volScalarField& T + ) const = 0; + + //- Saturation pressure derivative w.r.t. temperature + virtual tmp pSatPrime + ( + const volScalarField& T + ) const = 0; + + //- Natural log of the saturation pressure + virtual tmp lnPSat + ( + const volScalarField& T + ) const = 0; + + //- Saturation temperature + virtual tmp Tsat + ( + const volScalarField& p + ) const = 0; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModelNew.C new file mode 100644 index 0000000000..4b2bcfbc4a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialCompositionModels/saturationModels/saturationModel/saturationModelNew.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "saturationModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::saturationModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer ? interface.fluid().modelSubDict(dict) : dict; + + const word saturationModelType(modelDict.lookup("type")); + + Info<< "Selecting saturationModel for " + << interface.name() << ": " << saturationModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(saturationModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown saturationModelType type " + << saturationModelType << endl << endl + << "Valid saturationModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/files new file mode 100644 index 0000000000..fa1eb1f6f8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/files @@ -0,0 +1,91 @@ +dragModels/dragModel/dragModel.C +dragModels/dragModel/dragModelNew.C +dragModels/dispersedDragModel/dispersedDragModel.C +dragModels/Beetstra/Beetstra.C +dragModels/segregated/segregated.C +dragModels/Ergun/Ergun.C +dragModels/Gibilaro/Gibilaro.C +dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C +dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C +dragModels/Lain/Lain.C +dragModels/SchillerNaumann/SchillerNaumann.C +dragModels/SyamlalOBrien/SyamlalOBrien.C +dragModels/TomiyamaCorrelated/TomiyamaCorrelated.C +dragModels/TomiyamaAnalytic/TomiyamaAnalytic.C +dragModels/Tenneti/Tenneti.C +dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.C +dragModels/WenYu/WenYu.C +dragModels/IshiiZuber/IshiiZuber.C +dragModels/AttouFerschneider/AttouFerschneider.C +dragModels/aerosolDrag/aerosolDrag.C +dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.C + +swarmCorrections/swarmCorrection/swarmCorrection.C +swarmCorrections/swarmCorrection/swarmCorrectionNew.C +swarmCorrections/noSwarm/noSwarm.C +swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C + +liftModels/liftModel/liftModel.C +liftModels/liftModel/liftModelNew.C +liftModels/dispersedLiftModel/dispersedLiftModel.C +liftModels/noLift/noLift.C +liftModels/constantLiftCoefficient/constantLiftCoefficient.C +liftModels/Moraga/Moraga.C +liftModels/LegendreMagnaudet/LegendreMagnaudet.C +liftModels/SaffmanMei/SaffmanMei.C +liftModels/TomiyamaLift/TomiyamaLift.C +liftModels/wallDampedLift/wallDampedLift.C + +heatTransferModels/heatTransferModel/heatTransferModel.C +heatTransferModels/heatTransferModel/heatTransferModelNew.C +heatTransferModels/constantNu/constantNuHeatTransfer.C +heatTransferModels/RanzMarshall/RanzMarshall.C +heatTransferModels/Gunn/Gunn.C +heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.C +heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.C + +virtualMassModels/virtualMassModel/virtualMassModel.C +virtualMassModels/virtualMassModel/virtualMassModelNew.C +virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.C +virtualMassModels/noVirtualMass/noVirtualMass.C +virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.C +virtualMassModels/Lamb/Lamb.C + +wallLubricationModels/wallLubricationModel/wallLubricationModel.C +wallLubricationModels/wallLubricationModel/wallLubricationModelNew.C +wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.C +wallLubricationModels/noWallLubrication/noWallLubrication.C +wallLubricationModels/Antal/Antal.C +wallLubricationModels/Frank/Frank.C +wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C + +turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C +turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModelNew.C +turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.C +turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.C +turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.C +turbulentDispersionModels/Burns/Burns.C +turbulentDispersionModels/Gosman/Gosman.C +turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.C + +aspectRatioModels/aspectRatioModel/aspectRatioModel.C +aspectRatioModels/aspectRatioModel/aspectRatioModelNew.C +aspectRatioModels/constantAspectRatio/constantAspectRatio.C +aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C +aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C +aspectRatioModels/Wellek/Wellek.C + +wallDependentModel/wallDependentModel.C + +wallDampingModels/wallDampingModel/wallDampingModel.C +wallDampingModels/wallDampingModel/wallDampingModelNew.C +wallDampingModels/linear/linearWallDamping.C +wallDampingModels/cosine/cosineWallDamping.C +wallDampingModels/sine/sineWallDamping.C + +phaseTransferModels/phaseTransferModel/phaseTransferModel.C +phaseTransferModels/phaseTransferModel/phaseTransferModelNew.C +phaseTransferModels/deposition/deposition.C +phaseTransferModels/reactionDriven/reactionDriven.C + +LIB = $(FOAM_LIBBIN)/libeulerianInterfacialModels diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/options new file mode 100644 index 0000000000..a1290d84ef --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lphaseSystem \ + -lfluidThermophysicalModels \ + -lspecie diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C new file mode 100644 index 0000000000..ee5aad4c0c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaAspectRatio.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + defineTypeNameAndDebug(TomiyamaAspectRatio, 0); + addToRunTimeSelectionTable + ( + aspectRatioModel, + TomiyamaAspectRatio, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::TomiyamaAspectRatio::TomiyamaAspectRatio +( + const dictionary& dict, + const phaseInterface& interface +) +: + VakhrushevEfremov(dict, interface), + wallDependentModel(interface_.mesh()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::TomiyamaAspectRatio::~TomiyamaAspectRatio() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::aspectRatioModels::TomiyamaAspectRatio::E() const +{ + return + VakhrushevEfremov::E() + *max(1 - 0.35*yWall()/interface_.dispersed().d(), scalar(0.65)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H new file mode 100644 index 0000000000..d2c53eb758 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/TomiyamaAspectRatio/TomiyamaAspectRatio.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::aspectRatioModels::TomiyamaAspectRatio + +Description + Aspect ratio model of Tomiyama. + + Reference: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + +SourceFiles + TomiyamaAspectRatio.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaAspectRatio_H +#define TomiyamaAspectRatio_H + +#include "VakhrushevEfremov.H" +#include "wallDependentModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaAspectRatio Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaAspectRatio +: + public VakhrushevEfremov, + public wallDependentModel +{ +public: + + //- Runtime type information + TypeName("Tomiyama"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaAspectRatio + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~TomiyamaAspectRatio(); + + + // Member Functions + + //- Aspect ratio + virtual tmp E() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace aspectRatioModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C new file mode 100644 index 0000000000..94e9f1f009 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "VakhrushevEfremov.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + defineTypeNameAndDebug(VakhrushevEfremov, 0); + addToRunTimeSelectionTable + ( + aspectRatioModel, + VakhrushevEfremov, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::VakhrushevEfremov::VakhrushevEfremov +( + const dictionary& dict, + const phaseInterface& interface +) +: + aspectRatioModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::VakhrushevEfremov::~VakhrushevEfremov() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::aspectRatioModels::VakhrushevEfremov::E() const +{ + const volScalarField Ta(interface_.Ta()); + + return + neg(Ta - 1) + + pos0(Ta - 1)*neg(Ta - 39.8) + *pow3(0.81 + 0.206*tanh(1.6 - 2*log10(max(Ta, scalar(1))))) + + pos0(Ta - 39.8)*0.24; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.H new file mode 100644 index 0000000000..6303d18c93 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/VakhrushevEfremov/VakhrushevEfremov.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::aspectRatioModels::VakhrushevEfremov + +Description + Aspect ratio model of Vakhrushev and Efremov. + + Reference: + \verbatim + Vakhrushev, I. A., & Efremov, G. I. (1970). + Interpolation formula for computing the velocities of single gas bubbles + in liquids. + Chemistry and Technology of Fuels and Oils, 6(5), 376-379. + \endverbatim + +SourceFiles + VakhrushevEfremov.C + +\*---------------------------------------------------------------------------*/ + +#ifndef VakhrushevEfremov_H +#define VakhrushevEfremov_H + +#include "aspectRatioModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + +/*---------------------------------------------------------------------------*\ + Class VakhrushevEfremov Declaration +\*---------------------------------------------------------------------------*/ + +class VakhrushevEfremov +: + public aspectRatioModel +{ +public: + + //- Runtime type information + TypeName("VakhrushevEfremov"); + + + // Constructors + + //- Construct from a dictionary and an interface + VakhrushevEfremov + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~VakhrushevEfremov(); + + + // Member Functions + + //- Aspect ratio + virtual tmp E() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace aspectRatioModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.C new file mode 100644 index 0000000000..45e6c5aa64 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Wellek.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + defineTypeNameAndDebug(Wellek, 0); + addToRunTimeSelectionTable + ( + aspectRatioModel, + Wellek, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::Wellek::Wellek +( + const dictionary& dict, + const phaseInterface& interface +) +: + aspectRatioModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::Wellek::~Wellek() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::aspectRatioModels::Wellek::E() const +{ + return scalar(1)/(1 + 0.163*pow(interface_.Eo(), 0.757)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.H new file mode 100644 index 0000000000..5cbe7991f4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/Wellek/Wellek.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::aspectRatioModels::Wellek + +Description + Aspect ratio model of Wellek et al. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Wellek, R. M., Agrawal, A. K., & Skelland, A. H. P. (1966). + Shape of liquid drops moving in liquid media. + AIChE Journal, 12(5), 854-862. + \endverbatim + +SourceFiles + Wellek.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Wellek_H +#define Wellek_H + +#include "aspectRatioModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + +/*---------------------------------------------------------------------------*\ + Class Wellek Declaration +\*---------------------------------------------------------------------------*/ + +class Wellek +: + public aspectRatioModel +{ +public: + + //- Runtime type information + TypeName("Wellek"); + + + // Constructors + + //- Construct from a dictionary and an interface + Wellek + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Wellek(); + + + // Member Functions + + //- Aspect ratio + virtual tmp E() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace aspectRatioModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.C new file mode 100644 index 0000000000..5c26399e0f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.C @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "aspectRatioModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(aspectRatioModel, 0); + defineRunTimeSelectionTable(aspectRatioModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::aspectRatioModel::aspectRatioModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + interface_(interface.modelCast()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::aspectRatioModel::~aspectRatioModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.H new file mode 100644 index 0000000000..1bca597fd9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModel.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::aspectRatioModel + +Description + Model for deviations in the shape of the dispersed phase from spherical. + Just a sub-model modifier, typically for the drag model. Not a proper part + of the diameter/shape modelling in the phase models. + +SourceFiles + aspectRatioModel.C + aspectRatioModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef aspectRatioModel_H +#define aspectRatioModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class aspectRatioModel Declaration +\*---------------------------------------------------------------------------*/ + +class aspectRatioModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("aspectRatioModel"); + + + // Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + aspectRatioModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + aspectRatioModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~aspectRatioModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Aspect ratio + virtual tmp E() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModelNew.C new file mode 100644 index 0000000000..b807727abc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/aspectRatioModel/aspectRatioModelNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "aspectRatioModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::aspectRatioModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + const word aspectRatioModelType(dict.lookup("type")); + + Info<< "Selecting aspectRatioModel for " + << interface.name() << ": " << aspectRatioModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(aspectRatioModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown aspectRatioModelType type " + << aspectRatioModelType << endl << endl + << "Valid aspectRatioModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.C new file mode 100644 index 0000000000..67ec10cf91 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "constantAspectRatio.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + defineTypeNameAndDebug(constantAspectRatio, 0); + addToRunTimeSelectionTable + ( + aspectRatioModel, + constantAspectRatio, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::constantAspectRatio::constantAspectRatio +( + const dictionary& dict, + const phaseInterface& interface +) +: + aspectRatioModel(dict, interface), + E0_("E0", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::aspectRatioModels::constantAspectRatio::~constantAspectRatio() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::aspectRatioModels::constantAspectRatio::E() const +{ + return volScalarField::New + ( + aspectRatioModel::typeName + ":E", + interface_.mesh(), + E0_ + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H new file mode 100644 index 0000000000..86131e1c2a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/aspectRatioModels/constantAspectRatio/constantAspectRatio.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::aspectRatioModels::constantAspectRatio + +Description + Constant value aspect ratio model. + +SourceFiles + constantAspectRatio.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantAspectRatio_H +#define constantAspectRatio_H + +#include "aspectRatioModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace aspectRatioModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantAspectRatio Declaration +\*---------------------------------------------------------------------------*/ + +class constantAspectRatio +: + public aspectRatioModel +{ + // Private Data + + //- Constant aspect ratio value + const dimensionedScalar E0_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantAspectRatio + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantAspectRatio(); + + + // Member Functions + + //- Aspect ratio + virtual tmp E() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace aspectRatioModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.C new file mode 100644 index 0000000000..9b0d013e0b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.C @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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 "AttouFerschneider.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(AttouFerschneider, 0); + addToRunTimeSelectionTable(dragModel, AttouFerschneider, dictionary); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::AttouFerschneider::KGasLiquid +( + const phaseModel& gas, + const phaseModel& liquid +) const +{ + const phaseModel& solid = gas.fluid().phases()[solidName_]; + + const volScalarField oneMinusGas(max(1 - gas, liquid.residualAlpha())); + const volScalarField cbrtR + ( + cbrt(max(solid, solid.residualAlpha())/oneMinusGas) + ); + const volScalarField magURel(mag(gas.U() - liquid.U())); + + return + E2_*gas.thermo().mu()*sqr(oneMinusGas/solid.d())*sqr(cbrtR) + /max(gas, gas.residualAlpha()) + + E2_*gas.rho()*magURel*(1 - gas)/solid.d()*cbrtR; +} + + +Foam::tmp +Foam::dragModels::AttouFerschneider::KGasSolid +( + const phaseModel& gas, + const phaseModel& solid +) const +{ + const volScalarField oneMinusGas(max(1 - gas, solid.residualAlpha())); + const volScalarField cbrtR + ( + cbrt(max(solid, solid.residualAlpha())/oneMinusGas) + ); + + return + E1_*gas.thermo().mu()*sqr(oneMinusGas/solid.d())*sqr(cbrtR) + /max(gas, gas.residualAlpha()) + + E2_*gas.rho()*mag(gas.U())*(1 - gas)/solid.d()*cbrtR; +} + + +Foam::tmp +Foam::dragModels::AttouFerschneider::KLiquidSolid +( + const phaseModel& liquid, + const phaseModel& solid +) const +{ + const phaseModel& gas = liquid.fluid().phases()[gasName_]; + + return + E1_*liquid.thermo().mu() + *sqr(max(solid, solid.residualAlpha())/solid.d()) + /max(liquid, liquid.residualAlpha()) + + E2_*liquid.rho()*mag(gas.U())*solid/solid.d(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::AttouFerschneider::AttouFerschneider +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dragModel(dict, interface, registerObject), + interface_(interface), + gasName_(dict.lookup("gas")), + liquidName_(dict.lookup("liquid")), + solidName_(dict.lookup("solid")), + E1_("E1", dimless, dict), + E2_("E2", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::AttouFerschneider::~AttouFerschneider() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::AttouFerschneider::K() const +{ + const phaseModel& gas = interface_.fluid().phases()[gasName_]; + const phaseModel& liquid = interface_.fluid().phases()[liquidName_]; + const phaseModel& solid = interface_.fluid().phases()[solidName_]; + + if (interface_.contains(gas) && interface_.contains(liquid)) + { + return KGasLiquid(gas, liquid); + } + if (interface_.contains(gas) && interface_.contains(solid)) + { + return KGasSolid(gas, solid); + } + if (interface_.contains(liquid) && interface_.contains(solid)) + { + return KLiquidSolid(liquid, solid); + } + + FatalErrorInFunction + << "The interface " << interface_.name() << " does not contain two " + << "out of the gas, liquid and solid phase models." + << exit(FatalError); + + return tmp(nullptr); +} + + +Foam::tmp +Foam::dragModels::AttouFerschneider::Kf() const +{ + return fvc::interpolate(K()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.H new file mode 100644 index 0000000000..d94af2396a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/AttouFerschneider/AttouFerschneider.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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::dragModels::AttouFerschneider + +Description + Attou and Ferschneider's Drag model for film flow through packed beds. The + implementation follows the description of Gunjal and Ranade, who, in the + reference below, formulate the model in more convenient terms. + + Reference: + \verbatim + Gunjal, P. R., & Ranade, V. V. (2007). + Modeling of laboratory and commercial scale hydro-processing reactors + using CFD. + Chemical Engineering Science, 62(18-20), 5512-5526. + \endverbatim + +SourceFiles + AttouFerschneider.C + +\*---------------------------------------------------------------------------*/ + +#ifndef AttouFerschneider_H +#define AttouFerschneider_H + +#include "dragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class AttouFerschneider Declaration +\*---------------------------------------------------------------------------*/ + +class AttouFerschneider +: + public dragModel +{ + // Private Data + + //- Interface + const phaseInterface interface_; + + //- Name of the gaseous phase + const word gasName_; + + //- Name of the liquidphase + const word liquidName_; + + //- Name of the solid phase + const word solidName_; + + //- Ergun constant 1 + const dimensionedScalar E1_; + + //- Ergun constant 2 + const dimensionedScalar E2_; + + + // Private Member Functions + + //- Return the momentum transfer coefficient between gas and liquid + virtual tmp KGasLiquid + ( + const phaseModel& gas, + const phaseModel& liquid + ) const; + + //- Return the momentum transfer coefficient between gas and solid + virtual tmp KGasSolid + ( + const phaseModel& gas, + const phaseModel& solid + ) const; + + //- Return the momentum transfer coefficient between liquid and solid + virtual tmp KLiquidSolid + ( + const phaseModel& liquid, + const phaseModel& solid + ) const; + + +public: + + //- Runtime type information + TypeName("AttouFerschneider"); + + + // Constructors + + //- Construct from a dictionary and an interface + AttouFerschneider + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~AttouFerschneider(); + + + // Member Functions + + //- The drag coefficient used in the momentum equation + virtual tmp K() const; + + //- The drag coefficient used in the face-momentum equations + virtual tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.C new file mode 100644 index 0000000000..d458db7d63 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.C @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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 "Beetstra.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(Beetstra, 0); + addToRunTimeSelectionTable(dragModel, Beetstra, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::Beetstra::Beetstra +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict.lookup("residualRe")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::Beetstra::~Beetstra() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::Beetstra::CdRe() const +{ + const volScalarField alpha1 + ( + max(interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField Res(alpha2*interface_.Re()); + + const volScalarField ResLim + ( + "ReLim", + max(Res, residualRe_) + ); + + const volScalarField F0 + ( + "F0", + 10*alpha1/sqr(alpha2) + sqr(alpha2)*(1 + 1.5*sqrt(alpha1)) + ); + + const volScalarField F1 + ( + "F1", + 0.413*Res/(24*sqr(alpha2))*(1.0/alpha2 + + 3*alpha1*alpha2 + 8.4*pow(ResLim, -0.343)) + /(1 + pow(10.0, 3*alpha1)*pow(ResLim, -(1 + 4*alpha1)/2.0)) + ); + + return 24*alpha2*(F0 + F1); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.H new file mode 100644 index 0000000000..94e281fee8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Beetstra/Beetstra.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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::dragModels::Beetstra + +Description + Drag model of Beetstra et al. for monodisperse gas-particle flows obtained + with direct numerical simulations with the Lattice-Boltzmann method and + accounting for the effect of particle ensembles. + + Reference: + \verbatim + Beetstra, R., van der Hoef, M. A., & Kuipers, J. a. M. (2007). + Drag force of intermediate Reynolds number flow past mono- and + bidisperse arrays of spheres. + AIChE Journal, 53(2), 489–501. + \endverbatim + +SourceFiles + Beetstra.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Beetstra_H +#define Beetstra_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class Beetstra Declaration +\*---------------------------------------------------------------------------*/ + +class Beetstra +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("Beetstra"); + + + // Constructors + + //- Construct from a dictionary and an interface + Beetstra + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Beetstra(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.C new file mode 100644 index 0000000000..175a9f17e0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "Ergun.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(Ergun, 0); + addToRunTimeSelectionTable(dragModel, Ergun, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::Ergun::Ergun +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::Ergun::~Ergun() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::Ergun::CdRe() const +{ + const phaseModel& dispersed = interface_.dispersed(); + const phaseModel& continuous = interface_.continuous(); + + return + (4.0/3.0) + *( + 150 + *max(1 - continuous, dispersed.residualAlpha()) + /max(continuous, continuous.residualAlpha()) + + 1.75 + *interface_.Re() + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.H new file mode 100644 index 0000000000..1197260928 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Ergun/Ergun.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::Ergun + +Description + + Reference: + \verbatim + Enwald, H., Peirano, E., & Almstedt, A. E. (1996). + Eulerian two-phase flow theory applied to fluidisation. + International Journal of Multiphase Flow, 22, 21-66. + \endverbatim + +SourceFiles + Ergun.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Ergun_H +#define Ergun_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class Ergun Declaration +\*---------------------------------------------------------------------------*/ + +class Ergun +: + public dispersedDragModel +{ +public: + + //- Runtime type information + TypeName("Ergun"); + + + // Constructors + + //- Construct from a dictionary and an interface + Ergun + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Ergun(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.C new file mode 100644 index 0000000000..238be2d4d2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "Gibilaro.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(Gibilaro, 0); + addToRunTimeSelectionTable(dragModel, Gibilaro, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::Gibilaro::Gibilaro +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::Gibilaro::~Gibilaro() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::Gibilaro::CdRe() const +{ + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + return + (4.0/3.0) + *(17.3/alpha2 + 0.336*interface_.Re()) + *max(interface_.continuous(), interface_.continuous().residualAlpha()) + *pow(alpha2, -2.8); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.H new file mode 100644 index 0000000000..9de4e2a30b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Gibilaro/Gibilaro.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::Gibilaro + +Description + + Reference: + \verbatim + Enwald, H., Peirano, E., & Almstedt, A. E. (1996). + Eulerian two-phase flow theory applied to fluidisation. + International Journal of Multiphase Flow, 22, 21-66. + Eq. 106, p. 43. + \endverbatim + +SourceFiles + Gibilaro.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Gibilaro_H +#define Gibilaro_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class Gibilaro Declaration +\*---------------------------------------------------------------------------*/ + +class Gibilaro +: + public dispersedDragModel +{ +public: + + //- Runtime type information + TypeName("Gibilaro"); + + + // Constructors + + //- Construct from a dictionary and an interface + Gibilaro + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Gibilaro(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C new file mode 100644 index 0000000000..27ebb53f82 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "GidaspowErgunWenYu.H" +#include "Ergun.H" +#include "WenYu.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(GidaspowErgunWenYu, 0); + addToRunTimeSelectionTable(dragModel, GidaspowErgunWenYu, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::GidaspowErgunWenYu::GidaspowErgunWenYu +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + Ergun_(dict, interface, false), + WenYu_(dict, interface, false) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::GidaspowErgunWenYu::~GidaspowErgunWenYu() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::GidaspowErgunWenYu::CdRe() const +{ + return + pos0(interface_.continuous() - 0.8)*WenYu_.CdRe() + + neg(interface_.continuous() - 0.8)*Ergun_.CdRe(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.H new file mode 100644 index 0000000000..131500df01 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::GidaspowErgunWenYu + +Description + Gidaspow, Ergun, Wen and Yu drag model + + Reference: + \verbatim + Gidaspow, D. (1994). + Multiphase flow and fluidisation: continuum and kinetic theory + descriptions. + Academic press, New York. + \endverbatim + +SourceFiles + GidaspowErgunWenYu.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GidaspowErgunWenYu_H +#define GidaspowErgunWenYu_H + +#include "dispersedDragModel.H" +#include "Ergun.H" +#include "WenYu.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class GidaspowErgunWenYu Declaration +\*---------------------------------------------------------------------------*/ + +class GidaspowErgunWenYu +: + public dispersedDragModel +{ + // Private Data + + //- Ergun drag model + Ergun Ergun_; + + //- Wen Yu drag model + WenYu WenYu_; + + +public: + + //- Runtime type information + TypeName("GidaspowErgunWenYu"); + + + // Constructors + + //- Construct from a dictionary and an interface + GidaspowErgunWenYu + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~GidaspowErgunWenYu(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C new file mode 100644 index 0000000000..693e2ac641 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "GidaspowSchillerNaumann.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(GidaspowSchillerNaumann, 0); + addToRunTimeSelectionTable(dragModel, GidaspowSchillerNaumann, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::GidaspowSchillerNaumann::GidaspowSchillerNaumann +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::GidaspowSchillerNaumann::~GidaspowSchillerNaumann() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::GidaspowSchillerNaumann::CdRe() const +{ + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField Re(alpha2*interface_.Re()); + + const volScalarField CdsRe + ( + neg(Re - 1000)*24*(1.0 + 0.15*pow(Re, 0.687))/alpha2 + + pos0(Re - 1000)*0.44*max(Re, residualRe_) + ); + + return + CdsRe + *pow(alpha2, -2.65) + *max(interface_.continuous(), interface_.continuous().residualAlpha()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.H new file mode 100644 index 0000000000..81c7a91a32 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::GidaspowSchillerNaumann + +Description + Gidaspow, Schiller and Naumann drag model + + References: + \verbatim + Enwald, H., Peirano, E., & Almstedt, A. E. (1996). + Eulerian two-phase flow theory applied to fluidisation. + International Journal of Multiphase Flow, 22, 21-66. + + This is identical to the Wen and Yu, Rowe model Table 3.6 p.56 in + van Wachem, B. G. M. (2000). + Derivation, implementation, and validation of computer simulation models + for gas-solid fluidised beds. + PhD Thesis, TU Delft. + \endverbatim + +SourceFiles + GidaspowSchillerNaumann.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GidaspowSchillerNaumann_H +#define GidaspowSchillerNaumann_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class GidaspowSchillerNaumann Declaration +\*---------------------------------------------------------------------------*/ + +class GidaspowSchillerNaumann +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("GidaspowSchillerNaumann"); + + + // Constructors + + //- Construct from a dictionary and an interface + GidaspowSchillerNaumann + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~GidaspowSchillerNaumann(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.C new file mode 100644 index 0000000000..22678e392d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "IshiiZuber.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(IshiiZuber, 0); + addToRunTimeSelectionTable(dragModel, IshiiZuber, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::IshiiZuber::IshiiZuber +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::IshiiZuber::~IshiiZuber() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::IshiiZuber::CdRe() const +{ + const volScalarField Re(interface_.Re()); + const volScalarField Eo(interface_.Eo()); + + const volScalarField mud(interface_.dispersed().thermo().mu()); + const volScalarField muc(interface_.continuous().thermo().mu()); + + const volScalarField muStar((mud + 0.4*muc)/(mud + muc)); + + const volScalarField muMix + ( + muc*pow(max(1 - interface_.dispersed(), scalar(1e-3)), -2.5*muStar) + ); + + const volScalarField ReM(Re*muc/muMix); + const volScalarField CdRe + ( + pos0(1000 - ReM)*24*(1 + 0.1*pow(ReM, 0.75)) + + neg(1000 - ReM)*0.44*ReM + ); + + volScalarField F((muc/muMix)*sqrt(1 - interface_.dispersed())); + F.max(1e-3); + + const volScalarField Ealpha((1 + 17.67*pow(F, 0.8571428))/(18.67*F)); + + const volScalarField CdReEllipse(Ealpha*0.6666*sqrt(Eo)*Re); + + return + pos0(CdReEllipse - CdRe) + *min(CdReEllipse, Re*sqr(1 - interface_.dispersed())*2.66667) + + neg(CdReEllipse - CdRe)*CdRe; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.H new file mode 100644 index 0000000000..728d0b4fa0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/IshiiZuber/IshiiZuber.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::dragModels::IshiiZuber + +Description + Ishii and Zuber (1979) drag model for dense dispersed bubbly flows. + + Reference: + \verbatim + Ishii, M., & Zuber, N. (1979). + Drag coefficient and relative velocity in bubbly, droplet or particulate + flows. + AIChE Journal, 25(5), 843-855. + \endverbatim + +SourceFiles + IshiiZuber.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IshiiZuber_H +#define IshiiZuber_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class IshiiZuber Declaration +\*---------------------------------------------------------------------------*/ + +class IshiiZuber +: + public dispersedDragModel +{ + +public: + + //- Runtime type information + TypeName("IshiiZuber"); + + + // Constructors + + //- Construct from a dictionary and an interface + IshiiZuber + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~IshiiZuber(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.C new file mode 100644 index 0000000000..50c09ec63c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Lain.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(Lain, 0); + addToRunTimeSelectionTable(dragModel, Lain, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::Lain::Lain +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::Lain::~Lain() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::Lain::CdRe() const +{ + volScalarField Re(interface_.Re()); + + return + neg(Re - 1.5)*16.0 + + pos0(Re - 1.5)*neg(Re - 80)*14.9*pow(Re, 0.22) + + pos0(Re - 80)*neg(Re - 1500)*48*(1 - 2.21/sqrt(max(Re, small))) + + pos0(Re - 1500)*2.61*Re; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.H new file mode 100644 index 0000000000..5cd48ee980 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Lain/Lain.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::dragModels::Lain + +Description + Drag model of Lain et al. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Laın, S., Bröder, D., Sommerfeld, M., & Göz, M. F. (2002). + Modelling hydrodynamics and turbulence in a bubble column using the + Euler–Lagrange procedure. + International journal of multiphase flow, 28(8), 1381-1407. + \endverbatim + +SourceFiles + Lain.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lain_H +#define Lain_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class Lain Declaration +\*---------------------------------------------------------------------------*/ + +class Lain +: + public dispersedDragModel +{ +public: + + //- Runtime type information + TypeName("Lain"); + + + // Constructors + + //- Construct from a dictionary and an interface + Lain + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Lain(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C new file mode 100644 index 0000000000..b64ddfa164 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "SchillerNaumann.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(SchillerNaumann, 0); + addToRunTimeSelectionTable(dragModel, SchillerNaumann, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::SchillerNaumann::SchillerNaumann +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::SchillerNaumann::~SchillerNaumann() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::SchillerNaumann::CdRe() const +{ + volScalarField Re(interface_.Re()); + + return + neg(Re - 1000)*24*(1.0 + 0.15*pow(Re, 0.687)) + + pos0(Re - 1000)*0.44*max(Re, residualRe_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.H new file mode 100644 index 0000000000..67828f02ea --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::SchillerNaumann + +Description + Schiller and Naumann drag model for dispersed bubbly flows. + +SourceFiles + SchillerNaumann.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SchillerNaumann_H +#define SchillerNaumann_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class SchillerNaumann Declaration +\*---------------------------------------------------------------------------*/ + +class SchillerNaumann +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("SchillerNaumann"); + + + // Constructors + + //- Construct from a dictionary and an interface + SchillerNaumann + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~SchillerNaumann(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C new file mode 100644 index 0000000000..301c022622 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "SyamlalOBrien.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(SyamlalOBrien, 0); + addToRunTimeSelectionTable(dragModel, SyamlalOBrien, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::SyamlalOBrien::SyamlalOBrien +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::SyamlalOBrien::~SyamlalOBrien() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::SyamlalOBrien::CdRe() const +{ + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField A(pow(alpha2, 4.14)); + const volScalarField B + ( + neg(alpha2 - 0.85)*(0.8*pow(alpha2, 1.28)) + + pos0(alpha2 - 0.85)*(pow(alpha2, 2.65)) + ); + const volScalarField Re(interface_.Re()); + const volScalarField Vr + ( + 0.5 + *( + A - 0.06*Re + sqrt(sqr(0.06*Re) + 0.12*Re*(2*B - A) + sqr(A)) + ) + ); + volScalarField CdsRe(sqr(0.63*sqrt(Re) + 4.8*sqrt(Vr))); + + return + CdsRe + *max(interface_.continuous(), interface_.continuous().residualAlpha()) + /sqr(Vr); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.H new file mode 100644 index 0000000000..b888dc4f53 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::SyamlalOBrien + +Description + + Reference: + \verbatim + Syamlal, M., Rogers, W., & O’Brien, T. J. (1993). + Mfix documentation: Theory guide, technical note, doe/metc-94/1004, + ntis/de94000087. + National Technical Information Service. + \endverbatim + +SourceFiles + SyamlalOBrien.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SyamlalOBrien_H +#define SyamlalOBrien_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class SyamlalOBrien Declaration +\*---------------------------------------------------------------------------*/ + +class SyamlalOBrien +: + public dispersedDragModel +{ +public: + + //- Runtime type information + TypeName("SyamlalOBrien"); + + + // Constructors + + //- Construct from a dictionary and an interface + SyamlalOBrien + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~SyamlalOBrien(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.C new file mode 100644 index 0000000000..813689a96f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.C @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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 "Tenneti.H" +#include "SchillerNaumann.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(Tenneti, 0); + addToRunTimeSelectionTable(dragModel, Tenneti, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::Tenneti::Tenneti +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict.lookup("residualRe")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::Tenneti::~Tenneti() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::Tenneti::CdRe() const +{ + const volScalarField alpha1 + ( + max(interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField Res(alpha2*interface_.Re()); + + const volScalarField CdReIsolated + ( + neg(Res - 1000)*24*(1 + 0.15*pow(Res, 0.687)) + + pos0(Res - 1000)*0.44*max(Res, residualRe_) + ); + + const volScalarField F0 + ( + 5.81*alpha1/pow3(alpha2) + 0.48*pow(alpha1, 1.0/3.0)/pow4(alpha2) + ); + + const volScalarField F1 + ( + pow3(alpha1)*Res*(0.95 + 0.61*pow3(alpha1)/sqr(alpha2)) + ); + + // Tenneti et al. correlation includes the mean pressure drag. + // This was removed here by multiplying F by alpha2 for consistency with + // the formulation used in OpenFOAM + return CdReIsolated + 24*sqr(alpha2)*(F0 + F1); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.H new file mode 100644 index 0000000000..2825d14764 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/Tenneti/Tenneti.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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::dragModels::Tenneti + +Description + Drag model of Tenneti et al. for monodisperse gas-particle flows obtained + with particle-resolved direct numerical simulations and accounting for the + effect of particle ensembles. + + Reference: + \verbatim + Tenneti, S., Garg, R., & Subramaniam, S. (2011). + Drag law for monodisperse gas–solid systems using particle-resolved + direct numerical simulation of flow past fixed assemblies of spheres. + International Journal of Multiphase Flow, 37(9), 1072–1092. + \endverbatim + +SourceFiles + Tenneti.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Tenneti_H +#define Tenneti_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +class SchillerNaumann; + +/*---------------------------------------------------------------------------*\ + Class Tenneti Declaration +\*---------------------------------------------------------------------------*/ + +class Tenneti +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("Tenneti"); + + + // Constructors + + //- Construct from a dictionary and an interface + Tenneti + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Tenneti(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.C new file mode 100644 index 0000000000..fdbc0be7ac --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaAnalytic.H" +#include "aspectRatioModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(TomiyamaAnalytic, 0); + addToRunTimeSelectionTable(dragModel, TomiyamaAnalytic, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaAnalytic::TomiyamaAnalytic +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict), + residualEo_("residualEo", dimless, dict), + residualE_("residualE", dimless, dict), + aspectRatio_(aspectRatioModel::New(dict.subDict("aspectRatio"), interface)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaAnalytic::~TomiyamaAnalytic() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::TomiyamaAnalytic::CdRe() const +{ + const volScalarField Eo(max(interface_.Eo(), residualEo_)); + const volScalarField E(max(aspectRatio_->E(), residualE_)); + + const volScalarField OmEsq(max(1 - sqr(E), sqr(residualE_))); + const volScalarField rtOmEsq(sqrt(OmEsq)); + + const volScalarField F(max(asin(rtOmEsq) - E*rtOmEsq, residualE_)/OmEsq); + + return + (8.0/3.0) + *Eo + /( + Eo*pow(E, 2.0/3.0)/OmEsq + + 16*pow(E, 4.0/3.0) + ) + /sqr(F) + *max(interface_.Re(), residualRe_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.H new file mode 100644 index 0000000000..36654ab1fd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaAnalytic/TomiyamaAnalytic.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::dragModels::TomiyamaAnalytic + +Description + Analytical drag model of Tomiyama et al. + + Reference: + \verbatim + Tomiyama, A., Kataoka, I., & Sakaguchi, T. (1995). + Drag coefficients of bubbles (1 st Report, Drag coefficients of a single + bubble in a stagnant liquid). + Nihon Kikaigakkai Ronbunshu, 61, 2357-2364. + \endverbatim + +SourceFiles + TomiyamaAnalytic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaAnalytic_H +#define TomiyamaAnalytic_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class aspectRatioModel; + +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaAnalytic Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaAnalytic +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + //- Residual Eotvos number + const dimensionedScalar residualEo_; + + //- Residual aspect ratio + const dimensionedScalar residualE_; + + //- The aspect ratio model + autoPtr aspectRatio_; + + +public: + + //- Runtime type information + TypeName("TomiyamaAnalytic"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaAnalytic + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~TomiyamaAnalytic(); + + + // Member Functions + + // Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.C new file mode 100644 index 0000000000..e49f612626 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaCorrelated.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(TomiyamaCorrelated, 0); + addToRunTimeSelectionTable(dragModel, TomiyamaCorrelated, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaCorrelated::TomiyamaCorrelated +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + A_("A", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaCorrelated::~TomiyamaCorrelated() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::TomiyamaCorrelated::CdRe() const +{ + const volScalarField Re(interface_.Re()); + const volScalarField Eo(interface_.Eo()); + + return + max + ( + A_ + *min + ( + (1 + 0.15*pow(Re, 0.687)), + scalar(3) + ), + 8*Eo*Re/(3*Eo + 12) + ); + +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.H new file mode 100644 index 0000000000..e16a30efc5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaCorrelated/TomiyamaCorrelated.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::dragModels::TomiyamaCorrelated + +Description + Correlation of Tomiyama et al. + + Reference: + \verbatim + Tomiyama, A., Celata, G. P., Hosokawa, S., & Yoshida, S. (2002). + Terminal velocity of single bubbles in surface tension force dominant + regime. + International Journal of Multiphase Flow, 28(9), 1497-1519. + \endverbatim + +SourceFiles + TomiyamaCorrelated.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaCorrelated_H +#define TomiyamaCorrelated_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaCorrelated Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaCorrelated +: + public dispersedDragModel +{ + // Private Data + + //- Coefficient + const dimensionedScalar A_; + + +public: + + //- Runtime type information + TypeName("TomiyamaCorrelated"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaCorrelated + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~TomiyamaCorrelated(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.C new file mode 100644 index 0000000000..990153a638 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.C @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "TomiyamaKataokaZunSakaguchi.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(TomiyamaKataokaZunSakaguchi, 0); + addToRunTimeSelectionTable + ( + dragModel, + TomiyamaKataokaZunSakaguchi, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaKataokaZunSakaguchi::TomiyamaKataokaZunSakaguchi +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict), + residualEo_("residualEo", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::TomiyamaKataokaZunSakaguchi::~TomiyamaKataokaZunSakaguchi() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::TomiyamaKataokaZunSakaguchi::CdRe() const +{ + volScalarField Re(interface_.Re()); + volScalarField Eo(max(interface_.Eo(), residualEo_)); + + return + max + ( + 24*(1 + 0.15*pow(Re, 0.687))/max(Re, residualRe_), + 8*Eo/(3*(Eo + 4.0)) + ) + *max(interface_.Re(), residualRe_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.H new file mode 100644 index 0000000000..a82b9cdb15 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/TomiyamaKataokaZunSakaguchi/TomiyamaKataokaZunSakaguchi.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::dragModels::TomiyamaKataokaZunSakaguchi + +Description + Drag model for gas-liquid system of Tomiyama et al. + + Reference: + \verbatim + Tomiyama, A., Kataoka, I., Zun, I., & Sakaguchi, T. (1998). + Drag coefficients of single bubbles under normal and micro gravity + conditions. + JSME International Journal Series B Fluids and Thermal Engineering, + 41(2), 472-479. + \endverbatim + +SourceFiles + TomiyamaKataokaZunSakaguchi.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaKataokaZunSakaguchi_H +#define TomiyamaKataokaZunSakaguchi_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaKataokaZunSakaguchi Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaKataokaZunSakaguchi +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + //- Residual Eotvos number + const dimensionedScalar residualEo_; + + +public: + + //- Runtime type information + TypeName("TomiyamaKataokaZunSakaguchi"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaKataokaZunSakaguchi + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~TomiyamaKataokaZunSakaguchi(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.C new file mode 100644 index 0000000000..9dba43459a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "WenYu.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(WenYu, 0); + addToRunTimeSelectionTable(dragModel, WenYu, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::WenYu::WenYu +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + residualRe_("residualRe", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::WenYu::~WenYu() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::WenYu::CdRe() const +{ + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField Res(alpha2*interface_.Re()); + const volScalarField CdsRes + ( + neg(Res - 1000)*24*(1.0 + 0.15*pow(Res, 0.687)) + + pos0(Res - 1000)*0.44*max(Res, residualRe_) + ); + + return + CdsRes + *pow(alpha2, -3.65) + *max(interface_.continuous(), interface_.continuous().residualAlpha()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.H new file mode 100644 index 0000000000..b2239e2110 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/WenYu/WenYu.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModels::WenYu + +Description + Wen and Yu drag model + + Reference: + \verbatim + Enwald, H., Peirano, E., & Almstedt, A. E. (1996). + Eulerian two-phase flow theory applied to fluidisation. + International Journal of Multiphase Flow, 22, 21-66. + Eq. 86-87, p. 40. + \endverbatim + +SourceFiles + WenYu.C + +\*---------------------------------------------------------------------------*/ + +#ifndef WenYu_H +#define WenYu_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class WenYu Declaration +\*---------------------------------------------------------------------------*/ + +class WenYu +: + public dispersedDragModel +{ + // Private Data + + //- Residual Reynolds Number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("WenYu"); + + + // Constructors + + //- Construct from a dictionary and an interface + WenYu + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~WenYu(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.C new file mode 100644 index 0000000000..ff19261c39 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "aerosolDrag.H" +#include "swarmCorrection.H" +#include "addToRunTimeSelectionTable.H" +#include "constants.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(aerosolDrag, 0); + addToRunTimeSelectionTable(dragModel, aerosolDrag, dictionary); +} +} + +using Foam::constant::physicoChemical::k; +using Foam::constant::mathematical::pi; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::aerosolDrag::aerosolDrag +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict, interface, registerObject), + A1_(dict.lookupOrDefault("A1", 2.514)), + A2_(dict.lookupOrDefault("A2", 0.8)), + A3_(dict.lookupOrDefault("A3", 0.55)), + sigma_("sigma", dimLength, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::aerosolDrag::~aerosolDrag() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::aerosolDrag::CdRe() const +{ + const volScalarField& T = interface_.continuous().thermo().T(); + const volScalarField& p = interface_.continuous().thermo().p(); + tmp td(interface_.dispersed().d()); + const volScalarField& d = td(); + + const volScalarField lambda(k*T/(sqrt(2.0)*pi*p*sqr(sigma_))); + + return 24/(1 + lambda/d*(A1_ + A2_*exp(-A3_*d/lambda))); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.H new file mode 100644 index 0000000000..6145f4e3b5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/aerosolDrag/aerosolDrag.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::dragModels::aerosolDrag + +Description + Stokes drag with Cunningham slip correction. The slip correction coefficient + is implemented in the following form: + + \f[ + C_c = 1 + \lambda [A_1 + A_2 \exp(-A_3 d/\lambda)]/d\,. + \f] + + The coefficients default to the values proposed by Davis (1945). The mean + free path is computed by + + \f[ + \lambda = \frac{kT}{\sqrt{2} \pi p \sigma^{2}}\,. + \f] + + \vartable + A_1 | Coefficient [-] + A_2 | Coefficient [-] + A_3 | Coefficient [-] + \sigma | Lennard-Jones parameter [m] + \endvartable + + Reference: + \verbatim + Davies, C. N. (1945). + Definitive equations for the fluid resistance of spheres. + Proceedings of the Physical Society, 57(4), 259. + \endverbatim + +Usage + \table + Property | Description | Required | Default value + A1 | Coefficient A1 | no | 2.514 + A2 | Coefficient A2 | no | 0.8 + A3 | Coefficient A2 | no | 0.55 + sigma | Lennard-Jones parameter | yes | none + \endtable + +SourceFiles + aerosolDrag.C + +\*---------------------------------------------------------------------------*/ + +#ifndef aerosolDrag_H +#define aerosolDrag_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class aerosolDrag Declaration +\*---------------------------------------------------------------------------*/ + +class aerosolDrag +: + public dispersedDragModel +{ + // Private Data + + //- Cunningham slip correction coefficient A1 + const dimensionedScalar A1_; + + //- Cunningham slip correction coefficient A2 + const dimensionedScalar A2_; + + //- Cunningham slip correction coefficient A3 + const dimensionedScalar A3_; + + //- Lennard-Jones sigma parameter + const dimensionedScalar sigma_; + + +public: + + //- Runtime type information + TypeName("aerosolDrag"); + + + // Constructors + + //- Construct from a dictionary and an interface + aerosolDrag + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~aerosolDrag(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.C new file mode 100644 index 0000000000..6231ca6e2f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dispersedDragModel.H" +#include "phaseSystem.H" +#include "noSwarm.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::dispersedDragModel::dispersedDragModel +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dragModel(dict, interface, registerObject), + interface_(interface.modelCast()), + swarmCorrection_ + ( + dict.found("swarmCorrection") + ? swarmCorrection::New(dict.subDict("swarmCorrection"), interface).ptr() + : new swarmCorrections::noSwarm(dict, interface) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::dispersedDragModel::~dispersedDragModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::dispersedDragModel::Ki() const +{ + return + 0.75 + *CdRe() + *swarmCorrection_->Cs() + *interface_.continuous().rho() + *interface_.continuous().thermo().nu() + /sqr(interface_.dispersed().d()); +} + + +Foam::tmp Foam::dragModels::dispersedDragModel::K() const +{ + return + max + ( + interface_.dispersed(), + interface_.dispersed().residualAlpha() + )*Ki(); +} + + +Foam::tmp +Foam::dragModels::dispersedDragModel::Kf() const +{ + return + max + ( + fvc::interpolate(interface_.dispersed()), + interface_.dispersed().residualAlpha() + )*fvc::interpolate(Ki()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.H new file mode 100644 index 0000000000..b38d4179d3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dispersedDragModel/dispersedDragModel.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dispersedDragModel + +Description + Model for drag between two phases where one phase can be considered + dispersed in the other and the drag therefore characterised by a drag + coefficient + +SourceFiles + dispersedDragModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dispersedDragModel_H +#define dispersedDragModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "dragModel.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class dispersedDragModel Declaration +\*---------------------------------------------------------------------------*/ + +class dispersedDragModel +: + public dragModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Swarm correction + autoPtr swarmCorrection_; + + +public: + + // Constructors + + // Construct from a dictionary and an interface + dispersedDragModel + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~dispersedDragModel(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const = 0; + + //- Return the phase-intensive drag coefficient Ki + // used in the momentum equations + // ddt(alpha1*rho1*U1) + ... = ... alphad*K*(U1-U2) + // ddt(alpha2*rho2*U2) + ... = ... alphad*K*(U2-U1) + virtual tmp Ki() const; + + //- Return the drag coefficient K + // used in the momentum equations + // ddt(alpha1*rho1*U1) + ... = ... K*(U1-U2) + // ddt(alpha2*rho2*U2) + ... = ... K*(U2-U1) + virtual tmp K() const; + + //- Return the drag coefficient Kf + // used in the face-momentum equations + virtual tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.C new file mode 100644 index 0000000000..9198050aab --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dragModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(dragModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(dragModel, 0); + defineRunTimeSelectionTable(dragModel, dictionary); +} + +const Foam::dimensionSet Foam::dragModel::dimK(1, -3, -1, 0, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModel::dragModel +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, interface.name()), + interface.mesh().time().timeName(), + interface.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + registerObject + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModel::~dragModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::dragModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +Foam::tmp Foam::blendedDragModel::K() const +{ + return evaluate(&dragModel::K, "K", dragModel::dimK, false); +} + + +Foam::tmp Foam::blendedDragModel::Kf() const +{ + return evaluate(&dragModel::Kf, "Kf", dragModel::dimK, false); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.H new file mode 100644 index 0000000000..737812d064 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModel.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dragModel + +Description + Model for drag between phases + +SourceFiles + dragModel.C + dragModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dragModel_H +#define dragModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +namespace Foam +{ + +class swarmCorrection; + +/*---------------------------------------------------------------------------*\ + Class dragModel Declaration +\*---------------------------------------------------------------------------*/ + +class dragModel +: + public regIOobject +{ +public: + + //- Runtime type information + TypeName("dragModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + dragModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ), + (dict, interface, registerObject) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimK; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = true; + + + // Constructors + + // Construct from a dictionary and an interface + dragModel + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~dragModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true, + const bool registerObject=true + ); + + + // Member Functions + + //- Return the drag coefficient K + // used in the momentum equations + // ddt(alpha1*rho1*U1) + ... = ... K*(U1-U2) + // ddt(alpha2*rho2*U2) + ... = ... K*(U2-U1) + virtual tmp K() const = 0; + + //- Return the drag coefficient Kf + // used in the face-momentum equations + virtual tmp Kf() const = 0; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedDragModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedDragModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using BlendedInterfacialModel::BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return the drag coefficient K + tmp K() const; + + //- Return the drag coefficient Kf + tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModelNew.C new file mode 100644 index 0000000000..1c74a7d34c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/dragModel/dragModelNew.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dragModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::dragModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer, + const bool registerObject +) +{ + const dictionary& modelDict = + outer ? interface.fluid().modelSubDict(dict) : dict; + + const word dragModelType(modelDict.lookup("type")); + + Info<< "Selecting dragModel for " + << interface.name() << ": " << dragModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(dragModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown dragModelType type " + << dragModelType << endl << endl + << "Valid dragModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface, registerObject); +} + + +Foam::autoPtr Foam::blendedDragModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr(new blendedDragModel(dict, interface)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C new file mode 100644 index 0000000000..42f2964b51 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "segregated.H" +#include "fvcGrad.H" +#include "surfaceInterpolate.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(segregated, 0); + addToRunTimeSelectionTable(dragModel, segregated, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::segregated::segregated +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dragModel(dict, interface, registerObject), + interface_(interface.modelCast()), + m_("m", dimless, dict), + n_("n", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::segregated::~segregated() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::dragModels::segregated::K() const +{ + const fvMesh& mesh(interface_.phase1().mesh()); + + const volScalarField& alpha1(interface_.phase1()); + const volScalarField& alpha2(interface_.phase2()); + + const volScalarField& rho1(interface_.phase1().rho()); + const volScalarField& rho2(interface_.phase2().rho()); + + tmp tnu1(interface_.phase1().thermo().nu()); + tmp tnu2(interface_.phase2().thermo().nu()); + + const volScalarField& nu1(tnu1()); + const volScalarField& nu2(tnu2()); + + volScalarField L + ( + IOobject + ( + "L", + mesh.time().timeName(), + mesh + ), + mesh, + dimensionedScalar(dimLength, 0), + zeroGradientFvPatchField::typeName + ); + L.primitiveFieldRef() = cbrt(mesh.V()); + L.correctBoundaryConditions(); + + const dimensionedScalar residualAlpha + ( + ( + interface_.phase1().residualAlpha() + + interface_.phase2().residualAlpha() + )/2 + ); + + const volScalarField I1(alpha1/max(alpha1 + alpha2, residualAlpha)); + const volScalarField I2(alpha2/max(alpha1 + alpha2, residualAlpha)); + const volScalarField magGradI + ( + max + ( + (rho2*mag(fvc::grad(I1)) + rho1*mag(fvc::grad(I2)))/(rho1 + rho2), + residualAlpha/2/L + ) + ); + + const volScalarField muI(rho1*nu1*rho2*nu2/(rho1*nu1 + rho2*nu2)); + + const volScalarField limitedAlpha1 + ( + max(alpha1, interface_.phase1().residualAlpha()) + ); + + const volScalarField limitedAlpha2 + ( + max(alpha2, interface_.phase2().residualAlpha()) + ); + + const volScalarField muAlphaI + ( + limitedAlpha1*rho1*nu1*limitedAlpha2*rho2*nu2 + /(limitedAlpha1*rho1*nu1 + limitedAlpha2*rho2*nu2) + ); + + const volScalarField ReI + ( + interface_.rho()*interface_.magUr() + /(magGradI*limitedAlpha1*limitedAlpha2*muI) + ); + + const volScalarField lambda(m_*ReI + n_*muAlphaI/muI); + + return lambda*sqr(magGradI)*muI; +} + + +Foam::tmp Foam::dragModels::segregated::Kf() const +{ + return fvc::interpolate(K()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.H new file mode 100644 index 0000000000..f906ed7d06 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::dragModels::segregated + +Description + Segregated drag model for use in regions with no obvious dispersed phase. + + Reference: + \verbatim + Marschall, H. (2011). + Towards the numerical simulation of multi-scale two-phase flows. + PhD Thesis, TU München. + \endverbatim + +SourceFiles + segregated.C + +\*---------------------------------------------------------------------------*/ + +#ifndef segregated_H +#define segregated_H + +#include "dragModel.H" +#include "segregatedPhaseInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class segregated Declaration +\*---------------------------------------------------------------------------*/ + +class segregated +: + public dragModel +{ + // Private Data + + //- Interface + const segregatedPhaseInterface interface_; + + //- M coefficient + const dimensionedScalar m_; + + //- N coefficient + const dimensionedScalar n_; + + +public: + + //- Runtime type information + TypeName("segregated"); + + + // Constructors + + //- Construct from a dictionary and an interface + segregated + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~segregated(); + + + // Member Functions + + //- The drag function used in the momentum equation + virtual tmp K() const; + + //- The drag function Kf used in the face-momentum equations + virtual tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.C new file mode 100644 index 0000000000..562770b9a0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "timeScaleFilteredDrag.H" +#include "swarmCorrection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + defineTypeNameAndDebug(timeScaleFilteredDrag, 0); + addToRunTimeSelectionTable(dragModel, timeScaleFilteredDrag, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dragModels::timeScaleFilteredDrag::timeScaleFilteredDrag +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedDragModel(dict.subDict("dragModel"), interface, registerObject), + dragModel_ + ( + dragModel::New(dict.subDict("dragModel"), interface, false, false) + ), + minRelaxTime_("minRelaxTime", dimTime, dict) +{ + if (!isA(dragModel_())) + { + FatalErrorInFunction + << "The sub-drag-model of a " << type() + << " drag model must be for a dispersed configuration" + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dragModels::timeScaleFilteredDrag::~timeScaleFilteredDrag() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::dragModels::timeScaleFilteredDrag::CdRe() const +{ + const volScalarField limit + ( + sqr(interface_.dispersed().d()) + *interface_.dispersed().rho() + /0.75 + /swarmCorrection_->Cs() + /interface_.continuous().rho() + /interface_.continuous().thermo().nu() + /minRelaxTime_ + ); + + return min(refCast(dragModel_()).CdRe(), limit); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.H new file mode 100644 index 0000000000..b34bdebf72 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/dragModels/timeScaleFilteredDrag/timeScaleFilteredDrag.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::dragModels::timeScaleFiltered + +Description + A time scale filtering wrapper around an underlying drag model intended for + simulations involving dispersed phase with a very small diameter. + The model limits the drag coefficient based on the relaxation time given. + +SourceFiles + timeScaleFiltered.C + +\*---------------------------------------------------------------------------*/ + +#ifndef timeScaleFilteredDrag_H +#define timeScaleFilteredDrag_H + +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace dragModels +{ + +/*---------------------------------------------------------------------------*\ + Class timeScaleFilteredDrag Declaration +\*---------------------------------------------------------------------------*/ + +class timeScaleFilteredDrag +: + public dispersedDragModel +{ + // Private Data + + //- Pointer to the underlying drag model + autoPtr dragModel_; + + //- The minimum relaxation time + const dimensionedScalar minRelaxTime_; + + +public: + + //- Runtime type information + TypeName("timeScaleFiltered"); + + + // Constructors + + //- Construct from a dictionary and an interface + timeScaleFilteredDrag + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~timeScaleFilteredDrag(); + + + // Member Functions + + //- Drag coefficient + virtual tmp CdRe() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.C new file mode 100644 index 0000000000..609df7a317 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "Gunn.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + defineTypeNameAndDebug(Gunn, 0); + addToRunTimeSelectionTable(heatTransferModel, Gunn, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModels::Gunn::Gunn +( + const dictionary& dict, + const phaseInterface& interface +) +: + heatTransferModel(dict, interface), + interface_ + ( + interface.modelCast() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModels::Gunn::~Gunn() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModels::Gunn::K(const scalar residualAlpha) const +{ + const volScalarField alpha2 + ( + max(1 - interface_.dispersed(), interface_.continuous().residualAlpha()) + ); + + const volScalarField sqrAlpha2(sqr(alpha2)); + + const volScalarField Nu + ( + (7 - 10*alpha2 + 5*sqrAlpha2) + *(1 + 0.7*pow(interface_.Re(), 0.2)*cbrt(interface_.Pr())) + + (1.33 - 2.4*alpha2 + 1.2*sqrAlpha2) + *pow(interface_.Re(), 0.7)*cbrt(interface_.Pr()) + ); + + return + 6*max(interface_.dispersed(), residualAlpha) + *interface_.continuous().thermo().kappa() + *Nu/sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.H new file mode 100644 index 0000000000..6959144056 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/Gunn/Gunn.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::heatTransferModels::Gunn + +Description + Gunn (1978) correlation for fixed and fluidised beds with Re < 10^5 + and continuous phase fraction between 0.35 and 1. + + Reference: + \verbatim + Gunn, D. J. (1978). + Transfer of heat or mass to particles in fixed and fluidised beds. + International Journal of Heat and Mass Transfer, 21(4), 467-476. + \endverbatim + +SourceFiles + Gunn.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Gunn_H +#define Gunn_H + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class Gunn Declaration +\*---------------------------------------------------------------------------*/ + +class Gunn +: + public heatTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("Gunn"); + + + // Constructors + + //- Construct from a dictionary and an interface + Gunn + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Gunn(); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + tmp K(const scalar residualAlpha) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C new file mode 100644 index 0000000000..e3140250d4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "RanzMarshall.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + defineTypeNameAndDebug(RanzMarshall, 0); + addToRunTimeSelectionTable(heatTransferModel, RanzMarshall, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModels::RanzMarshall::RanzMarshall +( + const dictionary& dict, + const phaseInterface& interface +) +: + heatTransferModel(dict, interface), + interface_ + ( + interface.modelCast() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModels::RanzMarshall::~RanzMarshall() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModels::RanzMarshall::K(const scalar residualAlpha) const +{ + volScalarField Nu(2 + 0.6*sqrt(interface_.Re())*cbrt(interface_.Pr())); + + return + 6 + *max(interface_.dispersed(), residualAlpha) + *interface_.continuous().thermo().kappa() + *Nu + /sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.H new file mode 100644 index 0000000000..13eadde6ec --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::heatTransferModels::RanzMarshall + +Description + Ranz-Marshall correlation for turbulent heat transfer from the surface of a + sphere to the surrounding fluid. + +SourceFiles + RanzMarshall.C + +\*---------------------------------------------------------------------------*/ + +#ifndef RanzMarshall_H +#define RanzMarshall_H + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class RanzMarshall Declaration +\*---------------------------------------------------------------------------*/ + +class RanzMarshall +: + public heatTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("RanzMarshall"); + + + // Constructors + + //- Construct from a dictionary and an interface + RanzMarshall + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~RanzMarshall(); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + tmp K(const scalar residualAlpha) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.C new file mode 100644 index 0000000000..e6f15d52df --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "constantNuHeatTransfer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + defineTypeNameAndDebug(constantNuHeatTransfer, 0); + addToRunTimeSelectionTable + ( + heatTransferModel, + constantNuHeatTransfer, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModels::constantNuHeatTransfer::constantNuHeatTransfer +( + const dictionary& dict, + const phaseInterface& interface +) +: + heatTransferModel(dict, interface), + interface_ + ( + interface.modelCast() + ), + Nu_("Nu", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModels::constantNuHeatTransfer::~constantNuHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModels::constantNuHeatTransfer::K +( + const scalar residualAlpha +) const +{ + return + 6.0 + *max(interface_.dispersed(), residualAlpha) + *interface_.continuous().thermo().kappa() + *Nu_ + /sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.H new file mode 100644 index 0000000000..206c3f7e56 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/constantNu/constantNuHeatTransfer.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::heatTransferModels::constantNuHeatTransfer + +Description + Model which applies a user provided constant Nusselt number for interfacial + heat transfer. + +SourceFiles + constantNuHeatTransfer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantNuHeatTransfer_H +#define constantNuHeatTransfer_H + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantNuHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class constantNuHeatTransfer +: + public heatTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Nusselt number + dimensionedScalar Nu_; + + +public: + + //- Runtime type information + TypeName("constantNu"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantNuHeatTransfer + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantNuHeatTransfer(); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + tmp K(const scalar residualAlpha) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C new file mode 100644 index 0000000000..ccbd44fd73 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "heatTransferModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(heatTransferModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(heatTransferModel, 0); + defineSidedInterfacialModelTypeNameAndDebug(blendedHeatTransferModel, 0); + defineRunTimeSelectionTable(heatTransferModel, dictionary); +} + +const Foam::dimensionSet Foam::heatTransferModel::dimK(1, -1, -3, -1, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModel::heatTransferModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + residualAlpha_ + ( + "residualAlpha", + dimless, + dict.lookupOrDefault + ( + "residualAlpha", + sqrt + ( + interface.phase1().residualAlpha().value() + *interface.phase2().residualAlpha().value() + ) + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModel::~heatTransferModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModel::K() const +{ + return K(residualAlpha_.value()); +} + + +Foam::tmp Foam::blendedHeatTransferModel::K() const +{ + tmp (heatTransferModel::*k)() const = + &heatTransferModel::K; + return evaluate(k, "K", heatTransferModel::dimK, false); +} + + +Foam::tmp Foam::blendedHeatTransferModel::K +( + const scalar residualAlpha +) const +{ + tmp (heatTransferModel::*k)(const scalar) const = + &heatTransferModel::K; + return evaluate(k, "Kf", heatTransferModel::dimK, false, residualAlpha); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H new file mode 100644 index 0000000000..8b130b390e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H @@ -0,0 +1,205 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::heatTransferModel + +Description + Model for heat transfer between phases + +SourceFiles + heatTransferModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef heatTransferModel_H +#define heatTransferModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" +#include "SidedInterfacialModel.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class heatTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class heatTransferModel +{ +protected: + + // Protected data + + //- Residual phase fraction + const dimensionedScalar residualAlpha_; + + +public: + + //- Runtime type information + TypeName("heatTransferModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + heatTransferModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimK; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = false; + + + // Constructors + + //- Construct from a dictionary and an interface + heatTransferModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~heatTransferModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + // ddt(alpha1*rho1*ha) + ... = ... K*(Ta - Tb) + // ddt(alpha2*rho2*hb) + ... = ... K*(Tb - Ta) + tmp K() const; + + //- The heat transfer function K used in the enthalpy equation + // ddt(alpha1*rho1*ha) + ... = ... K*(Ta - Tb) + // ddt(alpha2*rho2*hb) + ... = ... K*(Tb - Ta) + // with a specified residual volume fraction + virtual tmp K(const scalar residualAlpha) const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedHeatTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedHeatTransferModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel:: + BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return the heatTransfer coefficient K + tmp K() const; + + //- Return the heatTransfer coefficient K + tmp K(const scalar residualAlpha) const; +}; + + +/*---------------------------------------------------------------------------*\ + Class sidedBlendedHeatTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class sidedBlendedHeatTransferModel +: + public SidedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + SidedInterfacialModel:: + SidedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModelNew.C new file mode 100644 index 0000000000..75c8739c79 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModelNew.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "heatTransferModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::heatTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer ? interface.fluid().modelSubDict(dict) : dict; + + const word heatTransferModelType(modelDict.lookup("type")); + + Info<< "Selecting heatTransferModel for " + << interface.name() << ": " << heatTransferModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(heatTransferModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown heatTransferModelType type " + << heatTransferModelType << endl << endl + << "Valid heatTransferModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::blendedHeatTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new blendedHeatTransferModel(dict, interface) + ); +} + + +Foam::autoPtr +Foam::sidedBlendedHeatTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new sidedBlendedHeatTransferModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.C new file mode 100644 index 0000000000..0d2e2aaa3e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "sphericalHeatTransfer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + defineTypeNameAndDebug(sphericalHeatTransfer, 0); + addToRunTimeSelectionTable + ( + heatTransferModel, + sphericalHeatTransfer, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModels::sphericalHeatTransfer::sphericalHeatTransfer +( + const dictionary& dict, + const phaseInterface& interface +) +: + heatTransferModel(dict, interface), + interface_ + ( + interface.modelCast() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModels::sphericalHeatTransfer::~sphericalHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModels::sphericalHeatTransfer::K +( + const scalar residualAlpha +) const +{ + return + 60.0 + *max(interface_.dispersed(), residualAlpha) + *interface_.dispersed().thermo().kappa() + /sqr(interface_.dispersed().d()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.H new file mode 100644 index 0000000000..699ed4dfd2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/sphericalHeatTransfer/sphericalHeatTransfer.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::heatTransferModels::sphericalHeatTransfer + +Description + Model which applies an analytical solution for heat transfer from the + surface of a sphere to the fluid within the sphere. + +SourceFiles + sphericalHeatTransfer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sphericalHeatTransfer_H +#define sphericalHeatTransfer_H + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class sphericalHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class sphericalHeatTransfer +: + public heatTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("spherical"); + + + // Constructors + + //- Construct from a dictionary and an interface + sphericalHeatTransfer + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~sphericalHeatTransfer(); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + tmp K(const scalar residualAlpha) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.C new file mode 100644 index 0000000000..2569ca6d9d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "timeScaleFilteredHeatTransfer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + defineTypeNameAndDebug(timeScaleFilteredHeatTransfer, 0); + addToRunTimeSelectionTable + ( + heatTransferModel, + timeScaleFilteredHeatTransfer, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferModels::timeScaleFilteredHeatTransfer:: +timeScaleFilteredHeatTransfer +( + const dictionary& dict, + const phaseInterface& interface +) +: + heatTransferModel(dict.subDict("heatTransferModel"), interface), + interface_ + ( + interface.modelCast() + ), + heatTransferModel_ + ( + heatTransferModel::New + ( + dict.subDict("heatTransferModel"), + interface, + false + ) + ), + minRelaxTime_("minRelaxTime", dimTime, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferModels::timeScaleFilteredHeatTransfer:: +~timeScaleFilteredHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::heatTransferModels::timeScaleFilteredHeatTransfer::K +( + const scalar residualAlpha +) const +{ + const volScalarField limit + ( + max(interface_.dispersed(), residualAlpha) + *interface_.dispersed().thermo().Cp() + *interface_.dispersed().rho() + /minRelaxTime_ + ); + + return min(heatTransferModel_->K(residualAlpha), limit); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.H new file mode 100644 index 0000000000..b51dd77338 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/heatTransferModels/timeScaleFilteredHeatTransfer/timeScaleFilteredHeatTransfer.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::heatTransferModels::timeScaleFiltered + +Description + A time scale filtering wrapper around an underlying heat transfer model + intended for simulations involving dispersed phase with a very small + diameter. The model limits the heat transfer coefficient based on the + relaxation time given. + +SourceFiles + timeScaleFiltered.C + +\*---------------------------------------------------------------------------*/ + +#ifndef timeScaleFilteredHeatTransfer_H +#define timeScaleFilteredHeatTransfer_H + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace heatTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class timeScaleFilteredHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class timeScaleFilteredHeatTransfer +: + public heatTransferModel +{ + // Private Data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Pointer to the underlying heat transfer model + autoPtr heatTransferModel_; + + //- The minimum relaxation time + const dimensionedScalar minRelaxTime_; + + +public: + + //- Runtime type information + TypeName("timeScaleFiltered"); + + + // Constructors + + //- Construct from a dictionary and an interface + timeScaleFilteredHeatTransfer + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~timeScaleFilteredHeatTransfer(); + + + // Member Functions + + //- The heat transfer function K used in the enthalpy equation + tmp K(const scalar residualAlpha) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace heatTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.C new file mode 100644 index 0000000000..df030f7739 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "LegendreMagnaudet.H" +#include "fvcGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(LegendreMagnaudet, 0); + addToRunTimeSelectionTable(liftModel, LegendreMagnaudet, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::LegendreMagnaudet::LegendreMagnaudet +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface), + residualRe_("residualRe", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::LegendreMagnaudet::~LegendreMagnaudet() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::LegendreMagnaudet::Cl() const +{ + const volScalarField Re(max(interface_.Re(), residualRe_)); + + const volScalarField Sr + ( + sqr(interface_.dispersed().d()) + /( + Re + *interface_.continuous().thermo().nu() + ) + *mag(fvc::grad(interface_.continuous().U())) + ); + + const volScalarField ClLowSqr + ( + sqr(6*2.255) + *sqr(Sr) + /( + pow4(constant::mathematical::pi) + *Re + *pow3(Sr + 0.2*Re) + ) + ); + + const volScalarField ClHighSqr + ( + sqr(0.5*(Re + 16)/(Re + 29)) + ); + + return sqrt(ClLowSqr + ClHighSqr); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.H new file mode 100644 index 0000000000..b2cfe28e85 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/LegendreMagnaudet/LegendreMagnaudet.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModels::LegendreMagnaudet + +Description + Lift model of Legendre and Magnaudet. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Legendre, D., & Magnaudet, J. (1998). + The lift force on a spherical bubble in a viscous linear shear flow. + Journal of Fluid Mechanics, 368, 81-126. + \endverbatim + +SourceFiles + LegendreMagnaudet.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LegendreMagnaudet_H +#define LegendreMagnaudet_H + +#include "dispersedLiftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class LegendreMagnaudet Declaration +\*---------------------------------------------------------------------------*/ + +class LegendreMagnaudet +: + public dispersedLiftModel +{ + // Private Data + + //- Residual Reynold's number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("LegendreMagnaudet"); + + + // Constructors + + //- Construct from a dictionary and an interface + LegendreMagnaudet + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~LegendreMagnaudet(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.C new file mode 100644 index 0000000000..9073011a96 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Moraga.H" +#include "fvcGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(Moraga, 0); + addToRunTimeSelectionTable(liftModel, Moraga, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::Moraga::Moraga +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::Moraga::~Moraga() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::Moraga::Cl() const +{ + volScalarField Re(interface_.Re()); + + volScalarField sqrSr + ( + sqr(interface_.dispersed().d()) + /interface_.continuous().thermo().nu() + *mag(fvc::grad(interface_.continuous().U())) + ); + + if + ( + min(Re).value() < 1200.0 + || max(Re).value() > 18800.0 + || min(sqrSr).value() < 0.0016 + || max(sqrSr).value() > 0.04 + ) + { + WarningInFunction + << "Re and/or Sr are out of the range of applicability of the " + << "Moraga model. Clamping to range bounds" + << endl; + } + + Re.min(1200.0); + Re.max(18800.0); + + sqrSr.min(0.0016); + sqrSr.max(0.04); + + return 0.2*exp(- Re*sqrSr/3.6e5 - 0.12)*exp(Re*sqrSr/3.0e7); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.H new file mode 100644 index 0000000000..e0dea490d4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/Moraga/Moraga.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModels::Moraga + +Description + Lift model of Moraga et al. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Moraga, F. J., Bonetto, F. J., & Lahey, R. T. (1999). + Lateral forces on spheres in turbulent uniform shear flow. + International Journal of Multiphase Flow, 25(6-7), 1321-1372. + \endverbatim + +SourceFiles + Moraga.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Moraga_H +#define Moraga_H + +#include "dispersedLiftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class Moraga Declaration +\*---------------------------------------------------------------------------*/ + +class Moraga +: + public dispersedLiftModel +{ +public: + + //- Runtime type information + TypeName("Moraga"); + + + // Constructors + + //- Construct from a dictionary and an interface + Moraga + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Moraga(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.C new file mode 100644 index 0000000000..f22137b777 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "SaffmanMei.H" +#include "fvcCurl.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(SaffmanMei, 0); + addToRunTimeSelectionTable(liftModel, SaffmanMei, dictionary); +} +} + +using Foam::constant::mathematical::twoPi; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::SaffmanMei::SaffmanMei +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface), + residualRe_("residualRe", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::SaffmanMei::~SaffmanMei() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::SaffmanMei::Cl() const +{ + volScalarField Re(max(interface_.Re(), residualRe_)); + volScalarField Rew + ( + mag(fvc::curl(interface_.continuous().U())) + *sqr(interface_.dispersed().d()) + /( + interface_.continuous().thermo().nu() + + dimensionedScalar(dimViscosity, rootVSmall) + ) + ); + + volScalarField Cld + ( + neg0(Re - 40)*6.46 + *( + (1 - 0.3314*sqrt(0.5*(Rew/Re)))*exp(-0.1*Re) + + 0.3314*sqrt(0.5*(Rew/Re)) + ) + + pos(Re - 40)*6.46*0.0524*sqrt(0.5*(Rew/Re)*Re) + ); + + return 3/(twoPi*sqrt(Rew + rootVSmall))*Cld; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.H new file mode 100644 index 0000000000..719180d075 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/SaffmanMei/SaffmanMei.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::liftModels::SaffmanMei + +Description + Lift model of Saffman (1965) as extended by Mei (1992). Applicable to + spherical particles. + + References: + \verbatim + Saffman, P. G. T. (1965). + The lift on a small sphere in a slow shear flow. + Journal of fluid mechanics, 22(2), 385-400. + + Mei, R. (1992). + An approximate expression for the shear lift force on a spherical + particle at finite Reynolds number. + International Journal of Multiphase Flow, 18(1), 145-147. + \endverbatim + +SourceFiles + SaffmanMei.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SaffmanMei_H +#define SaffmanMei_H + +#include "dispersedLiftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class SaffmanMei Declaration +\*---------------------------------------------------------------------------*/ + +class SaffmanMei +: + public dispersedLiftModel +{ + // Private Data + + //- Residual Reynold's number + const dimensionedScalar residualRe_; + + +public: + + //- Runtime type information + TypeName("SaffmanMei"); + + + // Constructors + + //- Construct from a dictionary and an interface + SaffmanMei + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~SaffmanMei(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.C new file mode 100644 index 0000000000..f591f33cbd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaLift.H" +#include "aspectRatioModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(TomiyamaLift, 0); + addToRunTimeSelectionTable(liftModel, TomiyamaLift, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::TomiyamaLift::TomiyamaLift +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface), + aspectRatio_(aspectRatioModel::New(dict.subDict("aspectRatio"), interface)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::TomiyamaLift::~TomiyamaLift() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::TomiyamaLift::Cl() const +{ + const volScalarField EoH + ( + interface_.Eo(interface_.dispersed().d()/cbrt(aspectRatio_->E())) + ); + + const volScalarField f + ( + 0.0010422*pow3(EoH) - 0.0159*sqr(EoH) - 0.0204*EoH + 0.474 + ); + + return + neg(EoH - 4)*min(0.288*tanh(0.121*interface_.Re()), f) + + pos0(EoH - 4)*neg(EoH - 10.7)*f + + pos0(EoH - 10.7)*(-0.288); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.H new file mode 100644 index 0000000000..c69385d7f1 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/TomiyamaLift/TomiyamaLift.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModels::TomiyamaLift + +Description + Lift model of Tomiyama et al. + + Reference: + \verbatim + Tomiyama, A., Tamai, H., Zun, I., & Hosokawa, S. (2002). + Transverse migration of single bubbles in simple shear flows. + Chemical Engineering Science, 57(11), 1849-1858. + \endverbatim + + The coefficient for pow3(EoH) proposed by Tomiyama (2002) has been modified + to make the model continuous at EoH = 10.7 while maintaining the + lift coefficient proposed by Tomiyama (2002) when EoH >= 10.7. + +SourceFiles + TomiyamaLift.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaLift_H +#define TomiyamaLift_H + +#include "dispersedLiftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class aspectRatioModel; + +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaLift Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaLift +: + public dispersedLiftModel +{ +private: + + //- Private Data + + //- The aspect ratio model + autoPtr aspectRatio_; + + +public: + + //- Runtime type information + TypeName("Tomiyama"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaLift + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~TomiyamaLift(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.C new file mode 100644 index 0000000000..5d7764cfbc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "constantLiftCoefficient.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(constantLiftCoefficient, 0); + addToRunTimeSelectionTable(liftModel, constantLiftCoefficient, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::constantLiftCoefficient::constantLiftCoefficient +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface), + Cl_("Cl", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::constantLiftCoefficient::~constantLiftCoefficient() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::liftModels::constantLiftCoefficient::Cl() const +{ + return volScalarField::New + ( + "zero", + interface_.mesh(), + Cl_ + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.H new file mode 100644 index 0000000000..6541d6ac4c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/constantLiftCoefficient/constantLiftCoefficient.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModels::constantLiftCoefficient + +Description + Constant coefficient lift model. + +SourceFiles + constantLiftCoefficient.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantLiftCoefficient_H +#define constantLiftCoefficient_H + +#include "dispersedLiftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantLiftCoefficient Declaration +\*---------------------------------------------------------------------------*/ + +class constantLiftCoefficient +: + public dispersedLiftModel +{ + // Private Data + + //- Constant lift coefficient + const dimensionedScalar Cl_; + + +public: + + //- Runtime type information + TypeName("constantCoefficient"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantLiftCoefficient + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantLiftCoefficient(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.C new file mode 100644 index 0000000000..3e98d9774d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dispersedLiftModel.H" +#include "fvcCurl.H" +#include "fvcFlux.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::dispersedLiftModel::dispersedLiftModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + liftModel(dict, interface), + interface_(interface.modelCast()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::dispersedLiftModel::~dispersedLiftModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::dispersedLiftModel::Fi() const +{ + return + Cl() + *interface_.continuous().rho() + *( + interface_.Ur() ^ fvc::curl(interface_.continuous().U()) + ); +} + + +Foam::tmp Foam::liftModels::dispersedLiftModel::F() const +{ + return interface_.dispersed()*Fi(); +} + + +Foam::tmp +Foam::liftModels::dispersedLiftModel::Ff() const +{ + return fvc::interpolate(interface_.dispersed())*fvc::flux(Fi()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.H new file mode 100644 index 0000000000..c47f03f48d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/dispersedLiftModel/dispersedLiftModel.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dispersedLiftModel + +Description + Model for lift between two phases where one phase can be considered + dispersed in the other and the lift therefore characterised by a lift + coefficient + +SourceFiles + dispersedLiftModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dispersedLiftModel_H +#define dispersedLiftModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "liftModel.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class dispersedLiftModel Declaration +\*---------------------------------------------------------------------------*/ + +class dispersedLiftModel +: + public liftModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + // Constructors + + // Construct from a dictionary and an interface + dispersedLiftModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~dispersedLiftModel(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const = 0; + + //- Return phase-intensive lift force + virtual tmp Fi() const; + + //- Return lift force + virtual tmp F() const; + + //- Return face lift force + virtual tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.C new file mode 100644 index 0000000000..4d7a38c648 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.C @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "liftModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(liftModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(liftModel, 0); + defineRunTimeSelectionTable(liftModel, dictionary); +} + +const Foam::dimensionSet Foam::liftModel::dimF(1, -2, -2, 0, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModel::liftModel +( + const dictionary& dict, + const phaseInterface& interface +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModel::~liftModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::blendedLiftModel::F() const +{ + return evaluate(&liftModel::F, "F", liftModel::dimF, true); +} + + +Foam::tmp Foam::blendedLiftModel::Ff() const +{ + return evaluate(&liftModel::Ff, "Ff", liftModel::dimF*dimArea, true); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.H new file mode 100644 index 0000000000..1459efef5f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModel.H @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModel + +Description + Model for the lift force between two phases + +SourceFiles + liftModel.C + liftModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef liftModel_H +#define liftModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class liftModel Declaration +\*---------------------------------------------------------------------------*/ + +class liftModel +{ +public: + + //- Runtime type information + TypeName("liftModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + liftModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Force dimensions + static const dimensionSet dimF; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = true; + + + // Constructors + + //- Construct from a dictionary and an interface + liftModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~liftModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + //- Return lift force + virtual tmp F() const = 0; + + //- Return face lift force + virtual tmp Ff() const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedLiftModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedLiftModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using BlendedInterfacialModel::BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return lift force + tmp F() const; + + //- Return face lift force + tmp Ff() const; +}; + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModelNew.C new file mode 100644 index 0000000000..543a7614c8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/liftModel/liftModelNew.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "liftModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::liftModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer ? interface.fluid().modelSubDict(dict) : dict; + + const word liftModelType(modelDict.lookup("type")); + + Info<< "Selecting liftModel for " + << interface.name() << ": " << liftModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(liftModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown liftModelType type " + << liftModelType << endl << endl + << "Valid liftModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr Foam::blendedLiftModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr(new blendedLiftModel(dict, interface)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.C new file mode 100644 index 0000000000..1f99fdc05f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "noLift.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(noLift, 0); + addToRunTimeSelectionTable(liftModel, noLift, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::noLift::noLift +( + const dictionary& dict, + const phaseInterface& interface +) +: + liftModel(dict, interface), + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::noLift::~noLift() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::noLift::F() const +{ + return volVectorField::New + ( + "F", + interface_.mesh(), + dimensionedVector(dimF, Zero) + ); +} + + +Foam::tmp Foam::liftModels::noLift::Ff() const +{ + return surfaceScalarField::New + ( + "Ff", + interface_.mesh(), + dimensionedScalar(dimF*dimArea, 0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.H new file mode 100644 index 0000000000..89cf703228 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/noLift/noLift.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::liftModels::noLift + +Description + +SourceFiles + noLift.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noLift_H +#define noLift_H + +#include "liftModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class noLift Declaration +\*---------------------------------------------------------------------------*/ + +class noLift +: + public liftModel +{ +protected: + + // Protected data + + //- Interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from a dictionary and an interface + noLift + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~noLift(); + + + // Member Functions + + //- Return lift force + virtual tmp F() const; + + //- Return face lift force + virtual tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.C new file mode 100644 index 0000000000..46ca6f4d0e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "wallDampedLift.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + defineTypeNameAndDebug(wallDamped, 0); + addToRunTimeSelectionTable(liftModel, wallDamped, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::liftModels::wallDamped::wallDamped +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedLiftModel(dict, interface), + liftModel_(liftModel::New(dict.subDict("lift"), interface, false)), + wallDampingModel_ + ( + wallDampingModel::New(dict.subDict("wallDamping"), interface) + ) +{ + if (!isA(liftModel_())) + { + FatalErrorInFunction + << "The sub-lift-model of a " << type() + << " lift model must be for a dispersed configuration" + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liftModels::wallDamped::~wallDamped() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::liftModels::wallDamped::Cl() const +{ + return + wallDampingModel_->damping() + *refCast(liftModel_()).Cl(); +} + + +Foam::tmp Foam::liftModels::wallDamped::Fi() const +{ + return + wallDampingModel_->damping() + *refCast(liftModel_()).Fi(); +} + + +Foam::tmp Foam::liftModels::wallDamped::F() const +{ + return wallDampingModel_->damping()*liftModel_->F(); +} + + +Foam::tmp Foam::liftModels::wallDamped::Ff() const +{ + return wallDampingModel_->dampingf()*liftModel_->Ff(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.H new file mode 100644 index 0000000000..07a93eb7a1 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/liftModels/wallDampedLift/wallDampedLift.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::liftModels::wallDamped + +Description + +SourceFiles + wallDamped.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallDampedLift_H +#define wallDampedLift_H + +#include "dispersedLiftModel.H" +#include "wallDampingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace liftModels +{ + +/*---------------------------------------------------------------------------*\ + Class wallDamped Declaration +\*---------------------------------------------------------------------------*/ + +class wallDamped +: + public dispersedLiftModel +{ + // Private Data + + //- The lift model to damp + autoPtr liftModel_; + + //- The wall-damping model + autoPtr wallDampingModel_; + + +public: + + //- Runtime type information + TypeName("wallDamped"); + + + // Constructors + + //- Construct from a dictionary and an interface + wallDamped + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~wallDamped(); + + + // Member Functions + + //- Lift coefficient + virtual tmp Cl() const; + + //- Return phase-intensive lift force + virtual tmp Fi() const; + + //- Return lift force + virtual tmp F() const; + + //- Return face lift force + virtual tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace liftModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.C new file mode 100644 index 0000000000..52f441b4f0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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 "deposition.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseTransferModels +{ + defineTypeNameAndDebug(deposition, 0); + addToRunTimeSelectionTable(phaseTransferModel, deposition, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseTransferModels::deposition::deposition +( + const dictionary& dict, + const phaseInterface& interface +) +: + phaseTransferModel(dict, interface), + interface_(interface), + dropletName_(dict.lookup("droplet")), + surfaceName_(dict.lookup("surface")), + efficiency_(dict.lookup("efficiency")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseTransferModels::deposition::~deposition() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::phaseTransferModels::deposition::mixture() const +{ + return true; +} + + +Foam::tmp +Foam::phaseTransferModels::deposition::dmdtf() const +{ + const phaseModel* dropletPtr = nullptr; + scalar sign = 1; + if (dropletName_ == interface_.phase1().name()) + { + dropletPtr = &interface_.phase1(); + sign = -1; + } + else if (dropletName_ == interface_.phase2().name()) + { + dropletPtr = &interface_.phase2(); + sign = 1; + } + else + { + FatalErrorInFunction + << "The specified droplet phase, " << dropletName_ << ", is not in " + << "the " << interface_ << " pair" + << exit(FatalError); + } + + const phaseModel& droplet = *dropletPtr; + const phaseModel& surface = droplet.fluid().phases()[surfaceName_]; + + return + 1.5*sign*efficiency_ + *droplet.rho()*droplet*surface/surface.d() + *mag(droplet.U() - surface.U()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.H new file mode 100644 index 0000000000..3cf5d16130 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/deposition/deposition.H @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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::phaseTransferModels::deposition + +Description + Phase transfer model representing change from a dispersed phase to a film as + a result of deposition onto a third phase + +SourceFiles + deposition.C + +\*---------------------------------------------------------------------------*/ + +#ifndef deposition_H +#define deposition_H + +#include "phaseTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class deposition Declaration +\*---------------------------------------------------------------------------*/ + +class deposition +: + public phaseTransferModel +{ +private: + + // Private Data + + //- Interface + const phaseInterface interface_; + + //- The name of the phase which deposits + const word dropletName_; + + //- The name of the phase onto which deposition occurs + const word surfaceName_; + + //- The deposition efficiency + const scalar efficiency_; + + +public: + + //- Runtime type information + TypeName("deposition"); + + + // Constructors + + //- Construct from a dictionary and an interface + deposition + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~deposition(); + + + // Member Functions + + //- Whether or not there is a mass transfer rate for the mixture + virtual bool mixture() const; + + //- The mass transfer rate for the mixture + virtual tmp dmdtf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C new file mode 100644 index 0000000000..e4de173ee4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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 "phaseTransferModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(phaseTransferModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(phaseTransferModel, 0); + defineRunTimeSelectionTable(phaseTransferModel, dictionary); +} + +const Foam::dimensionSet Foam::phaseTransferModel::dimDmdt = + Foam::dimDensity/Foam::dimTime; + +const Foam::hashedWordList Foam::phaseTransferModel::noSpecies_ = + Foam::hashedWordList(); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseTransferModel::phaseTransferModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, interface.name()), + interface.mesh().time().timeName(), + interface.mesh() + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseTransferModel::~phaseTransferModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::phaseTransferModel::mixture() const +{ + return false; +} + + +Foam::tmp Foam::phaseTransferModel::dmdtf() const +{ + return tmp(nullptr); +} + + +const Foam::hashedWordList& Foam::phaseTransferModel::species() const +{ + return noSpecies_; +} + + +Foam::HashPtrTable +Foam::phaseTransferModel::dmidtf() const +{ + return HashPtrTable(); +} + + +bool Foam::phaseTransferModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +bool Foam::blendedPhaseTransferModel::mixture() const +{ + return evaluate(&phaseTransferModel::mixture); +} + + +Foam::tmp +Foam::blendedPhaseTransferModel::dmdtf() const +{ + return + evaluate + ( + &phaseTransferModel::dmdtf, + "dmdtf", + phaseTransferModel::dimDmdt, + true + ); +} + + +Foam::hashedWordList Foam::blendedPhaseTransferModel::species() const +{ + return evaluate(&phaseTransferModel::species); +} + + +Foam::HashPtrTable +Foam::blendedPhaseTransferModel::dmidtf() const +{ + return + evaluate + ( + &phaseTransferModel::dmidtf, + "dmidtf", + phaseTransferModel::dimDmdt, + true + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H new file mode 100644 index 0000000000..0f428db78c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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::phaseTransferModel + +Description + +SourceFiles + phaseTransferModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseTransferModel_H +#define phaseTransferModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "HashPtrTable.H" +#include "hashedWordList.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +namespace Foam +{ + +class phaseSystem; + +/*---------------------------------------------------------------------------*\ + Class phaseTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class phaseTransferModel +: + public regIOobject +{ +public: + + //- Runtime type information + TypeName("phaseTransferModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + phaseTransferModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Mass transfer rate dimensions + static const dimensionSet dimDmdt; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = false; + + //- Empty species list + static const hashedWordList noSpecies_; + + + // Constructors + + //- Construct from a dictionary and an interface + phaseTransferModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~phaseTransferModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Whether or not there is a mass transfer rate for the mixture + virtual bool mixture() const; + + //- The mass transfer rate for the mixture + virtual tmp dmdtf() const; + + //- The list of individual species that are transferred + virtual const hashedWordList& species() const; + + //- The mass transfer rate for individual species + virtual HashPtrTable dmidtf() const; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedPhaseTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedPhaseTransferModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel:: + BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Whether or not there is a mass transfer rate for the mixture + bool mixture() const; + + //- The mass transfer rate for the mixture + tmp dmdtf() const; + + //- The list of individual species that are transferred + hashedWordList species() const; + + //- The mass transfer rate for individual species + HashPtrTable dmidtf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModelNew.C new file mode 100644 index 0000000000..99d40b11f3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModelNew.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018-2022 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 "phaseTransferModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::phaseTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + const dictionary& modelDict = + interface.fluid().modelSubDict(dict); + + const word phaseTransferModelType(modelDict.lookup("type")); + + Info<< "Selecting phaseTransferModel for " + << interface.name() << ": " << phaseTransferModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(phaseTransferModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown phaseTransferModelType type " + << phaseTransferModelType << endl << endl + << "Valid phaseTransferModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::blendedPhaseTransferModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return autoPtr + ( + new blendedPhaseTransferModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C new file mode 100644 index 0000000000..6602b31305 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "reactionDriven.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseTransferModels +{ + defineTypeNameAndDebug(reactionDriven, 0); + addToRunTimeSelectionTable(phaseTransferModel, reactionDriven, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseTransferModels::reactionDriven::reactionDriven +( + const dictionary& dict, + const phaseInterface& interface +) +: + phaseTransferModel(dict, interface), + interface_(interface), + reactingName_(dict.lookup("reactingPhase")), + reactingPhase_ + ( + reactingName_ == interface_.phase1().name() + ? interface_.phase1() + : interface_.phase2() + ), + otherPhase_(interface.otherPhase(reactingPhase_)), + sign_(reactingName_ == interface_.phase1().name() ? -1 : 1), + species_(dict.lookup("species")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::phaseTransferModels::reactionDriven::~reactionDriven() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::hashedWordList& +Foam::phaseTransferModels::reactionDriven::species() const +{ + return species_; +} + + +Foam::HashPtrTable +Foam::phaseTransferModels::reactionDriven::dmidtf() const +{ + HashPtrTable result; + + forAll(species_, i) + { + const word name = species_[i]; + + volScalarField& Y = + const_cast(reactingPhase_.Y(name)); + + result.set + ( + species_[i], + (sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr() + ); + } + + return result; +}; + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H new file mode 100644 index 0000000000..4bbe5e274a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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::phaseTransferModels::reactionDriven + +Description + Phase transfer model representing change from one phase to another due + to reactions. Intended for irreversible reactions. + +SourceFiles + reactionDriven.C + +\*---------------------------------------------------------------------------*/ + +#ifndef reactionDriven_H +#define reactionDriven_H + +#include "phaseTransferModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseTransferModels +{ + +/*---------------------------------------------------------------------------*\ + Class reactionDriven Declaration +\*---------------------------------------------------------------------------*/ + +class reactionDriven +: + public phaseTransferModel +{ +private: + + // Private Data + + //- Interface + const phaseInterface interface_; + + //- The name of the phase where the reactions occur + const word reactingName_; + + //- Const reference to the reacting phase + const phaseModel& reactingPhase_; + + //- Const reference to the other phase + const phaseModel& otherPhase_; + + //- Sign used to multiply the source terms + const scalar sign_; + + //- List of species changing phase + const hashedWordList species_; + + +public: + + //- Runtime type information + TypeName("reactionDriven"); + + + // Constructors + + //- Construct from a dictionary and an interface + reactionDriven + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~reactionDriven(); + + + // Member Functions + + //- The list of individual species that are transferred + virtual const hashedWordList& species() const; + + //- The mass transfer rate for individual species + virtual HashPtrTable dmidtf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseTransferModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C new file mode 100644 index 0000000000..4b3f82c824 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaSwarm.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace swarmCorrections +{ + defineTypeNameAndDebug(TomiyamaSwarm, 0); + addToRunTimeSelectionTable + ( + swarmCorrection, + TomiyamaSwarm, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::swarmCorrections::TomiyamaSwarm::TomiyamaSwarm +( + const dictionary& dict, + const phaseInterface& interface +) +: + swarmCorrection(dict, interface), + residualAlpha_ + ( + "residualAlpha", + dimless, + dict.lookupOrDefault + ( + "residualAlpha", + interface_.dispersed().residualAlpha().value() + ) + ), + l_("l", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::swarmCorrections::TomiyamaSwarm::~TomiyamaSwarm() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp +Foam::swarmCorrections::TomiyamaSwarm::Cs() const +{ + return pow(max(interface_.continuous(), residualAlpha_), 3 - 2*l_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.H new file mode 100644 index 0000000000..f299f5519e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/TomiyamaSwarm/TomiyamaSwarm.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::swarmCorrections::TomiyamaSwarm + +Description + Swarm correction of Tomiyama et al. + + Reference: + \verbatim + Tomiyama, A., Kataoka, I., Fukuda, T., & Sakaguchi, T. (1995). + Drag coefficients of bubbles: 2nd report, drag coefficient for a swarm + of bubbles and its applicability to transient flow. + JSME Journal of Fluid Engineering, 61, 2810-2817. + \endverbatim + +SourceFiles + TomiyamaSwarm.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaSwarm_H +#define TomiyamaSwarm_H + +#include "swarmCorrection.H" +#include "dispersedPhaseInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace swarmCorrections +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaSwarm Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaSwarm +: + public swarmCorrection +{ + // Private Data + + //- Residual phase fraction + const dimensionedScalar residualAlpha_; + + //- Constant exponent + const dimensionedScalar l_; + + +public: + + //- Runtime type information + TypeName("Tomiyama"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaSwarm + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~TomiyamaSwarm(); + + + // Member Functions + + //- Swarm correction coefficient + virtual tmp Cs() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace swarmCorrections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.C new file mode 100644 index 0000000000..2082820c25 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "noSwarm.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace swarmCorrections +{ + defineTypeNameAndDebug(noSwarm, 0); + addToRunTimeSelectionTable(swarmCorrection, noSwarm, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::swarmCorrections::noSwarm::noSwarm +( + const dictionary& dict, + const phaseInterface& interface +) +: + swarmCorrection(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::swarmCorrections::noSwarm::~noSwarm() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::swarmCorrections::noSwarm::Cs() const +{ + return volScalarField::New + ( + "Cs", + interface_.mesh(), + dimensionedScalar(dimless, 1) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.H new file mode 100644 index 0000000000..5bcca21740 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/noSwarm/noSwarm.H @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::swarmCorrections::noSwarm + +Description + No swarm correction + +SourceFiles + noSwarm.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noSwarm_H +#define noSwarm_H + +#include "swarmCorrection.H" +#include "phaseInterface.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace swarmCorrections +{ + +/*---------------------------------------------------------------------------*\ + Class noSwarm Declaration +\*---------------------------------------------------------------------------*/ + +class noSwarm +: + public swarmCorrection +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from a dictionary and an interface + noSwarm + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~noSwarm(); + + + // Member Functions + + //- Swarm correction coefficient + tmp Cs() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace swarmCorrections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.C new file mode 100644 index 0000000000..781ca57274 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.C @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "swarmCorrection.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(swarmCorrection, 0); + defineRunTimeSelectionTable(swarmCorrection, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::swarmCorrection::swarmCorrection +( + const dictionary& dict, + const phaseInterface& interface +) +: + interface_(interface.modelCast()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::swarmCorrection::~swarmCorrection() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.H new file mode 100644 index 0000000000..b723111d7a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrection.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::swarmCorrection + +Description + Drag model modifier to take into account large fractions (swarms) of the + dispersed phase. Often not appropriate as these effects are a fundamental + part of the drag model formulation (e.g. Ergun). Use with care. + +SourceFiles + swarmCorrection.C + swarmCorrectionNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef swarmCorrection_H +#define swarmCorrection_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class swarmCorrection Declaration +\*---------------------------------------------------------------------------*/ + +class swarmCorrection +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("swarmCorrection"); + + + // Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + swarmCorrection, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + swarmCorrection + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~swarmCorrection(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Swarm correction coefficient + virtual tmp Cs() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrectionNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrectionNew.C new file mode 100644 index 0000000000..316e84a9a7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/swarmCorrections/swarmCorrection/swarmCorrectionNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "swarmCorrection.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::swarmCorrection::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + const word swarmCorrectionType(dict.lookup("type")); + + Info<< "Selecting swarmCorrection for " + << interface.name() << ": " << swarmCorrectionType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(swarmCorrectionType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown swarmCorrectionType type " + << swarmCorrectionType << endl << endl + << "Valid swarmCorrection types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.C new file mode 100644 index 0000000000..2ada6e77b5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Burns.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "addToRunTimeSelectionTable.H" +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + defineTypeNameAndDebug(Burns, 0); + addToRunTimeSelectionTable + ( + turbulentDispersionModel, + Burns, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::Burns::Burns +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedTurbulentDispersionModel(dict, interface), + sigma_("sigma", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::Burns::~Burns() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentDispersionModels::Burns::D() const +{ + const dragModels::dispersedDragModel& drag = + interface_.mesh().lookupObject + ( + IOobject::groupName + ( + dragModel::typeName, + interface_.name() + ) + ); + + return + drag.Ki() + *continuousTurbulence().nut() + /sigma_ + *interface_.dispersed() + *sqr(interface_.dispersed() + interface_.continuous()) + /( + max + ( + interface_.dispersed(), + interface_.dispersed().residualAlpha() + ) + *max + ( + interface_.continuous(), + interface_.continuous().residualAlpha() + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.H new file mode 100644 index 0000000000..b30860ebf6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Burns/Burns.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModels::Burns + +Description + Turbulent dispersion model of Burns et al. + + References: + \verbatim + Burns, A. D., Frank, T., Hamill, I., & Shi, J. M. (2004, May). + The Favre averaged drag model for turbulent dispersion in Eulerian + multi-phase flows. + In 5th international conference on multiphase flow, + ICMF (Vol. 4, pp. 1-17). + \endverbatim + +SourceFiles + Burns.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Burns_H +#define Burns_H + +#include "dispersedTurbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class Burns Declaration +\*---------------------------------------------------------------------------*/ + +class Burns +: + public dispersedTurbulentDispersionModel +{ + // Private Data + + //- Schmidt number + const dimensionedScalar sigma_; + + +public: + + //- Runtime type information + TypeName("Burns"); + + + // Constructors + + //- Construct from a dictionary and an interface + Burns + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Burns(); + + + // Member Functions + + //- Turbulent diffusivity + // multiplying the gradient of the phase-fraction + virtual tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace turbulentDispersionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.C new file mode 100644 index 0000000000..87b63dc5e7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Gosman.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "addToRunTimeSelectionTable.H" +#include "dispersedDragModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + defineTypeNameAndDebug(Gosman, 0); + addToRunTimeSelectionTable + ( + turbulentDispersionModel, + Gosman, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::Gosman::Gosman +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedTurbulentDispersionModel(dict, interface), + sigma_("sigma", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::Gosman::~Gosman() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentDispersionModels::Gosman::D() const +{ + const dragModels::dispersedDragModel& drag = + interface_.mesh().lookupObject + ( + IOobject::groupName + ( + dragModel::typeName, + interface_.name() + ) + ); + + return + drag.Ki() + *continuousTurbulence().nut() + /sigma_ + *interface_.dispersed(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.H new file mode 100644 index 0000000000..1a88be8099 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/Gosman/Gosman.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModels::Gosman + +Description + Turbulent dispersion model of Gosman et al. + + Reference: + \verbatim + Gosman, A. D., Lekakou, C., Politis, S., Issa, R. I., & + Looney, M. K. (1992). + Multidimensional modeling of turbulent two-phase flows in stirred + vessels. + AIChE Journal, 38(12), 1946-1956. + \endverbatim + +SourceFiles + Gosman.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Gosman_H +#define Gosman_H + +#include "dispersedTurbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class Gosman Declaration +\*---------------------------------------------------------------------------*/ + +class Gosman +: + public dispersedTurbulentDispersionModel +{ + // Private Data + + //- Schmidt number + const dimensionedScalar sigma_; + + +public: + + //- Runtime type information + TypeName("Gosman"); + + + // Constructors + + //- Construct from a dictionary and an interface + Gosman + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Gosman(); + + + // Member Functions + + //- Turbulent diffusivity + // multiplying the gradient of the phase-fraction + virtual tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace turbulentDispersionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.C new file mode 100644 index 0000000000..8f02e0de34 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "LopezDeBertodano.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + defineTypeNameAndDebug(LopezDeBertodano, 0); + addToRunTimeSelectionTable + ( + turbulentDispersionModel, + LopezDeBertodano, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::LopezDeBertodano::LopezDeBertodano +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedTurbulentDispersionModel(dict, interface), + Ctd_("Ctd", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::LopezDeBertodano::~LopezDeBertodano() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentDispersionModels::LopezDeBertodano::D() const +{ + return + Ctd_ + *interface_.continuous().rho() + *continuousTurbulence().k(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.H new file mode 100644 index 0000000000..9d2e80fe24 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/LopezDeBertodano/LopezDeBertodano.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModels::LopezDeBertodano + +Description + Lopez de Bertodano (1992) turbulent dispersion model. + + \verbatim + Lopez, D. B. M. (1992). + Turbulent bubbly two-phase flow in a triangular duct. + PhD Thesis, Rensselaer Polytechnic Institution. + \endverbatim + +SourceFiles + LopezDeBertodano.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LopezDeBertodano_H +#define LopezDeBertodano_H + +#include "dispersedTurbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class LopezDeBertodano Declaration +\*---------------------------------------------------------------------------*/ + +class LopezDeBertodano +: + public dispersedTurbulentDispersionModel +{ + // Private Data + + //- Constant turbulent dispersion coefficient + const dimensionedScalar Ctd_; + + +public: + + //- Runtime type information + TypeName("LopezDeBertodano"); + + + // Constructors + + //- Construct from a dictionary and an interface + LopezDeBertodano + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~LopezDeBertodano(); + + + // Member Functions + + //- Turbulent diffusivity + // multiplying the gradient of the phase-fraction + virtual tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace turbulentDispersionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.C new file mode 100644 index 0000000000..09dae1f3d4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "constantTurbulentDispersionCoefficient.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + defineTypeNameAndDebug(constantTurbulentDispersionCoefficient, 0); + addToRunTimeSelectionTable + ( + turbulentDispersionModel, + constantTurbulentDispersionCoefficient, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::constantTurbulentDispersionCoefficient:: +constantTurbulentDispersionCoefficient +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedTurbulentDispersionModel(dict, interface), + Ctd_("Ctd", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::constantTurbulentDispersionCoefficient:: +~constantTurbulentDispersionCoefficient() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentDispersionModels::constantTurbulentDispersionCoefficient:: +D() const +{ + return + Ctd_ + *interface_.dispersed() + *interface_.continuous().rho() + *continuousTurbulence().k(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.H new file mode 100644 index 0000000000..7d9704a3bc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/constantTurbulentDispersionCoefficient/constantTurbulentDispersionCoefficient.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModels::constantTurbulentDispersionCoefficient + +Description + Constant coefficient turbulent dispersion model. + +SourceFiles + constantTurbulentDispersionCoefficient.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantTurbulentDispersionCoefficient_H +#define constantTurbulentDispersionCoefficient_H + +#include "dispersedTurbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantTurbulentDispersionCoefficient Declaration +\*---------------------------------------------------------------------------*/ + +class constantTurbulentDispersionCoefficient +: + public dispersedTurbulentDispersionModel +{ + // Private Data + + //- Constant turbulent dispersion coefficient + const dimensionedScalar Ctd_; + + +public: + + //- Runtime type information + TypeName("constantCoefficient"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantTurbulentDispersionCoefficient + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~constantTurbulentDispersionCoefficient(); + + + // Member Functions + + //- Turbulent diffusivity + // multiplying the gradient of the phase-fraction + virtual tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace turbulentDispersionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.C new file mode 100644 index 0000000000..7f8ef7ab07 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dispersedTurbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::dispersedTurbulentDispersionModel:: +dispersedTurbulentDispersionModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + turbulentDispersionModel(dict, interface), + interface_ + ( + interface.modelCast() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::dispersedTurbulentDispersionModel:: +~dispersedTurbulentDispersionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::phaseCompressible::momentumTransportModel& +Foam::turbulentDispersionModels::dispersedTurbulentDispersionModel:: +continuousTurbulence() const +{ + return + interface_.phase1().mesh().lookupObject + < + phaseCompressible::momentumTransportModel + > + ( + IOobject::groupName + ( + momentumTransportModel::typeName, + interface_.continuous().name() + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.H new file mode 100644 index 0000000000..9c951c1e1b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/dispersedTurbulentDispersionModel/dispersedTurbulentDispersionModel.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dispersedTurbulentDispersionModel + +Description + Model for turbulent dispersion between two phases where one phase can be + considered dispersed in the other + +SourceFiles + dispersedTurbulentDispersionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dispersedTurbulentDispersionModel_H +#define dispersedTurbulentDispersionModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "turbulentDispersionModel.H" +#include "dispersedPhaseInterface.H" +#include "phaseCompressibleMomentumTransportModel.H" + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class dispersedTurbulentDispersionModel Declaration +\*---------------------------------------------------------------------------*/ + +class dispersedTurbulentDispersionModel +: + public turbulentDispersionModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + // Constructors + + // Construct from a dictionary and an interface + dispersedTurbulentDispersionModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~dispersedTurbulentDispersionModel(); + + + // Member Functions + + //- Return a reference to the turbulence model for the continuous phase + const phaseCompressible::momentumTransportModel& + continuousTurbulence() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.C new file mode 100644 index 0000000000..63914f6218 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "noTurbulentDispersion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + defineTypeNameAndDebug(noTurbulentDispersion, 0); + addToRunTimeSelectionTable + ( + turbulentDispersionModel, + noTurbulentDispersion, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::noTurbulentDispersion::noTurbulentDispersion +( + const dictionary& dict, + const phaseInterface& interface +) +: + turbulentDispersionModel(dict, interface), + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModels::noTurbulentDispersion:: +~noTurbulentDispersion() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::turbulentDispersionModels::noTurbulentDispersion::D() const +{ + return volScalarField::New + ( + "D", + interface_.mesh(), + dimensionedScalar(dimD, 0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.H new file mode 100644 index 0000000000..326e261ab0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/noTurbulentDispersion/noTurbulentDispersion.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModels::noTurbulentDispersion + +Description + +SourceFiles + noTurbulentDispersion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noTurbulentDispersion_H +#define noTurbulentDispersion_H + +#include "turbulentDispersionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace turbulentDispersionModels +{ + +/*---------------------------------------------------------------------------*\ + Class noTurbulentDispersion Declaration +\*---------------------------------------------------------------------------*/ + +class noTurbulentDispersion +: + public turbulentDispersionModel +{ +private: + + // Private data + + //- Interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from a dictionary and an interface + noTurbulentDispersion + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~noTurbulentDispersion(); + + + // Member Functions + + //- Turbulent diffusivity + // multiplying the gradient of the phase-fraction + virtual tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace turbulentDispersionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C new file mode 100644 index 0000000000..6b9a21b395 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "turbulentDispersionModel.H" +#include "phaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(turbulentDispersionModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(turbulentDispersionModel, 0); + defineRunTimeSelectionTable(turbulentDispersionModel, dictionary); +} + +const Foam::dimensionSet Foam::turbulentDispersionModel::dimD(1, -1, -2, 0, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModel::turbulentDispersionModel +( + const dictionary& dict, + const phaseInterface& interface +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::turbulentDispersionModel::~turbulentDispersionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::blendedTurbulentDispersionModel::D() const +{ + return + evaluate + ( + &turbulentDispersionModel::D, + "F", + turbulentDispersionModel::dimD, + true + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.H new file mode 100644 index 0000000000..3f4b0e4625 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModel.H @@ -0,0 +1,159 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::turbulentDispersionModel + +Description + Model for turbulent dispersion between two phases + +SourceFiles + turbulentDispersionModel.C + turbulentDispersionModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef turbulentDispersionModel_H +#define turbulentDispersionModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class turbulentDispersionModel Declaration +\*---------------------------------------------------------------------------*/ + +class turbulentDispersionModel +{ +public: + + //- Runtime type information + TypeName("turbulentDispersionModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + turbulentDispersionModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + // Static Data Members + + //- Diffusivity dimensions + static const dimensionSet dimD; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = true; + + + // Constructors + + //- Construct from a dictionary and an interface + turbulentDispersionModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~turbulentDispersionModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + //- Return the turbulent diffusivity multiplying the gradient of the + // phase-fraction + virtual tmp D() const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedTurbulentDispersionModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedTurbulentDispersionModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel:: + BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return the turbulent diffusivity multiplying the gradient of the + // phase-fraction + tmp D() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModelNew.C new file mode 100644 index 0000000000..93fa0325bd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/turbulentDispersionModels/turbulentDispersionModel/turbulentDispersionModelNew.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "turbulentDispersionModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::turbulentDispersionModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer + ? interface.fluid().modelSubDict(dict) + : dict; + + const word turbulentDispersionModelType(modelDict.lookup("type")); + + Info<< "Selecting turbulentDispersionModel for " + << interface.name() << ": " << turbulentDispersionModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(turbulentDispersionModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown turbulentDispersionModelType type " + << turbulentDispersionModelType << endl << endl + << "Valid turbulentDispersionModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::blendedTurbulentDispersionModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return + autoPtr + ( + new blendedTurbulentDispersionModel(dict, interface) + ); +} + + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.C new file mode 100644 index 0000000000..3c5c45526b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Lamb.H" +#include "aspectRatioModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace virtualMassModels +{ + defineTypeNameAndDebug(Lamb, 0); + addToRunTimeSelectionTable + ( + virtualMassModel, + Lamb, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::virtualMassModels::Lamb::Lamb +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedVirtualMassModel(dict, interface, registerObject), + aspectRatio_(aspectRatioModel::New(dict.subDict("aspectRatio"), interface)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::virtualMassModels::Lamb::~Lamb() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::virtualMassModels::Lamb::Cvm() const +{ + volScalarField E(min(max(aspectRatio_->E(), small), 1 - small)); + volScalarField rtOmEsq(sqrt(1 - sqr(E))); + + return + (rtOmEsq - E*acos(E)) + /(E*acos(E) - sqr(E)*rtOmEsq); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.H new file mode 100644 index 0000000000..a5317750e8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/Lamb/Lamb.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::virtualMassModels::Lamb + +Description + Virtual mass model of Lamb. + + Reference: + \verbatim + Lamb, H. (1993). + Hydrodynamics. + Cambridge university press. + \endverbatim + +SourceFiles + Lamb.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lamb_H +#define Lamb_H + +#include "dispersedVirtualMassModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class aspectRatioModel; + +namespace virtualMassModels +{ + +/*---------------------------------------------------------------------------*\ + Class Lamb Declaration +\*---------------------------------------------------------------------------*/ + +class Lamb +: + public dispersedVirtualMassModel +{ +private: + + //- Private Data + + //- The aspect ratio model + autoPtr aspectRatio_; + + +public: + + //- Runtime type information + TypeName("Lamb"); + + + // Constructors + + //- Construct from a dictionary and an interface + Lamb + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~Lamb(); + + + // Member Functions + + //- Virtual mass coefficient + virtual tmp Cvm() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace virtualMassModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.C new file mode 100644 index 0000000000..f275de0d19 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "constantVirtualMassCoefficient.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace virtualMassModels +{ + defineTypeNameAndDebug(constantVirtualMassCoefficient, 0); + addToRunTimeSelectionTable + ( + virtualMassModel, + constantVirtualMassCoefficient, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::virtualMassModels::constantVirtualMassCoefficient:: +constantVirtualMassCoefficient +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + dispersedVirtualMassModel(dict, interface, registerObject), + Cvm_("Cvm", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::virtualMassModels::constantVirtualMassCoefficient:: +~constantVirtualMassCoefficient() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::virtualMassModels::constantVirtualMassCoefficient::Cvm() const +{ + return volScalarField::New + ( + "Cvm", + interface_.mesh(), + Cvm_ + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.H new file mode 100644 index 0000000000..4a9198a729 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/constantVirtualMassCoefficient/constantVirtualMassCoefficient.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::virtualMassModels::constantVirtualMassCoefficient + +Description + Constant coefficient virtual mass model. + +SourceFiles + constantVirtualMassCoefficient.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantVirtualMassCoefficient_H +#define constantVirtualMassCoefficient_H + +#include "dispersedVirtualMassModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace virtualMassModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantVirtualMassCoefficient Declaration +\*---------------------------------------------------------------------------*/ + +class constantVirtualMassCoefficient +: + public dispersedVirtualMassModel +{ + // Private Data + + //- Constant virtual mass coefficient + const dimensionedScalar Cvm_; + + +public: + + //- Runtime type information + TypeName("constantCoefficient"); + + + // Constructors + + //- Construct from a dictionary and an interface + constantVirtualMassCoefficient + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~constantVirtualMassCoefficient(); + + + // Member Functions + + //- Virtual mass coefficient + virtual tmp Cvm() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace virtualMassModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.C new file mode 100644 index 0000000000..b27e669fe8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dispersedVirtualMassModel.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::virtualMassModels::dispersedVirtualMassModel::dispersedVirtualMassModel +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + virtualMassModel(dict, interface, registerObject), + interface_(interface.modelCast()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::virtualMassModels::dispersedVirtualMassModel::~dispersedVirtualMassModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::virtualMassModels::dispersedVirtualMassModel::Ki() const +{ + return Cvm()*interface_.continuous().rho(); +} + + +Foam::tmp +Foam::virtualMassModels::dispersedVirtualMassModel::K() const +{ + return interface_.dispersed()*Ki(); +} + + +Foam::tmp +Foam::virtualMassModels::dispersedVirtualMassModel::Kf() const +{ + return fvc::interpolate(interface_.dispersed())*fvc::interpolate(Ki()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.H new file mode 100644 index 0000000000..df18b8da0b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/dispersedVirtualMassModel/dispersedVirtualMassModel.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dispersedVirtualMassModel + +Description + Model for virtual mass between two phases where one phase can be considered + dispersed in the other and the virtual mass therefore characterised by a + virtual mass coefficient + +SourceFiles + dispersedVirtualMassModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dispersedVirtualMassModel_H +#define dispersedVirtualMassModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "virtualMassModel.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ +namespace virtualMassModels +{ + +/*---------------------------------------------------------------------------*\ + Class dispersedVirtualMassModel Declaration +\*---------------------------------------------------------------------------*/ + +class dispersedVirtualMassModel +: + public virtualMassModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + // Constructors + + // Construct from a dictionary and an interface + dispersedVirtualMassModel + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~dispersedVirtualMassModel(); + + + // Member Functions + + //- Return the virtual mass coefficient + virtual tmp Cvm() const = 0; + + //- Return the phase-intensive virtual mass coefficient Ki + // used in the momentum equation + // ddt(alpha1*rho1*U1) + ... = ... alphad*K*(DU1_Dt - DU2_Dt) + // ddt(alpha2*rho2*U2) + ... = ... alphad*K*(DU1_Dt - DU2_Dt) + virtual tmp Ki() const; + + //- Return the virtual mass coefficient K + // used in the momentum equation + // ddt(alpha1*rho1*U1) + ... = ... K*(DU1_Dt - DU2_Dt) + // ddt(alpha2*rho2*U2) + ... = ... K*(DU1_Dt - DU2_Dt) + virtual tmp K() const; + + //- Return the virtual mass coefficient Kf + // used in the face-momentum equations + virtual tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace virtualMassModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.C new file mode 100644 index 0000000000..9afb7f0fcb --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "noVirtualMass.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace virtualMassModels +{ + defineTypeNameAndDebug(noVirtualMass, 0); + addToRunTimeSelectionTable(virtualMassModel, noVirtualMass, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::virtualMassModels::noVirtualMass::noVirtualMass +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + virtualMassModel(dict, interface, registerObject), + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::virtualMassModels::noVirtualMass::~noVirtualMass() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::virtualMassModels::noVirtualMass::K() const +{ + return volScalarField::New + ( + "K", + interface_.mesh(), + dimensionedScalar(dimK, 0) + ); +} + + +Foam::tmp +Foam::virtualMassModels::noVirtualMass::Kf() const +{ + return surfaceScalarField::New + ( + "Kf", + interface_.mesh(), + dimensionedScalar(dimK, 0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.H new file mode 100644 index 0000000000..f4d0f32b14 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/noVirtualMass/noVirtualMass.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::virtualMassModels::noVirtualMass + +Description + +SourceFiles + noVirtualMass.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noVirtualMass_H +#define noVirtualMass_H + +#include "virtualMassModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace virtualMassModels +{ + +/*---------------------------------------------------------------------------*\ + Class noVirtualMass Declaration +\*---------------------------------------------------------------------------*/ + +class noVirtualMass +: + public virtualMassModel +{ +protected: + + // Protected data + + //- Interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from a dictionary and an interface + noVirtualMass + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~noVirtualMass(); + + + // Member Functions + + //- Return the virtual mass coefficient K + // used in the momentum equations + virtual tmp K() const; + + //- Return the virtual mass coefficient Kf + // used in the face-momentum equations + virtual tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace virtualMassModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C new file mode 100644 index 0000000000..9240867c10 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "virtualMassModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(virtualMassModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(virtualMassModel, 0); + defineRunTimeSelectionTable(virtualMassModel, dictionary); +} + +const Foam::dimensionSet Foam::virtualMassModel::dimK(dimDensity); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::virtualMassModel::virtualMassModel +( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject +) +: + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, interface.name()), + interface.mesh().time().timeName(), + interface.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE, + registerObject + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::virtualMassModel::~virtualMassModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::virtualMassModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +Foam::tmp Foam::blendedVirtualMassModel::K() const +{ + return evaluate(&virtualMassModel::K, "K", virtualMassModel::dimK, false); +} + + +Foam::tmp Foam::blendedVirtualMassModel::Kf() const +{ + return evaluate(&virtualMassModel::Kf, "Kf", virtualMassModel::dimK, false); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H new file mode 100644 index 0000000000..627368f6dd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModel.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::virtualMassModel + +Description + Model for virtual mass between phases + +SourceFiles + virtualMassModel.C + virtualMassModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef virtualMassModel_H +#define virtualMassModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class virtualMassModel Declaration +\*---------------------------------------------------------------------------*/ + +class virtualMassModel +: + public regIOobject +{ +public: + + //- Runtime type information + TypeName("virtualMassModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + virtualMassModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ), + (dict, interface, registerObject) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimK; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = true; + + + // Constructors + + //- Construct from a dictionary and an interface + virtualMassModel + ( + const dictionary& dict, + const phaseInterface& interface, + const bool registerObject + ); + + + //- Destructor + virtual ~virtualMassModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true, + const bool registerObject=true + ); + + + // Member Functions + + //- Return the virtual mass coefficient K + // used in the momentum equation + // ddt(alpha1*rho1*U1) + ... = ... K*(DU1_Dt - DU2_Dt) + // ddt(alpha2*rho2*U2) + ... = ... K*(DU1_Dt - DU2_Dt) + virtual tmp K() const = 0; + + //- Return the virtual mass coefficient Kf + // used in the face-momentum equations + virtual tmp Kf() const = 0; + + // Dummy write for regIOobject + bool writeData(Ostream& os) const; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedVirtualMassModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedVirtualMassModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel + ::BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return the lift coefficient K + tmp K() const; + + //- Return the lift coefficient Kf + tmp Kf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModelNew.C new file mode 100644 index 0000000000..a07a5558ef --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/virtualMassModels/virtualMassModel/virtualMassModelNew.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "virtualMassModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::virtualMassModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer, + const bool registerObject +) +{ + const dictionary& modelDict = + outer ? interface.fluid().modelSubDict(dict) : dict; + + const word virtualMassModelType(modelDict.lookup("type")); + + Info<< "Selecting virtualMassModel for " + << interface.name() << ": " << virtualMassModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(virtualMassModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown virtualMassModelType type " + << virtualMassModelType << endl << endl + << "Valid virtualMassModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface, registerObject); +} + + +Foam::autoPtr Foam::blendedVirtualMassModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return + autoPtr + ( + new blendedVirtualMassModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.C new file mode 100644 index 0000000000..2ac5b6f0cf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "cosineWallDamping.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + defineTypeNameAndDebug(cosine, 0); + addToRunTimeSelectionTable + ( + wallDampingModel, + cosine, + dictionary + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::wallDampingModels::cosine::limiter() const +{ + return + ( + 0.5 + - 0.5*cos + ( + constant::mathematical::pi + *min + ( + max(yWall() - zeroWallDist_, dimensionedScalar(dimLength, 0)) + /(Cd_*interface_.dispersed().d()), + scalar(1) + ) + ) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDampingModels::cosine::cosine +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallDampingModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDampingModels::cosine::~cosine() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.H new file mode 100644 index 0000000000..fa86ea5d72 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/cosine/cosineWallDamping.H @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::wallDampingModels::cosine + +Description + +SourceFiles + cosineWallDamping.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cosineWallDamping_H +#define cosineWallDamping_H + +#include "wallDampingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + +/*---------------------------------------------------------------------------*\ + Class cosine Declaration +\*---------------------------------------------------------------------------*/ + +class cosine +: + public wallDampingModel +{ +protected: + + // Protected member functions + + //- Return the force limiter field + virtual tmp limiter() const; + + +public: + + //- Runtime type information + TypeName("cosine"); + + + // Constructors + + //- Construct from a dictionary and an interface + cosine + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~cosine(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallDampingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.C new file mode 100644 index 0000000000..6e7f927542 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "linearWallDamping.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + defineTypeNameAndDebug(linear, 0); + addToRunTimeSelectionTable + ( + wallDampingModel, + linear, + dictionary + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::wallDampingModels::linear::limiter() const +{ + return + min + ( + max(yWall() - zeroWallDist_, dimensionedScalar(dimLength, 0)) + /(Cd_*interface_.dispersed().d()), scalar(1) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDampingModels::linear::linear +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallDampingModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDampingModels::linear::~linear() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.H new file mode 100644 index 0000000000..98eedf357f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/linear/linearWallDamping.H @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::wallDampingModels::linear + +Description + +SourceFiles + linearWallDamping.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linearWallDamping_H +#define linearWallDamping_H + +#include "wallDampingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + +/*---------------------------------------------------------------------------*\ + Class linear Declaration +\*---------------------------------------------------------------------------*/ + +class linear +: + public wallDampingModel +{ +protected: + + // Protected member functions + + //- Return the force limiter field + virtual tmp limiter() const; + + +public: + + //- Runtime type information + TypeName("linear"); + + + // Constructors + + //- Construct from a dictionary and an interface + linear + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~linear(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallDampingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.C new file mode 100644 index 0000000000..13f718139d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "sineWallDamping.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + defineTypeNameAndDebug(sine, 0); + addToRunTimeSelectionTable + ( + wallDampingModel, + sine, + dictionary + ); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp +Foam::wallDampingModels::sine::limiter() const +{ + return sin + ( + constant::mathematical::piByTwo + *min + ( + max(yWall() - zeroWallDist_, dimensionedScalar(dimLength, 0)) + /(Cd_*interface_.dispersed().d()), + scalar(1) + ) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDampingModels::sine::sine +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallDampingModel(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDampingModels::sine::~sine() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.H new file mode 100644 index 0000000000..20382631cf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/sine/sineWallDamping.H @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::wallDampingModels::sine + +Description + +SourceFiles + sineWallDamping.C + +\*---------------------------------------------------------------------------*/ + +#ifndef sineWallDamping_H +#define sineWallDamping_H + +#include "wallDampingModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallDampingModels +{ + +/*---------------------------------------------------------------------------*\ + Class sine Declaration +\*---------------------------------------------------------------------------*/ + +class sine +: + public wallDampingModel +{ +protected: + + // Protected member functions + + //- Return the force limiter field + virtual tmp limiter() const; + + +public: + + //- Runtime type information + TypeName("sine"); + + + // Constructors + + //- Construct from a dictionary and an interface + sine + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~sine(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallDampingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.C new file mode 100644 index 0000000000..4e8d6af9c4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.C @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "wallDampingModel.H" +#include "surfaceInterpolate.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(wallDampingModel, 0); + defineRunTimeSelectionTable(wallDampingModel, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDampingModel::wallDampingModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallDependentModel(interface.mesh()), + interface_ + ( + interface.modelCast() + ), + Cd_("Cd", dimless, dict), + zeroWallDist_ + ( + dimensionedScalar::lookupOrDefault + ( + "zeroWallDist", + dict, + dimLength, + 0 + ) + ), + zeroInNearWallCells_ + ( + dict.lookupOrDefault("zeroInNearWallCells", false) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDampingModel::~wallDampingModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallDampingModel::damping() const +{ + tmp tlimiter(limiter().ptr()); + + if (zeroInNearWallCells_) + { + volScalarField& limiter = tlimiter.ref(); + + const fvBoundaryMesh& bMesh = limiter.mesh().boundary(); + + forAll(bMesh, patchi) + { + if (isA(bMesh[patchi])) + { + const labelUList& faceCells = bMesh[patchi].faceCells(); + + forAll(faceCells, facei) + { + limiter[faceCells[facei]] = 0; + } + } + } + + return tlimiter; + } + else + { + return tlimiter; + } +} + + +Foam::tmp +Foam::wallDampingModel::dampingf() const +{ + return fvc::interpolate(damping()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.H new file mode 100644 index 0000000000..6deab3ce85 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModel.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::wallDampingModel + +Description + Wall damping models can be used to filter interfacial models near the walls. + This is particularly useful for the lift force because of its dependence on + the velocity gradient. + + All damping functions accept the following parameters: + + - Cd: A coefficient for filtering the distance from the wall based on the + dispersed phase diameter. This can be useful to correct gradient + sampling error when the dispersed phase diameter is significantly + larger than near wall mesh resolution. + - zeroWallDist: A constant offset from the wall for the zero point of + the damping function. Below this distance, the damping will reduce the + value to zero. + - zeroInNearWallCells: A switch which sets the value to zero in near wall + cells regardless of the other parameters. This is recommended to be set + if a lift force is applied together with turbulent wall functions. + +Usage + \table + Property | Description | Required | Default value + Cd | Diameter coefficient | yes | none + zeroWallDist | Offset from wall | no | 0 + zeroInNearWallCells | Zero near wall cells | no | no + \endtable + +SourceFiles + wallDampingModel.C + wallDampingModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallDampingModel_H +#define wallDampingModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "wallDependentModel.H" +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallDampingModel Declaration +\*---------------------------------------------------------------------------*/ + +class wallDampingModel +: + public wallDependentModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + //- Diameter coefficient + const dimensionedScalar Cd_; + + //- Distance from wall below which the field is damped to zero + const dimensionedScalar zeroWallDist_; + + //- Set the value to zero in wall-adjacent cells + const Switch zeroInNearWallCells_; + + + // Protected member functions + + //- Return the force limiter field + virtual tmp limiter() const = 0; + + +public: + + //- Runtime type information + TypeName("wallDampingModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + wallDampingModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + wallDampingModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~wallDampingModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return damped coefficient + virtual tmp damping() const; + + //- Return damped face coefficient + virtual tmp dampingf() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModelNew.C new file mode 100644 index 0000000000..5382a27b2a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDampingModels/wallDampingModel/wallDampingModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "wallDampingModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::wallDampingModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + const word wallDampingModelType(dict.lookup("type")); + + Info<< "Selecting wallDampingModel for " + << interface.name() << ": " << wallDampingModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(wallDampingModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown wallDampingModelType type " + << wallDampingModelType << endl << endl + << "Valid wallDampingModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.C new file mode 100644 index 0000000000..2d502eb963 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.C @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2020 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 "wallDependentModel.H" +#include "wallDist.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallDependentModel::wallDependentModel(const fvMesh& mesh) +: + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallDependentModel::~wallDependentModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const Foam::volScalarField& Foam::wallDependentModel::yWall() const +{ + return wallDist::New(mesh_).y(); +} + + +const Foam::volVectorField& Foam::wallDependentModel::nWall() const +{ + return wallDist::New(mesh_).n(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.H new file mode 100644 index 0000000000..03dc0725fc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallDependentModel/wallDependentModel.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2020 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::wallDependentModel + +Description + A class which provides on-demand creation and caching of wall distance and + wall normal fields for use by multiple models. + +SourceFiles + wallDependentModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallDependentModel_H +#define wallDependentModel_H + +#include "fvMesh.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallDependentModel Declaration +\*---------------------------------------------------------------------------*/ + +class wallDependentModel +{ + // Private Data + + //- Reference to the mesh + const fvMesh& mesh_; + + +public: + + // Constructors + + //- Construct from a mesh + wallDependentModel(const fvMesh& mesh); + + //- Disallow default bitwise copy construction + wallDependentModel(const wallDependentModel&) = delete; + + + //- Destructor + virtual ~wallDependentModel(); + + + // Member Functions + + //- Return the wall distance, creating and storing it if necessary + const volScalarField& yWall() const; + + //- Return the wall normal, creating and storing it if necessary + const volVectorField& nWall() const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const wallDependentModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.C new file mode 100644 index 0000000000..17edc74d1d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Antal.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + defineTypeNameAndDebug(Antal, 0); + addToRunTimeSelectionTable(wallLubricationModel, Antal, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::Antal::Antal +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedWallLubricationModel(dict, interface), + Cw1_("Cw1", dimless, dict), + Cw2_("Cw2", dimless, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::Antal::~Antal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::wallLubricationModels::Antal::Fi() const +{ + const volVectorField Ur(interface_.Ur()); + + const volVectorField& n(nWall()); + + return zeroGradWalls + ( + max + ( + dimensionedScalar(dimless/dimLength, 0), + Cw1_/interface_.dispersed().d() + Cw2_/yWall() + ) + *interface_.continuous().rho() + *magSqr(Ur - (Ur & n)*n) + *n + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.H new file mode 100644 index 0000000000..4eedafad00 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Antal/Antal.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::wallLubricationModels::Antal + +Description + Wall lubrication model of Antal et al. + + Reference: + \verbatim + Antal, S. P., Lahey Jr, R. T., & Flaherty, J. E. (1991). + Analysis of phase distribution in fully developed laminar bubbly + two-phase flow. + International Journal of Multiphase Flow, 17(5), 635-652. + \endverbatim + +SourceFiles + Antal.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Antal_H +#define Antal_H + +#include "dispersedWallLubricationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + +/*---------------------------------------------------------------------------*\ + Class Antal Declaration +\*---------------------------------------------------------------------------*/ + +class Antal +: + public dispersedWallLubricationModel +{ + // Private Data + + //- Coefficient 1 + const dimensionedScalar Cw1_; + + //- Coefficient 2 + const dimensionedScalar Cw2_; + + +public: + + //- Runtime type information + TypeName("Antal"); + + + // Constructors + + //- Construct from a dictionary and an interface + Antal + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Antal(); + + + // Member Functions + + //- Return phase-intensive wall lubrication force + tmp Fi() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallLubricationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.C new file mode 100644 index 0000000000..b4310a108a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "Frank.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + defineTypeNameAndDebug(Frank, 0); + addToRunTimeSelectionTable + ( + wallLubricationModel, + Frank, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::Frank::Frank +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedWallLubricationModel(dict, interface), + Cwd_("Cwd", dimless, dict), + Cwc_("Cwc", dimless, dict), + p_(dict.lookup("p")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::Frank::~Frank() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::wallLubricationModels::Frank::Fi() const +{ + const volVectorField Ur(interface_.Ur()); + + const volVectorField& n(nWall()); + const volScalarField& y(yWall()); + + const volScalarField Eo(interface_.Eo()); + const volScalarField yTilde(y/(Cwc_*interface_.dispersed().d())); + + return zeroGradWalls + ( + ( + pos0(Eo - 1)*neg(Eo - 5)*exp(-0.933*Eo + 0.179) + + pos0(Eo - 5)*neg(Eo - 33)*(0.00599*Eo - 0.0187) + + pos0(Eo - 33)*0.179 + ) + *max + ( + dimensionedScalar(dimless/dimLength, 0), + (1 - yTilde)/(Cwd_*y*pow(yTilde, p_ - 1)) + ) + *interface_.continuous().rho() + *magSqr(Ur - (Ur & n)*n) + *n + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.H new file mode 100644 index 0000000000..740a9437f8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/Frank/Frank.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::wallLubricationModels::Frank + +Description + Wall lubrication model of Frank. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Frank, T. (2005, April). + Advances in computational fluid dynamics (CFD) of 3-dimensional + gas-liquid multiphase flows. + In NAFEMS Seminar: Simulation of Complex Flows (CFD)-Applications and + Trends, Wiesbaden, Germany (pp. 1-18). + \endverbatim + +SourceFiles + Frank.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Frank_H +#define Frank_H + +#include "dispersedWallLubricationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + +/*---------------------------------------------------------------------------*\ + Class Frank Declaration +\*---------------------------------------------------------------------------*/ + +class Frank +: + public dispersedWallLubricationModel +{ + // Private Data + + //- Coefficient d + const dimensionedScalar Cwd_; + + //- Coefficient c + const dimensionedScalar Cwc_; + + //- Power p + const scalar p_; + + +public: + + //- Runtime type information + TypeName("Frank"); + + + // Constructors + + //- Construct from a dictionary and an interface + Frank + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~Frank(); + + + // Member Functions + + //- Return phase-intensive wall lubrication force + tmp Fi() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallLubricationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C new file mode 100644 index 0000000000..06218f84e7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "TomiyamaWallLubrication.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + defineTypeNameAndDebug(TomiyamaWallLubrication, 0); + addToRunTimeSelectionTable + ( + wallLubricationModel, + TomiyamaWallLubrication, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::TomiyamaWallLubrication::TomiyamaWallLubrication +( + const dictionary& dict, + const phaseInterface& interface +) +: + dispersedWallLubricationModel(dict, interface), + D_("Cwd", dimLength, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::TomiyamaWallLubrication::~TomiyamaWallLubrication() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallLubricationModels::TomiyamaWallLubrication::Fi() const +{ + const volVectorField Ur(interface_.Ur()); + + const volVectorField& n(nWall()); + const volScalarField& y(yWall()); + + const volScalarField Eo(interface_.Eo()); + + return zeroGradWalls + ( + ( + pos0(Eo - 1)*neg(Eo - 5)*exp(-0.933*Eo + 0.179) + + pos0(Eo - 5)*neg(Eo - 33)*(0.00599*Eo - 0.0187) + + pos0(Eo - 33)*0.179 + ) + *0.5 + *interface_.dispersed().d() + *( + 1/sqr(y) + - 1/sqr(D_ - y) + ) + *interface_.continuous().rho() + *magSqr(Ur - (Ur & n)*n) + *n + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.H new file mode 100644 index 0000000000..87195daa8a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/TomiyamaWallLubrication/TomiyamaWallLubrication.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::wallLubricationModels::TomiyamaWallLubrication + +Description + Wall lubrication model of Tomiyama. + + References: + \verbatim + Otromke, M. (2013). + Implementation and Comparison of Correlations for interfacial Forces in + a Gas-Liquid System within an Euler-Euler Framework. + PhD Thesis. + \endverbatim + + \verbatim + Tomiyama, A. (1998). + Struggle with computational bubble dynamics. + Multiphase Science and Technology, 10(4), 369-405. + \endverbatim + +SourceFiles + TomiyamaWallLubrication.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TomiyamaWallLubrication_H +#define TomiyamaWallLubrication_H + +#include "dispersedWallLubricationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + +/*---------------------------------------------------------------------------*\ + Class TomiyamaWallLubrication Declaration +\*---------------------------------------------------------------------------*/ + +class TomiyamaWallLubrication +: + public dispersedWallLubricationModel +{ + // Private Data + + //- Characteristic channel dimension + const dimensionedScalar D_; + + +public: + + //- Runtime type information + TypeName("Tomiyama"); + + + // Constructors + + //- Construct from a dictionary and an interface + TomiyamaWallLubrication + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~TomiyamaWallLubrication(); + + + // Member Functions + + //- Return phase-intensive wall lubrication force + virtual tmp Fi() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallLubricationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.C new file mode 100644 index 0000000000..c32c051272 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "dispersedWallLubricationModel.H" +#include "fvcCurl.H" +#include "fvcFlux.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::dispersedWallLubricationModel:: +dispersedWallLubricationModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallLubricationModel(dict, interface), + interface_ + ( + interface.modelCast() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::dispersedWallLubricationModel:: +~dispersedWallLubricationModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallLubricationModels::dispersedWallLubricationModel::F() const +{ + return interface_.dispersed()*Fi(); +} + + +Foam::tmp +Foam::wallLubricationModels::dispersedWallLubricationModel::Ff() const +{ + return fvc::interpolate(interface_.dispersed())*fvc::flux(Fi()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.H new file mode 100644 index 0000000000..2ef3527ac7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/dispersedWallLubricationModel/dispersedWallLubricationModel.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::dispersedWallLubricationModel + +Description + Model for the wall lubrication force between two phases where one phase can + be considered dispersed in the other + +SourceFiles + dispersedWallLubricationModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dispersedWallLubricationModel_H +#define dispersedWallLubricationModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "wallLubricationModel.H" +#include "dispersedPhaseInterface.H" + +namespace Foam +{ +namespace wallLubricationModels +{ + +/*---------------------------------------------------------------------------*\ + Class dispersedWallLubricationModel Declaration +\*---------------------------------------------------------------------------*/ + +class dispersedWallLubricationModel +: + public wallLubricationModel +{ +protected: + + // Protected data + + //- Interface + const dispersedPhaseInterface interface_; + + +public: + + // Constructors + + // Construct from a dictionary and an interface + dispersedWallLubricationModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~dispersedWallLubricationModel(); + + + // Member Functions + + //- Return phase-intensive wallLubrication force + virtual tmp Fi() const = 0; + + //- Return wallLubrication force + virtual tmp F() const; + + //- Return face wallLubrication force + virtual tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace dragModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.C new file mode 100644 index 0000000000..84a2daa20d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "noWallLubrication.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + defineTypeNameAndDebug(noWallLubrication, 0); + addToRunTimeSelectionTable + ( + wallLubricationModel, + noWallLubrication, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::noWallLubrication::noWallLubrication +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallLubricationModel(dict, interface), + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModels::noWallLubrication::~noWallLubrication() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallLubricationModels::noWallLubrication::F() const +{ + return volVectorField::New + ( + "F", + interface_.mesh(), + dimensionedVector(dimF, Zero) + ); +} + + +Foam::tmp +Foam::wallLubricationModels::noWallLubrication::Ff() const +{ + return surfaceScalarField::New + ( + "F", + interface_.mesh(), + dimensionedScalar(dimF*dimArea, Zero) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.H new file mode 100644 index 0000000000..ddab85ebea --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/noWallLubrication/noWallLubrication.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::wallLubricationModels::noWallLubrication + +Description + +SourceFiles + noWallLubrication.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noWallLubrication_H +#define noWallLubrication_H + +#include "wallLubricationModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallLubricationModels +{ + +/*---------------------------------------------------------------------------*\ + Class noWallLubrication Declaration +\*---------------------------------------------------------------------------*/ + +class noWallLubrication +: + public wallLubricationModel +{ +protected: + + // Protected data + + //- Interface + const phaseInterface interface_; + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from a dictionary and an interface + noWallLubrication + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~noWallLubrication(); + + + // Member Functions + + //- Return wall lubrication force + virtual tmp F() const; + + //- Return face wall lubrication force + virtual tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace wallLubricationModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C new file mode 100644 index 0000000000..9684967932 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.C @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "wallLubricationModel.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(wallLubricationModel, 0); + defineBlendedInterfacialModelTypeNameAndDebug(wallLubricationModel, 0); + defineRunTimeSelectionTable(wallLubricationModel, dictionary); +} + +const Foam::dimensionSet Foam::wallLubricationModel::dimF(1, -2, -2, 0, 0); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::wallLubricationModel::zeroGradWalls +( + tmp tFi +) const +{ + volVectorField& Fi = tFi.ref(); + const fvPatchList& patches = Fi.mesh().boundary(); + + volVectorField::Boundary& FiBf = Fi.boundaryFieldRef(); + + forAll(patches, patchi) + { + if (isA(patches[patchi])) + { + fvPatchVectorField& Fiw = FiBf[patchi]; + Fiw = Fiw.patchInternalField(); + } + } + + return tFi; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallLubricationModel::wallLubricationModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + wallDependentModel(interface.mesh()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallLubricationModel::~wallLubricationModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::blendedWallLubricationModel::F() const +{ + return + evaluate + ( + &wallLubricationModel::F, + "F", + wallLubricationModel::dimF, + true + ); +} + + +Foam::tmp +Foam::blendedWallLubricationModel::Ff() const +{ + return + evaluate + ( + &wallLubricationModel::Ff, + "Ff", + wallLubricationModel::dimF*dimArea, + true + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H new file mode 100644 index 0000000000..cbb275fc8a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModel.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::wallLubricationModel + +Description + Model for the wall lubrication force between two phases + +SourceFiles + wallLubricationModel.C + wallLubricationModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef wallLubricationModel_H +#define wallLubricationModel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "wallDependentModel.H" +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" +#include "BlendedInterfacialModel.H" + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallLubricationModel Declaration +\*---------------------------------------------------------------------------*/ + +class wallLubricationModel +: + public wallDependentModel +{ +protected: + + // Protected member functions + + //- Zero-gradient wall-lubrication force at walls + tmp zeroGradWalls(tmp) const; + + +public: + + //- Runtime type information + TypeName("wallLubricationModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + wallLubricationModel, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Static Data Members + + //- Coefficient dimensions + static const dimensionSet dimF; + + //- Does this model require correcting on fixed flux boundaries? + static const bool correctFixedFluxBCs = true; + + + // Constructors + + //- Construct from a dictionary and an interface + wallLubricationModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~wallLubricationModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface, + const bool outer=true + ); + + + // Member Functions + + //- Return wall lubrication force + virtual tmp F() const = 0; + + //- Return face wall lubrication force + virtual tmp Ff() const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class blendedWallLubricationModel Declaration +\*---------------------------------------------------------------------------*/ + +class blendedWallLubricationModel +: + public BlendedInterfacialModel +{ +public: + + // Constructors + + //- Inherit base class constructors + using + BlendedInterfacialModel:: + BlendedInterfacialModel; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Member Functions + + //- Return wall lubrication force + tmp F() const; + + //- Return face wall lubrication force + tmp Ff() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModelNew.C new file mode 100644 index 0000000000..2412471465 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/interfacialModels/wallLubricationModels/wallLubricationModel/wallLubricationModelNew.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "wallLubricationModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::wallLubricationModel::New +( + const dictionary& dict, + const phaseInterface& interface, + const bool outer +) +{ + const dictionary& modelDict = + outer + ? interface.fluid().modelSubDict(dict) + : dict; + + const word wallLubricationModelType(modelDict.lookup("type")); + + Info<< "Selecting wallLubricationModel for " + << interface.name() << ": " << wallLubricationModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(wallLubricationModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown wallLubricationModelType type " + << wallLubricationModelType << endl << endl + << "Valid wallLubricationModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(modelDict, interface); +} + + +Foam::autoPtr +Foam::blendedWallLubricationModel::New +( + const dictionary& dict, + const phaseInterface& interface +) +{ + return + autoPtr + ( + new blendedWallLubricationModel(dict, interface) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/files new file mode 100644 index 0000000000..1f833d70df --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/files @@ -0,0 +1,73 @@ +multiphaseCompressibleMomentumTransportModels.C + + +phasePressureModel/phasePressureModel.C + + +kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C + +kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.C +kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModelNew.C +kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C +kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C +kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +kineticTheoryModels/viscosityModel/none/noneViscosity.C + +kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C +kineticTheoryModels/conductivityModel/conductivityModel/conductivityModelNew.C +kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C +kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C + +kineticTheoryModels/radialModel/radialModel/radialModel.C +kineticTheoryModels/radialModel/radialModel/radialModelNew.C +kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C +kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C +kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C + +kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C +kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModelNew.C +kineticTheoryModels/granularPressureModel/Lun/LunPressure.C +kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C + +kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C +kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModelNew.C +kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C +kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C +kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C + + +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModelNew.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C +derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C + +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModelNew.C +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C +derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.C + +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModelNew.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C +derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.C + +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModelNew.C +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C +derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C + +derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C +derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C +derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C +derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C + +derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C +derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C + + +LIB = $(FOAM_LIBBIN)/libmultiphaseMomentumTransportModels diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/options new file mode 100644 index 0000000000..289af49e9f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/Make/options @@ -0,0 +1,20 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I../interfacialModels/lnInclude\ + -I../interfacialCompositionModels/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lphaseSystem \ + -leulerianInterfacialModels \ + -leulerianInterfacialCompositionModels \ + -lphaseCompressibleMomentumTransportModels diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C new file mode 100644 index 0000000000..68a885f638 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "JohnsonJacksonParticleSlipFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "kineticTheoryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + JohnsonJacksonParticleSlipFvPatchVectorField + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + partialSlipFvPatchVectorField(p, iF), + specularityCoefficient_("specularityCoefficient", dimless, 0) +{} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + partialSlipFvPatchVectorField(p, iF), + specularityCoefficient_ + ( + "specularityCoefficient", + dimless, + dict.lookup("specularityCoefficient") + ) +{ + if + ( + (specularityCoefficient_.value() < 0) + || (specularityCoefficient_.value() > 1) + ) + { + FatalErrorInFunction + << "The specularity coefficient has to be between 0 and 1" + << abort(FatalError); + } + + fvPatchVectorField::operator= + ( + vectorField("value", dict, p.size()) + ); +} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const JohnsonJacksonParticleSlipFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + partialSlipFvPatchVectorField(ptf, p, iF, mapper), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +Foam::JohnsonJacksonParticleSlipFvPatchVectorField:: +JohnsonJacksonParticleSlipFvPatchVectorField +( + const JohnsonJacksonParticleSlipFvPatchVectorField& ptf, + const DimensionedField& iF +) +: + partialSlipFvPatchVectorField(ptf, iF), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // lookup the fluid model and the phase + const phaseSystem& fluid = + db().lookupObject(phaseSystem::propertiesName); + + const phaseModel& phase + ( + fluid.phases()[internalField().group()] + ); + + // lookup all the fields on this patch + const fvPatchScalarField& alpha + ( + patch().lookupPatchField + ( + phase.volScalarField::name() + ) + ); + + const fvPatchScalarField& gs0 + ( + patch().lookupPatchField + ( + IOobject::groupName + ( + Foam::typedName("gs0"), + phase.name() + ) + ) + ); + + const scalarField nu + ( + patch().lookupPatchField + ( + IOobject::groupName("nut", phase.name()) + ) + ); + + word ThetaName(IOobject::groupName("Theta", phase.name())); + + const fvPatchScalarField& Theta + ( + db().foundObject(ThetaName) + ? patch().lookupPatchField(ThetaName) + : alpha + ); + + // calculate the slip value fraction + scalarField c + ( + constant::mathematical::pi + *alpha + *gs0 + *specularityCoefficient_.value() + *sqrt(3*Theta) + /max(6*nu*phase.alphaMax(), small) + ); + + this->valueFraction() = c/(c + patch().deltaCoeffs()); + + partialSlipFvPatchVectorField::updateCoeffs(); +} + + +void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchVectorField::write(os); + writeEntry(os, "specularityCoefficient", specularityCoefficient_); + writeEntry(os, "value", *this); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H new file mode 100644 index 0000000000..33c966d750 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::JohnsonJacksonParticleSlipFvPatchVectorField + +Description + Partial slip boundary condition for the particulate velocity. + + References: + \verbatim + Reuge, N., Cadoret, L., Coufort-Saudejaud, C., Pannala, S., Syamlal, M., + & Caussat, B. (2008). + Multifluid Eulerian modeling of dense gas–solids fluidised bed + hydrodynamics: influence of the dissipation parameters. + Chemical Engineering Science, 63(22), 5540-5551. + \endverbatim + + \verbatim + Johnson, P. C., & Jackson, R. (1987). + Frictional–collisional constitutive relations for granular materials, + with application to plane shearing. + Journal of fluid Mechanics, 176, 67-93. + \endverbatim + +SourceFiles + JohnsonJacksonParticleSlipFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonParticleSlipFvPatchVectorField_H +#define JohnsonJacksonParticleSlipFvPatchVectorField_H + +#include "partialSlipFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonParticleSlipFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonParticleSlipFvPatchVectorField +: + public partialSlipFvPatchVectorField +{ + // Private Data + + //- Specularity coefficient + dimensionedScalar specularityCoefficient_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonParticleSlip"); + + + // Constructors + + //- Construct from patch and internal field + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping onto a new patch + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField& + ) = delete; + + //- Copy constructor setting internal field reference + JohnsonJacksonParticleSlipFvPatchVectorField + ( + const JohnsonJacksonParticleSlipFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new JohnsonJacksonParticleSlipFvPatchVectorField(*this, iF) + ); + } + + + // Member Functions + + //- Update the coefficients + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C new file mode 100644 index 0000000000..35f99aae6a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C @@ -0,0 +1,256 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "JohnsonJacksonParticleThetaFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "kineticTheoryModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + JohnsonJacksonParticleThetaFvPatchScalarField + ); +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF), + restitutionCoefficient_("restitutionCoefficient", dimless, 0), + specularityCoefficient_("specularityCoefficient", dimless, 0) +{} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF, dict, false), + restitutionCoefficient_ + ( + "restitutionCoefficient", + dimless, + dict.lookup("restitutionCoefficient") + ), + specularityCoefficient_ + ( + "specularityCoefficient", + dimless, + dict.lookup("specularityCoefficient") + ) +{ + if + ( + (restitutionCoefficient_.value() < 0) + || (restitutionCoefficient_.value() > 1) + ) + { + FatalErrorInFunction + << "The restitution coefficient has to be between 0 and 1" + << abort(FatalError); + } + + if + ( + (specularityCoefficient_.value() < 0) + || (specularityCoefficient_.value() > 1) + ) + { + FatalErrorInFunction + << "The specularity coefficient has to be between 0 and 1" + << abort(FatalError); + } + + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); +} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const JohnsonJacksonParticleThetaFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(ptf, p, iF, mapper), + restitutionCoefficient_(ptf.restitutionCoefficient_), + specularityCoefficient_(ptf.specularityCoefficient_) +{ +} + + +Foam::JohnsonJacksonParticleThetaFvPatchScalarField:: +JohnsonJacksonParticleThetaFvPatchScalarField +( + const JohnsonJacksonParticleThetaFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(ptf, iF), + restitutionCoefficient_(ptf.restitutionCoefficient_), + specularityCoefficient_(ptf.specularityCoefficient_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // lookup the fluid model and the phase + const phaseSystem& fluid = + db().lookupObject(phaseSystem::propertiesName); + + const phaseModel& phase + ( + fluid.phases()[internalField().group()] + ); + + // lookup all the fields on this patch + const fvPatchScalarField& alpha + ( + patch().lookupPatchField + ( + phase.volScalarField::name() + ) + ); + + const fvPatchVectorField& U + ( + patch().lookupPatchField + ( + IOobject::groupName("U", phase.name()) + ) + ); + + const fvPatchScalarField& gs0 + ( + patch().lookupPatchField + ( + IOobject::groupName + ( + Foam::typedName("gs0"), + phase.name() + ) + ) + ); + + const fvPatchScalarField& kappa + ( + patch().lookupPatchField + ( + IOobject::groupName + ( + Foam::typedName("kappa"), + phase.name() + ) + ) + ); + + const scalarField Theta(patchInternalField()); + + // calculate the reference value and the value fraction + if (restitutionCoefficient_.value() != 1.0) + { + this->refValue() = + (2.0/3.0) + *specularityCoefficient_.value() + *magSqr(U) + /(scalar(1) - sqr(restitutionCoefficient_.value())); + + this->refGrad() = 0.0; + + scalarField c + ( + constant::mathematical::pi + *alpha + *gs0 + *(scalar(1) - sqr(restitutionCoefficient_.value())) + *sqrt(3*Theta) + /max(4*kappa*phase.alphaMax(), small) + ); + + this->valueFraction() = c/(c + patch().deltaCoeffs()); + } + + // for a restitution coefficient of 1, the boundary degenerates to a fixed + // gradient condition + else + { + this->refValue() = 0.0; + + this->refGrad() = + pos0(alpha - small) + *constant::mathematical::pi + *specularityCoefficient_.value() + *alpha + *gs0 + *sqrt(3*Theta) + *magSqr(U) + /max(6*kappa*phase.alphaMax(), small); + + this->valueFraction() = 0; + } + + mixedFvPatchScalarField::updateCoeffs(); +} + + +void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + writeEntry(os, "restitutionCoefficient", restitutionCoefficient_); + writeEntry(os, "specularityCoefficient", specularityCoefficient_); + writeEntry(os, "value", *this); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H new file mode 100644 index 0000000000..dd1c104fed --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::JohnsonJacksonParticleThetaFvPatchScalarField + +Description + Robin condition for the particulate granular temperature. + + References: + \verbatim + Reuge, N., Cadoret, L., Coufort-Saudejaud, C., Pannala, S., Syamlal, M., + & Caussat, B. (2008). + Multifluid Eulerian modeling of dense gas–solids fluidised bed + hydrodynamics: influence of the dissipation parameters. + Chemical Engineering Science, 63(22), 5540-5551. + \endverbatim + + \verbatim + Johnson, P. C., & Jackson, R. (1987). + Frictional–collisional constitutive relations for granular materials, + with application to plane shearing. + Journal of fluid Mechanics, 176, 67-93. + \endverbatim + +SourceFiles + JohnsonJacksonParticleThetaFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonParticleThetaFvPatchScalarField_H +#define JohnsonJacksonParticleThetaFvPatchScalarField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonParticleThetaFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonParticleThetaFvPatchScalarField +: + public mixedFvPatchScalarField +{ + // Private Data + + //- Particle-wall restitution coefficient + dimensionedScalar restitutionCoefficient_; + + //- Specularity coefficient + dimensionedScalar specularityCoefficient_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonParticleTheta"); + + + // Constructors + + //- Construct from patch and internal field + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping onto a new patch + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + JohnsonJacksonParticleThetaFvPatchScalarField + ( + const JohnsonJacksonParticleThetaFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new JohnsonJacksonParticleThetaFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + //- Update the coefficients + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..eb0ac19ce3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2020 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 "alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), + fixedDmdtf_(0) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), + fixedDmdtf_(dict.lookupOrDefault("fixedDmdtf", 0)) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + psf, + p, + iF, + mapper + ), + fixedDmdtf_(psf.fixedDmdtf_) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), + fixedDmdtf_(psf.fixedDmdtf_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + dmdtf_ = (1 - relax_)*dmdtf_ + relax_*fixedDmdtf_; + + operator==(calcAlphat(*this)); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); + + writeEntry(os, "fixedDmdtf", fixedDmdtf_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..ba895e9fbd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2020 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::compressible:: + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + +Description + A simple alphatPhaseChangeWallFunctionFvPatchScalarField with + a fixed volumetric phase-change mass flux. + +See also + Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField + +SourceFiles + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H +#define alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H + +#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +: + public alphatPhaseChangeWallFunctionFvPatchScalarField +{ + // Private Data + + //- Volumetric phase-change mass flux in near wall cells + scalar fixedDmdtf_; + + +public: + + //- Runtime type information + TypeName("compressible::alphatFixedDmdtfWallBoilingWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + // onto a new patch + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member Functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..30b908e049 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -0,0 +1,224 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "phaseInterface.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(alphatPhaseChangeWallFunctionFvPatchScalarField, 0); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(p, iF), + otherPhaseName_(word::null), + relax_(1), + dmdtf_(p.size(), 0) +{} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), + otherPhaseName_(dict.lookup("otherPhase")), + relax_(dict.lookupOrDefault("relax", 1)), + dmdtf_(p.size(), 0) +{ + // Check that otherPhaseName != this phase + if (internalField().group() == otherPhaseName_) + { + FatalErrorInFunction + << "otherPhase should be the name of the vapor phase that " + << "corresponds to the liquid base or vice versa" << nl + << "This phase: " << internalField().group() << nl + << "otherPhase: " << otherPhaseName_ + << abort(FatalError); + } + + if (dict.found("dmdtf")) + { + dmdtf_ = scalarField("dmdtf", dict, p.size()); + } +} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const alphatPhaseChangeWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + otherPhaseName_(ptf.otherPhaseName_), + relax_(ptf.relax_), + dmdtf_(mapper(ptf.dmdtf_)) +{} + + +alphatPhaseChangeWallFunctionFvPatchScalarField:: +alphatPhaseChangeWallFunctionFvPatchScalarField +( + const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf, + const DimensionedField& iF +) +: + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(awfpsf, iF), + otherPhaseName_(awfpsf.otherPhaseName_), + relax_(awfpsf.relax_), + dmdtf_(awfpsf.dmdtf_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool alphatPhaseChangeWallFunctionFvPatchScalarField:: +activeInterface(const phaseInterface& interface) const +{ + const phaseSystem& fluid = interface.fluid(); + + if + ( + interface.contains(fluid.phases()[internalField().group()]) + && interface.contains(fluid.phases()[otherPhaseName_]) + ) + { + return true; + } + else + { + return false; + } +} + + +const scalarField& +alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf() const +{ + return dmdtf_; +} + + +const scalarField& alphatPhaseChangeWallFunctionFvPatchScalarField:: +dmdtf(const phaseInterface& interface) const +{ + if (activeInterface(interface)) + { + return dmdtf_; + } + else + { + FatalErrorInFunction + << "Phase change mass transfer rate requested for interface on " + << "which there is no phase change " + << abort(FatalError); + + return dmdtf_; + } +} + + +void alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::autoMap(m); + + m(dmdtf_, dmdtf_); +} + + +void alphatPhaseChangeWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + dmdtf_.rmap(tiptf.dmdtf_, addr); +} + + +void alphatPhaseChangeWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::reset(ptf); + + const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + dmdtf_.reset(tiptf.dmdtf_); +} + + +void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write(os); + + writeEntry(os, "otherPhase", otherPhaseName_); + writeEntry(os, "relax", relax_); + writeEntry(os, "dmdtf", dmdtf_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..0f8c2535c2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField + +Description + Abstract base-class for all alphatWallFunctions supporting phase-change. + +See also + Foam::alphatPhaseJayatillekeWallFunctionFvPatchScalarField + +SourceFiles + alphatPhaseChangeWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef alphatPhaseChangeWallFunctionFvPatchScalarField_H +#define alphatPhaseChangeWallFunctionFvPatchScalarField_H + +#include "alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class phaseInterface; + +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatPhaseChangeWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class alphatPhaseChangeWallFunctionFvPatchScalarField +: + public alphatPhaseJayatillekeWallFunctionFvPatchScalarField +{ +protected: + + // Protected data + + //- Name of the other phase + const word otherPhaseName_; + + //- Relaxation factor + const scalar relax_; + + //- Rate of phase-change + scalarField dmdtf_; + + +public: + + //- Runtime type information + TypeName("compressible::alphatPhaseChangeWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatPhaseChangeWallFunctionFvPatchScalarField + // onto a new patch + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + const alphatPhaseChangeWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + + // Member Functions + + //- Is there phase change mass transfer for this interface? + bool activeInterface(const phaseInterface&) const; + + //- Return the rate of phase-change + const scalarField& dmdtf() const; + + //- Return the rate of phase-change for an interface + const scalarField& dmdtf(const phaseInterface&) const; + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + // Used to update fields following mesh topology change + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + // Used to reconstruct fields + virtual void rmap(const fvPatchScalarField&, const labelList&); + + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs() = 0; + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..9fbd85b2dc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C @@ -0,0 +1,315 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H" +#include "phaseSystem.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +scalar alphatPhaseJayatillekeWallFunctionFvPatchScalarField::maxExp_ = 50.0; +scalar alphatPhaseJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01; +label alphatPhaseJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10; + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +tmp alphatPhaseJayatillekeWallFunctionFvPatchScalarField::Psmooth +( + const scalarField& Prat +) const +{ + return 9.24*(pow(Prat, 0.75) - 1.0)*(1.0 + 0.28*exp(-0.007*Prat)); +} + + +tmp +alphatPhaseJayatillekeWallFunctionFvPatchScalarField::yPlusTherm +( + const nutWallFunctionFvPatchScalarField& nutw, + const scalarField& P, + const scalarField& Prat +) const +{ + tmp typsf(new scalarField(this->size())); + scalarField& ypsf = typsf.ref(); + + forAll(ypsf, facei) + { + scalar ypt = 11.0; + + for (int i=0; i& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Prt_(0.85) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Prt_(dict.lookupOrDefault("Prt", 0.85)) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Prt_(ptf.Prt_) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& awfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(awfpsf, iF), + Prt_(awfpsf.Prt_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp +alphatPhaseJayatillekeWallFunctionFvPatchScalarField::calcAlphat +( + const scalarField& prevAlphat +) const +{ + // Lookup the fluid model + const phaseSystem& fluid = + db().lookupObject(phaseSystem::propertiesName); + + const phaseModel& phase + ( + fluid.phases()[internalField().group()] + ); + + const label patchi = patch().index(); + + // Retrieve turbulence properties from model + const phaseCompressible::momentumTransportModel& turbModel = + db().lookupType + ( + phase.name() + ); + + const nutWallFunctionFvPatchScalarField& nutw = + nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); + + const scalar Cmu25 = pow025(nutw.Cmu()); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp talphaw + ( + phase.thermo().kappa().boundaryField()[patchi] + /phase.thermo().Cp().boundaryField()[patchi] + ); + const scalarField& alphaw = talphaw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + const fvPatchScalarField& kw = k.boundaryField()[patchi]; + + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const scalarField magUp(mag(Uw.patchInternalField() - Uw)); + const scalarField magGradUw(mag(Uw.snGrad())); + + const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchi]; + const fvPatchScalarField& hew = + phase.thermo().he().boundaryField()[patchi]; + + const fvPatchScalarField& Tw = + phase.thermo().T().boundaryField()[patchi]; + + const scalarField Tp(Tw.patchInternalField()); + + // Heat flux [W/m^2] - lagging alphatw + const scalarField qDot + ( + (prevAlphat + alphaw)*hew.snGrad() + ); + + const scalarField uTau(Cmu25*sqrt(kw)); + + const scalarField yPlus(uTau*y/nuw); + + const scalarField Pr(rhow*nuw/alphaw); + + // Molecular-to-turbulent Prandtl number ratio + const scalarField Prat(Pr/Prt_); + + // Thermal sublayer thickness + const scalarField P(this->Psmooth(Prat)); + + const scalarField yPlusTherm(this->yPlusTherm(nutw, P, Prat)); + + tmp talphatConv(new scalarField(this->size())); + scalarField& alphatConv = talphatConv.ref(); + + // Populate boundary values + forAll(alphatConv, facei) + { + // Evaluate new effective thermal diffusivity + scalar alphaEff = 0.0; + if (yPlus[facei] < yPlusTherm[facei]) + { + const scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei]; + + const scalar B = qDot[facei]*Pr[facei]*yPlus[facei]; + + const scalar C = + Pr[facei]*0.5*rhow[facei]*uTau[facei]*sqr(magUp[facei]); + + alphaEff = A/(B + C + vSmall); + } + else + { + const scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei]; + + const scalar B = + qDot[facei]*Prt_ + *(1.0/nutw.kappa()*log(nutw.E()*yPlus[facei]) + P[facei]); + + const scalar magUc = + uTau[facei]/nutw.kappa() + *log(nutw.E()*yPlusTherm[facei]) - mag(Uw[facei]); + + const scalar C = + 0.5*rhow[facei]*uTau[facei] + *(Prt_*sqr(magUp[facei]) + (Pr[facei] - Prt_)*sqr(magUc)); + + alphaEff = A/(B + C + vSmall); + } + + // Update convective heat transfer turbulent thermal diffusivity + alphatConv[facei] = max(0.0, alphaEff - alphaw[facei]); + } + + return talphatConv; +} + + +void alphatPhaseJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + operator==(calcAlphat(*this)); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchField::write(os); + writeEntry(os, "Prt", Prt_); + writeEntry(os, "value", *this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + alphatPhaseJayatillekeWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..837ac26c52 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2020 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::compressible:: + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + +Description + This boundary condition provides a thermal wall function for turbulent + thermal diffusivity (usually\c alphat) based on the Jayatilleke model for + the Eulerian multiphase solvers. + +Usage + \table + Property | Description | Required | Default value + Prt | Turbulent Prandtl number | no | 0.85 + Cmu | Model coefficient | no | 0.09 + kappa | von Karman constant | no | 0.41 + E | Model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + + { + type alphatPhaseJayatillekeWallFunction; + Prt 0.85; + kappa 0.41; + E 9.8; + value uniform 0; // optional value entry + } + \endverbatim + +See also + Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField + +SourceFiles + alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressible_alphatPhaseJayatillekeWallFunctionFvPatchScalarField_H +#define compressible_alphatPhaseJayatillekeWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" +#include "nutWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatPhaseJayatillekeWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class alphatPhaseJayatillekeWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + +protected: + + // Protected data + + //- Turbulent Prandtl number + scalar Prt_; + + // Solution parameters + + static scalar maxExp_; + static scalar tolerance_; + static label maxIters_; + + + // Protected Member Functions + + //- 'P' function + tmp Psmooth(const scalarField& Prat) const; + + //- Calculate y+ at the edge of the thermal laminar sublayer + tmp yPlusTherm + ( + const nutWallFunctionFvPatchScalarField& nutw, + const scalarField& P, + const scalarField& Prat + ) const; + + +public: + + //- Runtime type information + TypeName("compressible::alphatPhaseJayatillekeWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatPhaseJayatillekeWallFunctionFvPatchScalarField + // onto a new patch + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new alphatPhaseJayatillekeWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member Functions + + // Evaluation functions + + //- Evaluate the turbulent thermal diffusivity + tmp calcAlphat(const scalarField& prevAlphat) const; + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..dafe292c5e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -0,0 +1,729 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "alphatWallBoilingWallFunctionFvPatchScalarField.H" +#include "phaseSystem.H" +#include "heatTransferPhaseSystem.H" +#include "compressibleMomentumTransportModels.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "saturationModel.H" +#include "rhoMulticomponentThermo.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* Foam::NamedEnum +< + Foam::compressible:: + alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, + 2 +>::names[] = +{ + "vapor", + "liquid" +}; + +const Foam::NamedEnum +< + Foam::compressible:: + alphatWallBoilingWallFunctionFvPatchScalarField::phaseType, + 2 +> +Foam::compressible:: +alphatWallBoilingWallFunctionFvPatchScalarField::phaseTypeNames_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatWallBoilingWallFunctionFvPatchScalarField:: +alphatWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), + phaseType_(liquidPhase), + AbyV_(p.size(), 0), + alphatConv_(p.size(), 0), + dDep_(p.size(), 1e-5), + qq_(p.size(), 0), + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiamModel_(nullptr), + departureFreqModel_(nullptr) +{ + AbyV_ = this->patch().magSf(); + forAll(AbyV_, facei) + { + const label faceCelli = this->patch().faceCells()[facei]; + AbyV_[facei] /= iF.mesh().V()[faceCelli]; + } +} + + +alphatWallBoilingWallFunctionFvPatchScalarField:: +alphatWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), + phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))), + AbyV_(p.size(), 0), + alphatConv_(p.size(), 0), + dDep_(p.size(), 1e-5), + qq_(p.size(), 0), + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiamModel_(nullptr), + departureFreqModel_(nullptr) +{ + // Check that otherPhaseName != this phase + if (internalField().group() == otherPhaseName_) + { + FatalErrorInFunction + << "otherPhase should be the name of the vapor phase that " + << "corresponds to the liquid base or vice versa" << nl + << "This phase: " << internalField().group() << nl + << "otherPhase: " << otherPhaseName_ + << abort(FatalError); + } + + switch (phaseType_) + { + case vaporPhase: + { + partitioningModel_ = + wallBoilingModels::partitioningModel::New + ( + dict.subDict("partitioningModel") + ); + + dmdtf_ = 0; + + break; + } + case liquidPhase: + { + partitioningModel_ = + wallBoilingModels::partitioningModel::New + ( + dict.subDict("partitioningModel") + ); + + nucleationSiteModel_ = + wallBoilingModels::nucleationSiteModel::New + ( + dict.subDict("nucleationSiteModel") + ); + + departureDiamModel_ = + wallBoilingModels::departureDiameterModel::New + ( + dict.subDict("departureDiamModel") + ); + + departureFreqModel_ = + wallBoilingModels::departureFrequencyModel::New + ( + dict.subDict("departureFreqModel") + ); + + if (dict.found("dDep")) + { + dDep_ = scalarField("dDep", dict, p.size()); + } + + if (dict.found("qQuenching")) + { + qq_ = scalarField("qQuenching", dict, p.size()); + } + + break; + } + } + + if (dict.found("alphatConv")) + { + alphatConv_ = scalarField("alphatConv", dict, p.size()); + } + + AbyV_ = this->patch().magSf(); + forAll(AbyV_, facei) + { + const label faceCelli = this->patch().faceCells()[facei]; + AbyV_[facei] /= iF.mesh().V()[faceCelli]; + } +} + + +alphatWallBoilingWallFunctionFvPatchScalarField:: +alphatWallBoilingWallFunctionFvPatchScalarField +( + const alphatWallBoilingWallFunctionFvPatchScalarField& psf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + psf, + p, + iF, + mapper + ), + phaseType_(psf.phaseType_), + AbyV_(mapper(psf.AbyV_)), + alphatConv_(mapper(psf.alphatConv_)), + dDep_(mapper(psf.dDep_)), + qq_(mapper(psf.qq_)), + partitioningModel_(psf.partitioningModel_, false), + nucleationSiteModel_(psf.nucleationSiteModel_, false), + departureDiamModel_(psf.departureDiamModel_, false), + departureFreqModel_(psf.departureFreqModel_, false) +{} + + +alphatWallBoilingWallFunctionFvPatchScalarField:: +alphatWallBoilingWallFunctionFvPatchScalarField +( + const alphatWallBoilingWallFunctionFvPatchScalarField& psf, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), + phaseType_(psf.phaseType_), + AbyV_(psf.AbyV_), + alphatConv_(psf.alphatConv_), + dDep_(psf.dDep_), + qq_(psf.qq_), + partitioningModel_(psf.partitioningModel_, false), + nucleationSiteModel_(psf.nucleationSiteModel_, false), + departureDiamModel_(psf.departureDiamModel_, false), + departureFreqModel_(psf.departureFreqModel_, false) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void alphatWallBoilingWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap(m); + + m(AbyV_, AbyV_); + m(alphatConv_, alphatConv_); + m(dDep_, dDep_); + m(qq_, qq_); +} + + +void alphatWallBoilingWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::rmap(ptf, addr); + + const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + AbyV_.rmap(tiptf.AbyV_, addr); + alphatConv_.rmap(tiptf.alphatConv_, addr); + dDep_.rmap(tiptf.dDep_, addr); + qq_.rmap(tiptf.qq_, addr); +} + + +void alphatWallBoilingWallFunctionFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::reset(ptf); + + const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf = + refCast(ptf); + + AbyV_.reset(tiptf.AbyV_); + alphatConv_.reset(tiptf.alphatConv_); + dDep_.reset(tiptf.dDep_); + qq_.reset(tiptf.qq_); +} + + +void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Lookup the fluid model + const phaseSystem& fluid = + db().lookupObject(phaseSystem::propertiesName); + + const word volatileSpecie(fluid.lookupOrDefault("volatile", "none")); + + const label patchi = patch().index(); + + switch (phaseType_) + { + case vaporPhase: + { + const phaseModel& vapor = fluid.phases()[internalField().group()]; + + // Vapor phase fraction at the wall + const scalarField& vaporw = vapor.boundaryField()[patchi]; + + // Partitioning + // NOTE! Assumes 1-thisPhase for liquid fraction in + // multiphase simulations + const scalarField fLiquid(partitioningModel_->fLiquid(1 - vaporw)); + + operator== + ( + calcAlphat(*this)*(1 - fLiquid)/max(vaporw, scalar(1e-8)) + ); + break; + } + case liquidPhase: + { + const phaseModel& liquid = fluid.phases()[internalField().group()]; + const phaseModel& vapor = fluid.phases()[otherPhaseName_]; + + const phaseInterface interface(vapor, liquid); + + if (fluid.foundInterfacialModel(interface)) + { + // Retrieve turbulence properties from models + const phaseCompressible::momentumTransportModel& turbModel + = db().lookupType + ( + liquid.name() + ); + const phaseCompressible::momentumTransportModel& vaporTurbModel + = db().lookupType + ( + vapor.name() + ); + + const nutWallFunctionFvPatchScalarField& nutw = + nutWallFunctionFvPatchScalarField::nutw(turbModel, patchi); + + const scalar Cmu25(pow025(nutw.Cmu())); + + const scalarField& y = turbModel.y()[patchi]; + + const tmp tnuw = turbModel.nu(patchi); + const scalarField& nuw = tnuw(); + + const rhoThermo& lThermo = liquid.thermo(); + + const tmp talphaw + ( + lThermo.kappa().boundaryField()[patchi] + /lThermo.Cp().boundaryField()[patchi] + ); + const scalarField& alphaw = talphaw(); + + const tmp tk = turbModel.k(); + const volScalarField& k = tk(); + const fvPatchScalarField& kw = k.boundaryField()[patchi]; + + const fvPatchVectorField& Uw = + turbModel.U().boundaryField()[patchi]; + const scalarField magUp(mag(Uw.patchInternalField() - Uw)); + const scalarField magGradUw(mag(Uw.snGrad())); + + const fvPatchScalarField& rhoLiquidw = + turbModel.rho().boundaryField()[patchi]; + + const fvPatchScalarField& rhoVaporw = + vaporTurbModel.rho().boundaryField()[patchi]; + + const fvPatchScalarField& hew = + lThermo.he().boundaryField()[patchi]; + + const fvPatchScalarField& Tw = + lThermo.T().boundaryField()[patchi]; + + const scalarField Tc(Tw.patchInternalField()); + + const scalarField uTau(Cmu25*sqrt(kw)); + + const scalarField yPlus(uTau*y/nuw); + + const scalarField Pr(rhoLiquidw*nuw/alphaw); + + // Molecular-to-turbulent Prandtl number ratio + const scalarField Prat(Pr/Prt_); + + // Thermal sublayer thickness + const scalarField P(this->Psmooth(Prat)); + + const scalarField yPlusTherm(this->yPlusTherm(nutw, P, Prat)); + + const scalarField Cpw(lThermo.Cp(Tw, patchi)); + + // Saturation temperature + const saturationModel& satModel = + fluid.lookupInterfacialModel(interface); + const tmp tTsat = satModel.Tsat(lThermo.p()); + const volScalarField& Tsat = tTsat(); + const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]); + + // Latent heat + const scalarField L + ( + volatileSpecie != "none" + ? -refCast(fluid) + .Li + ( + interface, + volatileSpecie, + dmdtf_, + Tsat, + patch().faceCells(), + heatTransferPhaseSystem::latentHeatScheme::upwind + ) + : -refCast(fluid) + .L + ( + interface, + dmdtf_, + Tsat, + patch().faceCells(), + heatTransferPhaseSystem::latentHeatScheme::upwind + ) + ); + + // Liquid phase fraction at the wall + const scalarField liquidw(liquid.boundaryField()[patchi]); + + // Partitioning + const scalarField fLiquid(partitioningModel_->fLiquid(liquidw)); + + // Convective thermal diffusivity + alphatConv_ = calcAlphat(alphatConv_); + + label maxIter(10); + for (label i=0; idDeparture + ( + liquid, + vapor, + patchi, + Tl, + Tsatw, + L + ); + + // Bubble departure frequency: + const scalarField fDep + ( + departureFreqModel_->fDeparture + ( + liquid, + vapor, + patchi, + Tl, + Tsatw, + L, + dDep_ + ) + ); + + // Nucleation site density: + const scalarField N + ( + nucleationSiteModel_->N + ( + liquid, + vapor, + patchi, + Tl, + Tsatw, + L, + dDep_, + fDep + ) + ); + + // Area fractions: + + // Del Valle & Kenning (1985) + const scalarField Ja + ( + rhoLiquidw*Cpw*(Tsatw - Tl)/(rhoVaporw*L) + ); + + const scalarField Al + ( + fLiquid*4.8*exp(min(-Ja/80, log(vGreat))) + ); + + scalarField A2(min(pi*sqr(dDep_)*N*Al/4, scalar(1))); + const scalarField A1(max(1 - A2, scalar(1e-4))); + scalarField A2E(min(pi*sqr(dDep_)*N*Al/4, scalar(5))); + + if (volatileSpecie != "none" && !liquid.pure()) + { + const volScalarField& Yvolatile = + liquid.Y(volatileSpecie); + A2E *= Yvolatile.boundaryField()[patchi]; + A2 *= Yvolatile.boundaryField()[patchi]; + } + + // Volumetric mass source in the near wall cell due to the + // wall boiling + dmdtf_ = + (1 - relax_)*dmdtf_ + + relax_*(1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*AbyV_; + + // Quenching heat transfer coefficient + const scalarField hQ + ( + 2*(alphaw*Cpw)*fDep + *sqrt + ( + (0.8/max(fDep, small))/(pi*alphaw/rhoLiquidw) + ) + ); + + // Quenching heat flux + qq_ = + (1 - relax_)*qq_ + + relax_*(A2*hQ*max(Tw - Tl, scalar(0))); + + // Evaporation heat flux + const scalarField qe(dmdtf_*L/AbyV_); + + // Effective thermal diffusivity that corresponds to the + // calculated convective, quenching and evaporative heat + // fluxes + + operator== + ( + ( + A1*alphatConv_ + + (qq_ + qe)/max(hew.snGrad(), scalar(1e-16)) + ) + /max(liquidw, scalar(1e-8)) + ); + + scalarField TsupPrev(max((Tw - Tsatw), scalar(0))); + const_cast(Tw).evaluate(); + scalarField TsupNew(max((Tw - Tsatw), scalar(0))); + + scalar maxErr(max(mag(TsupPrev - TsupNew))); + + if (debug) + { + const scalarField qc + ( + fLiquid*A1*(alphatConv_ + alphaw)*hew.snGrad() + ); + + const scalarField qEff + ( + liquidw*(*this + alphaw)*hew.snGrad() + ); + + Info<< " L: " << gMin(L) << " - " << gMax(L) << endl; + Info<< " Tl: " << gMin(Tl) << " - " << gMax(Tl) + << endl; + Info<< " N: " << gMin(N) << " - " << gMax(N) << endl; + Info<< " dDep_: " << gMin(dDep_) << " - " + << gMax(dDep_) << endl; + Info<< " fDep: " << gMin(fDep) << " - " + << gMax(fDep) << endl; + Info<< " Al: " << gMin(Al) << " - " << gMax(Al) + << endl; + Info<< " A1: " << gMin(A1) << " - " << gMax(A1) + << endl; + Info<< " A2: " << gMin(A2) << " - " << gMax(A2) + << endl; + Info<< " A2E: " << gMin(A2E) << " - " + << gMax(A2E) << endl; + Info<< " dmdtW: " << gMin(dmdtf_) << " - " + << gMax(dmdtf_) << endl; + Info<< " qc: " << gMin(qc) << " - " << gMax(qc) + << endl; + Info<< " qq: " << gMin(fLiquid*qq_) << " - " + << gMax(fLiquid*qq_) << endl; + Info<< " qe: " << gMin(fLiquid*qe) << " - " + << gMax(fLiquid*qe) << endl; + Info<< " qEff: " << gMin(qEff) << " - " + << gMax(qEff) << endl; + Info<< " alphat: " << gMin(*this) << " - " + << gMax(*this) << endl; + Info<< " alphatConv: " << gMin(alphatConv_) + << " - " << gMax(alphatConv_) << endl; + } + + if (maxErr < 1e-1) + { + if (i > 0) + { + Info<< "Wall boiling wall function iterations: " + << i + 1 << endl; + } + break; + } + else if (i == (maxIter - 1)) + { + Info<< "Maximum number of wall boiling wall function " + << "iterations (" << maxIter << ") reached." << endl + << "Maximum change in wall temperature on last " + << "iteration: " << maxErr << endl; + } + + } + break; + } + else + { + Info<< "Saturation model for interface " << interface.name() + << " not found. Wall boiling disabled." << endl; + + operator== (alphatConv_); + } + break; + } + default: + { + FatalErrorInFunction + << "Unknown phase type. Valid types are: " + << phaseTypeNames_ << nl << exit(FatalError); + } + } + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); + + writeEntry(os, "phaseType", phaseTypeNames_[phaseType_]); + writeEntry(os, "alphatConv", alphatConv_); + writeEntry(os, "dDep", dDep_); + writeEntry(os, "qQuenching", qq_); + + switch (phaseType_) + { + case vaporPhase: + { + writeKeyword(os, "partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + break; + } + case liquidPhase: + { + writeKeyword(os, "partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + writeKeyword(os, "nucleationSiteModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + nucleationSiteModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + writeKeyword(os, "departureDiamModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureDiamModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + writeKeyword(os, "departureFreqModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureFreqModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + break; + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + alphatWallBoilingWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..e7364645c3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -0,0 +1,316 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::compressible::alphatWallBoilingWallFunctionFvPatchScalarField + +Description + A thermal wall function for simulation of subcooled nucleate wall boiling + with runtime selectable submodels for: + - wall heat flux partitioning model + - nucleation site density + - bubble departure frequency + - bubble departure diameter + + Implements a version of the well-known RPI wall boiling model + (Kurul & Podowski, 1991). The model implementation based on implementation + described in Peltola et al. (2019) and is similar to the model described by + Peltola & Pättikangas (2012). The present implementation includes simplified + support for presence of non-volatile components in addition to a single + volatile component. + + References: + \verbatim + Kurul, N., & Podowski, M.Z. (1991). + On the modeling of multidimensional effects in boiling channels. + ANS. Proc. National Heat Transfer Con. Minneapolis, Minnesota, USA, + 1991. + ISBN: 0-89448-162-1, pp. 30-40. + \endverbatim + + \verbatim + Peltola, J., Pättikangas, T., Bainbridge, W., Lehnigk, R., Schlegel, F. + (2019). + On Development and validation of subcooled nucleate boiling models for + OpenFOAM Foundation Release. + NURETH-18 Conference Proceedings, Portland, Oregon, United States, 2019. + \endverbatim + + \verbatim + Peltola, J., & Pättikangas, T.J.H. (2012). + Development and validation of a boiling model for OpenFOAM multiphase + solver. + CFD4NRS-4 Conference Proceedings, Daejeon, Korea, 2012. + paper 59. + \endverbatim + +Usage + \table + Property | Description | Required | Default value + phaseType | 'vapor' or 'liquid' | yes | + relax | wall boiling model relaxation| yes | + Prt | inherited from alphatPhaseChangeJayatillekeWallFunction | yes | + Cmu | inherited from alphatPhaseChangeJayatillekeWallFunction | yes | + kappa | inherited from alphatPhaseChangeJayatillekeWallFunction | yes | + E | inherited from alphatPhaseChangeJayatillekeWallFunction | yes | + dmdt | phase change mass flux | yes | + value | initial alphat value | yes | + \endtable + + if phaseType 'vapor': + \table + partitioningModel| | yes | + \endtable + + if phaseType 'liquid': + \table + partitioningModel| | yes | + nucleationSiteModel| | yes | + departureDiamModel| | yes | + departureFreqModel| | yes | + \endtable + + NOTE: Runtime selectable submodels may require model specific entries + + Example usage: + \verbatim + hotWall + { + type compressible::alphatWallBoiling2WallFunction; + phaseType liquid; + Prt 0.85; + Cmu 0.09; + kappa 0.41; + E 9.8; + relax 0.1; + dmdt uniform 0; + partitioningModel + { + type Lavieville; + alphaCrit 0.2; + } + nucleationSiteModel + { + type LemmertChawla; + } + departureDiamModel + { + type TolubinskiKostanchuk; + } + departureFreqModel + { + type Cole; + } + value uniform 0.01; + \endverbatim + +See also + Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField + +SourceFiles + alphatWallBoilingWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H +#define compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H + +#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "partitioningModel.H" +#include "nucleationSiteModel.H" +#include "departureDiameterModel.H" +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatWallBoilingWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class alphatWallBoilingWallFunctionFvPatchScalarField +: + public alphatPhaseChangeWallFunctionFvPatchScalarField +{ +public: + + // Data types + + //- Enumeration listing the possible operational modes + enum phaseType + { + vaporPhase, + liquidPhase + }; + + //- Heat source type names + static const NamedEnum phaseTypeNames_; + + +private: + + // Private Data + + //- Heat source type + phaseType phaseType_; + + //- Patch face area by cell volume + scalarField AbyV_; + + //- Convective turbulent thermal diffusivity + scalarField alphatConv_; + + //- Departure diameter field + scalarField dDep_; + + //- Quenching surface heat flux + scalarField qq_; + + //- Run-time selected heat flux partitioning model + autoPtr + partitioningModel_; + + //- Run-time selected nucleation site density model + autoPtr + nucleationSiteModel_; + + //- Run-time selected bubble departure diameter model + autoPtr + departureDiamModel_; + + //- Run-time selected bubble departure frequency model + autoPtr + departureFreqModel_; + + +public: + + //- Runtime type information + TypeName("compressible::alphatWallBoilingWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + alphatWallBoilingWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + alphatWallBoilingWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatWallBoilingWallFunctionFvPatchScalarField + // onto a new patch + alphatWallBoilingWallFunctionFvPatchScalarField + ( + const alphatWallBoilingWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + alphatWallBoilingWallFunctionFvPatchScalarField + ( + const alphatWallBoilingWallFunctionFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + alphatWallBoilingWallFunctionFvPatchScalarField + ( + const alphatWallBoilingWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new alphatWallBoilingWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + //- Return the departure diameter field + const scalarField& dDeparture() const + { + return dDep_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + // Used to update fields following mesh topology change + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + // Used to reconstruct fields + virtual void rmap(const fvPatchScalarField&, const labelList&); + + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C new file mode 100644 index 0000000000..74c14604a3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2020 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 "copiedFixedValueFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::copiedFixedValueFvPatchScalarField::copiedFixedValueFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + sourceFieldName_("default") +{} + + +Foam::copiedFixedValueFvPatchScalarField::copiedFixedValueFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + sourceFieldName_(dict.lookup("sourceFieldName")) +{} + + +Foam::copiedFixedValueFvPatchScalarField::copiedFixedValueFvPatchScalarField +( + const copiedFixedValueFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + sourceFieldName_(ptf.sourceFieldName_) +{} + + +Foam::copiedFixedValueFvPatchScalarField::copiedFixedValueFvPatchScalarField +( + const copiedFixedValueFvPatchScalarField& awfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(awfpsf, iF), + sourceFieldName_(awfpsf.sourceFieldName_) +{} + + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::copiedFixedValueFvPatchScalarField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + operator== + ( + patch().lookupPatchField(sourceFieldName_) + ); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::copiedFixedValueFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + writeEntry(os, "sourceFieldName", sourceFieldName_); + writeEntry(os, "value", *this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + copiedFixedValueFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.H new file mode 100644 index 0000000000..f6bc1ebd94 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/copiedFixedValue/copiedFixedValueFvPatchScalarField.H @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2020 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::copiedFixedValueFvPatchScalarField + +Description + Copies the boundary values from a user specified field. + +See also + Foam::fixedValueFvPatchField + +SourceFiles + copiedFixedValueFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef copiedFixedValueFvPatchScalarField_H +#define copiedFixedValueFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class copiedFixedValueFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class copiedFixedValueFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ +protected: + + // Protected data + + word sourceFieldName_; + +public: + + //- Runtime type information + TypeName("copiedFixedValue"); + + + // Constructors + + //- Construct from patch and internal field + copiedFixedValueFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + copiedFixedValueFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // copiedFixedValueFvPatchScalarField + // onto a new patch + copiedFixedValueFvPatchScalarField + ( + const copiedFixedValueFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + copiedFixedValueFvPatchScalarField + ( + const copiedFixedValueFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + copiedFixedValueFvPatchScalarField + ( + const copiedFixedValueFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new copiedFixedValueFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C new file mode 100644 index 0000000000..4f0d85405b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "fixedMultiPhaseHeatFluxFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "addToRunTimeSelectionTable.H" + +#include "phaseSystem.H" +#include "compressibleMomentumTransportModels.H" +#include "phaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fixedMultiPhaseHeatFluxFvPatchScalarField:: +fixedMultiPhaseHeatFluxFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + q_(p.size(), 0.0), + relax_(1.0), + Tmin_(0.0) +{} + + +Foam::fixedMultiPhaseHeatFluxFvPatchScalarField:: +fixedMultiPhaseHeatFluxFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + q_("q", dict, p.size()), + relax_(dict.lookupOrDefault("relax", 1.0)), + Tmin_(dict.lookupOrDefault("Tmin", 273)) +{} + + +Foam::fixedMultiPhaseHeatFluxFvPatchScalarField:: +fixedMultiPhaseHeatFluxFvPatchScalarField +( + const fixedMultiPhaseHeatFluxFvPatchScalarField& psf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(psf, p, iF, mapper), + q_(mapper(psf.q_)), + relax_(psf.relax_), + Tmin_(psf.Tmin_) +{} + + +Foam::fixedMultiPhaseHeatFluxFvPatchScalarField:: +fixedMultiPhaseHeatFluxFvPatchScalarField +( + const fixedMultiPhaseHeatFluxFvPatchScalarField& psf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(psf, iF), + q_(psf.q_), + relax_(psf.relax_), + Tmin_(psf.Tmin_) +{} + + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Lookup the fluid model + const phaseSystem& fluid = + db().lookupObject(phaseSystem::propertiesName); + + const scalarField& Tp = *this; + + scalarField A(Tp.size(), scalar(0)); + scalarField B(Tp.size(), scalar(0)); + scalarField Q(Tp.size(), scalar(0)); + + forAll(fluid.phases(), phasei) + { + const phaseModel& phase = fluid.phases()[phasei]; + const fluidThermo& thermo = phase.thermo(); + + const fvPatchScalarField& alpha = + phase.boundaryField()[patch().index()]; + + const fvPatchScalarField& T = + thermo.T().boundaryField()[patch().index()]; + + const scalarField kappaEff(phase.kappaEff(patch().index())); + + if (debug) + { + scalarField q0(T.snGrad()*alpha*kappaEff); + Q += q0; + + Info<< patch().name() << " " << phase.name() + << ": Heat flux " << gMin(q0) << " - " << gMax(q0) << endl; + } + + A += T.patchInternalField()*alpha*kappaEff*patch().deltaCoeffs(); + B += alpha*kappaEff*patch().deltaCoeffs(); + } + + if (debug) + { + Info<< patch().name() << " " << ": overall heat flux " + << gMin(Q) << " - " << gMax(Q) << " W/m2, power: " + << gSum(patch().magSf()*Q) << " W" << endl; + } + + operator==((1 - relax_)*Tp + relax_*max(Tmin_,(q_ + A)/(B))); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + m(q_, q_); +} + + +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const fixedMultiPhaseHeatFluxFvPatchScalarField& mptf = + refCast(ptf); + + q_.rmap(mptf.q_, addr); +} + + +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::reset +( + const fvPatchScalarField& ptf +) +{ + fixedValueFvPatchScalarField::reset(ptf); + + const fixedMultiPhaseHeatFluxFvPatchScalarField& mptf = + refCast(ptf); + + q_.reset(mptf.q_); +} + + +void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + writeEntry(os, "relax", relax_); + writeEntry(os, "q", q_); + writeEntry(os, "value", *this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedMultiPhaseHeatFluxFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H new file mode 100644 index 0000000000..6dfa23faa8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::fixedMultiPhaseHeatFluxFvPatchScalarField + +Description + Calculates a wall temperature that produces the specified overall wall heat + flux across all the phases in an Eulerian multi-phase simulation. + + Intended to be used with copiedFixedValue to ensure that phase wall + temperature are consistent: + - Set 'fixedMultiPhaseHeatFlux' boundary for one of the phases + - Use 'copiedFixedValue' for all the other phases. + +See also + Foam::fixedValueFvPatchField + +SourceFiles + fixedMultiPhaseHeatFluxFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedMultiPhaseHeatFluxFvPatchScalarField_H +#define fixedMultiPhaseHeatFluxFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedMultiPhaseHeatFluxFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fixedMultiPhaseHeatFluxFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private Data + + //- Heat power [W] or flux [W/m^2] + scalarField q_; + + //- Relaxation factor + scalar relax_; + + //- Minimum temperature limit [K] + scalar Tmin_; + + +public: + + //- Runtime type information + TypeName("fixedMultiPhaseHeatFlux"); + + + // Constructors + + //- Construct from patch and internal field + fixedMultiPhaseHeatFluxFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedMultiPhaseHeatFluxFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // fixedMultiPhaseHeatFluxFvPatchScalarField + // onto a new patch + fixedMultiPhaseHeatFluxFvPatchScalarField + ( + const fixedMultiPhaseHeatFluxFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Disallow copy without setting internal field reference + fixedMultiPhaseHeatFluxFvPatchScalarField + ( + const fixedMultiPhaseHeatFluxFvPatchScalarField& + ) = delete; + + //- Copy constructor setting internal field reference + fixedMultiPhaseHeatFluxFvPatchScalarField + ( + const fixedMultiPhaseHeatFluxFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new fixedMultiPhaseHeatFluxFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + // Used to update fields following mesh topology change + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + // Used to reconstruct fields + virtual void rmap(const fvPatchScalarField&, const labelList&); + + //- Reset the fvPatchField to the given fvPatchField + // Used for mesh to mesh mapping + virtual void reset(const fvPatchScalarField&); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.C new file mode 100644 index 0000000000..bdc76d90fe --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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 "KocamustafaogullariIshiiDepartureDiameter.H" +#include "addToRunTimeSelectionTable.H" +#include "uniformDimensionedFields.H" +#include "compressibleMomentumTransportModels.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + defineTypeNameAndDebug(KocamustafaogullariIshiiDepartureDiameter, 0); + addToRunTimeSelectionTable + ( + departureDiameterModel, + KocamustafaogullariIshiiDepartureDiameter, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshiiDepartureDiameter:: +KocamustafaogullariIshiiDepartureDiameter +( + const dictionary& dict +) +: + departureDiameterModel(), + phi_(dict.lookup("phi")) +{} + + +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshiiDepartureDiameter:: +KocamustafaogullariIshiiDepartureDiameter +( + const KocamustafaogullariIshiiDepartureDiameter& model +) +: + departureDiameterModel(), + phi_(model.phi_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshiiDepartureDiameter:: +~KocamustafaogullariIshiiDepartureDiameter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshiiDepartureDiameter::dDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L +) const +{ + // Gravitational acceleration + const uniformDimensionedVectorField& g = + liquid.mesh().lookupObject("g"); + + const scalarField rhoLiquid(liquid.thermo().rho(patchi)); + const scalarField rhoVapor(vapor.thermo().rho(patchi)); + + const scalarField rhoM((rhoLiquid - rhoVapor)/rhoVapor); + + const scalarField sigmaw + ( + liquid.fluid().sigma(phaseInterface(liquid, vapor), patchi) + ); + + return + 0.0012*pow(rhoM, 0.9)*0.0208*phi_ + *sqrt(sigmaw/(mag(g.value())*(rhoLiquid - rhoVapor))); +} + + +void Foam::wallBoilingModels::departureDiameterModels:: +KocamustafaogullariIshiiDepartureDiameter::write(Ostream& os) const +{ + departureDiameterModel::write(os); + writeEntry(os, "phi", phi_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.H new file mode 100644 index 0000000000..fd95786de6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/KocamustafaogullariIshiiDepartureDiameter/KocamustafaogullariIshiiDepartureDiameter.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::departureDiameterModels:: + KocamustafaogullariIshiiDepartureDiameter + +Description + A correlation for bubble departure diameter. + + Requires model parameter 'phi': contact angle in degrees. + + Reference: + \verbatim + Kocamustafaogullari, G., & Ishii, M. (1983). + Interfacial area and nucleation site density in boiling systems. + International Journal of Heat and Mass Transfer, 26(9), 1377-1387. + \endverbatim + +SourceFiles + KocamustafaogullariIshiiDepartureDiameter.C + +\*---------------------------------------------------------------------------*/ + +#ifndef KocamustafaogullariIshiiDepartureDiameter_H +#define KocamustafaogullariIshiiDepartureDiameter_H + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + +/*---------------------------------------------------------------------------*\ + Class KocamustafaogullariIshiiDepartureDiameter Declaration +\*---------------------------------------------------------------------------*/ + +class KocamustafaogullariIshiiDepartureDiameter +: + public departureDiameterModel +{ + // Private Data + + //- Contact angle + scalar phi_; + + +public: + + //- Runtime type information + TypeName("KocamustafaogullariIshii"); + + // Constructors + + //- Construct from a dictionary + KocamustafaogullariIshiiDepartureDiameter(const dictionary& dict); + + //- Copy construct + KocamustafaogullariIshiiDepartureDiameter + ( + const KocamustafaogullariIshiiDepartureDiameter& model + ); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new KocamustafaogullariIshiiDepartureDiameter(*this) + ); + } + + + //- Destructor + virtual ~KocamustafaogullariIshiiDepartureDiameter(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureDiameterModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C new file mode 100644 index 0000000000..52e10ef0d0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.C @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "TolubinskiKostanchuk.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + defineTypeNameAndDebug(TolubinskiKostanchuk, 0); + addToRunTimeSelectionTable + ( + departureDiameterModel, + TolubinskiKostanchuk, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::TolubinskiKostanchuk +( + const dictionary& dict +) +: + departureDiameterModel(), + dRef_(dict.lookupOrDefault("dRef", 6e-4)), + dMax_(dict.lookupOrDefault("dMax", 0.0014)), + dMin_(dict.lookupOrDefault("dMin", 1e-6)) +{} + + +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::TolubinskiKostanchuk +( + const TolubinskiKostanchuk& model +) +: + departureDiameterModel(), + dRef_(model.dRef_), + dMax_(model.dMax_), + dMin_(model.dMin_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::~TolubinskiKostanchuk() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::dDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L +) const +{ + return max(min(dRef_*exp(-(Tsatw - Tl)/45), dMax_), dMin_); +} + + +void Foam::wallBoilingModels::departureDiameterModels:: +TolubinskiKostanchuk::write(Ostream& os) const +{ + departureDiameterModel::write(os); + writeEntry(os, "dRef", dRef_); + writeEntry(os, "dMax", dMax_); + writeEntry(os, "dMin", dMin_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H new file mode 100644 index 0000000000..8d6724abf2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/TolubinskiKostanchuk/TolubinskiKostanchuk.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::departureDiameterModels::TolubinskiKostanchuk + +Description + Tolubinski-Kostanchuk correlation for bubble departure diameter. + + Reference: + \verbatim + Tolubinsky, V. I., & Kostanchuk, D. M. (1970). + Vapour bubbles growth rate and heat transfer intensity at subcooled + water boiling. + In International Heat Transfer Conference 4 (Vol. 23). Begel House Inc. + \endverbatim + +SourceFiles + TolubinskiKostanchuk.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TolubinskiKostanchuk_H +#define TolubinskiKostanchuk_H + +#include "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureDiameterModels +{ + +/*---------------------------------------------------------------------------*\ + Class TolubinskiKostanchuk Declaration +\*---------------------------------------------------------------------------*/ + +class TolubinskiKostanchuk +: + public departureDiameterModel +{ + + // Private Data: + + //- Coefficient of the temperature term + scalar dRef_; + + //- Maximum diameter + scalar dMax_; + + //- Minimum diameter + scalar dMin_; + +public: + + //- Runtime type information + TypeName("TolubinskiKostanchuk"); + + + // Constructors + + //- Construct from a dictionary + TolubinskiKostanchuk(const dictionary& dict); + + //- Copy construct + TolubinskiKostanchuk(const TolubinskiKostanchuk& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new TolubinskiKostanchuk(*this) + ); + } + + + //- Destructor + virtual ~TolubinskiKostanchuk(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureDiameterModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C new file mode 100644 index 0000000000..703600d760 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "departureDiameterModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(departureDiameterModel, 0); + defineRunTimeSelectionTable(departureDiameterModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModel::departureDiameterModel() +{} + + +Foam::wallBoilingModels::departureDiameterModel::departureDiameterModel +( + const departureDiameterModel& +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureDiameterModel::~departureDiameterModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::departureDiameterModel::write(Ostream& os) const +{ + writeEntry(os, "type", this->type()); +} + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H new file mode 100644 index 0000000000..af612c78e4 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModel.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::departureDiameterModel + +Description + Base class for bubble departure diameter models + +SourceFiles + departureDiameterModel.C + departureDiameterModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef departureDiameterModel_H +#define departureDiameterModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class departureDiameterModel Declaration +\*---------------------------------------------------------------------------*/ + +class departureDiameterModel +{ +public: + + //- Runtime type information + TypeName("departureDiameterModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + departureDiameterModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + departureDiameterModel(); + + //- Copy constructor + departureDiameterModel(const departureDiameterModel&); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~departureDiameterModel(); + + + // Member Functions + + //- Calculate and return the departure diameter field + virtual tmp dDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L + ) const = 0; + + virtual void write(Ostream& os) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const departureDiameterModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModelNew.C new file mode 100644 index 0000000000..8d02329dfc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureDiameterModels/departureDiameterModel/departureDiameterModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "departureDiameterModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::departureDiameterModel::New +( + const dictionary& dict +) +{ + word departureDiameterModelType(dict.lookup("type")); + + Info<< "Selecting departureDiameterModel: " + << departureDiameterModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(departureDiameterModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown departureDiameterModelType type " + << departureDiameterModelType << endl << endl + << "Valid departureDiameterModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C new file mode 100644 index 0000000000..bf54e9342f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-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 "Cole.H" +#include "addToRunTimeSelectionTable.H" +#include "uniformDimensionedFields.H" +#include "compressibleMomentumTransportModels.H" +#include "phaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + defineTypeNameAndDebug(Cole, 0); + addToRunTimeSelectionTable + ( + departureFrequencyModel, + Cole, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::Cole(const dictionary& dict) +: + departureFrequencyModel() +{} + + +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::Cole(const Cole& model) +: + departureFrequencyModel(model) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::~Cole() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureFrequencyModels:: +Cole::fDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep +) const +{ + // Gravitational acceleration + const uniformDimensionedVectorField& g = + liquid.mesh().lookupObject("g"); + + const scalarField rhoLiquid(liquid.thermo().rho(patchi)); + const scalarField rhoVapor(vapor.thermo().rho(patchi)); + + return sqrt + ( + 4*mag(g).value() + *max(rhoLiquid - rhoVapor, scalar(0.1)) + /(3*dDep*rhoLiquid) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H new file mode 100644 index 0000000000..6c24fb38aa --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::departureFrequencyModels::Cole + +Description + Cole correlation for bubble departure frequency. + + Reference: + \verbatim + Cole, R. (1960). + A photographic study of pool boiling in the region of the critical heat + flux. + AIChE Journal, 6(4), 533-538. + \endverbatim + +SourceFiles + Cole.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Cole_H +#define Cole_H + +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + +/*---------------------------------------------------------------------------*\ + Class Cole Declaration +\*---------------------------------------------------------------------------*/ + +class Cole +: + public departureFrequencyModel +{ +public: + + //- Runtime type information + TypeName("Cole"); + + + // Constructors + + //- Construct from a dictionary + Cole(const dictionary& dict); + + //- Copy construct + Cole(const Cole& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new Cole(*this)); + } + + + //- Destructor + virtual ~Cole(); + + + // Member Functions + + //- Calculate and return the bubble departure frequency + virtual tmp fDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureFrequencyModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C new file mode 100644 index 0000000000..875f073810 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "KocamustafaogullariIshiiDepartureFrequency.H" +#include "addToRunTimeSelectionTable.H" +#include "uniformDimensionedFields.H" +#include "compressibleMomentumTransportModels.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + defineTypeNameAndDebug(KocamustafaogullariIshiiDepartureFrequency, 0); + addToRunTimeSelectionTable + ( + departureFrequencyModel, + KocamustafaogullariIshiiDepartureFrequency, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +KocamustafaogullariIshiiDepartureFrequency:: +KocamustafaogullariIshiiDepartureFrequency(const dictionary& dict) +: + departureFrequencyModel(), + Cf_(dict.lookupOrDefault("Cf", 1.18)) +{} + + +Foam::wallBoilingModels::departureFrequencyModels:: +KocamustafaogullariIshiiDepartureFrequency:: +KocamustafaogullariIshiiDepartureFrequency +( + const KocamustafaogullariIshiiDepartureFrequency& model +) +: + departureFrequencyModel(model), + Cf_(model.Cf_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModels:: +KocamustafaogullariIshiiDepartureFrequency:: +~KocamustafaogullariIshiiDepartureFrequency() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::departureFrequencyModels:: +KocamustafaogullariIshiiDepartureFrequency::fDeparture +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep +) const +{ + // Gravitational acceleration + const uniformDimensionedVectorField& g = + liquid.mesh().lookupObject("g"); + + const scalarField rhoLiquid(liquid.thermo().rho(patchi)); + const scalarField rhoVapor(min(vapor.thermo().rho(patchi), rhoLiquid)); + + const tmp tsigma + ( + liquid.fluid().sigma(phaseInterface(liquid, vapor)) + ); + + const volScalarField& sigma = tsigma(); + const fvPatchScalarField& sigmaw = sigma.boundaryField()[patchi]; + + return (Cf_/dDep)*pow025 + ( + sigmaw*mag(g.value())*(rhoLiquid - rhoVapor)/sqr(rhoLiquid) + ); +} + + +void Foam::wallBoilingModels::departureFrequencyModels:: +KocamustafaogullariIshiiDepartureFrequency::write(Ostream& os) const +{ + departureFrequencyModel::write(os); + writeKeyword(os, "Cf") << Cf_ << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.H new file mode 100644 index 0000000000..85c455c1ac --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2020 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::wallBoilingModels::departureFrequencyModels:: + KocamustafaogullariIshiiDepartureFrequency + +Description + Correlation for bubble departure frequency. + + Reference: + \verbatim + Kocamustafaogullari, G., & Ishii, M. (1995). + Foundation of the interfacial area transport equation and its closure + relations. + International Journal of Heat and Mass Transfer, 38(3), 481-493. + \endverbatim + +SourceFiles + KocamustafaogullariIshiiDepartureFrequency.C + +\*---------------------------------------------------------------------------*/ + +#ifndef KocamustafaogullariIshiiDepartureFrequency_H +#define KocamustafaogullariIshiiDepartureFrequency_H + +#include "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace departureFrequencyModels +{ + +/*---------------------------------------------------------------------------*\ + Class KocamustafaogullariIshiiDepartureFrequency Declaration +\*---------------------------------------------------------------------------*/ + +class KocamustafaogullariIshiiDepartureFrequency +: + public departureFrequencyModel +{ + // Private data + + //- Model parameter + scalar Cf_; + + +public: + + //- Runtime type information + TypeName("KocamustafaogullariIshii"); + + + // Constructors + + //- Construct from a dictionary + KocamustafaogullariIshiiDepartureFrequency(const dictionary& dict); + + //- Copy construct + KocamustafaogullariIshiiDepartureFrequency + ( + const KocamustafaogullariIshiiDepartureFrequency& model + ); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new KocamustafaogullariIshiiDepartureFrequency(*this) + ); + } + + + //- Destructor + virtual ~KocamustafaogullariIshiiDepartureFrequency(); + + + // Member Functions + + //- Calculate and return the bubble departure frequency + virtual tmp fDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace departureFrequencyModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C new file mode 100644 index 0000000000..e445a281c6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(departureFrequencyModel, 0); + defineRunTimeSelectionTable(departureFrequencyModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModel::departureFrequencyModel() +{} + + +Foam::wallBoilingModels::departureFrequencyModel::departureFrequencyModel +( + const departureFrequencyModel& model +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::departureFrequencyModel::~departureFrequencyModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::departureFrequencyModel::write(Ostream& os) const +{ + writeEntry(os, "type", this->type()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H new file mode 100644 index 0000000000..40057b365d --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModel.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::departureFrequencyModel + +Description + Base class for bubble departure frequency models + +SourceFiles + departureFrequencyModel.C + departureFrequencyModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef departureFrequencyModel_H +#define departureFrequencyModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class departureFrequencyModel Declaration +\*---------------------------------------------------------------------------*/ + +class departureFrequencyModel +{ +public: + + //- Runtime type information + TypeName("departureFrequencyModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + departureFrequencyModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + departureFrequencyModel(); + + //- Copy construct + departureFrequencyModel(const departureFrequencyModel& model); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~departureFrequencyModel(); + + + // Member Functions + + //- Calculate and return the bubble departure frequency + virtual tmp fDeparture + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep + ) const = 0; + + virtual void write(Ostream& os) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const departureFrequencyModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModelNew.C new file mode 100644 index 0000000000..d32dba73de --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/departureFrequencyModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "departureFrequencyModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::departureFrequencyModel::New +( + const dictionary& dict +) +{ + word departureFrequencyModelType(dict.lookup("type")); + + Info<< "Selecting departureFrequencyModel: " + << departureFrequencyModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(departureFrequencyModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown departureFrequencyModelType type " + << departureFrequencyModelType << endl << endl + << "Valid departureFrequencyModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.C new file mode 100644 index 0000000000..b34bdd323b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2022 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 "KocamustafaogullariIshiiNucleationSite.H" +#include "addToRunTimeSelectionTable.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + defineTypeNameAndDebug(KocamustafaogullariIshiiNucleationSite, 0); + addToRunTimeSelectionTable + ( + nucleationSiteModel, + KocamustafaogullariIshiiNucleationSite, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels:: +KocamustafaogullariIshiiNucleationSite::KocamustafaogullariIshiiNucleationSite +( + const dictionary& dict +) +: + nucleationSiteModel(), + Cn_(dict.lookupOrDefault("Cn", 1)) +{} + + +Foam::wallBoilingModels::nucleationSiteModels:: +KocamustafaogullariIshiiNucleationSite::KocamustafaogullariIshiiNucleationSite +( + const KocamustafaogullariIshiiNucleationSite& model +) +: + nucleationSiteModel(), + Cn_(model.Cn_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels:: +KocamustafaogullariIshiiNucleationSite:: +~KocamustafaogullariIshiiNucleationSite() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::nucleationSiteModels:: +KocamustafaogullariIshiiNucleationSite::N +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep, + const scalarField& fDep +) const +{ + const fvPatchScalarField& Tw = + liquid.thermo().T().boundaryField()[patchi]; + + const scalarField rhoLiquid(liquid.thermo().rho(patchi)); + const scalarField rhoVapor(vapor.thermo().rho(patchi)); + const scalarField rhoM((rhoLiquid - rhoVapor)/rhoVapor); + + const scalarField sigmaw + ( + liquid.fluid().sigma(phaseInterface(liquid, vapor), patchi) + ); + + //eq. (32) + const scalarField f(2.157e-7*pow(rhoM,-3.2)*pow(1 + 0.0049*rhoM,4.13)); + + // eq. (17) + const scalarField rRc(max(Tw-Tsatw,scalar(0))*rhoVapor*L/(2*sigmaw*Tsatw)); + + return (Cn_/sqr(dDep))*pow(rRc,4.4)*f; +} + + +void Foam::wallBoilingModels::nucleationSiteModels:: +KocamustafaogullariIshiiNucleationSite::write(Ostream& os) const +{ + nucleationSiteModel::write(os); + writeKeyword(os, "Cn") << Cn_ << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.H new file mode 100644 index 0000000000..a3008051ab --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/KocamustafaogullariIshiiNucleationSite/KocamustafaogullariIshiiNucleationSite.H @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019-2020 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::wallBoilingModels::nucleationSiteModels:: + KocamustafaogullariIshiiNucleationSite + +Description + A correlation for nucleation site density. + + Reference: + \verbatim + Kocamustafaogullari, G., & Ishii, M. (1983). + Interfacial area and nucleation site density in boiling systems. + International Journal of Heat and Mass Transfer, 26(9), 1377-1387. + \endverbatim + +SourceFiles + KocamustafaogullariIshiiNucleationSite.C + +\*---------------------------------------------------------------------------*/ + +#ifndef KocamustafaogullariIshiiNucleationSite_H +#define KocamustafaogullariIshiiNucleationSite_H + +#include "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + +/*---------------------------------------------------------------------------*\ + Class KocamustafaogullariIshiiNucleationSite Declaration +\*---------------------------------------------------------------------------*/ + +class KocamustafaogullariIshiiNucleationSite +: + public nucleationSiteModel +{ + // Private data: + + //- User adjustable coefficient for nucleation density + scalar Cn_; + + +public: + + //- Runtime type information + TypeName("KocamustafaogullariIshii"); + + // Constructors + + //- Construct from a dictionary + KocamustafaogullariIshiiNucleationSite(const dictionary& dict); + + //- Copy construct + KocamustafaogullariIshiiNucleationSite + ( + const KocamustafaogullariIshiiNucleationSite& model + ); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new KocamustafaogullariIshiiNucleationSite(*this) + ); + } + + + //- Destructor + virtual ~KocamustafaogullariIshiiNucleationSite(); + + + // Member Functions + + //- Calculate and return the nucleation-site density + virtual tmp N + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep, + const scalarField& fDep + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace nucleationSiteModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C new file mode 100644 index 0000000000..2384d98f48 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.C @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "LemmertChawla.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + defineTypeNameAndDebug(LemmertChawla, 0); + addToRunTimeSelectionTable + ( + nucleationSiteModel, + LemmertChawla, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla +( + const dictionary& dict +) +: + nucleationSiteModel(), + Cn_(dict.lookupOrDefault("Cn", 1)), + NRef_(dict.lookupOrDefault("NRef", 9.922e5)), + deltaTRef_(dict.lookupOrDefault("deltaTRef", 10)) +{} + + +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla +( + const LemmertChawla& model +) +: + nucleationSiteModel(), + Cn_(model.Cn_), + NRef_(model.NRef_), + deltaTRef_(model.deltaTRef_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::~LemmertChawla() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::N +( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep, + const scalarField& fDep +) const +{ + const fvPatchScalarField& Tw = + liquid.thermo().T().boundaryField()[patchi]; + + return Cn_*NRef_*pow(max((Tw - Tsatw)/deltaTRef_, scalar(0)), 1.805); +} + + +void Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla:: + write(Ostream& os) const +{ + nucleationSiteModel::write(os); + writeKeyword(os, "Cn") << Cn_ << token::END_STATEMENT << nl; + writeKeyword(os, "NRef") << NRef_ << token::END_STATEMENT << nl; + writeKeyword(os, "deltaTRef") << deltaTRef_ << token::END_STATEMENT << nl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H new file mode 100644 index 0000000000..3aa8a811f8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/LemmertChawla/LemmertChawla.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::nucleationSiteModels::LemmertChawla + +Description + Lemmert & Chawla function for nucleation site density, + correlation by Egorov & Menter. + + References: + \verbatim + Lemmert, M., & Chawla, J. M. (1977). + Influence of flow velocity on surface boiling heat transfer coefficient. + Heat Transfer in Boiling, 237, 247. + + Egorov, Y., & Menter, F. (2004). + Experimental implementation of the RPI wall boiling model in CFX-5.6. + Staudenfeldweg, 12, 83624. + Technical Report ANSYS/TR-04-10, ANSYS Gmbh. + \endverbatim + +SourceFiles + LemmertChawla.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LemmertChawla_H +#define LemmertChawla_H + +#include "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace nucleationSiteModels +{ + +/*---------------------------------------------------------------------------*\ + Class LemmertChawla Declaration +\*---------------------------------------------------------------------------*/ + +class LemmertChawla +: + public nucleationSiteModel +{ + // Private Data: + + //- Coefficient for nucleation site density + scalar Cn_; + + //- Reference nucleations density + scalar NRef_; + + //- Reference temperature difference + scalar deltaTRef_; + + +public: + + //- Runtime type information + TypeName("LemmertChawla"); + + // Constructors + + //- Construct from a dictionary + LemmertChawla(const dictionary& dict); + + //- Copy construct + LemmertChawla(const LemmertChawla& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new LemmertChawla(*this)); + } + + + //- Destructor + virtual ~LemmertChawla(); + + + // Member Functions + + //- Calculate and return the nucleation-site density + virtual tmp N + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep, + const scalarField& fDep + ) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace nucleationSiteModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C new file mode 100644 index 0000000000..b693dbcb92 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(nucleationSiteModel, 0); + defineRunTimeSelectionTable(nucleationSiteModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModel::nucleationSiteModel() +{} + + +Foam::wallBoilingModels::nucleationSiteModel::nucleationSiteModel +( + const nucleationSiteModel& model +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::nucleationSiteModel::~nucleationSiteModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::nucleationSiteModel::write(Ostream& os) const +{ + writeEntry(os, "type", this->type()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H new file mode 100644 index 0000000000..35ec59aa56 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModel.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::nucleationSiteModel + +Description + Base class for nucleation site density models + +SourceFiles + nucleationSiteModel.C + nucleationSiteModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nucleationSiteModel_H +#define nucleationSiteModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class nucleationSiteModel Declaration +\*---------------------------------------------------------------------------*/ + +class nucleationSiteModel +{ +public: + + //- Runtime type information + TypeName("nucleationSiteModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + nucleationSiteModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + nucleationSiteModel(); + + //- Copy construct + nucleationSiteModel(const nucleationSiteModel& model); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~nucleationSiteModel(); + + + // Member Functions + + //- Calculate and return the nucleation-site density + virtual tmp N + ( + const phaseModel& liquid, + const phaseModel& vapor, + const label patchi, + const scalarField& Tl, + const scalarField& Tsatw, + const scalarField& L, + const scalarField& dDep, + const scalarField& fDep + ) const = 0; + + virtual void write(Ostream& os) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const nucleationSiteModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModelNew.C new file mode 100644 index 0000000000..f0d6b53432 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/nucleationSiteModels/nucleationSiteModel/nucleationSiteModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "nucleationSiteModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::nucleationSiteModel::New +( + const dictionary& dict +) +{ + word nucleationSiteModelType(dict.lookup("type")); + + Info<< "Selecting nucleationSiteModel: " + << nucleationSiteModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(nucleationSiteModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown nucleationSiteModelType type " + << nucleationSiteModelType << endl << endl + << "Valid nucleationSiteModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C new file mode 100644 index 0000000000..e7bfed141c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.C @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "Lavieville.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(Lavieville, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + Lavieville, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +Lavieville::Lavieville(const dictionary& dict) +: + partitioningModel(), + alphaCrit_(dict.lookup("alphaCrit")) +{} + + +Foam::wallBoilingModels::partitioningModels:: +Lavieville::Lavieville(const Lavieville& model) +: + partitioningModel(model), + alphaCrit_(model.alphaCrit_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +Lavieville::~Lavieville() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +Lavieville::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return + pos0(alphaLiquid - alphaCrit_) + *( + 1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_)) + ) + + neg(alphaLiquid - alphaCrit_) + *( + 0.5*pow(alphaLiquid/alphaCrit_, 20*alphaCrit_) + ); +} + + +void Foam::wallBoilingModels::partitioningModels:: +Lavieville::write(Ostream& os) const +{ + partitioningModel::write(os); + writeEntry(os, "alphaCrit", alphaCrit_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H new file mode 100644 index 0000000000..e42521525c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/Lavieville/Lavieville.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::partitioningModels::Lavieville + +Description + Lavieville wall heat flux partitioning model. + + Model parameters: + alphaCrit: critical liquid fraction + + Reference: + \verbatim + Lavieville, J., Quemerais, E., Mimouni, S., Boucker, M., & + Mechitoua, N. (2006). + NEPTUNE CFD V1. 0 theory manual. + NEPTUNE report Nept_2004_L1, 2(3). + \endverbatim + +SourceFiles + Lavieville.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lavieville_H +#define Lavieville_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class Lavieville Declaration +\*---------------------------------------------------------------------------*/ + +class Lavieville +: + public partitioningModel +{ + // Private Data + + //- Critical liquid fraction + scalar alphaCrit_; + + +public: + + //- Runtime type information + TypeName("Lavieville"); + + + // Constructors + + //- Construct from a dictionary + Lavieville(const dictionary& dict); + + //- Copy construct + Lavieville(const Lavieville& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new Lavieville(*this)); + } + + + //- Destructor + virtual ~Lavieville(); + + + // Member Functions + + //- Liquid blending function + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C new file mode 100644 index 0000000000..8f3cf8aad0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "cosine.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(cosine, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + cosine, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +cosine::cosine(const dictionary& dict) +: + partitioningModel(), + alphaLiquid1_(dict.lookup("alphaLiquid1")), + alphaLiquid0_(dict.lookup("alphaLiquid0")) +{} + + +Foam::wallBoilingModels::partitioningModels:: +cosine::cosine(const cosine& model) +: + partitioningModel(model), + alphaLiquid1_(model.alphaLiquid1_), + alphaLiquid0_(model.alphaLiquid0_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +cosine::~cosine() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +cosine::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return + pos0(alphaLiquid1_ - alphaLiquid) + *( + neg(alphaLiquid0_ - alphaLiquid) + *( + 0.5 + *( + 1 - cos + ( + constant::mathematical::pi + *(alphaLiquid - alphaLiquid0_) + /(alphaLiquid1_ - alphaLiquid0_) + ) + ) + ) + ) + + neg(alphaLiquid1_ - alphaLiquid); +} + + +void Foam::wallBoilingModels::partitioningModels:: +cosine::write(Ostream& os) const +{ + partitioningModel::write(os); + writeEntry(os, "alphaLiquid1", alphaLiquid1_); + writeEntry(os, "alphaLiquid0", alphaLiquid0_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H new file mode 100644 index 0000000000..7d95944b3c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/cosine/cosine.H @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::partitioningModels::cosine + +Description + Cosine wall heat flux partitioning model. + + Proposed threshold liquid fractions: + - alphaLiquid1 0.1 + - alphaLiquid0 0.05 + + \verbatim + Tentner, A., Lo, S., & Kozlov, V. (2006). + Advances in computational fluid dynamics modeling + of two-phase flow in boiling water reactor fuel assemblies. + In International Conference of Nuclear Engineering, + Miami, Florida, USA. + \endverbatim + +SourceFiles + cosine.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cosine_H +#define cosine_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class cosine Declaration +\*---------------------------------------------------------------------------*/ + +class cosine +: + public partitioningModel +{ + // Private Data + + // Model parameters, threshold liquid phase fractions + scalar alphaLiquid1_; + scalar alphaLiquid0_; + + +public: + + //- Runtime type information + TypeName("cosine"); + + + // Constructors + + //- Construct from a dictionary + cosine(const dictionary& dict); + + //- Copy construct + cosine(const cosine& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new cosine(*this)); + } + + + //- Destructor + virtual ~cosine(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partitioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C new file mode 100644 index 0000000000..2dc6c14664 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.C @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "linear.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(linear, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + linear, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +linear::linear(const dictionary& dict) +: + partitioningModel(), + alphaLiquid1_(dict.lookup("alphaLiquid1")), + alphaLiquid0_(dict.lookup("alphaLiquid0")) +{} + + +Foam::wallBoilingModels::partitioningModels:: +linear::linear(const linear& model) +: + partitioningModel(model), + alphaLiquid1_(model.alphaLiquid1_), + alphaLiquid0_(model.alphaLiquid0_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +linear::~linear() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +linear::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return max + ( + scalar(0), + min + ( + scalar(1)-(alphaLiquid1_ - alphaLiquid) + /(alphaLiquid1_ - alphaLiquid0_), + scalar(1) + ) + ); +} + + +void Foam::wallBoilingModels::partitioningModels:: +linear::write(Ostream& os) const +{ + partitioningModel::write(os); + writeEntry(os, "alphaLiquid1", alphaLiquid1_); + writeEntry(os, "alphaLiquid0", alphaLiquid0_); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H new file mode 100644 index 0000000000..739bef5a33 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/linear/linear.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::partitioningModels::linear + +Description + Linear wall heat flux partitioning model. + + Proposed threshold liquid fractions: + - alphaLiquid1 0.1 + - alphaLiquid0 0.05 + + \verbatim + Ioilev, A., Samigulin, M., Ustinenko (2007). + Advances in the modeling of cladding heat transfer + and critical heat flux in boiling water reactor fuel assemblies. + In Proc. 12th International Topical Meeting on + Nuclear Reactor Thermal Hydraulics (NURETH-12), + Pittsburgh, Pennsylvania, USA. + \endverbatim + +SourceFiles + linear.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linear_H +#define linear_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class linear Declaration +\*---------------------------------------------------------------------------*/ + +class linear +: + public partitioningModel +{ + // Private Data + + //- Model parameters, threshold liquid phase fractions + scalar alphaLiquid1_; + scalar alphaLiquid0_; + + +public: + + //- Runtime type information + TypeName("linear"); + + + // Constructors + + //- Construct from a dictionary + linear(const dictionary& dict); + + //- Copy construct + linear(const linear& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new linear(*this)); + } + + + //- Destructor + virtual ~linear(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partitioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; + + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C new file mode 100644 index 0000000000..148096464b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "partitioningModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace wallBoilingModels + { + defineTypeNameAndDebug(partitioningModel, 0); + defineRunTimeSelectionTable(partitioningModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModel::partitioningModel() +{} + + +Foam::wallBoilingModels::partitioningModel::partitioningModel +( + const partitioningModel& model +) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModel::~partitioningModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::wallBoilingModels::partitioningModel::write(Ostream& os) const +{ + writeEntry(os, "type", this->type()); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H new file mode 100644 index 0000000000..06ccedcc83 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModel.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::partitioningModel + +Description + Base class for wall heat flux partitioning models + +SourceFiles + partitioningModel.C + partitioningModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef partitioningModel_H +#define partitioningModel_H + +#include "volFields.H" +#include "dictionary.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ + +/*---------------------------------------------------------------------------*\ + Class partitioningModel Declaration +\*---------------------------------------------------------------------------*/ + +class partitioningModel +{ +public: + + //- Runtime type information + TypeName("partitioningModel"); + + + //- Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + partitioningModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct null + partitioningModel(); + + //- Copy construct + partitioningModel(const partitioningModel&); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~partitioningModel(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partitioning + virtual tmp fLiquid + ( + const scalarField& alphaLiquid + ) const = 0; + + virtual void write(Ostream& os) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const partitioningModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModelNew.C new file mode 100644 index 0000000000..dc4a6c40d9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/partitioningModel/partitioningModelNew.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "partitioningModel.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::wallBoilingModels::partitioningModel::New +( + const dictionary& dict +) +{ + word partitioningModelType(dict.lookup("type")); + + Info<< "Selecting partitioningModel: " + << partitioningModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(partitioningModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown partitioningModelType type " + << partitioningModelType << endl << endl + << "Valid partitioningModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C new file mode 100644 index 0000000000..e888089c3a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.C @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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 "phaseFraction.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + defineTypeNameAndDebug(phaseFraction, 0); + addToRunTimeSelectionTable + ( + partitioningModel, + phaseFraction, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::phaseFraction(const dictionary& dict) +: + partitioningModel() +{} + + +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::phaseFraction(const phaseFraction& model) +: + partitioningModel(model) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::~phaseFraction() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::wallBoilingModels::partitioningModels:: +phaseFraction::fLiquid +( + const scalarField& alphaLiquid +) const +{ + return tmp(alphaLiquid); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H new file mode 100644 index 0000000000..df4a95f43b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/derivedFvPatchFields/wallBoilingSubModels/partitioningModels/phaseFraction/phaseFraction.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::wallBoilingModels::partitioningModels::phaseFraction + +Description + Wall heat-flux partitioned according to the phase volume fraction. + +SourceFiles + phaseFraction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseFraction_H +#define phaseFraction_H + +#include "partitioningModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace wallBoilingModels +{ +namespace partitioningModels +{ + +/*---------------------------------------------------------------------------*\ + Class phaseFraction Declaration +\*---------------------------------------------------------------------------*/ + +class phaseFraction +: + public partitioningModel +{ + +public: + + //- Runtime type information + TypeName("phaseFraction"); + + + // Constructors + + //- Construct from a dictionary + phaseFraction(const dictionary& dict); + + //- Copy construct + phaseFraction(const phaseFraction& model); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new phaseFraction(*this)); + } + + + //- Destructor + virtual ~phaseFraction(); + + + // Member Functions + + //- Calculate and return the wall heat-flux partitioning + virtual tmp fLiquid(const scalarField& alphaLiquid) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace partitioningModels +} // End namespace wallBoilingModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C new file mode 100644 index 0000000000..b16700752f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "GidaspowConductivity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + defineTypeNameAndDebug(Gidaspow, 0); + + addToRunTimeSelectionTable + ( + conductivityModel, + Gidaspow, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::Gidaspow::Gidaspow +( + const dictionary& dict +) +: + conductivityModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::Gidaspow::~Gidaspow() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::conductivityModels::Gidaspow::kappa +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + return rho1*da*sqrt(Theta)* + ( + 2*sqr(alpha1)*g0*(1 + e)/sqrtPi + + (9.0/8.0)*sqrtPi*g0*0.5*(1 + e)*sqr(alpha1) + + (15.0/16.0)*sqrtPi*alpha1 + + (25.0/64.0)*sqrtPi/((1 + e)*g0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H new file mode 100644 index 0000000000..524f578d6b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::conductivityModels::Gidaspow + +Description + +SourceFiles + Gidaspow.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GidaspowConductivity_H +#define GidaspowConductivity_H + +#include "conductivityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + +/*---------------------------------------------------------------------------*\ + Class Gidaspow Declaration +\*---------------------------------------------------------------------------*/ + +class Gidaspow +: + public conductivityModel +{ + +public: + + //- Runtime type information + TypeName("Gidaspow"); + + + // Constructors + + //- Construct from components + Gidaspow(const dictionary& dict); + + + //- Destructor + virtual ~Gidaspow(); + + + // Member Functions + + tmp kappa + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace conductivityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C new file mode 100644 index 0000000000..5fdedbe0a8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "HrenyaSinclairConductivity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + defineTypeNameAndDebug(HrenyaSinclair, 0); + + addToRunTimeSelectionTable + ( + conductivityModel, + HrenyaSinclair, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair +( + const dictionary& dict +) +: + conductivityModel(dict), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), + L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair:: +~HrenyaSinclair() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::kappa +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + volScalarField lambda + ( + scalar(1) + da/(6*sqrt(2.0)*(alpha1 + 1e-5))/L_ + ); + + return rho1*da*sqrt(Theta)* + ( + 2*sqr(alpha1)*g0*(1 + e)/sqrtPi + + (9.0/8.0)*sqrtPi*g0*0.25*sqr(1 + e)*(2*e - 1)*sqr(alpha1) + /(49.0/16.0 - 33*e/16.0) + + (15.0/16.0)*sqrtPi*alpha1*(0.5*sqr(e) + 0.25*e - 0.75 + lambda) + /((49.0/16.0 - 33*e/16.0)*lambda) + + (25.0/64.0)*sqrtPi + /((1 + e)*(49.0/16.0 - 33*e/16.0)*lambda*g0) + ); +} + + +bool Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::read() +{ + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); + + L_.readIfPresent(coeffDict_); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H new file mode 100644 index 0000000000..411073706f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::conductivityModels::HrenyaSinclair + +Description + +SourceFiles + HrenyaSinclair.C + +\*---------------------------------------------------------------------------*/ + +#ifndef HrenyaSinclairConductivity_H +#define HrenyaSinclairConductivity_H + +#include "conductivityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + +/*---------------------------------------------------------------------------*\ + Class HrenyaSinclair Declaration +\*---------------------------------------------------------------------------*/ + +class HrenyaSinclair +: + public conductivityModel +{ + dictionary coeffDict_; + + //- Characteristic length of geometry + dimensionedScalar L_; + + +public: + + //- Runtime type information + TypeName("HrenyaSinclair"); + + + // Constructors + + //- Construct from components + HrenyaSinclair(const dictionary& dict); + + + //- Destructor + virtual ~HrenyaSinclair(); + + + // Member Functions + + tmp kappa + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace conductivityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C new file mode 100644 index 0000000000..f5c851b617 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "SyamlalConductivity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + defineTypeNameAndDebug(Syamlal, 0); + + addToRunTimeSelectionTable + ( + conductivityModel, + Syamlal, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::Syamlal::Syamlal +( + const dictionary& dict +) +: + conductivityModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModels::Syamlal::~Syamlal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::conductivityModels::Syamlal::kappa +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + return rho1*da*sqrt(Theta)* + ( + 2*sqr(alpha1)*g0*(1 + e)/sqrtPi + + (9.0/8.0)*sqrtPi*g0*0.25*sqr(1 + e)*(2*e - 1)*sqr(alpha1) + /(49.0/16.0 - 33*e/16.0) + + (15.0/32.0)*sqrtPi*alpha1/(49.0/16.0 - 33*e/16.0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H new file mode 100644 index 0000000000..75f2e8cd6a --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::conductivityModels::Syamlal + +Description + +SourceFiles + Syamlal.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SyamlalConductivity_H +#define SyamlalConductivity_H + +#include "conductivityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace conductivityModels +{ + +/*---------------------------------------------------------------------------*\ + Class Syamlal Declaration +\*---------------------------------------------------------------------------*/ + +class Syamlal +: + public conductivityModel +{ + +public: + + //- Runtime type information + TypeName("Syamlal"); + + + // Constructors + + //- Construct from components + Syamlal(const dictionary& dict); + + + //- Destructor + virtual ~Syamlal(); + + + // Member Functions + + tmp kappa + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace conductivityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C new file mode 100644 index 0000000000..d50703def8 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "conductivityModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(conductivityModel, 0); + + defineRunTimeSelectionTable(conductivityModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModel::conductivityModel +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::conductivityModel::~conductivityModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H new file mode 100644 index 0000000000..91943163cb --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModel.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::conductivityModel + +SourceFiles + conductivityModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef conductivityModel_H +#define conductivityModel_H + +#include "dictionary.H" +#include "volFields.H" +#include "dimensionedTypes.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class conductivityModel Declaration +\*---------------------------------------------------------------------------*/ + +class conductivityModel +{ +protected: + + // Protected data + + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("conductivityModel"); + + // Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + conductivityModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from components + conductivityModel(const dictionary& dict); + + //- Disallow default bitwise copy construction + conductivityModel(const conductivityModel&) = delete; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~conductivityModel(); + + + // Member Functions + + virtual tmp kappa + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const = 0; + + virtual bool read() + { + return true; + } + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const conductivityModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModelNew.C new file mode 100644 index 0000000000..cce902e078 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/conductivityModel/conductivityModel/conductivityModelNew.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "conductivityModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::kineticTheoryModels::conductivityModel::New +( + const dictionary& dict +) +{ + word conductivityModelType(dict.lookup("granularConductivityModel")); + + Info<< "Selecting granularConductivityModel " + << conductivityModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(conductivityModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "conductivityModel::New(const dictionary&) : " << endl + << " unknown granularConductivityModel type " + << conductivityModelType + << ", constructor not in hash table" << endl << endl + << " Valid granularConductivityModel types are :" << endl; + Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C new file mode 100644 index 0000000000..45d5063aa7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "JohnsonJacksonFrictionalStress.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + defineTypeNameAndDebug(JohnsonJackson, 0); + + addToRunTimeSelectionTable + ( + frictionalStressModel, + JohnsonJackson, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: +JohnsonJackson +( + const dictionary& dict +) +: + frictionalStressModel(dict), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), + Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), + eta_("eta", dimless, coeffDict_), + p_("p", dimless, coeffDict_), + phi_("phi", dimless, coeffDict_), + alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_) +{ + phi_ *= constant::mathematical::pi/180.0; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: +~JohnsonJackson() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: +frictionalPressure +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return + Fr_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + /pow(max(alphaMax - alpha, alphaDeltaMin_), p_); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson:: +frictionalPressurePrime +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return Fr_* + ( + eta_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_ - 1) + *(alphaMax - alpha) + + p_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + )/pow(max(alphaMax - alpha, alphaDeltaMin_), p_ + 1); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::nu +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D +) const +{ + return volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + phase.group() + ), + dimensionedScalar(dimTime, 0.5)*pf*sin(phi_) + ); +} + + +bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read() +{ + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); + + Fr_.read(coeffDict_); + eta_.read(coeffDict_); + p_.read(coeffDict_); + + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; + + alphaDeltaMin_.read(coeffDict_); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H new file mode 100644 index 0000000000..6a13f74c19 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::frictionalStressModels::JohnsonJackson + +Description + +SourceFiles + JohnsonJacksonFrictionalStress.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonFrictionalStress_H +#define JohnsonJacksonFrictionalStress_H + +#include "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJackson Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJackson +: + public frictionalStressModel +{ + // Private Data + + dictionary coeffDict_; + + //- Material constant for frictional normal stress + dimensionedScalar Fr_; + + //- Material constant for frictional normal stress + dimensionedScalar eta_; + + //- Material constant for frictional normal stress + dimensionedScalar p_; + + //- Angle of internal friction + dimensionedScalar phi_; + + //- Lower limit for (alphaMax - alpha1) + dimensionedScalar alphaDeltaMin_; + + +public: + + //- Runtime type information + TypeName("JohnsonJackson"); + + + // Constructors + + //- Construct from components + JohnsonJackson(const dictionary& dict); + + + //- Destructor + virtual ~JohnsonJackson(); + + + // Member Functions + + virtual tmp frictionalPressure + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp frictionalPressurePrime + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp nu + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace frictionalStressModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C new file mode 100644 index 0000000000..760d9ccc61 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.C @@ -0,0 +1,204 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2022 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 "JohnsonJacksonSchaefferFrictionalStress.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + defineTypeNameAndDebug(JohnsonJacksonSchaeffer, 0); + + addToRunTimeSelectionTable + ( + frictionalStressModel, + JohnsonJacksonSchaeffer, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer +( + const dictionary& dict +) +: + frictionalStressModel(dict), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), + Fr_("Fr", dimensionSet(1, -1, -2, 0, 0), coeffDict_), + eta_("eta", dimless, coeffDict_), + p_("p", dimless, coeffDict_), + phi_("phi", dimless, coeffDict_), + alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_) +{ + phi_ *= constant::mathematical::pi/180.0; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::~JohnsonJacksonSchaeffer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::frictionalPressure +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return + Fr_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + /pow(max(alphaMax - alpha, alphaDeltaMin_), p_); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::frictionalPressurePrime +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return Fr_* + ( + eta_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_ - 1) + *(alphaMax - alpha) + + p_*pow(max(alpha - alphaMinFriction, scalar(0)), eta_) + )/pow(max(alphaMax - alpha, alphaDeltaMin_), p_ + 1); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::nu +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D +) const +{ + const volScalarField& alpha = phase; + + tmp tnu + ( + volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + phase.group() + ), + phase.mesh(), + dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), 0) + ) + ); + + volScalarField& nuf = tnu.ref(); + + forAll(D, celli) + { + if (alpha[celli] > alphaMinFriction.value()) + { + nuf[celli] = + 0.5*pf[celli]*sin(phi_.value()) + /( + sqrt((1.0/3.0)*sqr(tr(D[celli])) - invariantII(D[celli])) + + small + ); + } + } + + const fvPatchList& patches = phase.mesh().boundary(); + const volVectorField& U = phase.U(); + + volScalarField::Boundary& nufBf = nuf.boundaryFieldRef(); + + forAll(patches, patchi) + { + if (!patches[patchi].coupled()) + { + nufBf[patchi] = + ( + pf.boundaryField()[patchi]*sin(phi_.value()) + /( + mag(U.boundaryField()[patchi].snGrad()) + + small + ) + ); + } + } + + // Correct coupled BCs + nuf.correctBoundaryConditions(); + + return tnu; +} + + +bool Foam::kineticTheoryModels::frictionalStressModels:: +JohnsonJacksonSchaeffer::read() +{ + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); + + Fr_.read(coeffDict_); + eta_.read(coeffDict_); + p_.read(coeffDict_); + + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; + + alphaDeltaMin_.read(coeffDict_); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H new file mode 100644 index 0000000000..f8852e4f7c --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/JohnsonJacksonSchaeffer/JohnsonJacksonSchaefferFrictionalStress.H @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2016-2020 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::kineticTheoryModels::frictionalStressModels::JohnsonJacksonSchaeffer + +Description + +SourceFiles + JohnsonJacksonSchaefferFrictionalStress.C + +\*---------------------------------------------------------------------------*/ + +#ifndef JohnsonJacksonSchaefferFrictionalStress_H +#define JohnsonJacksonSchaefferFrictionalStress_H + +#include "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + +/*---------------------------------------------------------------------------*\ + Class JohnsonJacksonSchaeffer Declaration +\*---------------------------------------------------------------------------*/ + +class JohnsonJacksonSchaeffer +: + public frictionalStressModel +{ + // Private Data + + dictionary coeffDict_; + + //- Material constant for frictional normal stress + dimensionedScalar Fr_; + + //- Material constant for frictional normal stress + dimensionedScalar eta_; + + //- Material constant for frictional normal stress + dimensionedScalar p_; + + //- Angle of internal friction + dimensionedScalar phi_; + + //- Lower limit for (alphaMax - alpha1) + dimensionedScalar alphaDeltaMin_; + + +public: + + //- Runtime type information + TypeName("JohnsonJacksonSchaeffer"); + + + // Constructors + + //- Construct from components + JohnsonJacksonSchaeffer(const dictionary& dict); + + + //- Destructor + virtual ~JohnsonJacksonSchaeffer(); + + + // Member Functions + + virtual tmp frictionalPressure + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp frictionalPressurePrime + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp nu + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace frictionalStressModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C new file mode 100644 index 0000000000..1b06cb3c49 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "SchaefferFrictionalStress.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + defineTypeNameAndDebug(Schaeffer, 0); + + addToRunTimeSelectionTable + ( + frictionalStressModel, + Schaeffer, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer +( + const dictionary& dict +) +: + frictionalStressModel(dict), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), + phi_("phi", dimless, coeffDict_) +{ + phi_ *= constant::mathematical::pi/180.0; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::~Schaeffer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer:: +frictionalPressure +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return + dimensionedScalar(dimensionSet(1, -1, -2, 0, 0), 1e24) + *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer:: +frictionalPressurePrime +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + const volScalarField& alpha = phase; + + return + dimensionedScalar(dimensionSet(1, -1, -2, 0, 0), 1e25) + *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0); +} + + +Foam::tmp +Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu +( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D +) const +{ + const volScalarField& alpha = phase; + + tmp tnu + ( + volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + phase.group() + ), + phase.mesh(), + dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), 0) + ) + ); + + volScalarField& nuf = tnu.ref(); + + forAll(D, celli) + { + if (alpha[celli] > alphaMinFriction.value()) + { + nuf[celli] = + 0.5*pf[celli]*sin(phi_.value()) + /( + sqrt((1.0/3.0)*sqr(tr(D[celli])) - invariantII(D[celli])) + + small + ); + } + } + + const fvPatchList& patches = phase.mesh().boundary(); + const volVectorField& U = phase.U(); + + volScalarField::Boundary& nufBf = nuf.boundaryFieldRef(); + + forAll(patches, patchi) + { + if (!patches[patchi].coupled()) + { + nufBf[patchi] = + ( + pf.boundaryField()[patchi]*sin(phi_.value()) + /( + mag(U.boundaryField()[patchi].snGrad()) + + small + ) + ); + } + } + + // Correct coupled BCs + nuf.correctBoundaryConditions(); + + return tnu; +} + + +bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read() +{ + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); + + phi_.read(coeffDict_); + phi_ *= constant::mathematical::pi/180.0; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H new file mode 100644 index 0000000000..79bf2325c6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::frictionalStressModels::Schaeffer + +Description + +SourceFiles + SchaefferFrictionalStress.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SchaefferFrictionalStress_H +#define SchaefferFrictionalStress_H + +#include "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace frictionalStressModels +{ + +/*---------------------------------------------------------------------------*\ + Class Schaeffer Declaration +\*---------------------------------------------------------------------------*/ + +class Schaeffer +: + public frictionalStressModel +{ + // Private Data + + dictionary coeffDict_; + + //- Angle of internal friction + dimensionedScalar phi_; + + +public: + + //- Runtime type information + TypeName("Schaeffer"); + + + // Constructors + + //- Construct from components + Schaeffer(const dictionary& dict); + + + //- Destructor + virtual ~Schaeffer(); + + + // Member Functions + + virtual tmp frictionalPressure + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp frictionalPressurePrime + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + virtual tmp nu + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace frictionalStressModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C new file mode 100644 index 0000000000..1a1659c474 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "frictionalStressModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(frictionalStressModel, 0); + + defineRunTimeSelectionTable(frictionalStressModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModel::frictionalStressModel +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::frictionalStressModel::~frictionalStressModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H new file mode 100644 index 0000000000..a6cb445b38 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModel.H @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::frictionalStressModel + +SourceFiles + frictionalStressModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef frictionalStressModel_H +#define frictionalStressModel_H + +#include "dictionary.H" +#include "volFields.H" +#include "dimensionedTypes.H" +#include "runTimeSelectionTables.H" +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class frictionalStressModel Declaration +\*---------------------------------------------------------------------------*/ + +class frictionalStressModel +{ +protected: + + // Protected data + + //- Reference to higher-level dictionary for re-read + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("frictionalStressModel"); + + // Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + frictionalStressModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from components + frictionalStressModel(const dictionary& dict); + + //- Disallow default bitwise copy construction + frictionalStressModel(const frictionalStressModel&) = delete; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~frictionalStressModel(); + + + // Member Functions + + virtual tmp frictionalPressure + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const = 0; + + virtual tmp frictionalPressurePrime + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const = 0; + + virtual tmp nu + ( + const phaseModel& phase, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax, + const volScalarField& pf, + const volSymmTensorField& D + ) const = 0; + + virtual bool read() = 0; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const frictionalStressModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModelNew.C new file mode 100644 index 0000000000..981ef36ccc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/frictionalStressModel/frictionalStressModel/frictionalStressModelNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::kineticTheoryModels::frictionalStressModel::New +( + const dictionary& dict +) +{ + word frictionalStressModelType(dict.lookup("frictionalStressModel")); + + Info<< "Selecting frictionalStressModel " + << frictionalStressModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(frictionalStressModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "frictionalStressModel::New(const dictionary&) : " << endl + << " unknown frictionalStressModelType type " + << frictionalStressModelType + << ", constructor not in hash table" << endl << endl + << " Valid frictionalStressModelType types are :" << endl; + Info<< dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C new file mode 100644 index 0000000000..640b4cea09 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "LunPressure.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace granularPressureModels +{ + defineTypeNameAndDebug(Lun, 0); + + addToRunTimeSelectionTable + ( + granularPressureModel, + Lun, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModels::Lun::Lun +( + const dictionary& dict +) +: + granularPressureModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModels::Lun::~Lun() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::granularPressureModels::Lun::granularPressureCoeff +( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& rho1, + const dimensionedScalar& e +) const +{ + + return rho1*alpha1*(1 + 2*(1 + e)*alpha1*g0); +} + + +Foam::tmp +Foam::kineticTheoryModels::granularPressureModels::Lun:: +granularPressureCoeffPrime +( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& g0prime, + const volScalarField& rho1, + const dimensionedScalar& e +) const +{ + return rho1*(1 + alpha1*(1 + e)*(4*g0 + 2*g0prime*alpha1)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H new file mode 100644 index 0000000000..bc06a22865 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/Lun/LunPressure.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::granularPressureModels::Lun + +Description + +SourceFiles + LunPressure.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LunPressure_H +#define LunPressure_H + +#include "granularPressureModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace granularPressureModels +{ + +/*---------------------------------------------------------------------------*\ + Class Lun Declaration +\*---------------------------------------------------------------------------*/ + +class Lun +: + public granularPressureModel +{ + +public: + + //- Runtime type information + TypeName("Lun"); + + + // Constructors + + //- Construct from components + Lun(const dictionary& dict); + + + //- Destructor + virtual ~Lun(); + + + // Member Functions + + tmp granularPressureCoeff + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& rho1, + const dimensionedScalar& e + ) const; + + tmp granularPressureCoeffPrime + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& g0prime, + const volScalarField& rho1, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace granularPressureModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C new file mode 100644 index 0000000000..8c91d12dfa --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.C @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "SyamlalRogersOBrienPressure.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace granularPressureModels +{ + defineTypeNameAndDebug(SyamlalRogersOBrien, 0); + + addToRunTimeSelectionTable + ( + granularPressureModel, + SyamlalRogersOBrien, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModels::SyamlalRogersOBrien:: +SyamlalRogersOBrien +( + const dictionary& dict +) +: + granularPressureModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModels::SyamlalRogersOBrien:: +~SyamlalRogersOBrien() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::granularPressureModels::SyamlalRogersOBrien:: +granularPressureCoeff +( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& rho1, + const dimensionedScalar& e +) const +{ + + return 2*rho1*(1 + e)*sqr(alpha1)*g0; +} + + +Foam::tmp +Foam::kineticTheoryModels::granularPressureModels::SyamlalRogersOBrien:: +granularPressureCoeffPrime +( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& g0prime, + const volScalarField& rho1, + const dimensionedScalar& e +) const +{ + return rho1*alpha1*(1 + e)*(4*g0 + 2*g0prime*alpha1); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H new file mode 100644 index 0000000000..8886b5bdf2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::granularPressureModels::SyamlalRogersOBrien + +Description + +SourceFiles + SyamlalRogersOBrienPressure.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SyamlalRogersOBrienPressure_H +#define SyamlalRogersOBrienPressure_H + +#include "granularPressureModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace granularPressureModels +{ + +/*---------------------------------------------------------------------------*\ + Class SyamlalRogersOBrien Declaration +\*---------------------------------------------------------------------------*/ + +class SyamlalRogersOBrien +: + public granularPressureModel +{ + +public: + + //- Runtime type information + TypeName("SyamlalRogersOBrien"); + + + // Constructors + + //- Construct from components + SyamlalRogersOBrien(const dictionary& dict); + + + //- Destructor + virtual ~SyamlalRogersOBrien(); + + + // Member Functions + + tmp granularPressureCoeff + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& rho1, + const dimensionedScalar& e + ) const; + + tmp granularPressureCoeffPrime + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& g0prime, + const volScalarField& rho1, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace granularPressureModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C new file mode 100644 index 0000000000..37fd91f9c7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "granularPressureModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(granularPressureModel, 0); + + defineRunTimeSelectionTable(granularPressureModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModel::granularPressureModel +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::granularPressureModel::~granularPressureModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H new file mode 100644 index 0000000000..a77e66b7c5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModel.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::granularPressureModel + +SourceFiles + granularPressureModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef granularPressureModel_H +#define granularPressureModel_H + +#include "dictionary.H" +#include "volFields.H" +#include "dimensionedTypes.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class granularPressureModel Declaration +\*---------------------------------------------------------------------------*/ + +class granularPressureModel +{ +protected: + + // Protected data + + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("granularPressureModel"); + + // Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + granularPressureModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from components + granularPressureModel(const dictionary& dict); + + //- Disallow default bitwise copy construction + granularPressureModel(const granularPressureModel&) = delete; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~granularPressureModel(); + + + // Member Functions + + //- Granular pressure coefficient + virtual tmp granularPressureCoeff + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& rho1, + const dimensionedScalar& e + ) const = 0; + + //- Derivative of the granular pressure coefficient + virtual tmp granularPressureCoeffPrime + ( + const volScalarField& alpha1, + const volScalarField& g0, + const volScalarField& g0prime, + const volScalarField& rho1, + const dimensionedScalar& e + ) const = 0; + + virtual bool read() + { + return true; + } + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const granularPressureModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModelNew.C new file mode 100644 index 0000000000..07440f7241 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/granularPressureModel/granularPressureModel/granularPressureModelNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "granularPressureModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::kineticTheoryModels::granularPressureModel::New +( + const dictionary& dict +) +{ + word granularPressureModelType(dict.lookup("granularPressureModel")); + + Info<< "Selecting granularPressureModel " + << granularPressureModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(granularPressureModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "granularPressureModel::New(const dictionary&) : " << endl + << " unknown granularPressureModelType type " + << granularPressureModelType + << ", constructor not in hash table" << endl << endl + << " Valid granularPressureModelType types are :" << endl; + Info<< dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C new file mode 100644 index 0000000000..8dcafc84e6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -0,0 +1,629 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "kineticTheoryModel.H" +#include "mathematicalConstants.H" +#include "phaseSystem.H" +#include "fvModels.H" +#include "fvConstraints.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +const Foam::phaseModel& +Foam::RASModels::kineticTheoryModel::continuousPhase() const +{ + const phaseSystem& fluid = phase_.fluid(); + + if (continuousPhaseName_ == word::null) + { + if (fluid.movingPhases().size() != 2) + { + FatalIOErrorInFunction(coeffDict_) + << "Continuous phase name must be specified " + << "when there are more than two moving phases." + << exit(FatalIOError); + } + + forAll(fluid.movingPhases(), movingPhasei) + { + const phaseModel& otherPhase = fluid.movingPhases()[movingPhasei]; + + if (&otherPhase != &phase_) + { + return otherPhase; + } + } + } + + return fluid.phases()[continuousPhaseName_]; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::RASModels::kineticTheoryModel::kineticTheoryModel +( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const viscosity& viscosity, + const word& type +) +: + eddyViscosity> + ( + type, + alpha, + rho, + U, + alphaRhoPhi, + phi, + viscosity + ), + + phase_(refCast(viscosity)), + + continuousPhaseName_ + ( + coeffDict_.lookupOrDefault("continuousPhase", word::null) + ), + + viscosityModel_ + ( + kineticTheoryModels::viscosityModel::New + ( + coeffDict_ + ) + ), + conductivityModel_ + ( + kineticTheoryModels::conductivityModel::New + ( + coeffDict_ + ) + ), + radialModel_ + ( + kineticTheoryModels::radialModel::New + ( + coeffDict_ + ) + ), + granularPressureModel_ + ( + kineticTheoryModels::granularPressureModel::New + ( + coeffDict_ + ) + ), + frictionalStressModel_ + ( + kineticTheoryModels::frictionalStressModel::New + ( + coeffDict_ + ) + ), + + equilibrium_(coeffDict_.lookup("equilibrium")), + e_("e", dimless, coeffDict_), + alphaMinFriction_ + ( + "alphaMinFriction", + dimless, + coeffDict_ + ), + residualAlpha_ + ( + "residualAlpha", + dimless, + coeffDict_ + ), + + maxNut_ + ( + "maxNut", + dimensionSet(0, 2, -1, 0, 0), + coeffDict_.lookupOrDefault("maxNut", 1000) + ), + + Theta_ + ( + IOobject + ( + IOobject::groupName("Theta", phase_.name()), + U.time().timeName(), + U.mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + U.mesh() + ), + + lambda_ + ( + IOobject + ( + IOobject::groupName(typedName("lambda"), phase_.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), 0) + ), + + gs0_ + ( + IOobject + ( + IOobject::groupName(typedName("gs0"), phase_.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar(dimensionSet(0, 0, 0, 0, 0), 0) + ), + + kappa_ + ( + IOobject + ( + IOobject::groupName(typedName("kappa"), phase_.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + U.mesh(), + dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), 0) + ), + + nuFric_ + ( + IOobject + ( + IOobject::groupName(typedName("nuFric"), phase_.name()), + U.time().timeName(), + U.mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + U.mesh(), + dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), 0) + ) +{ + if (type == typeName) + { + printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::RASModels::kineticTheoryModel::~kineticTheoryModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::RASModels::kineticTheoryModel::read() +{ + if + ( + eddyViscosity>:: + read() + ) + { + coeffDict().lookup("equilibrium") >> equilibrium_; + e_.readIfPresent(coeffDict()); + alphaMinFriction_.readIfPresent(coeffDict()); + + viscosityModel_->read(); + conductivityModel_->read(); + radialModel_->read(); + granularPressureModel_->read(); + frictionalStressModel_->read(); + + return true; + } + else + { + return false; + } +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::k() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::epsilon() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::omega() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::sigma() const +{ + return tmp + ( + volSymmTensorField::New + ( + IOobject::groupName("R", U_.group()), + - (nut_ + nuFric_)*dev(twoSymm(fvc::grad(U_))) + - (lambda_*fvc::div(phi_))*symmTensor::I + ) + ); +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::pPrime() const +{ + const volScalarField& rho = phase_.rho(); + + tmp tpPrime + ( + volScalarField::New + ( + IOobject::groupName("pPrime", U_.group()), + Theta_ + *granularPressureModel_->granularPressureCoeffPrime + ( + alpha_, + radialModel_->g0 + ( + alpha_, + alphaMinFriction_, + phase_.alphaMax() + ), + radialModel_->g0prime + ( + alpha_, + alphaMinFriction_, + phase_.alphaMax() + ), + rho, + e_ + ) + + frictionalStressModel_->frictionalPressurePrime + ( + phase_, + alphaMinFriction_, + phase_.alphaMax() + ) + ) + ); + + volScalarField::Boundary& bpPrime = tpPrime.ref().boundaryFieldRef(); + + forAll(bpPrime, patchi) + { + if (!bpPrime[patchi].coupled()) + { + bpPrime[patchi] == 0; + } + } + + return tpPrime; +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::pPrimef() const +{ + return surfaceScalarField::New + ( + IOobject::groupName("pPrimef", U_.group()), + fvc::interpolate(pPrime()) + ); +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::devTau() const +{ + return tmp + ( + volSymmTensorField::New + ( + IOobject::groupName("devTau", U_.group()), + - (rho_*(nut_ + nuFric_)) + *dev(twoSymm(fvc::grad(U_))) + - ((rho_*lambda_)*fvc::div(phi_))*symmTensor::I + ) + ); +} + + +Foam::tmp +Foam::RASModels::kineticTheoryModel::divDevTau +( + volVectorField& U +) const +{ + return + ( + - fvm::laplacian(rho_*(nut_ + nuFric_), U) + - fvc::div + ( + (rho_*(nut_ + nuFric_))*dev2(T(fvc::grad(U))) + + ((rho_*lambda_)*fvc::div(phi_)) + *dimensioned("I", dimless, symmTensor::I), + "divDevTau(" + U_.name() + ')' + ) + ); +} + + +void Foam::RASModels::kineticTheoryModel::correct() +{ + // Local references + const volScalarField alpha(max(alpha_, scalar(0))); + const phaseSystem& fluid = phase_.fluid(); + const phaseModel& continuousPhase = this->continuousPhase(); + const volScalarField& rho = phase_.rho(); + const surfaceScalarField& alphaRhoPhi = alphaRhoPhi_; + const volVectorField& U = U_; + const volVectorField& Uc_ = continuousPhase.U(); + + const scalar sqrtPi = sqrt(constant::mathematical::pi); + const dimensionedScalar ThetaSmall("ThetaSmall", Theta_.dimensions(), 1e-6); + const dimensionedScalar ThetaSmallSqrt(sqrt(ThetaSmall)); + + tmp tda(phase_.d()); + const volScalarField& da = tda(); + + tmp tgradU(fvc::grad(U_)); + const volTensorField& gradU(tgradU()); + const volSymmTensorField D(symm(gradU)); + + // Calculating the radial distribution function + gs0_ = radialModel_->g0(alpha, alphaMinFriction_, phase_.alphaMax()); + + if (!equilibrium_) + { + // Particle viscosity (Table 3.2, p.47) + nut_ = viscosityModel_->nu(alpha, Theta_, gs0_, rho, da, e_); + + const volScalarField ThetaSqrt("sqrtTheta", sqrt(Theta_)); + + // Bulk viscosity p. 45 (Lun et al. 1984). + lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0_*(1 + e_)*ThetaSqrt/sqrtPi; + + // Stress tensor, Definitions, Table 3.1, p. 43 + const volSymmTensorField tau + ( + rho*(2*nut_*D + (lambda_ - (2.0/3.0)*nut_)*tr(D)*I) + ); + + // Dissipation (Eq. 3.24, p.50) + const volScalarField gammaCoeff + ( + "gammaCoeff", + 12*(1 - sqr(e_)) + *max(sqr(alpha), residualAlpha_) + *rho*gs0_*(1.0/da)*ThetaSqrt/sqrtPi + ); + + // Drag + const dispersedPhaseInterface interface(phase_, continuousPhase); + const volScalarField beta + ( + fluid.foundInterfacialModel(interface) + ? fluid.lookupInterfacialModel(interface).K() + : volScalarField::New + ( + "beta", + phase_.mesh(), + dimensionedScalar(dragModel::dimK, 0) + ) + ); + + // Eq. 3.25, p. 50 Js = J1 - J2 + const volScalarField J1("J1", 3*beta); + const volScalarField J2 + ( + "J2", + 0.25*sqr(beta)*da*magSqr(U - Uc_) + /( + max(alpha, residualAlpha_)*rho + *sqrtPi*(ThetaSqrt + ThetaSmallSqrt) + ) + ); + + // particle pressure - coefficient in front of Theta (Eq. 3.22, p. 45) + const volScalarField PsCoeff + ( + granularPressureModel_->granularPressureCoeff + ( + alpha, + gs0_, + rho, + e_ + ) + ); + + // 'thermal' conductivity (Table 3.3, p. 49) + kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rho, da, e_); + + const Foam::fvModels& fvModels(Foam::fvModels::New(mesh_)); + const Foam::fvConstraints& fvConstraints + ( + Foam::fvConstraints::New(mesh_) + ); + + // Construct the granular temperature equation (Eq. 3.20, p. 44) + // NB. note that there are two typos in Eq. 3.20: + // Ps should be without grad + // the laplacian has the wrong sign + fvScalarMatrix ThetaEqn + ( + 1.5* + ( + fvm::ddt(alpha, rho, Theta_) + + fvm::div(alphaRhoPhi, Theta_) + - fvc::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaRhoPhi), Theta_) + ) + - fvm::laplacian(kappa_, Theta_, "laplacian(kappa,Theta)") + == + - fvm::SuSp((PsCoeff*I) && gradU, Theta_) + + (tau && gradU) + + fvm::Sp(-gammaCoeff, Theta_) + + fvm::Sp(-J1, Theta_) + + fvm::Sp(J2/(Theta_ + ThetaSmall), Theta_) + + fvModels.source(alpha, rho, Theta_) + ); + + ThetaEqn.relax(); + fvConstraints.constrain(ThetaEqn); + ThetaEqn.solve(); + fvConstraints.constrain(Theta_); + } + else + { + // Equilibrium => dissipation == production + // Eq. 4.14, p.82 + const volScalarField K1("K1", 2*(1 + e_)*rho*gs0_); + const volScalarField K3 + ( + "K3", + 0.5*da*rho* + ( + (sqrtPi/(3*(3.0 - e_))) + *(1 + 0.4*(1 + e_)*(3*e_ - 1)*alpha*gs0_) + +1.6*alpha*gs0_*(1 + e_)/sqrtPi + ) + ); + + const volScalarField K2 + ( + "K2", + 4*da*rho*(1 + e_)*alpha*gs0_/(3*sqrtPi) - 2*K3/3.0 + ); + + const volScalarField K4("K4", 12*(1 - sqr(e_))*rho*gs0_/(da*sqrtPi)); + + const volScalarField trD + ( + "trD", + alpha/(alpha + residualAlpha_) + *fvc::div(phi_) + ); + const volScalarField tr2D("tr2D", sqr(trD)); + const volScalarField trD2("trD2", tr(D & D)); + + const volScalarField t1("t1", K1*alpha + rho); + const volScalarField l1("l1", -t1*trD); + const volScalarField l2("l2", sqr(t1)*tr2D); + const volScalarField l3 + ( + "l3", + 4.0 + *K4 + *alpha + *(2*K3*trD2 + K2*tr2D) + ); + + Theta_ = sqr + ( + (l1 + sqrt(l2 + l3)) + /(2*max(alpha, residualAlpha_)*K4) + ); + + kappa_ = conductivityModel_->kappa(alpha, Theta_, gs0_, rho, da, e_); + } + + Theta_.max(0); + Theta_.min(100); + + { + // particle viscosity (Table 3.2, p.47) + nut_ = viscosityModel_->nu(alpha, Theta_, gs0_, rho, da, e_); + + const volScalarField ThetaSqrt("sqrtTheta", sqrt(Theta_)); + + // Bulk viscosity p. 45 (Lun et al. 1984). + lambda_ = (4.0/3.0)*sqr(alpha)*da*gs0_*(1 + e_)*ThetaSqrt/sqrtPi; + + // Frictional pressure + const volScalarField pf + ( + frictionalStressModel_->frictionalPressure + ( + phase_, + alphaMinFriction_, + phase_.alphaMax() + ) + ); + + // Limit viscosity + nut_.min(maxNut_); + + nuFric_ = min + ( + frictionalStressModel_->nu + ( + phase_, + alphaMinFriction_, + phase_.alphaMax(), + pf/rho, + D + ), + maxNut_ - nut_ + ); + } + + if (debug) + { + Info<< typeName << ':' << nl + << " max(Theta) = " << max(Theta_).value() << nl + << " max(nut) = " << max(nut_).value() << endl; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H new file mode 100644 index 0000000000..d6932efe51 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H @@ -0,0 +1,240 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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::RASModels::kineticTheoryModel + +Description + Kinetic theory particle phase RAS model + + Reference: + \verbatim + van Wachem, B. G. M. (2000). + Derivation, implementation, and validation of computer simulation models + for gas-solid fluidised beds. + PhD Thesis, TU Delft. + \endverbatim + + There are no default model coefficients. + +SourceFiles + kineticTheoryModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kineticTheoryModel_H +#define kineticTheoryModel_H + +#include "RASModel.H" +#include "eddyViscosity.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "phaseModel.H" +#include "dragModel.H" +#include "kineticTheoryViscosityModel.H" +#include "conductivityModel.H" +#include "radialModel.H" +#include "granularPressureModel.H" +#include "frictionalStressModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kineticTheoryModel Declaration +\*---------------------------------------------------------------------------*/ + +class kineticTheoryModel +: + public eddyViscosity> +{ + // Private Data + + const phaseModel& phase_; + + //- Name of the continuous phase + word continuousPhaseName_; + + + // Sub-models + + //- Run-time selected viscosity model + autoPtr viscosityModel_; + + //- Run-time selected conductivity model + autoPtr conductivityModel_; + + //- Run-time selected radial distribution model + autoPtr radialModel_; + + //- Run-time selected granular pressure model + autoPtr + granularPressureModel_; + + //- Run-time selected frictional stress model + autoPtr + frictionalStressModel_; + + + // Kinetic Theory Model coefficients + + //- Use equilibrium approximation: generation == dissipation + Switch equilibrium_; + + //- Coefficient of restitution + dimensionedScalar e_; + + //- Min value for which the frictional stresses are zero + dimensionedScalar alphaMinFriction_; + + //- Residual phase fraction + dimensionedScalar residualAlpha_; + + //- Maximum turbulent viscosity + dimensionedScalar maxNut_; + + + // Kinetic Theory Model Fields + + //- The granular energy/temperature + volScalarField Theta_; + + //- The granular bulk viscosity + volScalarField lambda_; + + //- The granular radial distribution + volScalarField gs0_; + + //- The granular "thermal" conductivity + volScalarField kappa_; + + //- The frictional viscosity + volScalarField nuFric_; + + + // Private Member Functions + + void correctNut() + {} + + //- Return the continuous phase model + // which for two-phases is the "other" phase + // and for more than two phases must be specified + const phaseModel& continuousPhase() const; + + +public: + + //- Runtime type information + TypeName("kineticTheory"); + + + // Constructors + + //- Construct from components + kineticTheoryModel + ( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const viscosity& viscosity, + const word& type = typeName + ); + + //- Disallow default bitwise copy construction + kineticTheoryModel(const kineticTheoryModel&) = delete; + + + //- Destructor + virtual ~kineticTheoryModel(); + + + // Member Functions + + //- Re-read model coefficients if they have changed + virtual bool read(); + + //- Return the effective viscosity + virtual tmp nuEff() const + { + return this->nut(); + } + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const + { + return this->nut(patchi); + } + + //- Return the turbulence kinetic energy + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const; + + //- Return the turbulence specific dissipation rate + virtual tmp omega() const; + + //- Return the stress tensor [m^2/s^2] + virtual tmp sigma() const; + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devTau() const; + + //- Return the source term for the momentum equation + virtual tmp divDevTau(volVectorField& U) const; + + //- Solve the kinetic theory equations and correct the viscosity + virtual void correct(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const kineticTheoryModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C new file mode 100644 index 0000000000..d6c9881e39 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "CarnahanStarlingRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + defineTypeNameAndDebug(CarnahanStarling, 0); + + addToRunTimeSelectionTable + ( + radialModel, + CarnahanStarling, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::CarnahanStarling::CarnahanStarling +( + const dictionary& dict +) +: + radialModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::CarnahanStarling::~CarnahanStarling() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::radialModels::CarnahanStarling::g0 +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + + return + 1.0/(1 - alpha) + + 3*alpha/(2*sqr(1 - alpha)) + + sqr(alpha)/(2*pow3(1 - alpha)); +} + + +Foam::tmp +Foam::kineticTheoryModels::radialModels::CarnahanStarling::g0prime +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + return + 2.5/sqr(1 - alpha) + + 4*alpha/pow3(1 - alpha) + + 1.5*sqr(alpha)/pow4(1 - alpha); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H new file mode 100644 index 0000000000..4ad1327181 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/CarnahanStarling/CarnahanStarlingRadial.H @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::radialModels::CarnahanStarling + +Description + +SourceFiles + CarnahanStarlingRadial.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CarnahanStarlingRadial_H +#define CarnahanStarlingRadial_H + +#include "radialModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + +/*---------------------------------------------------------------------------*\ + Class CarnahanStarling Declaration +\*---------------------------------------------------------------------------*/ + +class CarnahanStarling +: + public radialModel +{ + +public: + + //- Runtime type information + TypeName("CarnahanStarling"); + + + // Constructors + + //- Construct from components + CarnahanStarling(const dictionary& dict); + + + //- Destructor + virtual ~CarnahanStarling(); + + + // Member Functions + + + tmp g0 + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + tmp g0prime + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace radialModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C new file mode 100644 index 0000000000..70f5d82361 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "LunSavageRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + defineTypeNameAndDebug(LunSavage, 0); + + addToRunTimeSelectionTable + ( + radialModel, + LunSavage, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::LunSavage::LunSavage +( + const dictionary& dict +) +: + radialModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::LunSavage::~LunSavage() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::radialModels::LunSavage::g0 +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + + return pow(1 - alpha/alphaMax, -2.5*alphaMax); +} + + +Foam::tmp +Foam::kineticTheoryModels::radialModels::LunSavage::g0prime +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + return 2.5*pow(1 - alpha/alphaMax, -2.5*alphaMax - 1); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H new file mode 100644 index 0000000000..c94690ccc2 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/LunSavage/LunSavageRadial.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::radialModels::LunSavage + +Description + +SourceFiles + LunSavage.C + +\*---------------------------------------------------------------------------*/ + +#ifndef LunSavageRadial_H +#define LunSavageRadial_H + +#include "radialModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + +/*---------------------------------------------------------------------------*\ + Class LunSavage Declaration +\*---------------------------------------------------------------------------*/ + +class LunSavage +: + public radialModel +{ + +public: + + //- Runtime type information + TypeName("LunSavage"); + + + // Constructors + + //- Construct from components + LunSavage(const dictionary& dict); + + + //- Destructor + virtual ~LunSavage(); + + + // Member Functions + + tmp g0 + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + tmp g0prime + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace radialModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C new file mode 100644 index 0000000000..98b780d343 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.C @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "SinclairJacksonRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + defineTypeNameAndDebug(SinclairJackson, 0); + + addToRunTimeSelectionTable + ( + radialModel, + SinclairJackson, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::SinclairJackson::SinclairJackson +( + const dictionary& dict +) +: + radialModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModels::SinclairJackson::~SinclairJackson() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::radialModels::SinclairJackson::g0 +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + return 1.0/(1 - cbrt(min(alpha, alphaMinFriction)/alphaMax)); +} + + +Foam::tmp +Foam::kineticTheoryModels::radialModels::SinclairJackson::g0prime +( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax +) const +{ + volScalarField aByaMax + ( + cbrt(min(max(alpha, scalar(1e-3)), alphaMinFriction)/alphaMax) + ); + + return (1.0/(3*alphaMax))/sqr(aByaMax - sqr(aByaMax)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H new file mode 100644 index 0000000000..d7e11d19f6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/SinclairJackson/SinclairJacksonRadial.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::radialModels::SinclairJackson + +Description + +SourceFiles + SinclairJacksonRadial.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SinclairJacksonRadial_H +#define SinclairJacksonRadial_H + +#include "radialModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace radialModels +{ + +/*---------------------------------------------------------------------------*\ + Class SinclairJackson Declaration +\*---------------------------------------------------------------------------*/ + +class SinclairJackson +: + public radialModel +{ + +public: + + //- Runtime type information + TypeName("SinclairJackson"); + + + // Constructors + + //- Construct from components + SinclairJackson(const dictionary& dict); + + + //- Destructor + virtual ~SinclairJackson(); + + + // Member Functions + + tmp g0 + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; + + tmp g0prime + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace radialModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.C new file mode 100644 index 0000000000..5ec4a31a6b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.C @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "radialModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(radialModel, 0); + + defineRunTimeSelectionTable(radialModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModel::radialModel +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::radialModel::~radialModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.H new file mode 100644 index 0000000000..23fb05cab1 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModel.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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::kineticTheoryModels::radialModel + +SourceFiles + radialModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef radialModel_H +#define radialModel_H + +#include "dictionary.H" +#include "volFields.H" +#include "dimensionedTypes.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class radialModel Declaration +\*---------------------------------------------------------------------------*/ + +class radialModel +{ +protected: + + // Protected data + + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("radialModel"); + + // Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + radialModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from components + radialModel(const dictionary& dict); + + //- Disallow default bitwise copy construction + radialModel(const radialModel&) = delete; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~radialModel(); + + + // Member Functions + + //- Radial distribution function + virtual tmp g0 + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const = 0; + + //- Derivative of the radial distribution function + virtual tmp g0prime + ( + const volScalarField& alpha, + const dimensionedScalar& alphaMinFriction, + const dimensionedScalar& alphaMax + ) const = 0; + + virtual bool read() + { + return true; + } + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const radialModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModelNew.C new file mode 100644 index 0000000000..0a57e62379 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/radialModel/radialModel/radialModelNew.C @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2020 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 "radialModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::kineticTheoryModels::radialModel::New +( + const dictionary& dict +) +{ + word radialModelType(dict.lookup("radialModel")); + + Info<< "Selecting radialModel " + << radialModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(radialModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "radialModel::New(const dictionary&) : " << endl + << " unknown radialModelType type " + << radialModelType + << ", constructor not in hash table" << endl << endl + << " Valid radialModelType types are :" << endl; + Info<< dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C new file mode 100644 index 0000000000..7eeb606171 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "GidaspowViscosity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + defineTypeNameAndDebug(Gidaspow, 0); + addToRunTimeSelectionTable(viscosityModel, Gidaspow, dictionary); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::Gidaspow::Gidaspow +( + const dictionary& dict +) +: + viscosityModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::Gidaspow::~Gidaspow() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::viscosityModels::Gidaspow::nu +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + return volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + Theta.group() + ), + da*sqrt(Theta) + *( + (4.0/5.0)*sqr(alpha1)*g0*(1.0 + e)/sqrtPi + + (1.0/15.0)*sqrtPi*g0*(1.0 + e)*sqr(alpha1) + + (1.0/6.0)*sqrtPi*alpha1 + + (10.0/96.0)*sqrtPi/((1.0 + e)*g0) + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H new file mode 100644 index 0000000000..6f0bd917ae --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.H @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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::kineticTheoryModels::viscosityModels::Gidaspow + +Description + +SourceFiles + GidaspowViscosity.C + +\*---------------------------------------------------------------------------*/ + +#ifndef GidaspowViscosity_H +#define GidaspowViscosity_H + +#include "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class Gidaspow Declaration +\*---------------------------------------------------------------------------*/ + +class Gidaspow +: + public viscosityModel +{ + +public: + + //- Runtime type information + TypeName("Gidaspow"); + + // Constructors + + //- Construct from components + Gidaspow(const dictionary& dict); + + + //- Destructor + virtual ~Gidaspow(); + + + // Member Functions + + tmp nu + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace viscosityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C new file mode 100644 index 0000000000..07e5a9dab0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "HrenyaSinclairViscosity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + defineTypeNameAndDebug(HrenyaSinclair, 0); + + addToRunTimeSelectionTable + ( + viscosityModel, + HrenyaSinclair, + dictionary + ); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair +( + const dictionary& dict +) +: + viscosityModel(dict), + coeffDict_(dict.optionalSubDict(typeName + "Coeffs")), + L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::~HrenyaSinclair() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::nu +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + const volScalarField lambda(1 + da/(6*sqrt(2.0)*(alpha1 + 1e-5))/L_); + + return volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + Theta.group() + ), + da*sqrt(Theta)* + ( + (4.0/5.0)*sqr(alpha1)*g0*(1 + e)/sqrtPi + + (1.0/15.0)*sqrtPi*g0*(1 + e)*(3*e - 1)*sqr(alpha1)/(3 - e) + + (1.0/6.0)*sqrtPi*alpha1*(0.5*lambda + 0.25*(3*e - 1)) + /(0.5*(3 - e)*lambda) + + (10.0/96.0)*sqrtPi/((1 + e)*0.5*(3 - e)*g0*lambda) + ) + ); +} + + +bool Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::read() +{ + coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs"); + + L_.readIfPresent(coeffDict_); + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H new file mode 100644 index 0000000000..20bd7f6978 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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::kineticTheoryModels::viscosityModels::HrenyaSinclair + +Description + +SourceFiles + HrenyaSinclairViscosity.C + +\*---------------------------------------------------------------------------*/ + +#ifndef HrenyaSinclairViscosity_H +#define HrenyaSinclairViscosity_H + +#include "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class HrenyaSinclair Declaration +\*---------------------------------------------------------------------------*/ + +class HrenyaSinclair +: + public viscosityModel +{ + // Private Data + + dictionary coeffDict_; + + //- Characteristic length of geometry + dimensionedScalar L_; + + +public: + + //- Runtime type information + TypeName("HrenyaSinclair"); + + + // Constructors + + //- Construct from components + HrenyaSinclair(const dictionary& dict); + + + //- Destructor + virtual ~HrenyaSinclair(); + + + // Member Functions + + tmp nu + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; + + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace viscosityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C new file mode 100644 index 0000000000..d328038e78 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "SyamlalViscosity.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + defineTypeNameAndDebug(Syamlal, 0); + addToRunTimeSelectionTable(viscosityModel, Syamlal, dictionary); +} +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::Syamlal::Syamlal +( + const dictionary& dict +) +: + viscosityModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModels::Syamlal::~Syamlal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::kineticTheoryModels::viscosityModels::Syamlal::nu +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + const scalar sqrtPi = sqrt(constant::mathematical::pi); + + return volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + Theta.group() + ), + da*sqrt(Theta) + *( + (4.0/5.0)*sqr(alpha1)*g0*(1 + e)/sqrtPi + + (1.0/15.0)*sqrtPi*g0*(1 + e)*(3*e - 1)*sqr(alpha1)/(3 - e) + + (1.0/6.0)*alpha1*sqrtPi/(3 - e) + ) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H new file mode 100644 index 0000000000..25c6f2fc5b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.H @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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::kineticTheoryModels::viscosityModels::Syamlal + +Description + +SourceFiles + SyamlalViscosity.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SyamlalViscosity_H +#define SyamlalViscosity_H + +#include "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ +namespace viscosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class Syamlal Declaration +\*---------------------------------------------------------------------------*/ + +class Syamlal +: + public viscosityModel +{ + +public: + + //- Runtime type information + TypeName("Syamlal"); + + + // Constructors + + //- Construct from components + Syamlal(const dictionary& dict); + + + //- Destructor + virtual ~Syamlal(); + + + // Member Functions + + tmp nu + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace viscosityModels +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C new file mode 100644 index 0000000000..9450ded558 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2022 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 "noneViscosity.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(noneViscosity, 0); + addToRunTimeSelectionTable(viscosityModel, noneViscosity, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::noneViscosity::noneViscosity(const dictionary& dict) +: + viscosityModel(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::noneViscosity::~noneViscosity() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::kineticTheoryModels::noneViscosity::nu +( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e +) const +{ + return volScalarField::New + ( + IOobject::groupName + ( + Foam::typedName("nu"), + Theta.group() + ), + alpha1.mesh(), + dimensionedScalar(dimArea/dimTime, 0) + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H new file mode 100644 index 0000000000..93fc6ff2da --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/none/noneViscosity.H @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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::kineticTheoryModels::noneViscosity + +Description + +SourceFiles + noneViscosity.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noneViscosity_H +#define noneViscosity_H + +#include "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class noneViscosity Declaration +\*---------------------------------------------------------------------------*/ + +class noneViscosity +: + public viscosityModel +{ + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from components + noneViscosity(const dictionary& dict); + + + //- Destructor + virtual ~noneViscosity(); + + + // Member Functions + + tmp nu + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.C new file mode 100644 index 0000000000..4f4a96c7fa --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.C @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + defineTypeNameAndDebug(viscosityModel, 0); + defineRunTimeSelectionTable(viscosityModel, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModel::viscosityModel +( + const dictionary& dict +) +: + dict_(dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::kineticTheoryModels::viscosityModel::~viscosityModel() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.H new file mode 100644 index 0000000000..a8f68017fa --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModel.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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::kineticTheoryModels::viscosityModel + +Description + +SourceFiles + viscosityModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kineticTheoryViscosityModel_H +#define kineticTheoryViscosityModel_H + +#include "dictionary.H" +#include "volFields.H" +#include "dimensionedTypes.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace kineticTheoryModels +{ + +/*---------------------------------------------------------------------------*\ + Class viscosityModel Declaration +\*---------------------------------------------------------------------------*/ + +class viscosityModel +{ +protected: + + // Protected data + + const dictionary& dict_; + + +public: + + //- Runtime type information + TypeName("viscosityModel"); + + // Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + viscosityModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from components + viscosityModel(const dictionary& dict); + + //- Disallow default bitwise copy construction + viscosityModel(const viscosityModel&) = delete; + + + // Selectors + + static autoPtr New + ( + const dictionary& dict + ); + + + //- Destructor + virtual ~viscosityModel(); + + + // Member Functions + + virtual tmp nu + ( + const volScalarField& alpha1, + const volScalarField& Theta, + const volScalarField& g0, + const volScalarField& rho1, + const volScalarField& da, + const dimensionedScalar& e + ) const = 0; + + virtual bool read() + { + return true; + } + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const viscosityModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace kineticTheoryModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModelNew.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModelNew.C new file mode 100644 index 0000000000..a43a671eed --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/kineticTheoryModels/viscosityModel/viscosityModel/kineticTheoryViscosityModelNew.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-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 "kineticTheoryViscosityModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::kineticTheoryModels::viscosityModel::New +( + const dictionary& dict +) +{ + word viscosityModelType(dict.lookup("granularViscosityModel")); + + Info<< "Selecting granularViscosityModel " + << viscosityModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(viscosityModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "viscosityModel::New(const dictionary&) : " << endl + << " unknown granularViscosityModel type " + << viscosityModelType + << ", constructor not in hash table" << endl << endl + << " Valid granularViscosityModel types are :" << endl; + Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/multiphaseCompressibleMomentumTransportModels.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/multiphaseCompressibleMomentumTransportModels.C new file mode 100644 index 0000000000..f5c407cc2e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/multiphaseCompressibleMomentumTransportModels.C @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-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 "makePhaseCompressibleMomentumTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "LaheyKEpsilon.H" +makeRASModel(LaheyKEpsilon); + +#include "kOmegaSSTSato.H" +makeRASModel(kOmegaSSTSato); + +#include "continuousGasKEpsilon.H" +makeRASModel(continuousGasKEpsilon); + +#include "mixtureKEpsilon.H" +makeRASModel(mixtureKEpsilon); + +#include "SmagorinskyZhang.H" +makeLESModel(SmagorinskyZhang); + +#include "NicenoKEqn.H" +makeLESModel(NicenoKEqn); + +#include "continuousGasKEqn.H" +makeLESModel(continuousGasKEqn); + +#include "kineticTheoryModel.H" +makeMomentumTransportModel +( + phaseCompressibleMomentumTransportModel, + RAS, + kineticTheoryModel +); + +#include "phasePressureModel.H" +makeMomentumTransportModel +( + phaseCompressibleMomentumTransportModel, + RAS, + phasePressureModel +); + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.C new file mode 100644 index 0000000000..4a76e0a2dc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.C @@ -0,0 +1,251 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2013-2022 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 "phasePressureModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::RASModels::phasePressureModel::phasePressureModel +( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const viscosity& viscosity, + const word& type +) +: + eddyViscosity> + ( + type, + alpha, + rho, + U, + alphaRhoPhi, + phi, + viscosity + ), + + phase_(refCast(viscosity)), + + preAlphaExp_(coeffDict_.lookup("preAlphaExp")), + expMax_(coeffDict_.lookup("expMax")), + g0_ + ( + "g0", + dimensionSet(1, -1, -2, 0, 0), + coeffDict_.lookup("g0") + ) +{ + nut_ == dimensionedScalar(nut_.dimensions(), 0); + + if (type == typeName) + { + printCoeffs(type); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::RASModels::phasePressureModel::~phasePressureModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::RASModels::phasePressureModel::read() +{ + if + ( + eddyViscosity>:: + read() + ) + { + coeffDict().lookup("preAlphaExp") >> preAlphaExp_; + coeffDict().lookup("expMax") >> expMax_; + g0_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::k() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::epsilon() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::omega() const +{ + NotImplemented; + return nut_; +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::sigma() const +{ + return tmp + ( + volSymmTensorField::New + ( + IOobject::groupName("R", U_.group()), + mesh_, + dimensioned + ( + "R", + dimensionSet(0, 2, -2, 0, 0), + Zero + ) + ) + ); +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::pPrime() const +{ + tmp tpPrime + ( + volScalarField::New + ( + IOobject::groupName("pPrime", U_.group()), + g0_ + *min + ( + exp(preAlphaExp_*(alpha_ - phase_.alphaMax())), + expMax_ + ) + ) + ); + + volScalarField::Boundary& bpPrime = + tpPrime.ref().boundaryFieldRef(); + + forAll(bpPrime, patchi) + { + if (!bpPrime[patchi].coupled()) + { + bpPrime[patchi] == 0; + } + } + + return tpPrime; +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::pPrimef() const +{ + tmp tpPrime + ( + surfaceScalarField::New + ( + IOobject::groupName("pPrimef", U_.group()), + g0_ + *min + ( + exp(preAlphaExp_ + *(fvc::interpolate(alpha_) - phase_.alphaMax())), + expMax_ + ) + ) + ); + + surfaceScalarField::Boundary& bpPrime = + tpPrime.ref().boundaryFieldRef(); + + forAll(bpPrime, patchi) + { + if (!bpPrime[patchi].coupled()) + { + bpPrime[patchi] == 0; + } + } + + return tpPrime; +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::devTau() const +{ + return tmp + ( + volSymmTensorField::New + ( + IOobject::groupName("devTau", U_.group()), + mesh_, + dimensioned + ( + "R", + rho_.dimensions()*dimensionSet(0, 2, -2, 0, 0), + Zero + ) + ) + ); +} + + +Foam::tmp +Foam::RASModels::phasePressureModel::divDevTau +( + volVectorField& U +) const +{ + return tmp + ( + new fvVectorMatrix + ( + U, + rho_.dimensions()*dimensionSet(0, 4, -2, 0, 0) + ) + ); +} + + +void Foam::RASModels::phasePressureModel::correct() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.H new file mode 100644 index 0000000000..b773deb104 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseCompressibleMomentumTransportModels/phasePressureModel/phasePressureModel.H @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2013-2022 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::RASModels::phasePressureModel + +Description + Particle-particle phase-pressure RAS model + + The derivative of the phase-pressure with respect to the phase-fraction + is evaluated as + + g0*min(exp(preAlphaExp*(alpha - alphaMax)), expMax) + + The default model coefficients correspond to the following: + \verbatim + phasePressureCoeffs + { + preAlphaExp 500; + expMax 1000; + g0 1000; + } + \endverbatim + +SourceFiles + phasePressureModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phasePressureModel_H +#define phasePressureModel_H + +#include "RASModel.H" +#include "eddyViscosity.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "phaseModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class phasePressureModel Declaration +\*---------------------------------------------------------------------------*/ + +class phasePressureModel +: + public eddyViscosity> +{ + // Private Data + + const phaseModel& phase_; + + // Phase pressure coefficients + + //- Pre-exponential factor + scalar preAlphaExp_; + + //- Maximum limit of the exponential + scalar expMax_; + + //- g0 + dimensionedScalar g0_; + + + // Private Member Functions + + void correctNut() + {} + + +public: + + //- Runtime type information + TypeName("phasePressure"); + + + // Constructors + + //- Construct from components + phasePressureModel + ( + const volScalarField& alpha, + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const viscosity& viscosity, + const word& type = typeName + ); + + //- Disallow default bitwise copy construction + phasePressureModel(const phasePressureModel&) = delete; + + + //- Destructor + virtual ~phasePressureModel(); + + + // Member Functions + + //- Re-read model coefficients if they have changed + virtual bool read(); + + //- Return the effective viscosity + virtual tmp nuEff() const + { + return this->nut(); + } + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const + { + return this->nut(patchi); + } + + //- Return the turbulence kinetic energy + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp epsilon() const; + + //- Return the turbulence specific dissipation rate + virtual tmp omega() const; + + //- Return the stress tensor [m^2/s^2] + virtual tmp sigma() const; + + //- Return the phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrime() const; + + //- Return the face-phase-pressure' + // (derivative of phase-pressure w.r.t. phase-fraction) + virtual tmp pPrimef() const; + + //- Return the effective stress tensor + virtual tmp devTau() const; + + //- Return the source term for the momentum equation + virtual tmp divDevTau(volVectorField& U) const; + + //- Solve the kinetic theory equations and correct the viscosity + virtual void correct(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const phasePressureModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwclean b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwclean new file mode 100755 index 0000000000..5d0dac0c4e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwclean @@ -0,0 +1,7 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +wclean libso multiphaseSystems +wclean + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwmake b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwmake new file mode 100755 index 0000000000..1baaf97cbf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Allwmake @@ -0,0 +1,10 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +wmake $targetType multiphaseSystems +wmake $targetType + +#------------------------------------------------------------------------------ diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/files new file mode 100644 index 0000000000..13439610b9 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/files @@ -0,0 +1,11 @@ +setRDeltaT.C +moveMesh.C +momentumPredictor.C +thermophysicalPredictor.C +compressibilityEqns.C +facePressureCorrector.C +cellPressureCorrector.C +pressureCorrector.C +multiphaseEuler.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseEuler diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/options new file mode 100644 index 0000000000..332970747b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/Make/options @@ -0,0 +1,30 @@ +EXE_INC = \ + -I$(FOAM_SOLVERS)/modules/fluid/fluidSolver/lnInclude \ + -I../include \ + -I../phaseSystems/lnInclude \ + -I../interfacialModels/lnInclude \ + -I../interfacialCompositionModels/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfluidSolver \ + -lphaseSystem \ + -lmultiphaseSystems \ + -leulerianInterfacialModels \ + -leulerianInterfacialCompositionModels \ + -lmultiphaseMomentumTransportModels \ + -lmultiphaseReactions \ + -lmultiphaseProperties \ + -lphaseFluidThermophysicalTransportModels \ + -lphaseFluidMulticomponentThermophysicalTransportModels \ + -lfiniteVolume \ + -lfvModels \ + -lfvConstraints \ + -lmeshTools diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/cellPressureCorrector.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/cellPressureCorrector.C new file mode 100644 index 0000000000..f16ad7b837 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/cellPressureCorrector.C @@ -0,0 +1,420 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" +#include "findRefCell.H" +#include "fvcFlux.H" +#include "fvcMeshPhi.H" +#include "fvcReconstruct.H" +#include "fvcDdt.H" +#include "fvcDiv.H" +#include "fvcSup.H" +#include "fvcSnGrad.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvmLaplacian.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::cellPressureCorrector() +{ + // Face volume fractions + PtrList alphafs(phases.size()); + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + + alphafs.set(phasei, fvc::interpolate(alpha).ptr()); + alphafs[phasei].rename("pEqn" + alphafs[phasei].name()); + } + + // Diagonal coefficients + rAUs.clear(); + rAUs.setSize(phases.size()); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + const volScalarField& alpha = phase; + + rAUs.set + ( + phase.index(), + new volScalarField + ( + IOobject::groupName("rAU", phase.name()), + 1.0 + /( + UEqns[phase.index()].A() + + byDt(max(phase.residualAlpha() - alpha, scalar(0))*phase.rho()) + ) + ) + ); + } + fluid.fillFields("rAU", dimTime/dimDensity, rAUs); + + // Phase diagonal coefficients + PtrList alpharAUfs(phases.size()); + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + + alpharAUfs.set + ( + phasei, + ( + fvc::interpolate(max(alpha, phase.residualAlpha())*rAUs[phasei]) + ).ptr() + ); + } + + // Explicit force fluxes + PtrList phiFs(fluid.phiFs(rAUs)); + + // --- Pressure corrector loop + while (pimple.correct()) + { + volScalarField rho("rho", fluid.rho()); + + // Correct p_rgh for consistency with p and the updated densities + p_rgh = p - rho*buoyancy.gh; + + // Correct fixed-flux BCs to be consistent with the velocity BCs + fluid.correctBoundaryFlux(); + + // Combined buoyancy and force fluxes + PtrList phigFs(phases.size()); + { + const surfaceScalarField ghSnGradRho + ( + "ghSnGradRho", + buoyancy.ghf*fvc::snGrad(rho)*mesh.magSf() + ); + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + + phigFs.set + ( + phasei, + ( + alpharAUfs[phasei] + *( + ghSnGradRho + - (fvc::interpolate(phase.rho() - rho)) + *(buoyancy.g & mesh.Sf()) + - fluid.surfaceTension(phase)*mesh.magSf() + ) + ).ptr() + ); + + if (phiFs.set(phasei)) + { + phigFs[phasei] += phiFs[phasei]; + } + } + } + + // Predicted velocities and fluxes for each phase + PtrList HbyAs(phases.size()); + PtrList phiHbyAs(phases.size()); + { + // Correction force fluxes + PtrList ddtCorrByAs(fluid.ddtCorrByAs(rAUs)); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + const volScalarField& alpha = phase; + + HbyAs.set + ( + phase.index(), + constrainHbyA + ( + rAUs[phase.index()] + *( + UEqns[phase.index()].H() + + byDt + ( + max(phase.residualAlpha() - alpha, scalar(0)) + *phase.rho() + ) + *phase.U()().oldTime() + ), + phase.U(), + p_rgh + ) + ); + + phiHbyAs.set + ( + phase.index(), + new surfaceScalarField + ( + IOobject::groupName("phiHbyA", phase.name()), + fvc::flux(HbyAs[phase.index()]) + - phigFs[phase.index()] + - ddtCorrByAs[phase.index()] + ) + ); + } + } + fluid.fillFields("HbyA", dimVelocity, HbyAs); + fluid.fillFields("phiHbyA", dimForce/dimDensity/dimVelocity, phiHbyAs); + + // Add explicit drag forces and fluxes + PtrList KdUByAs(fluid.KdUByAs(rAUs)); + PtrList phiKdPhis(fluid.phiKdPhis(rAUs)); + + forAll(phases, phasei) + { + if (KdUByAs.set(phasei)) + { + HbyAs[phasei] -= KdUByAs[phasei]; + } + + if (phiKdPhis.set(phasei)) + { + phiHbyAs[phasei] -= phiKdPhis[phasei]; + } + } + + // Total predicted flux + surfaceScalarField phiHbyA + ( + IOobject + ( + "phiHbyA", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimFlux, 0) + ); + + forAll(phases, phasei) + { + phiHbyA += alphafs[phasei]*phiHbyAs[phasei]; + } + + MRF.makeRelative(phiHbyA); + fvc::makeRelative(phiHbyA, fluid.movingPhases()[0].U()); + + // Construct pressure "diffusivity" + surfaceScalarField rAUf + ( + IOobject + ( + "rAUf", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar(dimensionSet(-1, 3, 1, 0, 0), 0) + ); + + forAll(phases, phasei) + { + rAUf += alphafs[phasei]*alpharAUfs[phasei]; + } + + rAUf = mag(rAUf); + + // Update the fixedFluxPressure BCs to ensure flux consistency + { + surfaceScalarField::Boundary phib + ( + surfaceScalarField::Internal::null(), + phi.boundaryField() + ); + phib = 0; + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + phib += + alphafs[phasei].boundaryField()*phase.phi()().boundaryField(); + } + + setSnGrad + ( + p_rgh.boundaryFieldRef(), + ( + phiHbyA.boundaryField() - phib + )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) + ); + } + + // Compressible pressure equations + PtrList pEqnComps(compressibilityEqns()); + + // Cache p prior to solve for density update + volScalarField p_rgh_0(p_rgh); + + // Iterate over the pressure equation to correct for non-orthogonality + while (pimple.correctNonOrthogonal()) + { + // Construct the transport part of the pressure equation + fvScalarMatrix pEqnIncomp + ( + fvc::div(phiHbyA) + - fvm::laplacian(rAUf, p_rgh) + ); + + // Solve + { + fvScalarMatrix pEqn(pEqnIncomp); + + forAll(phases, phasei) + { + pEqn += pEqnComps[phasei]; + } + + if (fluid.incompressible()) + { + pEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + } + + pEqn.solve(); + } + + // Correct fluxes and velocities on last non-orthogonal iteration + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqnIncomp.flux(); + + surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phase.phiRef() = + phiHbyAs[phase.index()] + + alpharAUfs[phase.index()]*mSfGradp; + + // Set the phase dilatation rate + phase.divU(-pEqnComps[phase.index()] & p_rgh); + } + + // Optionally relax pressure for velocity correction + p_rgh.relax(); + + mSfGradp = pEqnIncomp.flux()/rAUf; + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phase.URef() = + HbyAs[phase.index()] + + fvc::reconstruct + ( + alpharAUfs[phase.index()]*mSfGradp + - phigFs[phase.index()] + ); + } + + if (partialElimination) + { + fluid.partialElimination(rAUs, KdUByAs, alphafs, phiKdPhis); + } + else + { + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + MRF.makeRelative(phase.phiRef()); + fvc::makeRelative(phase.phiRef(), phase.U()); + } + } + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phase.URef().correctBoundaryConditions(); + phase.correctUf(); + fvConstraints().constrain(phase.URef()); + } + } + } + + // Update and limit the static pressure + p = p_rgh + rho*buoyancy.gh; + fvConstraints().constrain(p); + + // Account for static pressure reference + if (p_rgh.needReference() && fluid.incompressible()) + { + p += dimensionedScalar + ( + "p", + p.dimensions(), + pressureReference.refValue() + - getRefCellValue(p, pressureReference.refCell()) + ); + } + + // Limit p_rgh + p_rgh = p - rho*buoyancy.gh; + + // Update densities from change in p_rgh + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + phase.thermoRef().rho() += phase.thermo().psi()*(p_rgh - p_rgh_0); + } + + // Correct p_rgh for consistency with p and the updated densities + rho = fluid.rho(); + p_rgh = p - rho*buoyancy.gh; + p_rgh.correctBoundaryConditions(); + } + + UEqns.clear(); + + if (!fluid.implicitPhasePressure()) + { + rAUs.clear(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/compressibilityEqns.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/compressibilityEqns.C new file mode 100644 index 0000000000..5ef3e1ad0f --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/compressibilityEqns.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "fvcDdt.H" +#include "fvcDiv.H" +#include "fvcSup.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::PtrList +Foam::solvers::multiphaseEuler::compressibilityEqns() const +{ + PtrList pEqnComps(phases.size()); + + PtrList dmdts(fluid.dmdts()); + PtrList d2mdtdps(fluid.d2mdtdps()); + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + volScalarField& rho = phase.thermoRef().rho(); + + pEqnComps.set(phasei, new fvScalarMatrix(p_rgh, dimVolume/dimTime)); + fvScalarMatrix& pEqnComp = pEqnComps[phasei]; + + // Density variation + if (!phase.isochoric() || !phase.pure()) + { + pEqnComp += + ( + fvc::ddt(alpha, rho) + fvc::div(phase.alphaRhoPhi()) + - fvc::Sp(fvc::ddt(alpha) + fvc::div(phase.alphaPhi()), rho) + )/rho; + } + + // Mesh dilatation correction + if (mesh.moving()) + { + pEqnComp += fvc::div(mesh.phi())*alpha; + } + + // Compressibility + if (!phase.incompressible()) + { + if (pimple.transonic()) + { + const surfaceScalarField phid + ( + IOobject::groupName("phid", phase.name()), + fvc::interpolate(phase.thermo().psi())*phase.phi() + ); + + pEqnComp += + correction + ( + (alpha/rho)* + ( + phase.thermo().psi()*fvm::ddt(p_rgh) + + fvm::div(phid, p_rgh) + - fvm::Sp(fvc::div(phid), p_rgh) + ) + ); + + pEqnComps[phasei].relax(); + } + else + { + pEqnComp += + (alpha*phase.thermo().psi()/rho) + *correction(fvm::ddt(p_rgh)); + } + } + + // Option sources + if (fvModels().addsSupToField(rho.name())) + { + pEqnComp -= (fvModels().source(alpha, rho) & rho)/rho; + } + + // Mass transfer + if (dmdts.set(phasei)) + { + pEqnComp -= dmdts[phasei]/rho; + } + if (d2mdtdps.set(phasei)) + { + pEqnComp -= correction(fvm::Sp(d2mdtdps[phasei]/rho, p_rgh)); + } + } + + return pEqnComps; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/facePressureCorrector.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/facePressureCorrector.C new file mode 100644 index 0000000000..6c03a026e3 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/facePressureCorrector.C @@ -0,0 +1,399 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" +#include "findRefCell.H" +#include "fvcFlux.H" +#include "fvcMeshPhi.H" +#include "fvcReconstruct.H" +#include "fvcDdt.H" +#include "fvcDiv.H" +#include "fvcSup.H" +#include "fvcSnGrad.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvmLaplacian.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::facePressureCorrector() +{ + // Face volume fractions + PtrList alphafs(phases.size()); + PtrList alphaRho0fs(phases.size()); + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + const volScalarField& alpha = phase; + + alphafs.set(phasei, fvc::interpolate(alpha).ptr()); + alphafs[phasei].rename("pEqn" + alphafs[phasei].name()); + + alphaRho0fs.set + ( + phasei, + ( + fvc::interpolate + ( + max(alpha.oldTime(), phase.residualAlpha()) + *phase.rho()().oldTime() + ) + ).ptr() + ); + } + + // Diagonal coefficients + rAUfs.clear(); + rAUfs.setSize(phases.size()); + { + PtrList AFfs(fluid.AFfs()); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + rAUfs.set + ( + phase.index(), + new surfaceScalarField + ( + IOobject::groupName("rAUf", phase.name()), + 1.0 + /( + byDt(alphaRho0fs[phase.index()]) + + fvc::interpolate(UEqns[phase.index()].A()) + + AFfs[phase.index()] + ) + ) + ); + } + } + fluid.fillFields("rAUf", dimTime/dimDensity, rAUfs); + + // Phase diagonal coefficients + PtrList alpharAUfs(phases.size()); + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + alpharAUfs.set + ( + phase.index(), + ( + max(alphafs[phase.index()], phase.residualAlpha()) + *rAUfs[phase.index()] + ).ptr() + ); + } + + // Explicit force fluxes + PtrList phiFfs(fluid.phiFfs(rAUfs)); + + // --- Pressure corrector loop + while (pimple.correct()) + { + volScalarField rho("rho", fluid.rho()); + + // Correct p_rgh for consistency with p and the updated densities + p_rgh = p - rho*buoyancy.gh; + + // Correct fixed-flux BCs to be consistent with the velocity BCs + fluid.correctBoundaryFlux(); + + // Combined buoyancy and force fluxes + PtrList phigFs(phases.size()); + { + const surfaceScalarField ghSnGradRho + ( + "ghSnGradRho", + buoyancy.ghf*fvc::snGrad(rho)*mesh.magSf() + ); + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + + phigFs.set + ( + phasei, + ( + alpharAUfs[phasei] + *( + ghSnGradRho + - (fvc::interpolate(phase.rho() - rho)) + *(buoyancy.g & mesh.Sf()) + - fluid.surfaceTension(phase)*mesh.magSf() + ) + ).ptr() + ); + + if (phiFfs.set(phasei)) + { + phigFs[phasei] += phiFfs[phasei]; + } + } + } + + // Predicted fluxes for each phase + PtrList phiHbyAs(phases.size()); + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phiHbyAs.set + ( + phase.index(), + constrainPhiHbyA + ( + rAUfs[phase.index()] + *( + fvc::flux(UEqns[phase.index()].H()) + + alphaRho0fs[phase.index()] + *byDt + ( + phase.Uf().valid() + ? (mesh.Sf() & phase.Uf()().oldTime()) + : MRF.absolute(phase.phi()().oldTime()) + ) + ) + - phigFs[phase.index()], + phase.U(), + p_rgh + ) + ); + } + fluid.fillFields("phiHbyA", dimForce/dimDensity/dimVelocity, phiHbyAs); + + // Add explicit drag forces and fluxes + PtrList phiKdPhifs(fluid.phiKdPhifs(rAUfs)); + + forAll(phases, phasei) + { + if (phiKdPhifs.set(phasei)) + { + phiHbyAs[phasei] -= phiKdPhifs[phasei]; + } + } + + // Total predicted flux + surfaceScalarField phiHbyA + ( + IOobject + ( + "phiHbyA", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimFlux, 0) + ); + + forAll(phases, phasei) + { + phiHbyA += alphafs[phasei]*phiHbyAs[phasei]; + } + + MRF.makeRelative(phiHbyA); + fvc::makeRelative(phiHbyA, phases[0].U()); + + // Construct pressure "diffusivity" + surfaceScalarField rAUf + ( + IOobject + ( + "rAUf", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar(dimensionSet(-1, 3, 1, 0, 0), 0) + ); + + forAll(phases, phasei) + { + rAUf += alphafs[phasei]*alpharAUfs[phasei]; + } + + rAUf = mag(rAUf); + + // Update the fixedFluxPressure BCs to ensure flux consistency + { + surfaceScalarField::Boundary phib + ( + surfaceScalarField::Internal::null(), + phi.boundaryField() + ); + phib = 0; + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + phib += + alphafs[phasei].boundaryField() + *phase.phi()().boundaryField(); + } + + setSnGrad + ( + p_rgh.boundaryFieldRef(), + ( + phiHbyA.boundaryField() - phib + )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) + ); + } + + // Compressible pressure equations + PtrList pEqnComps(compressibilityEqns()); + + // Cache p prior to solve for density update + volScalarField p_rgh_0(p_rgh); + + // Iterate over the pressure equation to correct for non-orthogonality + while (pimple.correctNonOrthogonal()) + { + // Construct the transport part of the pressure equation + fvScalarMatrix pEqnIncomp + ( + fvc::div(phiHbyA) + - fvm::laplacian(rAUf, p_rgh) + ); + + // Solve + { + fvScalarMatrix pEqn(pEqnIncomp); + + forAll(phases, phasei) + { + pEqn += pEqnComps[phasei]; + } + + if (fluid.incompressible()) + { + pEqn.setReference + ( + pressureReference.refCell(), + pressureReference.refValue() + ); + } + + pEqn.solve(); + } + + // Correct fluxes and velocities on last non-orthogonal iteration + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA + pEqnIncomp.flux(); + + surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phase.phiRef() = + phiHbyAs[phase.index()] + + alpharAUfs[phase.index()]*mSfGradp; + + // Set the phase dilatation rate + phase.divU(-pEqnComps[phase.index()] & p_rgh); + } + + if (partialElimination) + { + fluid.partialEliminationf(rAUfs, alphafs, phiKdPhifs); + } + else + { + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + MRF.makeRelative(phase.phiRef()); + fvc::makeRelative(phase.phiRef(), phase.U()); + } + } + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + phase.URef() = fvc::reconstruct + ( + fvc::absolute(MRF.absolute(phase.phi()), phase.U()) + ); + + phase.URef().correctBoundaryConditions(); + phase.correctUf(); + fvConstraints().constrain(phase.URef()); + } + } + } + + // Update and limit the static pressure + p = p_rgh + rho*buoyancy.gh; + fvConstraints().constrain(p); + + // Account for static pressure reference + if (p_rgh.needReference() && fluid.incompressible()) + { + p += dimensionedScalar + ( + "p", + p.dimensions(), + pressureReference.refValue() + - getRefCellValue(p, pressureReference.refCell()) + ); + } + + // Limit p_rgh + p_rgh = p - rho*buoyancy.gh; + + // Update densities from change in p_rgh + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + phase.thermoRef().rho() += phase.thermo().psi()*(p_rgh - p_rgh_0); + } + + // Correct p_rgh for consistency with p and the updated densities + rho = fluid.rho(); + p_rgh = p - rho*buoyancy.gh; + p_rgh.correctBoundaryConditions(); + } + + UEqns.clear(); + + if (!fluid.implicitPhasePressure()) + { + rAUfs.clear(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/momentumPredictor.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/momentumPredictor.C new file mode 100644 index 0000000000..f9fe80bddd --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/momentumPredictor.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::cellMomentumPredictor() +{ + Info<< "Constructing momentum equations" << endl; + + autoPtr + momentumTransferPtr(fluid.momentumTransfer()); + + phaseSystem::momentumTransferTable& + momentumTransfer(momentumTransferPtr()); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + const volScalarField& alpha = phase; + const volScalarField& rho = phase.rho(); + volVectorField& U = phase.URef(); + + UEqns.set + ( + phase.index(), + new fvVectorMatrix + ( + phase.UEqn() + == + *momentumTransfer[phase.name()] + + fvModels().source(alpha, rho, U) + ) + ); + + UEqns[phase.index()].relax(); + fvConstraints().constrain(UEqns[phase.index()]); + U.correctBoundaryConditions(); + fvConstraints().constrain(U); + } +} + + +void Foam::solvers::multiphaseEuler::faceMomentumPredictor() +{ + Info<< "Constructing face momentum equations" << endl; + + // !!! Update coefficients shouldn't be necessary + // This should be done on demand + fluid.momentumTransfer(); + + autoPtr + momentumTransferPtr(fluid.momentumTransferf()); + + phaseSystem::momentumTransferTable& + momentumTransfer(momentumTransferPtr()); + + forAll(fluid.movingPhases(), movingPhasei) + { + phaseModel& phase = fluid.movingPhases()[movingPhasei]; + + const volScalarField& alpha = phase; + const volScalarField& rho = phase.rho(); + volVectorField& U = phase.URef(); + + UEqns.set + ( + phase.index(), + new fvVectorMatrix + ( + phase.UfEqn() + == + *momentumTransfer[phase.name()] + + fvModels().source(alpha, rho, U) + ) + ); + + UEqns[phase.index()].relax(); + fvConstraints().constrain(UEqns[phase.index()]); + U.correctBoundaryConditions(); + fvConstraints().constrain(U); + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::momentumPredictor() +{ + if (pimple.flow()) + { + UEqns.setSize(phases.size()); + + if (faceMomentum) + { + faceMomentumPredictor(); + } + else + { + cellMomentumPredictor(); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/moveMesh.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/moveMesh.C new file mode 100644 index 0000000000..4a2c536946 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/moveMesh.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "fvcDiv.H" +#include "fvcMeshPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::solvers::multiphaseEuler::moveMesh() +{ + if + ( + pimple.flow() + && (pimple.firstIter() || pimple.moveMeshOuterCorrectors()) + ) + { + if (correctPhi && !divU.valid()) + { + // Construct and register divU for mapping + divU = new volScalarField + ( + "divU0", + fvc::div + ( + fvc::absolute(phi, fluid.movingPhases()[0].U()) + ) + ); + } + + // Move the mesh + mesh.move(); + + if (mesh.changing()) + { + buoyancy.moveMesh(); + + fluid.meshUpdate(); + + if (correctPhi) + { + fluid.correctPhi + ( + p_rgh, + divU, + pressureReference, + pimple + ); + } + + meshCourantNo(); + + divU.clear(); + + return true; + } + + divU.clear(); + } + + return false; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.C new file mode 100644 index 0000000000..b89960d3a7 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.C @@ -0,0 +1,270 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "localEulerDdtScheme.H" +#include "surfaceFields.H" +#include "fvcDiv.H" +#include "fvcSurfaceIntegrate.H" +#include "fvcMeshPhi.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(multiphaseEuler, 0); + addToRunTimeSelectionTable(solver, multiphaseEuler, fvMesh); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::read() +{ + fluidSolver::read(); + + faceMomentum = + pimple.dict().lookupOrDefault("faceMomentum", false); + + partialElimination = + pimple.dict().lookupOrDefault("partialElimination", false); + + nEnergyCorrectors = + pimple.dict().lookupOrDefault("nEnergyCorrectors", 1); +} + + +void Foam::solvers::multiphaseEuler::correctCoNum() +{ + CoNum = 0; + scalar meanCoNum = 0.0; + + if (mesh.nInternalFaces()) + { + scalarField sumPhi + ( + fvc::surfaceSum(mag(phi))().primitiveField() + ); + + forAll(phases, phasei) + { + sumPhi = max + ( + sumPhi, + fvc::surfaceSum(mag(phases[phasei].phi()))().primitiveField() + ); + } + + CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + + meanCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + } + + Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::multiphaseEuler::multiphaseEuler(fvMesh& mesh) +: + fluidSolver(mesh), + + buoyancy(mesh), + + fluidPtr(phaseSystem::New(mesh)), + + fluid(fluidPtr()), + + phases(fluid.phases()), + + phi(fluid.phi()), + + p(phases[0].thermoRef().p()), + + p_rgh(buoyancy.p_rgh), + + pressureReference + ( + p, + p_rgh, + pimple.dict(), + fluid.incompressible() + ), + + faceMomentum(false), + + partialElimination(false), + + nEnergyCorrectors(1), + + MRF(fluid.MRF()) +{ + // Read the controls + read(); + + mesh.schemes().setFluxRequired(p_rgh.name()); + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + Info<< "Using LTS" << endl; + + trDeltaT = tmp + ( + new volScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTName, + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1), + extrapolatedCalculatedFvPatchScalarField::typeName + ) + ); + + if (faceMomentum) + { + trDeltaTf = tmp + ( + new surfaceScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTfName, + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1) + ) + ); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::multiphaseEuler::~multiphaseEuler() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::preSolve() +{ + // Read the controls + read(); + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + setRDeltaT(); + } + + // Store divU from the previous mesh so that it can be + // mapped and used in correctPhi to ensure the corrected phi + // has the same divergence + if (correctPhi && mesh.topoChanged()) + { + // Construct and register divU for mapping + divU = new volScalarField + ( + "divU0", + fvc::div + ( + fvc::absolute(phi, fluid.movingPhases()[0].U()) + ) + ); + } + + fvModels().preUpdateMesh(); + + // Update the mesh for topology change, mesh to mesh mapping + mesh.update(); +} + + +void Foam::solvers::multiphaseEuler::prePredictor() +{ + if (pimple.models()) + { + fvModels().correct(); + } + + if (pimple.thermophysics() || pimple.flow()) + { + fluid.solve(rAUs, rAUfs); + fluid.correct(); + fluid.correctContinuityError(); + } + + if (pimple.thermophysics()) + { + compositionPredictor(); + } +} + + +void Foam::solvers::multiphaseEuler::momentumTransportCorrector() +{ + if (pimple.flow() && pimple.transportCorr()) + { + fluid.correctTurbulence(); + } +} + + +void Foam::solvers::multiphaseEuler::thermophysicalTransportCorrector() +{} + + +void Foam::solvers::multiphaseEuler::postSolve() +{ + divU.clear(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.H new file mode 100644 index 0000000000..d608dde3ce --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseEuler.H @@ -0,0 +1,259 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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::solvers::multiphaseEuler + +Description + Solver module for a system of any number of compressible fluid phases with a + common pressure, but otherwise separate properties. The type of phase model + is run time selectable and can optionally represent multiple species and + in-phase reactions. The phase system is also run time selectable and can + optionally represent different types of momentum, heat and mass transfer. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + + Optional fvModels and fvConstraints are provided to enhance the simulation + in many ways including adding various sources, Lagrangian + particles, surface film etc. and constraining or limiting the solution. + +SourceFiles + multiphaseEuler.C + +See also + Foam::solvers::compressibleVoF + Foam::solvers::fluidSolver + Foam::solvers::incompressibleFluid + +\*---------------------------------------------------------------------------*/ + +#ifndef multiphaseEuler_H +#define multiphaseEuler_H + +#include "fluidSolver.H" +#include "phaseSystem.H" +#include "phaseCompressibleMomentumTransportModel.H" +#include "buoyancy.H" +#include "pressureReference.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class multiphaseEuler Declaration +\*---------------------------------------------------------------------------*/ + +class multiphaseEuler +: + public fluidSolver +{ + +protected: + + //- Buoyancy force + solvers::buoyancy buoyancy; + + + // Phase properties + + autoPtr fluidPtr; + + phaseSystem& fluid; + + phaseSystem::phaseModelList& phases; + + surfaceScalarField& phi; + + + // Thermophysical properties + + volScalarField& p; + + //- Reference to the buoyant pressure for buoyant cases + // otherwise to the pressure + volScalarField& p_rgh; + + + // Pressure reference + + //- Pressure reference + Foam::pressureReference pressureReference; + + + // Controls + + //- Cell/face momentum equation switch + // Defaults to false, i.e. uses the cell momentum equation + Switch faceMomentum; + + //- Partial elimination drag contribution optimisation + // Defaults to false + Switch partialElimination; + + //- Number of energy correctors + // Used to improve stability of phase-change sibulations + // Defaults to 1 + int nEnergyCorrectors; + + + // Optional models + + const IOMRFZoneList& MRF; + + + // Cached temporary fields + + //- Optional LTS reciprocal time-step field + tmp trDeltaT; + + //- Optional LTS reciprocal face time-step field + tmp trDeltaTf; + + //- Temporary phase momentum matrices + // shared between the momentum predictor and pressure corrector + PtrList UEqns; + + //- Temporary storage for the reciprocal momentum equation diagonal + // Used by the phase-fraction predictor and pressure corrector + PtrList rAUs; + + //- Temporary storage for the reciprocal momentum equation diagonal + // Used by the phase-fraction predictor and face pressure corrector + PtrList rAUfs; + + //- Stored divU from the previous mesh so that it can be + // mapped and used in correctPhi to ensure the corrected phi + // has the same divergence + tmp divU; + + //- Read controls + void read(); + + +private: + + // Private Member Functions + + //- Set rDeltaT for LTS + virtual void setRDeltaT(); + + //- Correct the cached Courant numbers + void correctCoNum(); + + //- Composition predictor + // called in prePredictor() after phase-fraction prediction + void compositionPredictor(); + + //- Energy and temperature predictor + void energyPredictor(); + + //- Cell-based momentum equation predictor + void cellMomentumPredictor(); + + //- Face-based momentum equation predictor + void faceMomentumPredictor(); + + //- Cell-based pressure equation predictor + void cellPressureCorrector(); + + //- Face-based pressure equation predictor + void facePressureCorrector(); + + //- Return the list of pressure equation compressibility contributions + PtrList compressibilityEqns() const; + + +public: + + //- Runtime type information + TypeName("multiphaseEuler"); + + + // Constructors + + //- Construct from region mesh + multiphaseEuler(fvMesh& mesh); + + //- Disallow default bitwise copy construction + multiphaseEuler(const multiphaseEuler&) = delete; + + + //- Destructor + virtual ~multiphaseEuler(); + + + // Member Functions + + //- Called at the start of the time-step, before the PIMPLE loop + virtual void preSolve(); + + //- Called at the start of the PIMPLE loop to move the mesh + virtual bool moveMesh(); + + //- Called at the start of the PIMPLE loop + virtual void prePredictor(); + + //- Construct and optionally solve the momentum equation + virtual void momentumPredictor(); + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Construct and solve the pressure equation in the PISO loop + virtual void pressureCorrector(); + + //- Correct the momentum transport modelling + // Newtonian, non-Newtonian or turbulent + virtual void momentumTransportCorrector(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const multiphaseEuler&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/files new file mode 100644 index 0000000000..8283aa0248 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/files @@ -0,0 +1,3 @@ +multiphaseSystems.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseSystems diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/options new file mode 100644 index 0000000000..653bd83701 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/Make/options @@ -0,0 +1,20 @@ +EXE_INC = \ + -I../../interfacialModels/lnInclude \ + -I../../interfacialCompositionModels/lnInclude \ + -I../../phaseSystems/lnInclude \ + -I../../multiphaseCompressibleMomentumTransportModels/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lcombustionModels \ + -lphaseSystem diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/multiphaseSystems.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/multiphaseSystems.C new file mode 100644 index 0000000000..4e41f27082 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/multiphaseSystems/multiphaseSystems.C @@ -0,0 +1,171 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "phaseSystem.H" +#include "MomentumTransferPhaseSystem.H" +#include "OneResistanceHeatTransferPhaseSystem.H" +#include "TwoResistanceHeatTransferPhaseSystem.H" +#include "PhaseTransferPhaseSystem.H" +#include "InterfaceCompositionPhaseChangePhaseSystem.H" +#include "ThermalPhaseChangePhaseSystem.H" +#include "PopulationBalancePhaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef + PhaseTransferPhaseSystem + < + OneResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + basicMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + basicMultiphaseSystem, + dictionary, + basicMultiphaseSystem + ); + + typedef + InterfaceCompositionPhaseChangePhaseSystem + < + PhaseTransferPhaseSystem + < + TwoResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + interfaceCompositionPhaseChangeMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + interfaceCompositionPhaseChangeMultiphaseSystem, + dictionary, + interfaceCompositionPhaseChangeMultiphaseSystem + ); + + typedef + ThermalPhaseChangePhaseSystem + < + PhaseTransferPhaseSystem + < + TwoResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + thermalPhaseChangeMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + thermalPhaseChangeMultiphaseSystem, + dictionary, + thermalPhaseChangeMultiphaseSystem + ); + + typedef + PopulationBalancePhaseSystem + < + PhaseTransferPhaseSystem + < + OneResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + populationBalanceMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + populationBalanceMultiphaseSystem, + dictionary, + populationBalanceMultiphaseSystem + ); + + typedef + InterfaceCompositionPhaseChangePhaseSystem + < + PopulationBalancePhaseSystem + < + PhaseTransferPhaseSystem + < + TwoResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + > + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem, + dictionary, + interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem + ); + + typedef + ThermalPhaseChangePhaseSystem + < + PopulationBalancePhaseSystem + < + PhaseTransferPhaseSystem + < + TwoResistanceHeatTransferPhaseSystem + < + MomentumTransferPhaseSystem + > + > + > + > + thermalPhaseChangePopulationBalanceMultiphaseSystem; + + addNamedToRunTimeSelectionTable + ( + phaseSystem, + thermalPhaseChangePopulationBalanceMultiphaseSystem, + dictionary, + thermalPhaseChangePopulationBalanceMultiphaseSystem + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/pressureCorrector.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/pressureCorrector.C new file mode 100644 index 0000000000..7079c46131 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/pressureCorrector.C @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::pressureCorrector() +{ + if (pimple.flow()) + { + if (faceMomentum) + { + facePressureCorrector(); + } + else + { + cellPressureCorrector(); + } + + fluid.correctKinematics(); + } + else + { + PtrList pEqnComps(compressibilityEqns()); + + forAll(phases, phasei) + { + phases[phasei].divU(-pEqnComps[phasei] & p_rgh); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/setRDeltaT.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/setRDeltaT.C new file mode 100644 index 0000000000..99bbeba635 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/setRDeltaT.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "fvcSmooth.H" +#include "fvcSurfaceIntegrate.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::setRDeltaT() +{ + volScalarField& rDeltaT = trDeltaT.ref(); + + const dictionary& pimpleDict = pimple.dict(); + + const scalar maxCo + ( + pimpleDict.lookupOrDefault("maxCo", 0.2) + ); + + const scalar maxDeltaT + ( + pimpleDict.lookupOrDefault("maxDeltaT", great) + ); + + const scalar minDeltaT + ( + pimpleDict.lookupOrDefault("minDeltaT", small) + ); + + const scalar rDeltaTSmoothingCoeff + ( + pimpleDict.lookupOrDefault("rDeltaTSmoothingCoeff", 0.02) + ); + + surfaceScalarField maxPhi("maxPhi", phi); + + forAll(phases, phasei) + { + maxPhi = max(maxPhi, mag(phases[phasei].phi())); + } + + // Set the reciprocal time-step from the local Courant number + // and maximum and minimum time-steps + rDeltaT.ref() = min + ( + 1/dimensionedScalar(dimTime, minDeltaT), + max + ( + 1/dimensionedScalar(dimTime, maxDeltaT), + fvc::surfaceSum(maxPhi)()() + /((2*maxCo)*mesh.V()) + ) + ); + + // Update the boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + + Info<< "Flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + + if (faceMomentum) + { + trDeltaTf.ref() = fvc::interpolate(rDeltaT); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C new file mode 100644 index 0000000000..8f122cbacc --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseEuler/thermophysicalPredictor.C @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 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 "multiphaseEuler.H" +#include "fvcDdt.H" +#include "fvcDiv.H" +#include "fvcSup.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::compositionPredictor() +{ + autoPtr + specieTransferPtr(fluid.specieTransfer()); + + phaseSystem::specieTransferTable& + specieTransfer(specieTransferPtr()); + + fluid.correctReactions(); + + forAll(fluid.multicomponentPhases(), multicomponentPhasei) + { + phaseModel& phase = fluid.multicomponentPhases()[multicomponentPhasei]; + + UPtrList& Y = phase.YActiveRef(); + const volScalarField& alpha = phase; + const volScalarField& rho = phase.rho(); + + forAll(Y, i) + { + fvScalarMatrix YiEqn + ( + phase.YiEqn(Y[i]) + == + *specieTransfer[Y[i].name()] + + fvModels().source(alpha, rho, Y[i]) + ); + + YiEqn.relax(); + fvConstraints().constrain(YiEqn); + YiEqn.solve("Yi"); + fvConstraints().constrain(Y[i]); + } + } + + fluid.correctSpecies(); +} + + +void Foam::solvers::multiphaseEuler::energyPredictor() +{ + for (int Ecorr=0; Ecorr + heatTransferPtr(fluid.heatTransfer()); + + phaseSystem::heatTransferTable& heatTransfer = heatTransferPtr(); + + forAll(fluid.anisothermalPhases(), anisothermalPhasei) + { + phaseModel& phase = fluid.anisothermalPhases()[anisothermalPhasei]; + + const volScalarField& alpha = phase; + tmp tRho = phase.rho(); + const volScalarField& rho = tRho(); + tmp tU = phase.U(); + const volVectorField& U = tU(); + + fvScalarMatrix EEqn + ( + phase.heEqn() + == + *heatTransfer[phase.name()] + + alpha*rho*(U&buoyancy.g) + + fvModels().source(alpha, rho, phase.thermoRef().he()) + ); + + EEqn.relax(); + fvConstraints().constrain(EEqn); + EEqn.solve(); + fvConstraints().constrain(phase.thermoRef().he()); + } + + fluid.correctThermo(); + fluid.correctContinuityError(); + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::multiphaseEuler::thermophysicalPredictor() +{ + if (pimple.thermophysics()) + { + // compositionPredictor(); + energyPredictor(); + + forAll(phases, phasei) + { + phaseModel& phase = phases[phasei]; + + Info<< phase.name() << " min/max T " + << min(phase.thermo().T()).value() + << " - " + << max(phase.thermo().T()).value() + << endl; + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/files new file mode 100644 index 0000000000..8d89c2db04 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/files @@ -0,0 +1,3 @@ +phaseSurfaceArrheniusReactionRate/makephaseSurfaceArrheniusReactions.C + +LIB = $(FOAM_LIBBIN)/libmultiphaseReactions diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/options new file mode 100644 index 0000000000..f14ec540da --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/Make/options @@ -0,0 +1,24 @@ +EXE_INC = \ + -I../phaseSystems/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lphaseSystem \ + -leulerianInterfacialModels \ + -leulerianInterfacialCompositionModels \ + -lphaseCompressibleMomentumTransportModels \ + -lmultiphaseMomentumTransportModels \ + -lphaseFluidThermophysicalTransportModels \ + -lphaseFluidMulticomponentThermophysicalTransportModels \ + -lspecie \ + -lfluidThermophysicalModels \ + -lmulticomponentThermophysicalModels \ + -lchemistryModel \ + -lcombustionModels \ + -lfiniteVolume diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/makephaseSurfaceArrheniusReactions.C b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/makephaseSurfaceArrheniusReactions.C new file mode 100644 index 0000000000..9f22f24d6e --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/makephaseSurfaceArrheniusReactions.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 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 "makeReaction.H" + +#include "phaseSurfaceArrheniusReactionRate.H" + +#include "forGases.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + forCoeffGases + ( + makeGeneralReaction, + IrreversibleReaction, + phaseSurfaceArrheniusReactionRate + ) +} + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRate.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRate.H new file mode 100644 index 0000000000..94988cae37 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRate.H @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 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::phaseSurfaceArrheniusReactionRate + +Description + A modified Arrhenius reaction rate given by: + + k = (A * T^beta * exp(-Ta/T))*a + + Where a is the phase surface area per unit volume. The name of the phase is + specified by the user. + +SourceFiles + phaseSurfaceArrheniusReactionRateI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseSurfaceArrheniusReactionRate_H +#define phaseSurfaceArrheniusReactionRate_H + +#include "ArrheniusReactionRate.H" +#include "speciesTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +class phaseSurfaceArrheniusReactionRate; + +Ostream& operator<<(Ostream&, const phaseSurfaceArrheniusReactionRate&); + +/*---------------------------------------------------------------------------*\ + Class phaseSurfaceArrheniusReactionRate Declaration +\*---------------------------------------------------------------------------*/ + +class phaseSurfaceArrheniusReactionRate +: + public ArrheniusReactionRate +{ + // Private Data + + //- Name of the phase + const word phaseName_; + + //- Reference to the object registry + const objectRegistry& ob_; + + //- Surface area per unit volume field + mutable tmp tA_; + + +public: + + // Constructors + + //- Construct from dictionary + inline phaseSurfaceArrheniusReactionRate + ( + const speciesTable& species, + const objectRegistry& ob, + const dictionary& dict + ); + + + // Member Functions + + //- Return the type name + static word type() + { + return "phaseSurfaceArrhenius"; + } + + //- Pre-evaluation hook + inline void preEvaluate() const; + + //- Post-evaluation hook + inline void postEvaluate() const; + + //- Evaluate the rate + inline scalar operator() + ( + const scalar p, + const scalar T, + const scalarField& c, + const label li + ) const; + + //- Evaluate the derivative + inline scalar ddT + ( + const scalar p, + const scalar T, + const scalarField& c, + const label li + ) const; + + //- Write to stream + inline void write(Ostream& os) const; + + + // Ostream Operator + + inline friend Ostream& operator<< + ( + Ostream&, + const phaseSurfaceArrheniusReactionRate& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "phaseSurfaceArrheniusReactionRateI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRateI.H b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRateI.H new file mode 100644 index 0000000000..5f7e8b78bf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/multiphaseReactions/phaseSurfaceArrheniusReactionRate/phaseSurfaceArrheniusReactionRateI.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 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 "phaseSurfaceArrheniusReactionRate.H" +#include "phaseSystem.H" +#include "diameterModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +inline Foam::phaseSurfaceArrheniusReactionRate:: +phaseSurfaceArrheniusReactionRate +( + const speciesTable& species, + const objectRegistry& ob, + const dictionary& dict +) +: + ArrheniusReactionRate(species, dict), + phaseName_(dict.lookup("phase")), + ob_(ob), + tA_(nullptr) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline void Foam::phaseSurfaceArrheniusReactionRate::preEvaluate() const +{ + ArrheniusReactionRate::preEvaluate(); + + const phaseModel& phase = + ob_.lookupObject(IOobject::groupName("alpha", phaseName_)); + + tA_ = phase.dPtr()->a(); +} + + +inline void Foam::phaseSurfaceArrheniusReactionRate::postEvaluate() const +{ + ArrheniusReactionRate::postEvaluate(); + + tA_.clear(); +} + + +inline Foam::scalar Foam::phaseSurfaceArrheniusReactionRate::operator() +( + const scalar p, + const scalar T, + const scalarField& c, + const label li +) const +{ + return ArrheniusReactionRate::operator()(p, T, c, li)*tA_()[li]; +} + + +inline Foam::scalar Foam::phaseSurfaceArrheniusReactionRate::ddT +( + const scalar p, + const scalar T, + const scalarField& c, + const label li +) const +{ + return ArrheniusReactionRate::ddT(p, T, c, li)*tA_()[li]; +} + + +inline void Foam::phaseSurfaceArrheniusReactionRate::write(Ostream& os) const +{ + ArrheniusReactionRate::write(os); + writeEntry(os, "phase", phaseName_); +} + + +inline Foam::Ostream& Foam::operator<< +( + Ostream& os, + const phaseSurfaceArrheniusReactionRate& arr +) +{ + arr.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C new file mode 100644 index 0000000000..112bdcb3d5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -0,0 +1,1425 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "BlendedInterfacialModel.H" +#include "phaseSystem.H" +#include "dispersedDisplacedPhaseInterface.H" +#include "segregatedDisplacedPhaseInterface.H" +#include "fixedValueFvsPatchFields.H" +#include "surfaceInterpolate.H" +#include "zeroDimensionalFvMesh.H" +#include "mathematicalConstants.H" +#include "writeFile.H" +#include "triFace.H" +#include "noSetWriter.H" +#include "noSurfaceWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendedInterfacialModel +{ + +template +inline tmp interpolate(tmp f); + +template<> +inline tmp interpolate(tmp f) +{ + return f; +} + +template<> +inline tmp interpolate(tmp f) +{ + return fvc::interpolate(f); +} + +template +inline bool valid(const PtrList& l) +{ + forAll(l, i) + { + if (l.set(i)) + { + return true; + } + } + return false; +} + +} // End namespace blendedInterfacialModel +} // End namespace Foam + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::BlendedInterfacialModel::check() const +{ + // Only generate warnings once per timestep + const label timeIndex = interface_.mesh().time().timeIndex(); + if (checkTimeIndex_ == timeIndex) return; + checkTimeIndex_ = timeIndex; + + const phaseModel& phase1 = interface_.phase1(); + const phaseModel& phase2 = interface_.phase2(); + + const bool can1In2 = blending_->canBeContinuous(1); + const bool can2In1 = blending_->canBeContinuous(0); + const bool canS = blending_->canSegregate(); + + // Warnings associated with redundant model specification + + if + ( + !can1In2 + && ( + model1DispersedIn2_.valid() + || blendedInterfacialModel::valid(models1DispersedIn2Displaced_) + ) + ) + { + WarningInFunction + << "A " << ModelType::typeName << " was provided for " + << dispersedPhaseInterface(phase1, phase2).name() + << " but the associated blending does not permit " << phase2.name() + << " to be continuous so this model will not be used" << endl; + } + + if + ( + !can2In1 + && ( + model2DispersedIn1_.valid() + || blendedInterfacialModel::valid(models2DispersedIn1Displaced_) + ) + ) + { + WarningInFunction + << "A " << ModelType::typeName << " was provided for " + << dispersedPhaseInterface(phase2, phase1).name() + << " but the associated blending does not permit " << phase1.name() + << " to be continuous so this model will not be used" << endl; + } + + if + ( + !canS + && ( + model1SegregatedWith2_.valid() + || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_) + ) + ) + { + WarningInFunction + << "A " << ModelType::typeName << " was provided for " + << segregatedPhaseInterface(phase1, phase2).name() + << " but the associated blending does not permit segregation" + << " so this model will not be used" << endl; + } + + if + ( + modelGeneral_.valid() + && (can1In2 || can2In1 || canS) + && (!can1In2 || model1DispersedIn2_.valid()) + && (!can2In1 || model2DispersedIn1_.valid()) + && (!canS || model1SegregatedWith2_.valid()) + ) + { + WarningInFunction + << "A " << ModelType::typeName << " was provided for " + << phaseInterface(phase1, phase2).name() + << " but other displaced and/or segregated models apply" + << " across the entire phase fraction space so this model" + << " will not be used" << endl; + } + + forAll(interface_.fluid().phases(), phasei) + { + const phaseModel& phaseD = interface_.fluid().phases()[phasei]; + + if + ( + modelsGeneralDisplaced_.set(phasei) + && (can1In2 || can2In1 || canS) + && (!can1In2 || models1DispersedIn2Displaced_.set(phasei)) + && (!can2In1 || models2DispersedIn1Displaced_.set(phasei)) + && (!canS || models1SegregatedWith2Displaced_.set(phasei)) + ) + { + WarningInFunction + << "A " << ModelType::typeName << " was provided for " + << displacedPhaseInterface(phase1, phase2, phaseD).name() + << " but other displaced and/or segregated models apply" + << " across the entire phase fraction space so this model" + << " will not be used" << endl; + } + } + + // Warnings associated with gaps in the blending space + + if (can1In2 && !modelGeneral_.valid() && !model1DispersedIn2_.valid()) + { + WarningInFunction + << "Blending for " << ModelType::typeName << "s permits " + << phase2.name() << " to become continuous, but no model was " + << "provided for " << dispersedPhaseInterface(phase1, phase2).name() + << ". Consider adding a model for this configuration (or for " + << phaseInterface(phase1, phase2).name() << "), or if no model is " + << "needed then add a \"none\" model to suppress this warning." + << endl; + } + + if (can2In1 && !modelGeneral_.valid() && !model2DispersedIn1_.valid()) + { + WarningInFunction + << "Blending for " << ModelType::typeName << "s permits " + << phase1.name() << " to become continuous, but no model was " + << "provided for " << dispersedPhaseInterface(phase2, phase1).name() + << ". Consider adding a model for this configuration (or for " + << phaseInterface(phase1, phase2).name() << "), or if no model is " + << "needed then add a \"none\" model to suppress this warning." + << endl; + } + + if (canS && !modelGeneral_.valid() && !model1SegregatedWith2_.valid()) + { + WarningInFunction + << "Blending for " << ModelType::typeName << "s permits " + << "segregation but no model was provided for " + << segregatedPhaseInterface(phase2, phase1).name() + << ". Consider adding a model for this configuration (or for " + << phaseInterface(phase1, phase2).name() << "), or if no model is " + << "needed then add a \"none\" model to suppress this warning." + << endl; + } +} + + +template +template class PatchField, class GeoMesh> +void Foam::BlendedInterfacialModel::calculateBlendingCoeffs +( + const UPtrList& alphas, + tmp>& fG, + tmp>& f1D2, + tmp>& f2D1, + tmp>& fS, + PtrList>& fGD, + PtrList>& f1D2D, + PtrList>& f2D1D, + PtrList>& fSD, + const bool subtract +) const +{ + typedef GeometricField scalarGeoField; + + // Create a constant field + auto constant = [&](const scalar k) + { + return + scalarGeoField::New + ( + Foam::name(k), + alphas.first().mesh(), + dimensionedScalar(dimless, k) + ); + }; + + // Get the dispersed blending functions + tmp F1D2, F2D1; + if + ( + model1DispersedIn2_.valid() + || model1SegregatedWith2_.valid() + || blendedInterfacialModel::valid(models1DispersedIn2Displaced_) + || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_) + ) + { + F1D2 = + blendedInterfacialModel::interpolate + ( + blending_->f1DispersedIn2(alphas) + ); + } + if + ( + model2DispersedIn1_.valid() + || model1SegregatedWith2_.valid() + || blendedInterfacialModel::valid(models2DispersedIn1Displaced_) + || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_) + ) + { + F2D1 = + blendedInterfacialModel::interpolate + ( + blending_->f2DispersedIn1(alphas) + ); + } + + // Construct non-displaced coefficients + { + if (model1DispersedIn2_.valid()) + { + f1D2 = F1D2().clone(); + } + + if (model2DispersedIn1_.valid()) + { + f2D1 = F2D1().clone(); + } + + if (model1SegregatedWith2_.valid()) + { + fS = constant(1); + if (f1D2.valid()) { fS.ref() -= f1D2(); } + if (f2D1.valid()) { fS.ref() -= f2D1(); } + } + + if (modelGeneral_.valid()) + { + fG = constant(1); + if (f1D2.valid()) { fG.ref() -= f1D2(); } + if (f2D1.valid()) { fG.ref() -= f2D1(); } + if (fS.valid()) { fG.ref() -= fS(); } + } + } + + // Get the displaced blending function + tmp FD; + if + ( + blendedInterfacialModel::valid(modelsGeneralDisplaced_) + || blendedInterfacialModel::valid(models1DispersedIn2Displaced_) + || blendedInterfacialModel::valid(models2DispersedIn1Displaced_) + || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_) + ) + { + FD = + blendedInterfacialModel::interpolate + ( + blending_->fDisplaced(alphas) + ); + } + + // Construct displaced coefficients + tmp fDSum; + if + ( + blendedInterfacialModel::valid(modelsGeneralDisplaced_) + || blendedInterfacialModel::valid(models1DispersedIn2Displaced_) + || blendedInterfacialModel::valid(models2DispersedIn1Displaced_) + || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_) + ) + { + fDSum = constant(0); + + forAll(alphas, phasei) + { + const phaseModel& phaseD = interface_.fluid().phases()[phasei]; + + if (interface_.contains(phaseD)) continue; + + // Weight the contribution of a dispersed model for this phase + // according to the phase fraction in the subset of phases that are + // not part of this interface. This seems like a reasonable + // assumption if a stochastic viewpoint is taken. However, it is + // possible that other forms may be desired in which case this + // could be abstracted and controlled by the blending method. + tmp alpha; + if + ( + models1DispersedIn2Displaced_.set(phasei) + || models2DispersedIn1Displaced_.set(phasei) + || models1SegregatedWith2Displaced_.set(phasei) + || modelsGeneralDisplaced_.set(phasei) + ) + { + alpha = + blendedInterfacialModel::interpolate + ( + alphas[phasei] + /max + ( + 1 + - alphas[interface_.phase1().index()] + - alphas[interface_.phase2().index()], + phaseD.residualAlpha() + ) + ); + } + + if (models1DispersedIn2Displaced_.set(phasei)) + { + f1D2D.set(phasei, alpha()*FD()*F1D2()); + fDSum.ref() += f1D2D[phasei]; + } + + if (models2DispersedIn1Displaced_.set(phasei)) + { + f2D1D.set(phasei, alpha()*FD()*F2D1()); + fDSum.ref() += f2D1D[phasei]; + } + + if (models1SegregatedWith2Displaced_.set(phasei)) + { + fSD.set(phasei, alpha()*FD()); + if (f1D2D.set(phasei)) fSD[phasei] -= f1D2D[phasei]; + if (f2D1D.set(phasei)) fSD[phasei] -= f2D1D[phasei]; + fDSum.ref() += fSD[phasei]; + } + + if (modelsGeneralDisplaced_.set(phasei)) + { + fGD.set(phasei, alpha()*FD()); + if (f1D2D.set(phasei)) fGD[phasei] -= f1D2D[phasei]; + if (f2D1D.set(phasei)) fGD[phasei] -= f2D1D[phasei]; + if (fSD.set(phasei)) fGD[phasei] -= fSD[phasei]; + fDSum.ref() += fGD[phasei]; + } + } + } + + // Remove the displaced part from the non-displaced coefficients + if (fDSum.valid()) + { + if (f1D2.valid()) f1D2.ref() *= 1 - fDSum(); + if (f2D1.valid()) f2D1.ref() *= 1 - fDSum(); + if (fS.valid()) fS.ref() *= 1 - fDSum(); + if (fG.valid()) fG.ref() *= 1 - fDSum(); + } + + // Flip the sign of the 2 dispersed in 1 models if necessary + if (subtract) + { + auto signedError = [this](const phaseInterface& interface) + { + FatalErrorInFunction + << "A signed quantity was evaluated from the blended " + << ModelType::typeName << " for " << interface_.name() + << " but a model was provided for " << interface.name() + << ". Signed quantities are only possible to evaluate for" + << " dispersed configurations" << exit(FatalError); + }; + + const phaseModel& phase1 = interface_.phase1(); + const phaseModel& phase2 = interface_.phase2(); + + if (fG.valid()) + { + signedError(phaseInterface(phase1, phase2)); + } + if (f1D2.valid()) + { + // Do nothing + } + if (f2D1.valid()) + { + f2D1.ref() *= -1; + } + if (fS.valid()) + { + signedError(segregatedPhaseInterface(phase1, phase2)); + } + + forAll(alphas, phasei) + { + const phaseModel& phaseD = interface_.fluid().phases()[phasei]; + + if (fGD.set(phasei)) + { + signedError + ( + displacedPhaseInterface(phase1, phase2, phaseD) + ); + } + if (f1D2D.set(phasei)) + { + // Do nothing + } + if (f2D1D.set(phasei)) + { + f2D1.ref() *= -1; + } + if (fSD.set(phasei)) + { + signedError + ( + segregatedDisplacedPhaseInterface(phase1, phase2, phaseD) + ); + } + } + } +} + + +template +template class PatchField, class GeoMesh> +void Foam::BlendedInterfacialModel::correctFixedFluxBCs +( + GeometricField& field +) const +{ + typedef GeometricField typeGeoField; + + typename typeGeoField::Boundary& fieldBf = field.boundaryFieldRef(); + + forAll(fieldBf, patchi) + { + if + ( + ( + !interface_.phase1().stationary() + && isA + ( + interface_.phase1().phi()().boundaryField()[patchi] + ) + ) + || ( + !interface_.phase2().stationary() + && isA + ( + interface_.phase2().phi()().boundaryField()[patchi] + ) + ) + ) + { + fieldBf[patchi] = Zero; + } + } +} + + +template +void Foam::BlendedInterfacialModel::postProcessBlendingCoefficients +( + const word& format +) const +{ + using namespace constant::mathematical; + + const phaseSystem& fluid = interface_.fluid(); + const label nPhases = fluid.phases().size(); + + // Construct geometry and phase fraction values + pointField points; + faceList faces; + wordList fieldNames(nPhases); + PtrList fields(nPhases); + if (nPhases == 1) + { + // Single value + fieldNames[0] = fluid.phases()[0].volScalarField::name(); + fields.set(0, new scalarField(1, 1)); + } + else if (nPhases == 2) + { + // Single axis, using the first phase as the x-coordinate + static const label nDivisions = 128; + const scalarField divisionis(scalarList(identity(nDivisions))); + fieldNames[0] = fluid.phases()[0].volScalarField::name(); + fieldNames[1] = fluid.phases()[1].volScalarField::name(); + fields.set(0, new scalarField(divisionis/(nDivisions - 1))); + fields.set(1, new scalarField(1 - fields[0])); + } + else + { + // Polygon with as many vertices as there are phases. Each phase + // fraction equals one at a unique vertex, they vary linearly between + // vertices, and vary smoothly in the interior of the polygon. The sum + // of phase fractions is always one throughout the polygon (partition + // of unity). This is done using Wachspress coordinates. This does not + // cover the entire N-dimensional phase fraction space for N >= 4 (it's + // hard to imagine how that could be visualised) but it provides enough + // to give a good indication of what is going on. + + // Create the nodes of the blending space polygon + List phaseNodes(nPhases); + forAll(phaseNodes, phasei) + { + const scalar theta = 2*pi*phasei/nPhases; + phaseNodes[phasei] = point(cos(theta), sin(theta), 0); + } + + // Create points within the polygon + static const label nDivisions = 32; + points.append(point::zero); + for (label divi = 0; divi < nDivisions; ++ divi) + { + const scalar s = scalar(divi + 1)/nDivisions; + + forAll(phaseNodes, phasei) + { + for (label i = 0; i < divi + 1; ++ i) + { + const scalar t = scalar(i)/(divi + 1); + + points.append + ( + s*(1 - t)*phaseNodes[phasei] + + s*t*phaseNodes[(phasei + 1) % nPhases] + ); + } + } + } + + // Create triangles within the polygon + forAll(phaseNodes, phasei) + { + faces.append(triFace(0, phasei + 1, (phasei + 1) % nPhases + 1)); + } + for (label divi = 1; divi < nDivisions; ++ divi) + { + const label pointi0 = nPhases*(divi - 1)*divi/2 + 1; + const label pointi1 = nPhases*divi*(divi + 1)/2 + 1; + + forAll(phaseNodes, phasei) + { + for (label i = 0; i < divi + 1; ++ i) + { + const label pi00 = + pointi0 + + ((phasei*divi + i) % (nPhases*divi)); + const label pi01 = + pointi0 + + ((phasei*divi + i + 1) % (nPhases*divi)); + const label pi10 = + pointi1 + + ((phasei*(divi + 1) + i) % (nPhases*(divi + 1))); + const label pi11 = + pointi1 + + ((phasei*(divi + 1) + i + 1) % (nPhases*(divi + 1))); + + faces.append(triFace({pi00, pi10, pi11})); + if (i < divi) faces.append(triFace({pi00, pi11, pi01})); + } + } + } + + // Create phase fraction fields + forAll(fluid.phases(), phasei) + { + fieldNames[phasei] = fluid.phases()[phasei].volScalarField::name(); + fields.set(phasei, new scalarField(points.size(), 0)); + + const label phasei0 = (phasei + nPhases - 1) % nPhases; + const label phasei1 = (phasei + 1) % nPhases; + + const point& node0 = phaseNodes[phasei0]; + const point& node = phaseNodes[phasei]; + const point& node1 = phaseNodes[phasei1]; + + forAll(points, i) + { + const scalar A = mag((node - node0) ^ (node1 - node0)); + const scalar A0 = mag((node - node0) ^ (points[i] - node0)); + const scalar A1 = mag((node1 - node) ^ (points[i] - node)); + + if (A0 < rootSmall) + { + fields[phasei][i] = + great*mag(points[i] - node0)/mag(node - node0); + } + else if (A1 < rootSmall) + { + fields[phasei][i] = + great*mag(points[i] - node1)/mag(node - node1); + } + else + { + fields[phasei][i] = A/A0/A1; + } + } + } + forAll(points, i) + { + scalar s = 0; + forAll(fluid.phases(), phasei) + { + s += fields[phasei][i]; + } + forAll(fluid.phases(), phasei) + { + fields[phasei][i] /= s; + } + } + } + + // Add the model coefficient fields + { + // Create alpha fields on a zero-dimensional one-cell mesh + const fvMesh mesh(zeroDimensionalFvMesh(fluid.mesh())); + PtrList alphas(nPhases); + forAll(fluid.phases(), phasei) + { + alphas.set + ( + phasei, + new volScalarField + ( + IOobject + ( + fluid.phases()[phasei].volScalarField::name(), + mesh.time().timeName(), + mesh + ), + mesh, + dimensionedScalar(dimless, fields[phasei][0]) + ) + ); + } + + // Construct blending coefficient fields + { + tmp fG, f1D2, f2D1, fS; + PtrList fGD(nPhases); + PtrList f1D2D(nPhases); + PtrList f2D1D(nPhases); + PtrList fSD(nPhases); + calculateBlendingCoeffs + ( + alphas.convert(), + fG, f1D2, f2D1, fS, + fGD, f1D2D, f2D1D, fSD, + false + ); + + const phaseModel& phase1 = interface_.phase1(); + const phaseModel& phase2 = interface_.phase2(); + + auto addField = [&](const phaseInterface& interface) + { + fieldNames.append(interface.name()); + fields.append(new scalarField(fields.first().size())); + }; + + if (fG.valid()) + { + addField(phaseInterface(phase1, phase2)); + } + if (f1D2.valid()) + { + addField(dispersedPhaseInterface(phase1, phase2)); + } + if (f2D1.valid()) + { + addField(dispersedPhaseInterface(phase2, phase1)); + } + if (fS.valid()) + { + addField(segregatedPhaseInterface(phase2, phase1)); + } + + forAll(fluid.phases(), phasei) + { + const phaseModel& phaseD = fluid.phases()[phasei]; + + if (fGD.set(phasei)) + { + addField(displacedPhaseInterface(phase1, phase2, phaseD)); + } + if (f1D2D.set(phasei)) + { + addField + ( + dispersedDisplacedPhaseInterface + ( + phase1, + phase2, + phaseD + ) + ); + } + if (f2D1D.set(phasei)) + { + addField + ( + dispersedDisplacedPhaseInterface + ( + phase2, + phase1, + phaseD + ) + ); + } + if (fSD.set(phasei)) + { + addField + ( + segregatedDisplacedPhaseInterface + ( + phase1, + phase2, + phaseD + ) + ); + } + } + } + + // Populate blending coefficient fields + forAll(fields.first(), i) + { + forAll(fluid.phases(), phasei) + { + alphas[phasei] = fields[phasei][i]; + } + + tmp fG, f1D2, f2D1, fS; + PtrList fGD(nPhases); + PtrList f1D2D(nPhases); + PtrList f2D1D(nPhases); + PtrList fSD(nPhases); + calculateBlendingCoeffs + ( + alphas.convert(), + fG, f1D2, f2D1, fS, + fGD, f1D2D, f2D1D, fSD, + false + ); + + label fieldi = nPhases; + + if (fG.valid()) + { + fields[fieldi ++][i] = fG()[0]; + } + if (f1D2.valid()) + { + fields[fieldi ++][i] = f1D2()[0]; + } + if (f2D1.valid()) + { + fields[fieldi ++][i] = f2D1()[0]; + } + if (fS.valid()) + { + fields[fieldi ++][i] = fS()[0]; + } + + forAll(fluid.phases(), phasei) + { + if (fGD.set(phasei)) + { + fields[fieldi ++][i] = fGD[phasei][0]; + } + if (f1D2D.set(phasei)) + { + fields[fieldi ++][i] = f1D2D[phasei][0]; + } + if (f2D1D.set(phasei)) + { + fields[fieldi ++][i] = f2D1D[phasei][0]; + } + if (fSD.set(phasei)) + { + fields[fieldi ++][i] = fSD[phasei][0]; + } + } + } + } + + // Write + const fileName path = + fluid.mesh().time().globalPath() + /functionObjects::writeFile::outputPrefix + /ModelType::typeName; + Info<< "Writing blending coefficients to " << path/interface_.name() + << endl; + if (nPhases <= 2) + { + // Strip out the first field and shuffle everything else up + const autoPtr field0 = fields.set(0, nullptr); + const word field0Name = fieldNames[0]; + for (label fieldi = 1; fieldi < fields.size(); ++ fieldi) + { + fields.set(fieldi - 1, fields.set(fieldi, nullptr).ptr()); + fieldNames[fieldi - 1] = fieldNames[fieldi]; + } + fields.resize(fields.size() - 1); + fieldNames.resize(fieldNames.size() - 1); + + setWriter::New + ( + format, + IOstream::ASCII, + IOstream::UNCOMPRESSED + )->write + ( + path, + interface_.name(), + coordSet(true, field0Name, field0), + fieldNames, + fields + ); + } + else + { + surfaceWriter::New + ( + format, + IOstream::ASCII, + IOstream::UNCOMPRESSED + )->write + ( + path, + interface_.name(), + points, + faces, + true, + fieldNames, + fields + ); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +template +< + class Type, + template class PatchField, + class GeoMesh, + class ... Args +> +Foam::tmp> +Foam::BlendedInterfacialModel::evaluate +( + tmp> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args +) const +{ + check(); + + typedef GeometricField scalarGeoField; + typedef GeometricField typeGeoField; + + // Get the blending coefficients + const label nPhases = interface_.fluid().phases().size(); + tmp fG, f1D2, f2D1, fS; + PtrList fGD(nPhases); + PtrList f1D2D(nPhases); + PtrList f2D1D(nPhases); + PtrList fSD(nPhases); + calculateBlendingCoeffs + ( + interface_.fluid().phases().template convert(), + fG, f1D2, f2D1, fS, + fGD, f1D2D, f2D1D, fSD, + subtract + ); + + // Construct the result + tmp x = + typeGeoField::New + ( + ModelType::typeName + ":" + + IOobject::groupName(name, interface_.name()), + interface_.mesh(), + dimensioned(dims, Zero) + ); + + // Add the model contributions to the result + if (modelGeneral_.valid()) + { + x.ref() += fG*(modelGeneral_().*method)(args ...); + } + if (model1DispersedIn2_.valid()) + { + x.ref() += f1D2*(model1DispersedIn2_().*method)(args ...); + } + if (model2DispersedIn1_.valid()) + { + x.ref() += f2D1*(model2DispersedIn1_().*method)(args ...); + } + if (model1SegregatedWith2_.valid()) + { + x.ref() += fS*(model1SegregatedWith2_().*method)(args ...); + } + forAll(interface_.fluid().phases(), phasei) + { + if (modelsGeneralDisplaced_.set(phasei)) + { + x.ref() += + fGD[phasei] + *(modelsGeneralDisplaced_[phasei].*method)(args ...); + } + if (models1DispersedIn2Displaced_.set(phasei)) + { + x.ref() += + f1D2D[phasei] + *(models1DispersedIn2Displaced_[phasei].*method)(args ...); + } + if (models2DispersedIn1Displaced_.set(phasei)) + { + x.ref() += + f2D1D[phasei] + *(models2DispersedIn1Displaced_[phasei].*method)(args ...); + } + if (models1SegregatedWith2Displaced_.set(phasei)) + { + x.ref() += + fSD[phasei] + *(models1SegregatedWith2Displaced_[phasei].*method)(args ...); + } + } + + // Correct boundary conditions if necessary + if (ModelType::correctFixedFluxBCs) + { + correctFixedFluxBCs(x.ref()); + } + + return x; +} + + +template +template +< + class Type, + template class PatchField, + class GeoMesh, + class ... Args +> +Foam::HashPtrTable> +Foam::BlendedInterfacialModel::evaluate +( + HashPtrTable> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args +) const +{ + check(); + + typedef GeometricField scalarGeoField; + typedef GeometricField typeGeoField; + + // Get the blending coefficients + const label nPhases = interface_.fluid().phases().size(); + tmp fG, f1D2, f2D1, fS; + PtrList fGD(nPhases); + PtrList f1D2D(nPhases); + PtrList f2D1D(nPhases); + PtrList fSD(nPhases); + calculateBlendingCoeffs + ( + interface_.fluid().phases().template convert(), + fG, f1D2, f2D1, fS, + fGD, f1D2D, f2D1D, fSD, + subtract + ); + + // Construct the result + HashPtrTable xs; + + // Add the model contributions to the result + auto addToXs = [&] + ( + const scalarGeoField& f, + const HashPtrTable& dxs + ) + { + forAllConstIter(typename HashPtrTable, dxs, dxIter) + { + if (xs.found(dxIter.key())) + { + *xs[dxIter.key()] += f**dxIter(); + } + else + { + xs.insert + ( + dxIter.key(), + typeGeoField::New + ( + ModelType::typeName + ':' + + IOobject::groupName + ( + IOobject::groupName(name, dxIter.key()), + interface_.name() + ), + f**dxIter() + ).ptr() + ); + } + } + }; + if (modelGeneral_.valid()) + { + addToXs(fG, (modelGeneral_().*method)(args ...)); + } + if (model1DispersedIn2_.valid()) + { + addToXs(f1D2, (model1DispersedIn2_().*method)(args ...)); + } + if (model2DispersedIn1_.valid()) + { + addToXs(f2D1, (model2DispersedIn1_().*method)(args ...)); + } + if (model1SegregatedWith2_.valid()) + { + addToXs(fS, (model1SegregatedWith2_().*method)(args ...)); + } + forAll(interface_.fluid().phases(), phasei) + { + if (modelsGeneralDisplaced_.set(phasei)) + { + addToXs + ( + fGD[phasei], + (modelsGeneralDisplaced_[phasei].*method)(args ...) + ); + } + if (models1DispersedIn2Displaced_.set(phasei)) + { + addToXs + ( + f1D2D[phasei], + (models1DispersedIn2Displaced_[phasei].*method)(args ...) + ); + } + if (models2DispersedIn1Displaced_.set(phasei)) + { + addToXs + ( + f2D1D[phasei], + (models2DispersedIn1Displaced_[phasei].*method)(args ...) + ); + } + if (models1SegregatedWith2Displaced_.set(phasei)) + { + addToXs + ( + fSD[phasei], + (models1SegregatedWith2Displaced_[phasei].*method)(args ...) + ); + } + } + + // Correct boundary conditions if necessary + if (ModelType::correctFixedFluxBCs) + { + forAllIter(typename HashPtrTable, xs, xIter) + { + correctFixedFluxBCs(*xIter()); + } + } + + return xs; +} + + +template +template +bool Foam::BlendedInterfacialModel::evaluate +( + bool (ModelType::*method)(Args ...) const, + Args ... args +) const +{ + check(); + + bool result = false; + + if (modelGeneral_.valid()) + { + result = result || (modelGeneral_().*method)(args ...); + } + if (model1DispersedIn2_.valid()) + { + result = result || (model1DispersedIn2_().*method)(args ...); + } + if (model2DispersedIn1_.valid()) + { + result = result || (model2DispersedIn1_().*method)(args ...); + } + if (model1SegregatedWith2_.valid()) + { + result = result || (model1SegregatedWith2_().*method)(args ...); + } + + forAll(interface_.fluid().phases(), phasei) + { + if (modelsGeneralDisplaced_.set(phasei)) + { + result = + result + || (modelsGeneralDisplaced_[phasei].*method)(args ...); + } + if (models1DispersedIn2Displaced_.set(phasei)) + { + result = + result + || (models1DispersedIn2Displaced_[phasei].*method)(args ...); + } + if (models2DispersedIn1Displaced_.set(phasei)) + { + result = + result + || (models2DispersedIn1Displaced_[phasei].*method)(args ...); + } + if (models1SegregatedWith2Displaced_.set(phasei)) + { + result = + result + || (models1SegregatedWith2Displaced_[phasei].*method)(args ...); + } + } + + return result; +} + + +template +template +Foam::hashedWordList Foam::BlendedInterfacialModel::evaluate +( + const hashedWordList& (ModelType::*method)(Args ...) const, + Args ... args +) const +{ + check(); + + wordList result; + + if (modelGeneral_.valid()) + { + result.append((modelGeneral_().*method)(args ...)); + } + if (model1DispersedIn2_.valid()) + { + result.append((model1DispersedIn2_().*method)(args ...)); + } + if (model2DispersedIn1_.valid()) + { + result.append((model2DispersedIn1_().*method)(args ...)); + } + if (model1SegregatedWith2_.valid()) + { + result.append((model1SegregatedWith2_().*method)(args ...)); + } + + forAll(interface_.fluid().phases(), phasei) + { + if (modelsGeneralDisplaced_.set(phasei)) + { + result.append + ( + (modelsGeneralDisplaced_[phasei].*method)(args ...) + ); + } + if (models1DispersedIn2Displaced_.set(phasei)) + { + result.append + ( + (models1DispersedIn2Displaced_[phasei].*method)(args ...) + ); + } + if (models2DispersedIn1Displaced_.set(phasei)) + { + result.append + ( + (models2DispersedIn1Displaced_[phasei].*method)(args ...) + ); + } + if (models1SegregatedWith2Displaced_.set(phasei)) + { + result.append + ( + (models1SegregatedWith2Displaced_[phasei].*method)(args ...) + ); + } + } + + return hashedWordList(move(result)); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::BlendedInterfacialModel::BlendedInterfacialModel +( + const dictionary& dict, + const phaseInterface& interface +) +: + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, interface.name()), + interface.fluid().mesh().time().timeName(), + interface.fluid().mesh() + ) + ), + interface_(interface), + blending_(), + modelGeneral_(), + model1DispersedIn2_(), + model2DispersedIn1_(), + model1SegregatedWith2_(), + modelsGeneralDisplaced_(interface.fluid().phases().size()), + models1DispersedIn2Displaced_(interface.fluid().phases().size()), + models2DispersedIn1Displaced_(interface.fluid().phases().size()), + models1SegregatedWith2Displaced_(interface.fluid().phases().size()), + checkTimeIndex_(-1) +{ + // Construct blending functions + const dictionary& blendingDict = interface.fluid().subDict("blending"); + blending_ = + blendingMethod::New + ( + ModelType::typeName, + blendingDict.found(interface.fluid().modelName()) + ? blendingDict.subDict(interface.fluid().modelName()) + : blendingDict.subDict("default"), + interface + ); + + // Construct the models + PtrList interfaces; + PtrList models; + interface.fluid().generateInterfacialModels + < + ModelType, + dispersedDisplacedPhaseInterface, + segregatedDisplacedPhaseInterface, + displacedPhaseInterface, + dispersedPhaseInterface, + segregatedPhaseInterface, + phaseInterface + > + ( + dict, + interface, + interfaces, + models + ); + + // Unpack the interface and model lists to populate the models used for the + // different parts of the blending space + forAll(interfaces, i) + { + const phaseInterface& interface = interfaces[i]; + + autoPtr* modelPtrPtr; + PtrList* modelPtrsPtr; + + if (isA(interface)) + { + const phaseModel& dispersed = + refCast(interface).dispersed(); + + modelPtrPtr = + interface_.index(dispersed) == 0 + ? &model1DispersedIn2_ + : &model2DispersedIn1_; + modelPtrsPtr = + interface_.index(dispersed) == 0 + ? &models1DispersedIn2Displaced_ + : &models2DispersedIn1Displaced_; + } + else if (isA(interface)) + { + modelPtrPtr = &model1SegregatedWith2_; + modelPtrsPtr = &models1SegregatedWith2Displaced_; + } + else + { + modelPtrPtr = &modelGeneral_; + modelPtrsPtr = &modelsGeneralDisplaced_; + } + + if (!isA(interface)) + { + *modelPtrPtr = models.set(i, nullptr); + } + else + { + const phaseModel& displacing = + refCast(interface).displacing(); + + modelPtrsPtr->set(displacing.index(), models.set(i, nullptr)); + } + } + + // Write out the blending space if needed + if (blendingDict.found("format")) + { + const word format = blendingDict.lookup("format"); + + const label nPhases = interface_.fluid().phases().size(); + + if + ( + (nPhases <= 2 && format != noSetWriter::typeName) + || (nPhases > 2 && format != noSurfaceWriter::typeName) + ) + { + postProcessBlendingCoefficients(format); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::BlendedInterfacialModel::~BlendedInterfacialModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +const Foam::phaseInterface& +Foam::BlendedInterfacialModel::interface() const +{ + return interface_; +} + + +template +bool Foam::BlendedInterfacialModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H new file mode 100644 index 0000000000..8072be23a1 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H @@ -0,0 +1,254 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::BlendedInterfacialModel + +Description + +SourceFiles + BlendedInterfacialModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef BlendedInterfacialModel_H +#define BlendedInterfacialModel_H + +#include "blendingMethod.H" +#include "phaseInterface.H" +#include "HashPtrTable.H" +#include "hashedWordList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class BlendedInterfacialModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class BlendedInterfacialModel +: + public regIOobject +{ + // Private Data + + //- The interface + const phaseInterface interface_; + + //- Blending method + autoPtr blending_; + + //- Model for general configurations + autoPtr modelGeneral_; + + //- Model for phase 1 dispersed in phase 2 + autoPtr model1DispersedIn2_; + + //- Model for phase 2 dispersed in phase 1 + autoPtr model2DispersedIn1_; + + //- Model for phase 1 segregated with phase 2 + autoPtr model1SegregatedWith2_; + + //- Models for general configurations displaced by a third phase + PtrList modelsGeneralDisplaced_; + + //- Models for phase 1 dispersed in phase 2 displaced by a third phase + PtrList models1DispersedIn2Displaced_; + + //- Models for phase 2 dispersed in phase 1 displaced by a third phase + PtrList models2DispersedIn1Displaced_; + + //- Models for phase 1 segregated with phase 2 displaced by a third + // phase + PtrList models1SegregatedWith2Displaced_; + + //- Time index of last check + mutable label checkTimeIndex_; + + + // Private Member Functions + + //- Check compatibility of the available models and the blending method + void check() const; + + //- Calculate the blending coefficients + template class PatchField, class GeoMesh> + void calculateBlendingCoeffs + ( + const UPtrList& alphas, + tmp>& fG, + tmp>& f1D2, + tmp>& f2D1, + tmp>& fS, + PtrList>& fGD, + PtrList>& f1D2D, + PtrList>& f2D1D, + PtrList>& fSD, + const bool subtract + ) const; + + //- Correct coeff/value on fixed flux boundary conditions + template class PatchField, class GeoMesh> + void correctFixedFluxBCs + ( + GeometricField& field + ) const; + + //- Write out a set or surface that visualises the various models' + // utilisation of the blending space + void postProcessBlendingCoefficients(const word& format) const; + + +protected: + + // Protected Member Functions + + //- Return a blended field + template + < + class Type, + template class PatchField, + class GeoMesh, + class ... Args + > + tmp> evaluate + ( + tmp> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args + ) const; + + //- Return a table of blended fields + template + < + class Type, + template class PatchField, + class GeoMesh, + class ... Args + > + HashPtrTable> evaluate + ( + HashPtrTable> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args + ) const; + + //- Return a bool combined (or) from all models + template + bool evaluate + ( + bool (ModelType::*method)(Args ...) const, + Args ... args + ) const; + + //- Return a hashed word list combined from all models + template + hashedWordList evaluate + ( + const hashedWordList& (ModelType::*method)(Args ...) const, + Args ... args + ) const; + + +public: + + //- Runtime type information + TypeName("BlendedInterfacialModel"); + + + // Constructors + + //- Construct from a dictionary and an interface + BlendedInterfacialModel + ( + const dictionary& dict, + const phaseInterface& interface + ); + + //- Disallow default bitwise copy construction + BlendedInterfacialModel + ( + const BlendedInterfacialModel& + ) = delete; + + + //- Destructor + ~BlendedInterfacialModel(); + + + // Member Functions + + //- Access the interface + const phaseInterface& interface() const; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const BlendedInterfacialModel&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define defineBlendedInterfacialModelTypeNameAndDebug(ModelType, DebugSwitch) \ + \ + defineTemplateTypeNameAndDebugWithName \ + ( \ + BlendedInterfacialModel, \ + ( \ + word(BlendedInterfacialModel::typeName_()) + "<" \ + + ModelType::typeName + ">" \ + ).c_str(), \ + DebugSwitch \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "BlendedInterfacialModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C new file mode 100644 index 0000000000..8e942628b6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C @@ -0,0 +1,277 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "blendingMethod.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(blendingMethod, 0); + defineRunTimeSelectionTable(blendingMethod, dictionary); +} + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::scalar Foam::blendingMethod::readParameter +( + const word& name, + const dictionary& dict, + const Pair& bounds, + const bool allowNone +) +{ + if (dict.found(name) || allowNone) + { + const token t(dict.lookup(name)); + + if (allowNone && t.isWord() && t.wordToken() == "none") + { + return NaN; + } + + if (t.isNumber()) + { + forAll(bounds, i) + { + if (!std::isnan(bounds[i])) + { + const label s = i == 0 ? -1 : +1; + + if (s*t.number() > s*bounds[i]) + { + FatalErrorInFunction + << "Blending parameter " << name << " is " + << (i == 0 ? "less" : "greater") << " than " + << bounds[i] << exit(FatalError); + } + } + } + + return t.number(); + } + + FatalIOErrorInFunction(dict) + << "wrong token type - expected Scalar or the word 'none', found " + << t.info() << exit(FatalIOError); + } + + return NaN; +} + + +Foam::Pair Foam::blendingMethod::readParameters +( + const word& name, + const dictionary& dict, + const phaseInterface& interface, + const Pair& bounds, + const bool allowNone +) +{ + const word name1 = IOobject::groupName(name, interface.phase1().name()); + const word name2 = IOobject::groupName(name, interface.phase2().name()); + return + Pair + ( + readParameter(name1, dict, bounds, allowNone), + readParameter(name2, dict, bounds, allowNone) + ); +} + + +bool Foam::blendingMethod::isParameter(const scalar parameter) +{ + return !std::isnan(parameter); +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethod::constant +( + const UPtrList& alphas, + const scalar k +) const +{ + return + volScalarField::New + ( + name(k), + alphas.first().mesh(), + dimensionedScalar(dimless, k) + ); +} + + +Foam::tmp Foam::blendingMethod::alpha +( + const UPtrList& alphas, + const label set, + const bool protect +) const +{ + tmp talpha = constant(alphas, 0); + + forAllConstIter(phaseInterface, interface_, iter) + { + if (0b01 << iter.index() & set) + { + talpha.ref() += + protect + ? max(iter().residualAlpha(), alphas[iter().index()])() + : alphas[iter().index()]; + } + } + + return talpha; +} + + +Foam::tmp Foam::blendingMethod::parameter +( + const UPtrList& alphas, + const label set, + const Pair& parameters +) const +{ + tmp talphaParameter = constant(alphas, 0); + + forAllConstIter(phaseInterface, interface_, iter) + { + if (0b01 << iter.index() & set) + { + talphaParameter.ref() += + max(iter().residualAlpha(), alphas[iter().index()]) + *parameters[iter.index()]; + } + } + + return talphaParameter/alpha(alphas, set, true); +} + + +Foam::tmp Foam::blendingMethod::x +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + return + systemSet == 0b00 + ? alpha(alphas, phaseSet, false) + : alpha(alphas, phaseSet, false)/alpha(alphas, systemSet, true); +} + + +Foam::tmp Foam::blendingMethod::f +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + label canBeContinuousPhaseSet = 0b00; + label canBeContinuousSystemSet = 0b00; + forAllConstIter(phaseInterface, interface_, iter) + { + if (canBeContinuous(iter.index())) + { + canBeContinuousPhaseSet += 0b01 << iter.index() & phaseSet; + canBeContinuousSystemSet += 0b01 << iter.index() & systemSet; + } + } + + if (canBeContinuousPhaseSet == 0) + { + return constant(alphas, 0); + } + + if (canBeContinuousPhaseSet == canBeContinuousSystemSet) + { + return constant(alphas, 1); + } + + return + fContinuous + ( + alphas, + canBeContinuousPhaseSet, + canBeContinuousSystemSet + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blendingMethod::blendingMethod +( + const dictionary& dict, + const phaseInterface& interface +) +: + interface_(interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blendingMethod::~blendingMethod() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethod::f1DispersedIn2 +( + const UPtrList& alphas +) const +{ + return f(alphas, 0b10, 0b11); +} + + +Foam::tmp Foam::blendingMethod::f2DispersedIn1 +( + const UPtrList& alphas +) const +{ + return f(alphas, 0b01, 0b11); +} + + +Foam::tmp Foam::blendingMethod::fDisplaced +( + const UPtrList& alphas +) const +{ + return 1 - f(alphas, 0b11, 0b00); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H new file mode 100644 index 0000000000..bbb8a170be --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.H @@ -0,0 +1,222 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::blendingMethod + +Description + Abstract base class for functions that are used to combine interfacial + sub-models according to the volume fractions of the phases that they apply + to. + +SourceFiles + blendingMethod.C + +\*---------------------------------------------------------------------------*/ + +#ifndef blendingMethod_H +#define blendingMethod_H + +#include "phaseInterface.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class blendingMethod Declaration +\*---------------------------------------------------------------------------*/ + +class blendingMethod +{ +protected: + + // Protected Data + + //- Interface + const phaseInterface interface_; + + + // Protected Static Member Functions + + //- Read a parameter and check it lies within specified bounds + static scalar readParameter + ( + const word& name, + const dictionary& dict, + const Pair& bounds, + const bool allowNone + ); + + //- Read a parameter for each phase in the interface + static Pair readParameters + ( + const word& name, + const dictionary& dict, + const phaseInterface& interface, + const Pair& bounds, + const bool allowNone + ); + + //- Test if the given scalar is a valid parameter + static bool isParameter(const scalar parameter); + + + // Protected Member Functions + + //- Return a constant field with the given value + tmp constant + ( + const UPtrList& alphas, + const scalar k + ) const; + + //- Get the volume fraction of the given set + tmp alpha + ( + const UPtrList& alphas, + const label set, + const bool protect + ) const; + + //- Get a blending parameter averaged for the given set + tmp parameter + ( + const UPtrList& alphas, + const label set, + const Pair& parameters + ) const; + + //- Return the coordinate of the blending function + tmp x + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + //- Evaluate the blending function for sets in which all phases can be + // continuous + virtual tmp fContinuous + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const = 0; + + //- Evaluate the blending function. Filters out phases that cannot + // become continuous from the sets, then calls fContinuous + virtual tmp f + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + +public: + + //- Runtime type information + TypeName("blendingMethod"); + + + // Declare runtime construction + declareRunTimeSelectionTable + ( + autoPtr, + blendingMethod, + dictionary, + ( + const dictionary& dict, + const phaseInterface& interface + ), + (dict, interface) + ); + + + // Constructors + + //- Construct from a dictionary and an interface + blendingMethod + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + // Selector + + static autoPtr New + ( + const word& modelTypeName, + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + virtual ~blendingMethod(); + + + // Member Functions + + //- Return whether or not a phase can be considered continuous + virtual bool canBeContinuous(const label index) const = 0; + + //- Return whether or not this interface can segregate + virtual bool canSegregate() const = 0; + + //- Return the coefficient for models in which phase 1 is dispersed in + // phase 2 + tmp f1DispersedIn2 + ( + const UPtrList& alphas + ) const; + + //- Return the coefficient for models in which phase 2 is dispersed in + // phase 1 + tmp f2DispersedIn1 + ( + const UPtrList& alphas + ) const; + + //- Return the coefficient for when the interface is displaced by a + // third phase + tmp fDisplaced + ( + const UPtrList& alphas + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethodNew.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethodNew.C new file mode 100644 index 0000000000..36f53b78a0 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethodNew.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "blendingMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::blendingMethod::New +( + const word& modelTypeName, + const dictionary& dict, + const phaseInterface& interface +) +{ + const word blendingMethodType(dict.lookup("type")); + + Info<< "Selecting " << modelTypeName << " blending method for " + << interface.name() << ": " << blendingMethodType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(blendingMethodType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown blendingMethodType type " + << blendingMethodType << endl << endl + << "Valid blendingMethod types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(dict, interface); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.C new file mode 100644 index 0000000000..14df97fc91 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "continuous.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + defineTypeNameAndDebug(continuous, 0); + addToRunTimeSelectionTable(blendingMethod, continuous, dictionary); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethods::continuous::fContinuous +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + return + constant + ( + alphas, + interface_.contains(phase_) + && (0b01 << interface_.index(phase_) & phaseSet) + ? 1 + : 0 + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blendingMethods::continuous::continuous +( + const dictionary& dict, + const phaseInterface& interface +) +: + blendingMethod(dict, interface), + phase_(interface_.fluid().phases()[dict.lookup("phase")]) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blendingMethods::continuous::~continuous() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::blendingMethods::continuous::canBeContinuous(const label index) const +{ + return interface_.contains(phase_) && interface_.index(phase_) == index; +} + + +bool Foam::blendingMethods::continuous::canSegregate() const +{ + return false; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.H new file mode 100644 index 0000000000..83dde03649 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/continuous/continuous.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::blendingMethods::continuous + +Description + Blending method for the case in which the continuous phase is always the + same. E.g., for an air-particles flow, the air phase is always continuous. + + This method requires the continuous phase to be specified. + +SourceFiles + continuous.C + +\*---------------------------------------------------------------------------*/ + +#ifndef continuous_H +#define continuous_H + +#include "blendingMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + +/*---------------------------------------------------------------------------*\ + Class continuous Declaration +\*---------------------------------------------------------------------------*/ + +class continuous +: + public blendingMethod +{ + // Private Data + + //- The continuous phase + const phaseModel& phase_; + + +protected: + + // Protected Member Functions + + //- Evaluate the blending function + virtual tmp fContinuous + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + +public: + + //- Runtime type information + TypeName("continuous"); + + + // Constructors + + //- Construct from a dictionary and an interface + continuous + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + ~continuous(); + + + // Member Functions + + //- Return whether or not a phase can be considered continuous + virtual bool canBeContinuous(const label index) const; + + //- Return whether or not this interface can segregate + virtual bool canSegregate() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace blendingMethods +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C new file mode 100644 index 0000000000..67000b1d93 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "hyperbolic.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + defineTypeNameAndDebug(hyperbolic, 0); + addToRunTimeSelectionTable(blendingMethod, hyperbolic, dictionary); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethods::hyperbolic::fContinuous +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + tmp x = this->x(alphas, phaseSet, systemSet); + tmp a = parameter(alphas, phaseSet, minContinuousAlpha_); + return (1 + tanh((4/transitionAlphaScale_)*(x - a)))/2; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blendingMethods::hyperbolic::hyperbolic +( + const dictionary& dict, + const phaseInterface& interface +) +: + blendingMethod(dict, interface), + minContinuousAlpha_ + ( + readParameters("minContinuousAlpha", dict, interface, {0, 1}, true) + ), + transitionAlphaScale_ + ( + readParameter("transitionAlphaScale", dict, {0, NaN}, false) + ) +{ + if + ( + canBeContinuous(0) + && canBeContinuous(1) + && minContinuousAlpha_[0] + minContinuousAlpha_[1] < 1 - rootSmall + ) + { + FatalErrorInFunction + << typeName.capitalise() << " blending function for interface " + << interface.name() << " is invalid in that it creates negative " + << "coefficients for sub-modelled values. A valid function will " + << "have minimum continuous alphas that sum one or greater." + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blendingMethods::hyperbolic::~hyperbolic() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::blendingMethods::hyperbolic::canBeContinuous(const label index) const +{ + return isParameter(minContinuousAlpha_[index]); +} + + +bool Foam::blendingMethods::hyperbolic::canSegregate() const +{ + return + canBeContinuous(0) + && canBeContinuous(1) + && minContinuousAlpha_[0] + minContinuousAlpha_[1] > 1 + rootSmall; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H new file mode 100644 index 0000000000..02289012a6 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::blendingMethods::hyperbolic + +Description + Blending method based on smooth hyperbolic functions. Supports the full + range of phase fraction space. E.g., from droplets in air, through a + segregated regime, to bubbly flow. + + This method requires a volume fraction at which the phase is considered to + become continuous, and a range of volume fraction over which this occurs, + to be specified for both phases. + + Alternatively, the volume fraction can be omitted or replaced with the + keyword "none" to represent a phase which cannot become continuous. E.g., + a particulate phase. + +SourceFiles + hyperbolic.C + +\*---------------------------------------------------------------------------*/ + +#ifndef hyperbolic_H +#define hyperbolic_H + +#include "blendingMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + +/*---------------------------------------------------------------------------*\ + Class hyperbolic Declaration +\*---------------------------------------------------------------------------*/ + +class hyperbolic +: + public blendingMethod +{ + // Private Data + + //- Minimum fraction of phases which can be considered continuous + Pair minContinuousAlpha_; + + //- Width of the transition + const scalar transitionAlphaScale_; + + +protected: + + // Protected Member Functions + + //- Evaluate the blending function + virtual tmp fContinuous + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + +public: + + //- Runtime type information + TypeName("hyperbolic"); + + + // Constructors + + //- Construct from a dictionary and an interface + hyperbolic + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + ~hyperbolic(); + + + // Member Functions + + //- Return whether or not a phase can be considered continuous + virtual bool canBeContinuous(const label index) const; + + //- Return whether or not this interface can segregate + virtual bool canSegregate() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace blendingMethods +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C new file mode 100644 index 0000000000..2b2a213534 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.C @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "linear.H" +#include "one.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + defineTypeNameAndDebug(linear, 0); + addToRunTimeSelectionTable(blendingMethod, linear, dictionary); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethods::linear::fContinuous +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + tmp x = this->x(alphas, phaseSet, systemSet); + tmp f = + parameter(alphas, phaseSet, minFullyContinuousAlpha_); + tmp p = + parameter(alphas, phaseSet, minPartlyContinuousAlpha_); + return min(max((x - p())/max(f - p(), rootVSmall), zero()), one()); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blendingMethods::linear::linear +( + const dictionary& dict, + const phaseInterface& interface +) +: + blendingMethod(dict, interface), + minFullyContinuousAlpha_ + ( + readParameters + ( + "minFullyContinuousAlpha", + dict, + interface, + {0, 1}, + true + ) + ), + minPartlyContinuousAlpha_ + ( + readParameters + ( + "minPartlyContinuousAlpha", + dict, + interface, + {0, 1}, + true + ) + ) +{ + forAllConstIter(phaseInterface, interface, iter) + { + const label i = iter.index(); + + if + ( + isParameter(minFullyContinuousAlpha_[i]) + != isParameter(minPartlyContinuousAlpha_[i]) + ) + { + FatalErrorInFunction + << "Both minimum fully and partly continuous alpha must be " + << "supplied for phases that can become continuous. Only one " + << "is supplied for " << iter().name() << exit(FatalError); + } + + if + ( + ( + canBeContinuous(i) + && minFullyContinuousAlpha_[i] <= minPartlyContinuousAlpha_[i] + ) + ) + { + FatalErrorInFunction + << "The fully continuous alpha specified for " << iter().name() + << " is not greater than the partly continuous alpha" + << exit(FatalError); + } + } + + if + ( + canBeContinuous(0) + && canBeContinuous(1) + && ( + ( + minFullyContinuousAlpha_[0] + minPartlyContinuousAlpha_[1] + < 1 - rootSmall + ) + || ( + minFullyContinuousAlpha_[1] + minPartlyContinuousAlpha_[0] + < 1 - rootSmall + ) + ) + ) + { + FatalErrorInFunction + << typeName.capitalise() << " blending function for interface " + << interface.name() << " is invalid in that it creates negative " + << "coefficients for sub-modelled values. A valid function will " + << "have fully continuous alphas that are greater than one minus " + << "the partly continuous alphas in the opposite phase." + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blendingMethods::linear::~linear() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::blendingMethods::linear::canBeContinuous(const label index) const +{ + return isParameter(minFullyContinuousAlpha_[index]); +} + + +bool Foam::blendingMethods::linear::canSegregate() const +{ + return + canBeContinuous(0) + && canBeContinuous(1) + && ( + minFullyContinuousAlpha_[0] + minPartlyContinuousAlpha_[1] + > 1 + rootSmall + || + minFullyContinuousAlpha_[1] + minPartlyContinuousAlpha_[0] + > 1 + rootSmall + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.H new file mode 100644 index 0000000000..75656caaeb --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/linear/linear.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::blendingMethods::linear + +Description + Blending method based on piecewise linear functions. Supports the full + range of phase fraction space. E.g., from droplets in air, through a + segregated regime, to bubbly flow. + + This method requires two volume fractions between which the phase is + considered to become continuous to be specified for both phases. + + Alternatively, these volume fractions can be omitted or replaced with the + keyword "none" to represent a phase which cannot become continuous. E.g., + a particulate phase. + +SourceFiles + linear.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linear_H +#define linear_H + +#include "blendingMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + +/*---------------------------------------------------------------------------*\ + Class linear Declaration +\*---------------------------------------------------------------------------*/ + +class linear +: + public blendingMethod +{ + // Private Data + + //- Minimum fraction of phases which can be considered fully continuous + Pair minFullyContinuousAlpha_; + + //- Minimum fraction of phases which can be considered partly continuous + Pair minPartlyContinuousAlpha_; + + +protected: + + // Protected Member Functions + + //- Evaluate the blending function + virtual tmp fContinuous + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + +public: + + //- Runtime type information + TypeName("linear"); + + + // Constructors + + //- Construct from a dictionary and an interface + linear + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + ~linear(); + + + // Member Functions + + //- Return whether or not a phase can be considered continuous + virtual bool canBeContinuous(const label index) const; + + //- Return whether or not this interface can segregate + virtual bool canSegregate() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace blendingMethods +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.C new file mode 100644 index 0000000000..e463a6516b --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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 "segregatedBlendingMethod.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + defineTypeNameAndDebug(segregated, 0); + addToRunTimeSelectionTable(blendingMethod, segregated, dictionary); +} +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::blendingMethods::segregated::fContinuous +( + const UPtrList& alphas, + const label phaseSet, + const label systemSet +) const +{ + return constant(alphas, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::blendingMethods::segregated::segregated +( + const dictionary& dict, + const phaseInterface& interface +) +: + blendingMethod(dict, interface) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::blendingMethods::segregated::~segregated() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::blendingMethods::segregated::canBeContinuous(const label index) const +{ + return false; +} + + +bool Foam::blendingMethods::segregated::canSegregate() const +{ + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.H new file mode 100644 index 0000000000..4912c5af19 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2014-2022 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::blendingMethods::segregated + +Description + Blending method for segregated configurations. E.g., a churning flow in + which it is never appropriate to consider one phase continuous. + +SourceFiles + segregatedBlendingMethod.C + +\*---------------------------------------------------------------------------*/ + +#ifndef segregatedBlendingMethod_H +#define segregatedBlendingMethod_H + +#include "blendingMethod.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace blendingMethods +{ + +/*---------------------------------------------------------------------------*\ + Class segregated Declaration +\*---------------------------------------------------------------------------*/ + +class segregated +: + public blendingMethod +{ +protected: + + // Protected Member Functions + + //- Evaluate the blending function + virtual tmp fContinuous + ( + const UPtrList& alphas, + const label phaseSet, + const label systemSet + ) const; + + +public: + + //- Runtime type information + TypeName("segregated"); + + + // Constructors + + //- Construct from a dictionary and an interface + segregated + ( + const dictionary& dict, + const phaseInterface& interface + ); + + + //- Destructor + ~segregated(); + + + // Member Functions + + //- Return whether or not a phase can be considered segregated + virtual bool canBeContinuous(const label index) const; + + //- Return whether or not this interface can segregate + virtual bool canSegregate() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace blendingMethods +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/files b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/files new file mode 100644 index 0000000000..1786ef3140 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/files @@ -0,0 +1,109 @@ +phaseModel/phaseModel/phaseModel.C +phaseModel/phaseModel/phaseModelNew.C +phaseModel/phaseModel/phaseModels.C + +phaseInterface/phaseInterfaceKey/phaseInterfaceKey.C +phaseInterface/phaseInterface/phaseInterface.C +phaseInterface/dispersedPhaseInterface/dispersedPhaseInterface.C +phaseInterface/segregatedPhaseInterface/segregatedPhaseInterface.C +phaseInterface/displacedPhaseInterface/displacedPhaseInterface.C +phaseInterface/dispersedDisplacedPhaseInterface/dispersedDisplacedPhaseInterface.C +phaseInterface/segregatedDisplacedPhaseInterface/segregatedDisplacedPhaseInterface.C +phaseInterface/sidedPhaseInterface/sidedPhaseInterface.C +phaseInterface/dispersedSidedPhaseInterface/dispersedSidedPhaseInterface.C +phaseInterface/segregatedSidedPhaseInterface/segregatedSidedPhaseInterface.C +phaseInterface/displacedSidedPhaseInterface/displacedSidedPhaseInterface.C +phaseInterface/dispersedDisplacedSidedPhaseInterface/dispersedDisplacedSidedPhaseInterface.C +phaseInterface/segregatedDisplacedSidedPhaseInterface/segregatedDisplacedSidedPhaseInterface.C + +phaseSystem/phaseSystem.C +phaseSystem/phaseSystemNew.C +phaseSystem/phaseSystemSolve.C + +PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.C +PhaseSystems/TwoResistanceHeatTransferPhaseSystem/twoResistanceHeatTransferPhaseSystem.C + +diameterModels/diameterModel/diameterModel.C +diameterModels/diameterModel/diameterModelNew.C +diameterModels/sphericalDiameter/sphericalDiameter.C +diameterModels/constantDiameter/constantDiameter.C +diameterModels/isothermalDiameter/isothermalDiameter.C +diameterModels/linearTsubDiameter/linearTsubDiameter.C +diameterModels/noDiameter/noDiameter.C +diameterModels/velocityGroup/velocityGroup.C + +diameterModels/IATE/IATE.C +diameterModels/IATE/IATEsources/IATEsource/IATEsource.C +diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/IATEwakeEntrainmentCoalescence.C +diameterModels/IATE/IATEsources/turbulentBreakUp/IATEturbulentBreakUp.C +diameterModels/IATE/IATEsources/randomCoalescence/IATErandomCoalescence.C +diameterModels/IATE/IATEsources/phaseChange/IATEphaseChange.C +diameterModels/IATE/IATEsources/wallBoiling/IATEwallBoiling.C + +sizeGroup = diameterModels/velocityGroup/sizeGroup +$(sizeGroup)/sizeGroup.C + +shapeModels = $(sizeGroup)/shapeModels +$(shapeModels)/shapeModel/shapeModel.C +$(shapeModels)/spherical/spherical.C +$(shapeModels)/fractal/fractal.C +$(shapeModels)/fractal/sinteringModels/sinteringModel/sinteringModel.C +$(shapeModels)/fractal/sinteringModels/KochFriedlander/KochFriedlander.C +$(shapeModels)/fractal/sinteringModels/noSintering/noSintering.C + +populationBalanceModel/populationBalanceModel/populationBalanceModel.C + +coalescenceModels = populationBalanceModel/coalescenceModels +$(coalescenceModels)/coalescenceModel/coalescenceModel.C +$(coalescenceModels)/AdachiStuartFokkink/AdachiStuartFokkink.C +$(coalescenceModels)/ballisticCollisions/ballisticCollisions.C +$(coalescenceModels)/BrownianCollisions/BrownianCollisions.C +$(coalescenceModels)/constantCoalescence/constantCoalescence.C +$(coalescenceModels)/CoulaloglouTavlarides/CoulaloglouTavlarides.C +$(coalescenceModels)/DahnekeInterpolation/DahnekeInterpolation.C +$(coalescenceModels)/hydrodynamic/hydrodynamic.C +$(coalescenceModels)/LehrMilliesMewesCoalescence/LehrMilliesMewesCoalescence.C +$(coalescenceModels)/LiaoCoalescence/LiaoCoalescence.C +$(coalescenceModels)/Luo/Luo.C +$(coalescenceModels)/PrinceBlanch/PrinceBlanch.C +$(coalescenceModels)/turbulentShear/turbulentShear.C + +binaryBreakupModels = populationBalanceModel/binaryBreakupModels +$(binaryBreakupModels)/binaryBreakupModel/binaryBreakupModel.C +$(binaryBreakupModels)/LehrMilliesMewes/LehrMilliesMewes.C +$(binaryBreakupModels)/Liao/LiaoBase.C +$(binaryBreakupModels)/Liao/Liao.C +$(binaryBreakupModels)/LuoSvendsen/LuoSvendsen.C +$(binaryBreakupModels)/powerLawUniformBinary/powerLawUniformBinary.C + +breakupModels = populationBalanceModel/breakupModels +$(breakupModels)/breakupModel/breakupModel.C +$(breakupModels)/exponential/exponential.C +$(breakupModels)/Kusters/Kusters.C +$(breakupModels)/Laakkonen/Laakkonen.C +$(breakupModels)/powerLaw/powerLaw.C + +daughterSizeDistributionModels = populationBalanceModel/daughterSizeDistributionModels +$(daughterSizeDistributionModels)/daughterSizeDistributionModel/daughterSizeDistributionModel.C +$(daughterSizeDistributionModels)/LaakkonenDaughterSizeDistribution/LaakkonenDaughterSizeDistribution.C +$(daughterSizeDistributionModels)/uniformBinary/uniformBinary.C + +driftModels = populationBalanceModel/driftModels +$(driftModels)/driftModel/driftModel.C +$(driftModels)/constantDrift/constantDrift.C +$(driftModels)/densityChange/densityChange.C +$(driftModels)/phaseChange/phaseChange.C + +nucleationModels = populationBalanceModel/nucleationModels +$(nucleationModels)/nucleationModel/nucleationModel.C +$(nucleationModels)/reactionDriven/reactionDriven.C +$(nucleationModels)/wallBoiling/wallBoiling.C + +BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethod.C +BlendedInterfacialModel/blendingMethods/blendingMethod/blendingMethodNew.C +BlendedInterfacialModel/blendingMethods/linear/linear.C +BlendedInterfacialModel/blendingMethods/hyperbolic/hyperbolic.C +BlendedInterfacialModel/blendingMethods/continuous/continuous.C +BlendedInterfacialModel/blendingMethods/segregatedBlendingMethod/segregatedBlendingMethod.C + +LIB = $(FOAM_LIBBIN)/libphaseSystem diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/options b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/options new file mode 100644 index 0000000000..cc8504ddcf --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/Make/options @@ -0,0 +1,21 @@ +EXE_INC = \ + -I../interfacialModels/lnInclude \ + -I../interfacialCompositionModels/lnInclude \ + -I../multiphaseCompressibleMomentumTransportModels/lnInclude \ + -I$(LIB_SRC)/physicalProperties/lnInclude \ + -I$(LIB_SRC)/multiphaseModels/multiphaseProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ + -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/thermophysicalTransportModel/lnInclude \ + -I$(LIB_SRC)/ThermophysicalTransportModels/fluid/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +LIB_LIBS = \ + -lfiniteVolume diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C new file mode 100644 index 0000000000..f9fe20d8b5 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C @@ -0,0 +1,756 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-2022 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 "HeatTransferPhaseSystem.H" +#include "fvmSup.H" +#include "rhoMulticomponentThermo.H" + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +void Foam::HeatTransferPhaseSystem::addDmdtHefs +( + const phaseSystem::dmdtfTable& dmdtfs, + phaseSystem::heatTransferTable& eqns +) const +{ + // Loop the pairs + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) + { + const phaseInterface interface(*this, dmdtfIter.key()); + + const volScalarField& dmdtf = *dmdtfIter(); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + const rhoThermo& thermo1 = phase1.thermo(); + const rhoThermo& thermo2 = phase2.thermo(); + const volScalarField& he1 = thermo1.he(); + const volScalarField& he2 = thermo2.he(); + const volScalarField hs1(thermo1.hs()); + const volScalarField hs2(thermo2.hs()); + const volScalarField K1(phase1.K()); + const volScalarField K2(phase2.K()); + + // Transfer of sensible enthalpy within the phases + *eqns[phase1.name()] += + dmdtf*hs1 + fvm::Sp(dmdtf12, he1) - dmdtf12*he1; + *eqns[phase2.name()] -= + dmdtf*hs2 + fvm::Sp(dmdtf21, he2) - dmdtf21*he2; + + // Transfer of sensible enthalpy between the phases + *eqns[phase1.name()] += dmdtf21*(hs2 - hs1); + *eqns[phase2.name()] -= dmdtf12*(hs1 - hs2); + + // Transfer of kinetic energy + *eqns[phase1.name()] += dmdtf21*K2 + dmdtf12*K1; + *eqns[phase2.name()] -= dmdtf12*K1 + dmdtf21*K2; + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmidtHefs +( + const phaseSystem::dmidtfTable& dmidtfs, + phaseSystem::heatTransferTable& eqns +) const +{ + static const dimensionedScalar one(dimless, 1); + + // Loop the pairs + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) + { + const phaseInterface interface(*this, dmidtfIter.key()); + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + const rhoThermo& thermo1 = phase1.thermo(); + const rhoThermo& thermo2 = phase2.thermo(); + const basicSpecieMixture* compositionPtr1 = + isA(thermo1) + ? &refCast(thermo1).composition() + : static_cast(nullptr); + const basicSpecieMixture* compositionPtr2 = + isA(thermo2) + ? &refCast(thermo2).composition() + : static_cast(nullptr); + const volScalarField& he1 = thermo1.he(); + const volScalarField& he2 = thermo2.he(); + const volScalarField hs1(thermo1.hs()); + const volScalarField hs2(thermo2.hs()); + const volScalarField K1(phase1.K()); + const volScalarField K2(phase2.K()); + + // Loop the species + forAllConstIter(HashPtrTable, *dmidtfIter(), dmidtfJter) + { + const word& specie = dmidtfJter.key(); + + // Mass transfer rates + const volScalarField& dmidtf = *dmidtfJter(); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); + + // Specie indices + const label speciei1 = + compositionPtr1 ? compositionPtr1->species()[specie] : -1; + const label speciei2 = + compositionPtr2 ? compositionPtr2->species()[specie] : -1; + + // Enthalpies + const volScalarField hsi1 + ( + compositionPtr1 + ? compositionPtr1->Hs(speciei1, thermo1.p(), thermo1.T()) + : tmp(hs1) + ); + const volScalarField hsi2 + ( + compositionPtr2 + ? compositionPtr2->Hs(speciei2, thermo2.p(), thermo2.T()) + : tmp(hs2) + ); + + // Limited mass fractions + tmp tYi1, tYi2; + if (residualY_ > 0) + { + tYi1 = + compositionPtr1 + ? max(compositionPtr1->Y(speciei1), residualY_) + : volScalarField::New("Yi1", this->mesh(), one); + tYi2 = + compositionPtr2 + ? max(compositionPtr2->Y(speciei2), residualY_) + : volScalarField::New("Yi2", this->mesh(), one); + } + + // Transfer of sensible enthalpy within the phases + *eqns[phase1.name()] += dmidtf*hsi1; + *eqns[phase2.name()] -= dmidtf*hsi2; + if (residualY_ > 0) + { + *eqns[phase1.name()] += + fvm::Sp(dmidtf12/tYi1(), he1) - dmidtf12/tYi1()*he1; + *eqns[phase2.name()] -= + fvm::Sp(dmidtf21/tYi2(), he2) - dmidtf21/tYi2()*he2; + } + + // Transfer of sensible enthalpy between the phases + *eqns[phase1.name()] += dmidtf21*(hsi2 - hsi1); + *eqns[phase2.name()] -= dmidtf12*(hsi1 - hsi2); + + // Transfer of kinetic energy + *eqns[phase1.name()] += dmidtf21*K2 + dmidtf12*K1; + *eqns[phase2.name()] -= dmidtf12*K1 + dmidtf21*K2; + } + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmdtHefsWithoutL +( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + // Loop the pairs + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) + { + const phaseInterface interface(*this, dmdtfIter.key()); + + const volScalarField& dmdtf = *dmdtfIter(); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); + + const volScalarField& Tf = *Tfs[dmdtfIter.key()]; + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + const rhoThermo& thermo1 = phase1.thermo(); + const rhoThermo& thermo2 = phase2.thermo(); + const volScalarField& he1 = thermo1.he(); + const volScalarField& he2 = thermo2.he(); + const volScalarField K1(phase1.K()); + const volScalarField K2(phase2.K()); + + // Interface enthalpies + const volScalarField hsf1(thermo1.hs(thermo1.p(), Tf)); + const volScalarField hsf2(thermo2.hs(thermo1.p(), Tf)); + + // Transfer of energy from the interface into the bulk + switch (scheme) + { + case latentHeatScheme::symmetric: + { + *eqns[phase1.name()] += dmdtf*hsf1; + *eqns[phase2.name()] -= dmdtf*hsf2; + + break; + } + case latentHeatScheme::upwind: + { + // Bulk enthalpies + const volScalarField hs1(thermo1.hs()); + const volScalarField hs2(thermo2.hs()); + + *eqns[phase1.name()] += dmdtf21*hsf1 + dmdtf12*hs1; + *eqns[phase2.name()] -= dmdtf12*hsf2 + dmdtf21*hs2; + + break; + } + } + *eqns[phase1.name()] += fvm::Sp(dmdtf12, he1) - dmdtf12*he1; + *eqns[phase2.name()] -= fvm::Sp(dmdtf21, he2) - dmdtf21*he2; + + // Transfer of kinetic energy + *eqns[phase1.name()] += dmdtf21*K2 + dmdtf12*K1; + *eqns[phase2.name()] -= dmdtf12*K1 + dmdtf21*K2; + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmdtL +( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + // Loop the pairs + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) + { + const phaseInterface interface(*this, dmdtfIter.key()); + + const volScalarField& dmdtf = *dmdtfIter(); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); + + const volScalarField& Tf = *Tfs[dmdtfIter.key()]; + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + + // Latent heat contribution + const volScalarField L(this->L(interface, dmdtf, Tf, scheme)); + *eqns[phase1.name()] += ((1 - weight)*dmdtf12 + weight*dmdtf21)*L; + *eqns[phase2.name()] += ((1 - weight)*dmdtf21 + weight*dmdtf12)*L; + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmdtHefs +( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + addDmdtHefsWithoutL(dmdtfs, Tfs, scheme, eqns); + addDmdtL(dmdtfs, Tfs, weight, scheme, eqns); +} + + +template +void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL +( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + static const dimensionedScalar one(dimless, 1); + + // Loop the pairs + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) + { + const phaseInterface interface(*this, dmidtfIter.key()); + + const volScalarField& Tf = *Tfs[dmidtfIter.key()]; + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + const rhoThermo& thermo1 = phase1.thermo(); + const rhoThermo& thermo2 = phase2.thermo(); + const basicSpecieMixture* compositionPtr1 = + isA(thermo1) + ? &refCast(thermo1).composition() + : static_cast(nullptr); + const basicSpecieMixture* compositionPtr2 = + isA(thermo2) + ? &refCast(thermo2).composition() + : static_cast(nullptr); + const volScalarField& he1 = thermo1.he(); + const volScalarField& he2 = thermo2.he(); + const volScalarField K1(phase1.K()); + const volScalarField K2(phase2.K()); + + // Interface enthalpies + const volScalarField hsf1(thermo1.hs(thermo1.p(), Tf)); + const volScalarField hsf2(thermo2.hs(thermo2.p(), Tf)); + + // Loop the species + forAllConstIter(HashPtrTable, *dmidtfIter(), dmidtfJter) + { + const word& specie = dmidtfJter.key(); + + // Mass transfer rates + const volScalarField& dmidtf = *dmidtfJter(); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); + + // Specie indices + const label speciei1 = + compositionPtr1 ? compositionPtr1->species()[specie] : -1; + const label speciei2 = + compositionPtr2 ? compositionPtr2->species()[specie] : -1; + + // Interface enthalpies + const volScalarField hsfi1 + ( + compositionPtr1 + ? compositionPtr1->Hs(speciei1, thermo1.p(), Tf) + : tmp(hsf1) + ); + const volScalarField hsfi2 + ( + compositionPtr2 + ? compositionPtr2->Hs(speciei2, thermo2.p(), Tf) + : tmp(hsf2) + ); + + // Limited mass fractions + tmp tYi1, tYi2; + if (this->residualY_ > 0) + { + tYi1 = + compositionPtr1 + ? max(compositionPtr1->Y(speciei1), this->residualY_) + : volScalarField::New("Yi1", this->mesh(), one); + tYi2 = + compositionPtr2 + ? max(compositionPtr2->Y(speciei2), this->residualY_) + : volScalarField::New("Yi2", this->mesh(), one); + } + + // Transfer of energy from the interface into the bulk + switch (scheme) + { + case latentHeatScheme::symmetric: + { + *eqns[phase1.name()] += dmidtf*hsfi1; + *eqns[phase2.name()] -= dmidtf*hsfi2; + + break; + } + case latentHeatScheme::upwind: + { + // Bulk enthalpies + const volScalarField hsi1 + ( + compositionPtr1 + ? compositionPtr1->Hs(speciei1, thermo1.p(), thermo1.T()) + : thermo1.hs() + ); + const volScalarField hsi2 + ( + compositionPtr2 + ? compositionPtr2->Hs(speciei2, thermo2.p(), thermo2.T()) + : thermo2.hs() + ); + + *eqns[phase1.name()] += dmidtf21*hsfi1 + dmidtf12*hsi1; + *eqns[phase2.name()] -= dmidtf12*hsfi2 + dmidtf21*hsi2; + + break; + } + } + if (this->residualY_ > 0) + { + *eqns[phase1.name()] += + fvm::Sp(dmidtf12/tYi1(), he1) - dmidtf12/tYi1()*he1; + } + if (this->residualY_ > 0) + { + *eqns[phase2.name()] -= + fvm::Sp(dmidtf21/tYi2(), he2) - dmidtf21/tYi2()*he2; + } + + + // Transfer of kinetic energy + *eqns[phase1.name()] += dmidtf21*K2 + dmidtf12*K1; + *eqns[phase2.name()] -= dmidtf12*K1 + dmidtf21*K2; + } + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmidtL +( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + // Loop the pairs + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) + { + const phaseInterface interface(*this, dmidtfIter.key()); + + const volScalarField& Tf = *Tfs[dmidtfIter.key()]; + + const phaseModel& phase1 = interface.phase1(); + const phaseModel& phase2 = interface.phase2(); + + // Loop the species + forAllConstIter(HashPtrTable, *dmidtfIter(), dmidtfJter) + { + const word& specie = dmidtfJter.key(); + + // Mass transfer rates + const volScalarField& dmidtf = *dmidtfJter(); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); + + // Latent heat contribution + const volScalarField Li + ( + this->Li(interface, specie, dmidtf, Tf, scheme) + ); + *eqns[phase1.name()] += + ((1 - weight)*dmidtf12 + weight*dmidtf21)*Li; + *eqns[phase2.name()] += + ((1 - weight)*dmidtf21 + weight*dmidtf12)*Li; + } + } +} + + +template +void Foam::HeatTransferPhaseSystem::addDmidtHefs +( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns +) const +{ + addDmidtHefsWithoutL(dmidtfs, Tfs, scheme, eqns); + addDmidtL(dmidtfs, Tfs, weight, scheme, eqns); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::HeatTransferPhaseSystem::HeatTransferPhaseSystem +( + const fvMesh& mesh +) +: + heatTransferPhaseSystem(), + BasePhaseSystem(mesh), + residualY_(this->template lookupOrDefault("residualY", -1)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::HeatTransferPhaseSystem::~HeatTransferPhaseSystem() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +Foam::tmp +Foam::HeatTransferPhaseSystem::L +( + const phaseInterface& interface, + const volScalarField& dmdtf, + const volScalarField& Tf, + const latentHeatScheme scheme +) const +{ + const rhoThermo& thermo1 = interface.phase1().thermo(); + const rhoThermo& thermo2 = interface.phase2().thermo(); + + // Interface enthalpies + const volScalarField haf1(thermo1.ha(thermo1.p(), Tf)); + const volScalarField haf2(thermo2.ha(thermo2.p(), Tf)); + + switch (scheme) + { + case latentHeatScheme::symmetric: + { + return haf2 - haf1; + } + case latentHeatScheme::upwind: + { + // Bulk enthalpies + const volScalarField ha1(thermo1.ha()); + const volScalarField ha2(thermo2.ha()); + + return + neg0(dmdtf)*haf2 + pos(dmdtf)*ha2 + - pos0(dmdtf)*haf1 - neg(dmdtf)*ha1; + } + } + + return tmp(nullptr); +} + + +template +Foam::tmp +Foam::HeatTransferPhaseSystem::L +( + const phaseInterface& interface, + const scalarField& dmdtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme +) const +{ + const rhoThermo& thermo1 = interface.phase1().thermo(); + const rhoThermo& thermo2 = interface.phase2().thermo(); + + // Interface enthalpies + const scalarField haf1(thermo1.ha(Tf, cells)); + const scalarField haf2(thermo2.ha(Tf, cells)); + + switch (scheme) + { + case latentHeatScheme::symmetric: + { + return haf2 - haf1; + } + case latentHeatScheme::upwind: + { + const scalarField T1(UIndirectList(thermo1.T(), cells)); + const scalarField T2(UIndirectList(thermo2.T(), cells)); + + // Bulk enthalpies + const scalarField ha1(thermo1.ha(T1, cells)); + const scalarField ha2(thermo2.ha(T2, cells)); + + return + neg0(dmdtf)*haf2 + pos(dmdtf)*ha2 + - pos0(dmdtf)*haf1 - neg(dmdtf)*ha1; + } + } + + return tmp(nullptr); +} + + +template +Foam::tmp +Foam::HeatTransferPhaseSystem::Li +( + const phaseInterface& interface, + const word& specie, + const volScalarField& dmdtf, + const volScalarField& Tf, + const latentHeatScheme scheme +) const +{ + const rhoThermo& thermo1 = interface.phase1().thermo(); + const rhoThermo& thermo2 = interface.phase2().thermo(); + const basicSpecieMixture* compositionPtr1 = + isA(thermo1) + ? &refCast(thermo1).composition() + : static_cast(nullptr); + const basicSpecieMixture* compositionPtr2 = + isA(thermo2) + ? &refCast(thermo2).composition() + : static_cast(nullptr); + const label speciei1 = + compositionPtr1 ? compositionPtr1->species()[specie] : -1; + const label speciei2 = + compositionPtr2 ? compositionPtr2->species()[specie] : -1; + + // Interface enthalpies + const volScalarField hafi1 + ( + compositionPtr1 + ? compositionPtr1->Ha(speciei1, thermo1.p(), Tf) + : thermo1.ha(thermo1.p(), Tf) + ); + const volScalarField hafi2 + ( + compositionPtr2 + ? compositionPtr2->Ha(speciei2, thermo2.p(), Tf) + : thermo2.ha(thermo1.p(), Tf) + ); + + switch (scheme) + { + case latentHeatScheme::symmetric: + { + return hafi2 - hafi1; + } + case latentHeatScheme::upwind: + { + // Bulk enthalpies + const volScalarField hai1 + ( + compositionPtr1 + ? compositionPtr1->Ha(speciei1, thermo1.p(), thermo1.T()) + : thermo1.ha() + ); + const volScalarField hai2 + ( + compositionPtr2 + ? compositionPtr2->Ha(speciei2, thermo2.p(), thermo2.T()) + : thermo2.ha() + ); + + return + neg0(dmdtf)*hafi2 + pos(dmdtf)*hai2 + - pos0(dmdtf)*hafi1 - neg(dmdtf)*hai1; + } + } + + return tmp(nullptr); +} + + +template +Foam::tmp +Foam::HeatTransferPhaseSystem::Li +( + const phaseInterface& interface, + const word& specie, + const scalarField& dmdtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme +) const +{ + const rhoThermo& thermo1 = interface.phase1().thermo(); + const rhoThermo& thermo2 = interface.phase2().thermo(); + const basicSpecieMixture* compositionPtr1 = + isA(thermo1) + ? &refCast(thermo1).composition() + : static_cast(nullptr); + const basicSpecieMixture* compositionPtr2 = + isA(thermo2) + ? &refCast(thermo2).composition() + : static_cast(nullptr); + const label speciei1 = + compositionPtr1 ? compositionPtr1->species()[specie] : -1; + const label speciei2 = + compositionPtr2 ? compositionPtr2->species()[specie] : -1; + + const scalarField p1(UIndirectList(thermo1.p(), cells)); + const scalarField p2(UIndirectList(thermo2.p(), cells)); + + // Interface enthalpies + const scalarField hafi1 + ( + compositionPtr1 + ? compositionPtr1->Ha(speciei1, p1, Tf) + : thermo1.ha(Tf, cells) + ); + const scalarField hafi2 + ( + compositionPtr2 + ? compositionPtr2->Ha(speciei2, p2, Tf) + : thermo2.ha(Tf, cells) + ); + + switch (scheme) + { + case latentHeatScheme::symmetric: + { + return hafi2 - hafi1; + } + case latentHeatScheme::upwind: + { + const scalarField T1(UIndirectList(thermo1.T(), cells)); + const scalarField T2(UIndirectList(thermo2.T(), cells)); + + // Bulk enthalpies + const scalarField hai1 + ( + compositionPtr1 + ? compositionPtr1->Ha(speciei1, p1, T1) + : thermo1.ha(T1, cells) + ); + const scalarField hai2 + ( + compositionPtr2 + ? compositionPtr2->Ha(speciei2, p2, T2) + : thermo2.ha(T2, cells) + ); + + return + neg0(dmdtf)*hafi2 + pos(dmdtf)*hai2 + - pos0(dmdtf)*hafi1 - neg(dmdtf)*hai1; + } + } + + return tmp(nullptr); +} + + +template +bool Foam::HeatTransferPhaseSystem::read() +{ + if (BasePhaseSystem::read()) + { + bool readOK = true; + + // Models ... + + return readOK; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.H new file mode 100644 index 0000000000..81bc8c64be --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/HeatTransferPhaseSystem.H @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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::HeatTransferPhaseSystem + +Description + ... + +SourceFiles + HeatTransferPhaseSystem.C + +\*---------------------------------------------------------------------------*/ + +#ifndef HeatTransferPhaseSystem_H +#define HeatTransferPhaseSystem_H + +#include "heatTransferPhaseSystem.H" +#include "phaseSystem.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class HeatTransferPhaseSystem Declaration +\*---------------------------------------------------------------------------*/ + +template +class HeatTransferPhaseSystem +: + public heatTransferPhaseSystem, + public BasePhaseSystem +{ +protected: + + // Protected Member Functions + + //- Add energy transfer terms which result from bulk mass transfers + void addDmdtHefs + ( + const phaseSystem::dmdtfTable& dmdtfs, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add energy transfer terms which result from specie mass transfers + void addDmidtHefs + ( + const phaseSystem::dmidtfTable& dmidtfs, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add energy transfer terms which result from bulk phase changes, + // without the latent heat contribution + void addDmdtHefsWithoutL + ( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add latent heat terms which result from bulk phase changes. + // Weight is the proportion of the latent heat contribution applied to + // the downwind side of the mass transfer. + void addDmdtL + ( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add energy transfer terms which result from bulk phase changes. + // Weight is the proportion of the latent heat contribution applied to + // the downwind side of the mass transfer. + void addDmdtHefs + ( + const phaseSystem::dmdtfTable& dmdtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add energy transfer terms which result from specie phase changes, + // without the latent heat contribution + void addDmidtHefsWithoutL + ( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add latent heat terms which result from specie phase changes. + // Weight is the proportion of the latent heat contribution applied to + // the downwind side of the mass transfer. + void addDmidtL + ( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + //- Add energy transfer terms which result from specie phase changes + // Weight is the proportion of the latent heat contribution applied to + // the downwind side of the mass transfer. + void addDmidtHefs + ( + const phaseSystem::dmidtfTable& dmidtfs, + const phaseSystem::dmdtfTable& Tfs, + const scalar weight, + const latentHeatScheme scheme, + phaseSystem::heatTransferTable& eqns + ) const; + + + // Protected data + + //- Residual mass fraction used for linearisation of heat transfer + // terms that result from mass transfers of individual species + scalar residualY_; + + + +public: + + // Constructors + + //- Construct from fvMesh + HeatTransferPhaseSystem(const fvMesh&); + + + //- Destructor + virtual ~HeatTransferPhaseSystem(); + + + // Member Functions + + //- Return the latent heat for a given interface, mass transfer rate + // (used only for it's sign), and interface temperature + virtual tmp L + ( + const phaseInterface& interface, + const volScalarField& dmdtf, + const volScalarField& Tf, + const latentHeatScheme scheme + ) const; + + //- As above, but for a cell-set + virtual tmp L + ( + const phaseInterface& interface, + const scalarField& dmdtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme + ) const; + + //- Return the latent heat for a given interface, specie, mass transfer + // rate (used only for it's sign), and interface temperature + virtual tmp Li + ( + const phaseInterface& interface, + const word& member, + const volScalarField& dmidtf, + const volScalarField& Tf, + const latentHeatScheme scheme + ) const; + + //- As above, but for a cell-set + virtual tmp Li + ( + const phaseInterface& interface, + const word& member, + const scalarField& dmidtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme + ) const; + + //- Read base phaseProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "HeatTransferPhaseSystem.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.C new file mode 100644 index 0000000000..fafc243603 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "heatTransferPhaseSystem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* NamedEnum + < + Foam::heatTransferPhaseSystem::latentHeatScheme, + 2 + >::names[] = {"symmetric", "upwind"}; +} + + +const Foam::NamedEnum +< + Foam::heatTransferPhaseSystem::latentHeatScheme, + 2 +> +Foam::heatTransferPhaseSystem::latentHeatSchemeNames_; + + +namespace Foam +{ + defineTypeNameAndDebug(heatTransferPhaseSystem, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatTransferPhaseSystem::heatTransferPhaseSystem() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatTransferPhaseSystem::~heatTransferPhaseSystem() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.H b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.H new file mode 100644 index 0000000000..b8558cf286 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/HeatTransferPhaseSystem/heatTransferPhaseSystem.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020-2022 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::heatTransferPhaseSystem + +SourceFiles + heatTransferPhaseSystem.C + +\*---------------------------------------------------------------------------*/ + +#ifndef heatTransferPhaseSystem_H +#define heatTransferPhaseSystem_H + +#include "NamedEnum.H" +#include "primitiveFieldsFwd.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class phaseInterface; + +/*---------------------------------------------------------------------------*\ + Class heatTransferPhaseSystem Declaration +\*---------------------------------------------------------------------------*/ + +class heatTransferPhaseSystem +{ +public: + + //- Enumeration for the latent heat scheme + enum class latentHeatScheme + { + symmetric, + upwind + }; + + //- Names of the latent heat schemes + static const NamedEnum latentHeatSchemeNames_; + + + //- Runtime type information + TypeName("heatTransferPhaseSystem"); + + + // Constructors + + //- Default constructor + heatTransferPhaseSystem(); + + + //- Destructor + virtual ~heatTransferPhaseSystem(); + + + // Member Functions + + //- Return the latent heat for a given interface, mass transfer rate + // (used only for it's sign), and interface temperature + virtual tmp L + ( + const phaseInterface& interface, + const volScalarField& dmdtf, + const volScalarField& Tf, + const latentHeatScheme scheme + ) const = 0; + + //- As above, but for a cell-set + virtual tmp L + ( + const phaseInterface& interface, + const scalarField& dmdtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme + ) const = 0; + + //- Return the latent heat for a given interface, specie, mass transfer + // rate (used only for it's sign), and interface temperature + virtual tmp Li + ( + const phaseInterface& interface, + const word& member, + const volScalarField& dmidtf, + const volScalarField& Tf, + const latentHeatScheme scheme + ) const = 0; + + //- As above, but for a cell-set + virtual tmp Li + ( + const phaseInterface& interface, + const word& member, + const scalarField& dmidtf, + const scalarField& Tf, + const labelUList& cells, + const latentHeatScheme scheme + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C new file mode 100644 index 0000000000..8ad8185871 --- /dev/null +++ b/applications/solvers/modules/fluid/multiphaseEuler/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -0,0 +1,766 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2022 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 "InterfaceCompositionPhaseChangePhaseSystem.H" +#include "interfaceCompositionModel.H" +#include "heatTransferModel.H" +#include "diffusiveMassTransferModel.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template +void Foam::InterfaceCompositionPhaseChangePhaseSystem:: +correctDmdtfs() +{ + forAllConstIter + ( + interfaceCompositionModelTable, + interfaceCompositionModels_, + interfaceCompositionModelIter + ) + { + const sidedInterfaceCompositionModel& compositionModel = + interfaceCompositionModelIter(); + + const phaseInterface& interface = compositionModel.interface(); + + *dmdtfs_[interface] = Zero; + + forAllConstIter(phaseInterface, interface, interfaceIter) + { + const phaseModel& phase = interfaceIter(); + + if (!compositionModel.haveModelInThe(phase)) continue; + + forAllConstIter + ( + hashedWordList, + compositionModel.modelInThe(phase).species(), + specieIter + ) + { + const word& specie = *specieIter; + + *dmdtfs_[interface] += + (interfaceIter.index() == 0 ? +1 : -1) + *( + *(*dmidtfSus_[interface])[specie] + + *(*dmidtfSps_[interface])[specie]*phase.Y(specie) + ); + } + } + } +} + + +template +Foam::autoPtr +Foam::InterfaceCompositionPhaseChangePhaseSystem:: +totalDmidtfs() const +{ + autoPtr totalDmidtfsPtr + ( + new phaseSystem::dmidtfTable + ); + phaseSystem::dmidtfTable& totalDmidtfs = totalDmidtfsPtr(); + + forAllConstIter + ( + interfaceCompositionModelTable, + interfaceCompositionModels_, + interfaceCompositionModelIter + ) + { + const sidedInterfaceCompositionModel& compositionModel = + interfaceCompositionModelIter(); + + const phaseInterface& interface = compositionModel.interface(); + + if (!totalDmidtfs.found(interface)) + { + totalDmidtfs.insert(interface, new HashPtrTable()); + } + + forAllConstIter(phaseInterface, interface, interfaceIter) + { + const phaseModel& phase = interfaceIter(); + + if (!compositionModel.haveModelInThe(phase)) continue; + + forAllConstIter + ( + hashedWordList, + compositionModel.modelInThe(phase).species(), + specieIter + ) + { + const word& specie = *specieIter; + + tmp dmidtf + ( + (interfaceIter.index() == 0 ? +1 : -1) + *( + *(*dmidtfSus_[interface])[specie] + + *(*dmidtfSps_[interface])[specie]*phase.Y(specie) + ) + ); + + if (totalDmidtfs[interface]->found(specie)) + { + *(*totalDmidtfs[interface])[specie] += dmidtf; + } + else + { + totalDmidtfs[interface]->insert(specie, dmidtf.ptr()); + } + } + } + } + + return totalDmidtfsPtr; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::InterfaceCompositionPhaseChangePhaseSystem:: +InterfaceCompositionPhaseChangePhaseSystem +( + const fvMesh& mesh +) +: + BasePhaseSystem(mesh), + nInterfaceCorrectors_ + ( + this->template lookupOrDefault