From dfd611aeac7cf079cc46bc9e1c1656221dd4d425 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 31 Mar 2017 14:32:38 +0100 Subject: [PATCH] surfaceTensionModels: New class hierarchy for run-time selectable surface tension models These models have been particularly designed for use in the VoF solvers, both incompressible and compressible. Currently constant and temperature dependent surface tension models are provided but it easy to write models in which the surface tension is evaluated from any fields held by the mesh database. --- .../twoPhaseMixtureThermo.C | 13 ++ .../twoPhaseMixtureThermo.H | 6 + .../functions/Function1/Function1/Function1.H | 2 +- .../immiscibleIncompressibleTwoPhaseMixture.C | 12 +- .../immiscibleIncompressibleTwoPhaseMixture.H | 9 +- .../interfaceProperties/Make/files | 5 + .../interfaceProperties/interfaceProperties.C | 12 +- .../interfaceProperties/interfaceProperties.H | 8 +- .../constant/constantSurfaceTension.C | 116 +++++++++++++ .../constant/constantSurfaceTension.H | 117 +++++++++++++ .../newSurfaceTensionModel.C | 71 ++++++++ .../surfaceTensionModel/surfaceTensionModel.C | 73 ++++++++ .../surfaceTensionModel/surfaceTensionModel.H | 161 ++++++++++++++++++ .../temperatureDependentSurfaceTension.C | 138 +++++++++++++++ .../temperatureDependentSurfaceTension.H | 132 ++++++++++++++ ...ndentAlphaContactAngleFvPatchScalarField.H | 9 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../damBreak/constant/transportProperties | 11 +- 19 files changed, 875 insertions(+), 28 deletions(-) create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C create mode 100644 src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index cfad517482..6274ad1c31 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -360,4 +360,17 @@ Foam::tmp Foam::twoPhaseMixtureThermo::alphaEff } +bool Foam::twoPhaseMixtureThermo::read() +{ + if (psiThermo::read()) + { + return interfaceProperties::read(); + } + else + { + return false; + } +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index 82b0ac90a2..aefdbdee4f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -285,6 +285,12 @@ public: const scalarField& alphat, const label patchi ) const; + + + // IO + + //- Read base transportProperties dictionary + virtual bool read(); }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H index c75f128cec..a0492f66ee 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H @@ -162,7 +162,7 @@ public: friend Ostream& operator<< ( Ostream& os, - const Function1& de + const Function1& func ); //- Write in dictionary format diff --git a/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C b/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C index 532a9af34f..22e835d8b8 100644 --- a/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C +++ b/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,4 +40,14 @@ immiscibleIncompressibleTwoPhaseMixture {} +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::immiscibleIncompressibleTwoPhaseMixture::read() +{ + return + incompressibleTwoPhaseMixture::read() + && interfaceProperties::read(); +} + + // ************************************************************************* // diff --git a/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.H b/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.H index ded416b068..8129ea543e 100644 --- a/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.H +++ b/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,12 +80,7 @@ public: } //- Read base transportProperties dictionary - virtual bool read() - { - return - incompressibleTwoPhaseMixture::read() - && interfaceProperties::read(); - } + virtual bool read(); }; diff --git a/src/transportModels/interfaceProperties/Make/files b/src/transportModels/interfaceProperties/Make/files index 35c9a52b3d..ad518b1aba 100644 --- a/src/transportModels/interfaceProperties/Make/files +++ b/src/transportModels/interfaceProperties/Make/files @@ -1,4 +1,9 @@ interfaceProperties.C interfaceCompression/interfaceCompression.C +surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C +surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C +surfaceTensionModels/constant/constantSurfaceTension.C +surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C + LIB = $(FOAM_LIBBIN)/libinterfaceProperties diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index 98e2c37087..5d2008130b 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -167,7 +167,8 @@ Foam::interfaceProperties::interfaceProperties alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha") ) ), - sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict), + + sigmaPtr_(surfaceTensionModel::New(dict, alpha1.mesh())), deltaN_ ( @@ -208,6 +209,13 @@ Foam::interfaceProperties::interfaceProperties // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +Foam::tmp +Foam::interfaceProperties::sigmaK() const +{ + return sigmaPtr_->sigma()*K_; +} + + Foam::tmp Foam::interfaceProperties::surfaceTensionForce() const { @@ -231,7 +239,7 @@ void Foam::interfaceProperties::correct() bool Foam::interfaceProperties::read() { alpha1_.mesh().solverDict(alpha1_.name()).lookup("cAlpha") >> cAlpha_; - transportPropertiesDict_.lookup("sigma") >> sigma_; + sigmaPtr_->read(transportPropertiesDict_); return true; } diff --git a/src/transportModels/interfaceProperties/interfaceProperties.H b/src/transportModels/interfaceProperties/interfaceProperties.H index 7956746c2b..81c08948ca 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.H +++ b/src/transportModels/interfaceProperties/interfaceProperties.H @@ -40,6 +40,7 @@ SourceFiles #define interfaceProperties_H #include "IOdictionary.H" +#include "surfaceTensionModel.H" #include "volFields.H" #include "surfaceFields.H" @@ -63,7 +64,7 @@ class interfaceProperties scalar cAlpha_; //- Surface tension - dimensionedScalar sigma_; + autoPtr sigmaPtr_; //- Stabilisation for normalisation of the interface normal const dimensionedScalar deltaN_; @@ -127,10 +128,7 @@ public: return nHatf_; } - tmp sigmaK() const - { - return sigma_*K_; - } + tmp sigmaK() const; tmp surfaceTensionForce() const; diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C new file mode 100644 index 0000000000..bbe92e5196 --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.C @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "constantSurfaceTension.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceTensionModels +{ + defineTypeNameAndDebug(constant, 0); + addToRunTimeSelectionTable(surfaceTensionModel, constant, dictionary); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::constant::constant +( + const dictionary& dict, + const fvMesh& mesh +) +: + surfaceTensionModel(mesh), + sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::constant::~constant() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::surfaceTensionModels::constant::sigma() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "sigma", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + sigma_ + ) + ); +} + + +bool Foam::surfaceTensionModels::constant::read(const dictionary& dict) +{ + // Handle sub-dictionary format as a special case + if (dict.isDict("sigma")) + { + dict.subDict("sigma").lookup("sigma") >> sigma_; + } + else + { + dict.lookup("sigma") >> sigma_; + } + + return true; +} + + +bool Foam::surfaceTensionModels::constant::writeData(Ostream& os) const +{ + if (surfaceTensionModel::writeData(os)) + { + os << sigma_ << token::END_STATEMENT << nl; + return os.good(); + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H new file mode 100644 index 0000000000..feef36300c --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/constant/constantSurfaceTension.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::constant + +Description + Uniform constant surface tension model. + +Usage + Example of the surface tension specification: + \verbatim + sigma + { + type constant; + sigma 0.07; + } + \endverbatim + +See also + Foam::surfaceTensionModel + +SourceFiles + constantSurfaceTension.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantSurfaceTension_H +#define constantSurfaceTension_H + +#include "surfaceTensionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace surfaceTensionModels +{ + +/*---------------------------------------------------------------------------*\ + Class constant Declaration +\*---------------------------------------------------------------------------*/ + +class constant +: + public surfaceTensionModel +{ + // Private data + + //- Surface tension coefficient + dimensionedScalar sigma_; + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from dictionary and mesh + constant + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~constant(); + + + // 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/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C new file mode 100644 index 0000000000..a1f6e9f86d --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "surfaceTensionModel.H" +#include "constantSurfaceTension.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::surfaceTensionModel::New +( + const dictionary& dict, + const fvMesh& mesh +) +{ + if (dict.isDict("sigma")) + { + const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict); + + word surfaceTensionModelType(sigmaDict.lookup("type")); + + Info<< "Selecting surfaceTensionModel " + << surfaceTensionModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(surfaceTensionModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown surfaceTensionModelType type " + << surfaceTensionModelType << endl << endl + << "Valid surfaceTensionModel types are : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return cstrIter()(sigmaDict, mesh); + } + else + { + return autoPtr + ( + new surfaceTensionModels::constant(dict, mesh) + ); + } +} + + +// ************************************************************************* // diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C new file mode 100644 index 0000000000..b0d1cbf2d9 --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "surfaceTensionModel.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(surfaceTensionModel, 0); + defineRunTimeSelectionTable(surfaceTensionModel, dictionary); +} + +const Foam::dimensionSet Foam::surfaceTensionModel::dimSigma(1, 0, -2, 0, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceTensionModel::surfaceTensionModel(const fvMesh& mesh) +: + regIOobject + ( + IOobject + ( + typeName, mesh.name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModel::~surfaceTensionModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::surfaceTensionModel::writeData(Ostream& os) const +{ + return os.good(); +} + + +// ************************************************************************* // diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H new file mode 100644 index 0000000000..930a8444f1 --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::surfaceTensionModel + +Description + Abstract base-class for surface tension models which return the surface + tension coefficient field. + +Usage + Example of the surface tension specification: + \verbatim + sigma + { + type ; + ; + . + . + . + } + \endverbatim + For simplicity and backward-compatibility the constant value format is + also supported, e.g. + \verbatim + sigma 0.07; + \endverbatim + +SourceFiles + surfaceTensionModel.C + newSurfaceTensionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef surfaceTensionModel_H +#define surfaceTensionModel_H + +#include "regIOobject.H" +#include "dimensionedTypes.H" +#include "volFieldsFwd.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class surfaceTensionModel Declaration +\*---------------------------------------------------------------------------*/ + +class surfaceTensionModel +: + public regIOobject +{ +protected: + + // Protected member data + + //- Reference to mesh + const fvMesh& mesh_; + + + // Protected member functions + + static const dictionary& sigmaDict(const dictionary& dict) + { + return dict.subDict("sigma"); + } + + +public: + + //- Runtime type information + TypeName("surfaceTensionModel"); + + + // Declare runtime construction + + declareRunTimeSelectionTable + ( + autoPtr, + surfaceTensionModel, + dictionary, + ( + const dictionary& dict, + const fvMesh& mesh + ), + (dict, mesh) + ); + + + // Static data members + + //- Surface tension coefficient dimensions + static const dimensionSet dimSigma; + + + // Constructors + + // Construct from mesh + surfaceTensionModel(const fvMesh& mesh); + + + //- Destructor + virtual ~surfaceTensionModel(); + + + // Selectors + + static autoPtr New + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + // Member Functions + + //- Surface tension coefficient + virtual tmp sigma() const = 0; + + //- Update surface tension coefficient from given dictionary + virtual bool read(const dictionary& dict) = 0; + + //- Write in dictionary format + virtual bool writeData(Ostream& os) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C new file mode 100644 index 0000000000..c56ac7f4a8 --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "temperatureDependentSurfaceTension.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceTensionModels +{ + defineTypeNameAndDebug(temperatureDependent, 0); + addToRunTimeSelectionTable + ( + surfaceTensionModel, + temperatureDependent, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::temperatureDependent::temperatureDependent +( + const dictionary& dict, + const fvMesh& mesh +) +: + surfaceTensionModel(mesh), + TName_(dict.lookupOrDefault("T", "T")), + sigma_(Function1::New("sigma", dict)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::surfaceTensionModels::temperatureDependent::sigma() const +{ + 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 = mesh_.lookupObject(TName_); + + sigma.field() = sigma_->value(T.field()); + + volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); + const volScalarField::Boundary& TBf = T.boundaryField(); + + forAll(sigmaBf, patchi) + { + sigmaBf[patchi] = sigma_->value(TBf[patchi]); + } + + return tsigma; +} + + +bool Foam::surfaceTensionModels::temperatureDependent::read +( + const dictionary& dict +) +{ + const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict); + + TName_ = sigmaDict.lookupOrDefault("T", "T"); + sigma_ = Function1::New("sigma", sigmaDict); + + return true; +} + + +bool Foam::surfaceTensionModels::temperatureDependent::writeData +( + Ostream& os +) const +{ + if (surfaceTensionModel::writeData(os)) + { + os << sigma_() << token::END_STATEMENT << nl; + return os.good(); + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H new file mode 100644 index 0000000000..c0bded7c31 --- /dev/null +++ b/src/transportModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::temperatureDependent + +Description + Temperature-dependent surface tension model. + + The surface tension is evaluated from the specified Foam::Function1 for the + temperature field looked-up from the mesh database the name of which + may optionally be provided. + +Usage + \table + Property | Description | Required | Default value + T | Temperature field name | no | T + sigma | Surface tension function | yes | + \endtable + + Example of the surface tension specification: + \verbatim + sigma + { + type temperatureDependent; + sigma constant 0.07; + } + \endverbatim + +See also + Foam::surfaceTensionModel + Foam::Function1 + +SourceFiles + temperatureDependentSurfaceTension.C + +\*---------------------------------------------------------------------------*/ + +#ifndef temperatureDependentSurfaceTension_H +#define temperatureDependentSurfaceTension_H + +#include "surfaceTensionModel.H" +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace surfaceTensionModels +{ + +/*---------------------------------------------------------------------------*\ + Class temperatureDependent Declaration +\*---------------------------------------------------------------------------*/ + +class temperatureDependent +: + public surfaceTensionModel +{ + // Private data + + //- Name of temperature field, default = "T" + word TName_; + + //- Surface-tension function + autoPtr> sigma_; + + +public: + + //- Runtime type information + TypeName("temperatureDependent"); + + + // Constructors + + //- Construct from dictionary and mesh + temperatureDependent + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~temperatureDependent(); + + + // 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/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H b/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H index a3068b76e4..ac5ede7727 100644 --- a/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H +++ b/src/transportModels/twoPhaseProperties/alphaContactAngle/temperatureDependentAlphaContactAngle/temperatureDependentAlphaContactAngleFvPatchScalarField.H @@ -25,13 +25,17 @@ Class Foam::temperatureDependentAlphaContactAngleFvPatchScalarField Description - Temperature-dependent constant alphaContactAngle scalar boundary condition. + Temperature-dependent alphaContactAngle scalar boundary condition. + + The contact angle is evaluated from the specified Foam::Function1 for the + temperature field looked-up from the mesh database the name of which + may optionally be provided. Usage \table Property | Description | Required | Default value T | Temperature field name | no | T - theta0 | Contact angle data | yes | + theta0 | Contact angle function | yes | \endtable Example of the boundary condition specification: @@ -46,6 +50,7 @@ Usage See also Foam::alphaContactAngleFvPatchScalarField Foam::constantAlphaContactAngleFvPatchScalarField + Foam::Function1 SourceFiles temperatureDependentAlphaContactAngleFvPatchScalarField.C diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties index 8506bd51f3..39d2517cd8 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge2D/constant/thermophysicalProperties @@ -17,8 +17,8 @@ FoamFile phases (water air); -pMin [1 -1 -2 0 0 0 0] 10000; +pMin 10000; -sigma [1 0 -2 0 0 0 0] 0.07; +sigma 0.07; // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties index 8506bd51f3..39d2517cd8 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties +++ b/tutorials/multiphase/compressibleInterFoam/laminar/depthCharge3D/constant/thermophysicalProperties @@ -17,8 +17,8 @@ FoamFile phases (water air); -pMin [1 -1 -2 0 0 0 0] 10000; +pMin 10000; -sigma [1 0 -2 0 0 0 0] 0.07; +sigma 0.07; // ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/constant/transportProperties b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/constant/transportProperties index 577be61a90..d5c08cdf56 100644 --- a/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/constant/transportProperties +++ b/tutorials/multiphase/interFoam/laminar/damBreak/damBreak/constant/transportProperties @@ -20,18 +20,17 @@ phases (water air); water { transportModel Newtonian; - nu [0 2 -1 0 0 0 0] 1e-06; - rho [1 -3 0 0 0 0 0] 1000; + nu 1e-06; + rho 1000; } air { transportModel Newtonian; - nu [0 2 -1 0 0 0 0] 1.48e-05; - rho [1 -3 0 0 0 0 0] 1; + nu 1.48e-05; + rho 1; } -sigma [1 0 -2 0 0 0 0] 0.07; - +sigma 0.07; // ************************************************************************* //