temperatureDependentSurfaceTension.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "volFields.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace surfaceTensionModels
38 {
39  defineTypeNameAndDebug(temperatureDependent, 0);
41  (
42  surfaceTensionModel,
43  temperatureDependent,
44  dictionary
45  );
46 }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const dictionary& dict,
55  const fvMesh& mesh
56 )
57 :
59  TName_(dict.getOrDefault<word>("T", "T")),
60  sigma_(Function1<scalar>::New("sigma", dict, &mesh))
61 {}
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
74 {
75  auto tsigma = tmp<volScalarField>::New
76  (
77  IOobject
78  (
79  "sigma",
80  mesh_.time().timeName(),
81  mesh_,
84  false
85  ),
86  mesh_,
87  dimSigma
88  );
89  auto& sigma = tsigma.ref();
90 
91  const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
92 
93  sigma.field() = sigma_->value(T.field());
94 
95  volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
96  const volScalarField::Boundary& TBf = T.boundaryField();
97 
98  forAll(sigmaBf, patchi)
99  {
100  sigmaBf[patchi] = sigma_->value(TBf[patchi]);
101  }
102 
103  return tsigma;
104 }
105 
106 
108 (
109  const dictionary& dict
110 )
111 {
112  const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict);
113 
114  TName_ = sigmaDict.getOrDefault<word>("T", "T");
115  sigma_ = Function1<scalar>::New("sigma", sigmaDict, &mesh_);
116 
117  return true;
118 }
119 
120 
122 (
123  Ostream& os
124 ) const
125 {
127  {
128  os << sigma_() << token::END_STATEMENT << nl;
129  return os.good();
130  }
131 
132  return false;
133 }
134 
135 
136 // ************************************************************************* //
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:191
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:165
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::surfaceTensionModels::temperatureDependent::readDict
virtual bool readDict(const dictionary &dict)
Definition: temperatureDependentSurfaceTension.C:101
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:57
Foam::surfaceTensionModel
Abstract base-class for surface tension models which return the surface tension coefficient field.
Definition: surfaceTensionModel.H:51
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: propellerInfo.H:287
Foam::surfaceTensionModel::writeData
bool writeData(Ostream &os) const
Definition: surfaceTensionModel.C:94
forAll
#define forAll(list, i)
Definition: stdFoam.H:349
Foam::surfaceTensionModel::sigmaDict
static const dictionary & sigmaDict(const dictionary &dict)
Definition: surfaceTensionModel.H:85
Foam::surfaceTensionModels::temperatureDependent::sigma
virtual tmp< volScalarField > sigma() const
Definition: temperatureDependentSurfaceTension.C:66
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:51
Foam::token::END_STATEMENT
@ END_STATEMENT
End entry [isseparator].
Definition: token.H:150
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent
virtual ~temperatureDependent()
Definition: temperatureDependentSurfaceTension.C:59
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
temperatureDependentSurfaceTension.H
Foam::surfaceTensionModels::defineTypeNameAndDebug
defineTypeNameAndDebug(constantSurfaceTensionCoefficient, 0)
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:81
Foam
Definition: atmBoundaryLayer.C:26
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Definition: DimensionedFieldReuseFunctions.H:100
Foam::GeometricField::Boundary
Definition: GeometricField.H:111
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::surfaceTensionModels::temperatureDependent::writeData
virtual bool writeData(Ostream &os) const
Definition: temperatureDependentSurfaceTension.C:115
Foam::tmp::New
static tmp< T > New(Args &&... args)
Foam::surfaceTensionModels::addToRunTimeSelectionTable
addToRunTimeSelectionTable(surfaceTensionModel, constantSurfaceTensionCoefficient, dictionary)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
sigma
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:141
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:49
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:184
Foam::surfaceTensionModels::temperatureDependent::temperatureDependent
temperatureDependent(const dictionary &dict, const fvMesh &mesh)
Definition: temperatureDependentSurfaceTension.C:46