From 76579f581463280121d97c1b63cebb4b4651c7a9 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 5 Apr 2017 14:36:11 +0100 Subject: [PATCH] surfaceTensionModels::liquidProperties: New temperature-dependent surface tension model Description Temperature-dependent surface tension model in which the surface tension function provided by the phase Foam::liquidProperties class is used. Usage \table Property | Description | Required | Default value phase | Phase name | yes | \endtable Example of the surface tension specification: \verbatim sigma { type liquidProperties; phase water; } \endverbatim for use with e.g. compressibleInterFoam, see tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D --- .../compressibleInterFoam/Allwclean | 1 + .../multiphase/compressibleInterFoam/Allwmake | 1 + .../compressibleInterFoam/Make/options | 1 + .../compressibleInterDyMFoam/Make/options | 1 + .../surfaceTensionModels/Make/files | 3 + .../surfaceTensionModels/Make/options | 15 ++ .../liquidPropertiesSurfaceTension.C | 155 ++++++++++++++++++ .../liquidPropertiesSurfaceTension.H | 123 ++++++++++++++ .../basic/mixtures/pureMixture/pureMixture.H | 7 +- .../basic/rhoThermo/liquidThermo.C | 24 +-- .../basic/rhoThermo/liquidThermo.H | 59 +++++++ .../thermophysicalPropertiesSelector.H | 4 + .../thermophysicalPropertiesSelectorI.H | 8 + .../constant/thermophysicalProperties | 6 +- 14 files changed, 383 insertions(+), 25 deletions(-) create mode 100644 applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files create mode 100644 applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options create mode 100644 applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C create mode 100644 applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H create mode 100644 src/thermophysicalModels/basic/rhoThermo/liquidThermo.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/multiphase/compressibleInterFoam/Allwclean index deb5e2378..71bff64a7 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwclean +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwclean @@ -2,6 +2,7 @@ cd ${0%/*} || exit 1 # Run from this directory wclean libso twoPhaseMixtureThermo +wclean libso surfaceTensionModels wclean wclean compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 20da00c47..29bafc3a6 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -5,6 +5,7 @@ cd ${0%/*} || exit 1 # Run from this directory . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments wmake $targetType twoPhaseMixtureThermo +wmake $targetType surfaceTensionModels wmake $targetType wmake $targetType compressibleInterDyMFoam diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index b947836f6..29b12f311 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -13,6 +13,7 @@ EXE_INC = \ EXE_LIBS = \ -ltwoPhaseMixtureThermo \ + -ltwoPhaseSurfaceTension \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options index b44af44a7..4de8fd271 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options @@ -16,6 +16,7 @@ EXE_INC = \ EXE_LIBS = \ -ltwoPhaseMixtureThermo \ + -ltwoPhaseSurfaceTension \ -lcompressibleTransportModels \ -lfluidThermophysicalModels \ -lspecie \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files new file mode 100644 index 000000000..fa34a8382 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/files @@ -0,0 +1,3 @@ +liquidProperties/liquidPropertiesSurfaceTension.C + +LIB = $(FOAM_LIBBIN)/libtwoPhaseSurfaceTension diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options new file mode 100644 index 000000000..0d8cc30e2 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -linterfaceProperties \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lspecie \ + -lthermophysicalProperties \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C new file mode 100644 index 000000000..71e108980 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "liquidPropertiesSurfaceTension.H" +#include "liquidThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceTensionModels +{ + defineTypeNameAndDebug(liquidProperties, 0); + addToRunTimeSelectionTable + ( + surfaceTensionModel, + liquidProperties, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::liquidProperties::liquidProperties +( + const dictionary& dict, + const fvMesh& mesh +) +: + surfaceTensionModel(mesh), + phaseName_(dict.lookup("phase")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::liquidProperties::~liquidProperties() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::surfaceTensionModels::liquidProperties::sigma() const +{ + const heRhoThermopureMixtureliquidProperties& thermo = + mesh_.lookupObject + ( + IOobject::groupName(basicThermo::dictName, phaseName_) + ); + + const Foam::liquidProperties& liquid = thermo.mixture().properties(); + + tmp tsigma + ( + new volScalarField + ( + IOobject + ( + "sigma", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimSigma + ) + ); + volScalarField& sigma = tsigma.ref(); + + const volScalarField& T = thermo.T(); + const volScalarField& p = thermo.p(); + + volScalarField::Internal& sigmai = sigma; + const volScalarField::Internal& pi = p; + const volScalarField::Internal& Ti = T; + + forAll(sigmai, celli) + { + sigmai[celli] = liquid.sigma(pi[celli], Ti[celli]); + } + + volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); + const volScalarField::Boundary& pBf = p.boundaryField(); + const volScalarField::Boundary& TBf = T.boundaryField(); + + forAll(sigmaBf, patchi) + { + scalarField& sigmaPf = sigmaBf[patchi]; + const scalarField& pPf = pBf[patchi]; + const scalarField& TPf = TBf[patchi]; + + forAll(sigmaPf, facei) + { + sigmaPf[facei] = liquid.sigma(pPf[facei], TPf[facei]); + } + } + + return tsigma; +} + + +bool Foam::surfaceTensionModels::liquidProperties::read +( + const dictionary& dict +) +{ + return true; +} + + +bool Foam::surfaceTensionModels::liquidProperties::writeData +( + Ostream& os +) const +{ + if (surfaceTensionModel::writeData(os)) + { + return os.good(); + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H new file mode 100644 index 000000000..b209dfc9d --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterFoam/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.H @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::surfaceTensionModels::liquidProperties + +Description + Temperature-dependent surface tension model in which the surface tension + function provided by the phase Foam::liquidProperties class is used. + +Usage + \table + Property | Description | Required | Default value + phase | Phase name | yes | + \endtable + + Example of the surface tension specification: + \verbatim + sigma + { + type liquidProperties; + phase water; + } + \endverbatim + +See also + Foam::surfaceTensionModel + +SourceFiles + liquidPropertiesSurfaceTension.C + +\*---------------------------------------------------------------------------*/ + +#ifndef liquidPropertiesSurfaceTension_H +#define liquidPropertiesSurfaceTension_H + +#include "surfaceTensionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace surfaceTensionModels +{ + +/*---------------------------------------------------------------------------*\ + Class liquidProperties Declaration +\*---------------------------------------------------------------------------*/ + +class liquidProperties +: + public surfaceTensionModel +{ + // Private data + + //- Name of the liquid phase + word phaseName_; + + +public: + + //- Runtime type information + TypeName("liquidProperties"); + + + // Constructors + + //- Construct from dictionary and mesh + liquidProperties + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~liquidProperties(); + + + // Member Functions + + //- Surface tension coefficient + virtual tmp sigma() const; + + //- Update surface tension coefficient from given dictionary + virtual bool read(const dictionary& dict); + + //- Write in dictionary format + virtual bool writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceTensionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H index d49aa797f..f7f213f10 100644 --- a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H +++ b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,6 +73,11 @@ public: // Member functions + const ThermoType& mixture() const + { + return mixture_; + } + const ThermoType& cellMixture(const label) const { return mixture_; diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C index c023c5068..de4a576b1 100644 --- a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C @@ -23,16 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "rhoThermo.H" -#include "heRhoThermo.H" -#include "pureMixture.H" -#include "thermo.H" -#include "sensibleEnthalpy.H" -#include "sensibleInternalEnergy.H" - -#include "thermophysicalPropertiesSelector.H" -#include "liquidProperties.H" - +#include "liquidThermo.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,19 +33,6 @@ namespace Foam /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ -typedef heRhoThermo -< - rhoThermo, - pureMixture - < - species::thermo - < - thermophysicalPropertiesSelector, - sensibleInternalEnergy - > - > -> heRhoThermopureMixtureliquidProperties; - defineTemplateTypeNameAndDebugWithName ( heRhoThermopureMixtureliquidProperties, diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H new file mode 100644 index 000000000..de5aed514 --- /dev/null +++ b/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "rhoThermo.H" +#include "heRhoThermo.H" +#include "pureMixture.H" +#include "thermo.H" +#include "sensibleInternalEnergy.H" +#include "thermophysicalPropertiesSelector.H" +#include "liquidProperties.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +typedef heRhoThermo +< + rhoThermo, + pureMixture + < + species::thermo + < + thermophysicalPropertiesSelector, + sensibleInternalEnergy + > + > +> heRhoThermopureMixtureliquidProperties; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H index 690e4a950..7edd6225a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H @@ -80,6 +80,10 @@ public: // Member Functions + //- Return reference to the selected physical properties class + inline const ThermophysicalProperties& properties() const; + + // Physical constants which define the specie //- Molecular weight [kg/kmol] diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H index 870aa1dbe..a074d3714 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H @@ -25,6 +25,14 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +inline const ThermophysicalProperties& +Foam::thermophysicalPropertiesSelector +::properties() const +{ + return propertiesPtr_(); +} + template inline Foam::scalar Foam::thermophysicalPropertiesSelector::W() const diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties index 39d2517cd..be327980e 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties @@ -19,6 +19,10 @@ phases (water air); pMin 10000; -sigma 0.07; +sigma +{ + type liquidProperties; + phase water; +} // ************************************************************************* //