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 | Copyright (C) 2017 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace surfaceTensionModels
35 {
36  defineTypeNameAndDebug(temperatureDependent, 0);
38  (
39  surfaceTensionModel,
40  temperatureDependent,
41  dictionary
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
50 (
51  const dictionary& dict,
52  const fvMesh& mesh
53 )
54 :
55  surfaceTensionModel(mesh),
56  TName_(dict.lookupOrDefault<word>("T", "T")),
57  sigma_(Function1<scalar>::New("sigma", dict))
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
71 {
72  tmp<volScalarField> tsigma
73  (
74  new volScalarField
75  (
76  IOobject
77  (
78  "sigma",
79  mesh_.time().timeName(),
80  mesh_,
83  false
84  ),
85  mesh_,
86  dimSigma
87  )
88  );
89  volScalarField& 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.lookupOrDefault<word>("T", "T");
115  sigma_ = Function1<scalar>::New("sigma", sigmaDict);
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  else
132  {
133  return false;
134  }
135 }
136 
137 
138 // ************************************************************************* //
static const dictionary & sigmaDict(const dictionary &dict)
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:53
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
Macros for easy insertion into run-time selection tables.
temperatureDependent(const dictionary &dict, const fvMesh &mesh)
Construct from dictionary and mesh.
virtual bool writeData(Ostream &os) const
Write in dictionary format.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool writeData(Ostream &os) const =0
Write in dictionary format.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
const Field< Type > & field() const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label patchi
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
virtual bool readDict(const dictionary &dict)
Update surface tension coefficient from given dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
defineTypeNameAndDebug(constant, 0)
virtual tmp< volScalarField > sigma() const
Surface tension coefficient.
addToRunTimeSelectionTable(surfaceTensionModel, constant, dictionary)
A class for managing temporary objects.
Definition: PtrList.H:53
Abstract base-class for surface tension models which return the surface tension coefficient field...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict)
Selector.
Definition: Function1New.C:32
Namespace for OpenFOAM.