constantSurfaceTension.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 
26 #include "constantSurfaceTension.H"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace surfaceTensionModels
35 {
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const dictionary& dict,
47  const fvMesh& mesh
48 )
49 :
50  surfaceTensionModel(mesh),
51  sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict)
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
56 
58 {}
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
65 {
66  return tmp<volScalarField>
67  (
68  new volScalarField
69  (
70  IOobject
71  (
72  "sigma",
73  mesh_.time().timeName(),
74  mesh_,
77  false
78  ),
79  mesh_,
80  sigma_
81  )
82  );
83 }
84 
85 
87 {
88  // Handle sub-dictionary format as a special case
89  if (dict.isDict("sigma"))
90  {
91  dict.subDict("sigma").lookup("sigma") >> sigma_;
92  }
93  else
94  {
95  dict.lookup("sigma") >> sigma_;
96  }
97 
98  return true;
99 }
100 
101 
103 {
105  {
106  os << sigma_ << token::END_STATEMENT << nl;
107  return os.good();
108  }
109  else
110  {
111  return false;
112  }
113 }
114 
115 
116 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool writeData(Ostream &os) const
Write in dictionary format.
constant(const dictionary &dict, const fvMesh &mesh)
Construct from dictionary and mesh.
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
Macros for easy insertion into run-time selection tables.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:646
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:692
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Dimension set for the base types.
Definition: dimensionSet.H:120
Uniform constant surface tension model.
virtual bool readDict(const dictionary &dict)
Update surface tension coefficient from given dictionary.
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
virtual tmp< volScalarField > sigma() const
Surface tension coefficient.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
defineTypeNameAndDebug(constant, 0)
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
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576