diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C index cfad51748287f85dc602e2feaa41ed4aff79ff87..6274ad1c31a04a30f57b09db22f68b24a686039d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.C @@ -360,4 +360,17 @@ Foam::tmp<Foam::scalarField> 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 82b0ac90a2d83e2504f90e755303f4ee35ac5da3..aefdbdee4fbc2f06a74ce37d95a8b9fbb0877bc5 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 c75f128cec65031599427722811dc938a460f4a7..a0492f66ee1684bc2591ff715e76110064b8cb71 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<< <Type> ( Ostream& os, - const Function1<Type>& de + const Function1<Type>& func ); //- Write in dictionary format diff --git a/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C b/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/immiscibleIncompressibleTwoPhaseMixture.C index 532a9af34fbaf88c2996571a95108c5995257e7d..22e835d8b8cb2ae0ed3bcf297fceb45e25a8304c 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 ded416b068f47652b39d7534b9ae4a5687f0fe88..8129ea543e2c0e27e8c7e1e4e1f265ca8dc32f7c 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 35c9a52b3d370a8128f489a5e563b2552ed89c70..ad518b1abac0f50882d5f9dd2529391efa4ecb5f 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 98e2c37087c87fb34664984398e96327ba97b86d..5d2008130b2503ca61c5f592495e69dd054aea6b 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::volScalarField> +Foam::interfaceProperties::sigmaK() const +{ + return sigmaPtr_->sigma()*K_; +} + + Foam::tmp<Foam::surfaceScalarField> 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 7956746c2ba060966f81ef9bf7554b02411f37c6..81c08948cadd7d6a6db00ad709a74c84ba19490d 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<surfaceTensionModel> sigmaPtr_; //- Stabilisation for normalisation of the interface normal const dimensionedScalar deltaN_; @@ -127,10 +128,7 @@ public: return nHatf_; } - tmp<volScalarField> sigmaK() const - { - return sigma_*K_; - } + tmp<volScalarField> sigmaK() const; tmp<surfaceScalarField> 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 0000000000000000000000000000000000000000..bbe92e5196e95f23504add3f833eca19e27d1691 --- /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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#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::volScalarField> +Foam::surfaceTensionModels::constant::sigma() const +{ + return tmp<volScalarField> + ( + 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 0000000000000000000000000000000000000000..feef36300c256e2c0c272799a793ff04c7038774 --- /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 <http://www.gnu.org/licenses/>. + +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<volScalarField> 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 0000000000000000000000000000000000000000..a1f6e9f86dd95102e25a737c6a34cc8d3b5be391 --- /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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "surfaceTensionModel.H" +#include "constantSurfaceTension.H" + +// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::surfaceTensionModel> 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<surfaceTensionModel> + ( + 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 0000000000000000000000000000000000000000..b0d1cbf2d92ab20c424eb239bfa2379be8fc8821 --- /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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#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 0000000000000000000000000000000000000000..930a8444f1d7e572e62070b097036efdad261398 --- /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 <http://www.gnu.org/licenses/>. + +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 <surface tension model type>; + <coefficient name> <coefficient value>; + . + . + . + } + \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<surfaceTensionModel> New + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + // Member Functions + + //- Surface tension coefficient + virtual tmp<volScalarField> 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 0000000000000000000000000000000000000000..c56ac7f4a8bde8332bd12b03f625c5a1c8414562 --- /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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#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<word>("T", "T")), + sigma_(Function1<scalar>::New("sigma", dict)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> +Foam::surfaceTensionModels::temperatureDependent::sigma() const +{ + tmp<volScalarField> 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<volScalarField>(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<word>("T", "T"); + sigma_ = Function1<scalar>::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 0000000000000000000000000000000000000000..c0bded7c311205f814f58d69e0d7f2fce2645be2 --- /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 <http://www.gnu.org/licenses/>. + +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<Function1<scalar>> 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<volScalarField> 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 a3068b76e4b923b414adeb5fc144684b6bba414a..ac5ede7727494b603774bf4bc89be98daea6715c 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 8506bd51f34bec094e941bb16d4344a21b3eeda8..39d2517cd86d45a05d71b0355cdf13421fc97525 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 8506bd51f34bec094e941bb16d4344a21b3eeda8..39d2517cd86d45a05d71b0355cdf13421fc97525 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 577be61a90eaf2a5ace9736704b629691989518a..d5c08cdf56224a6336fa95b22d12dffae5379ecf 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; // ************************************************************************* //