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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "volFields.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace surfaceTensionModels
37 {
38  defineTypeNameAndDebug(temperatureDependent, 0);
40  (
41  surfaceTensionModel,
42  temperatureDependent,
43  dictionary
44  );
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
52 (
53  const dictionary& dict,
54  const fvMesh& mesh
55 )
56 :
58  TName_(dict.lookupOrDefault<word>("T", "T")),
59  sigma_(Function1<scalar>::New("sigma", dict))
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
64 
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
70 
73 {
74  auto tsigma = tmp<volScalarField>::New
75  (
76  IOobject
77  (
78  "sigma",
79  mesh_.time().timeName(),
80  mesh_,
83  false
84  ),
85  mesh_,
86  dimSigma
87  );
88  auto& sigma = tsigma.ref();
89 
90  const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
91 
92  sigma.field() = sigma_->value(T.field());
93 
94  volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
95  const volScalarField::Boundary& TBf = T.boundaryField();
96 
97  forAll(sigmaBf, patchi)
98  {
99  sigmaBf[patchi] = sigma_->value(TBf[patchi]);
100  }
101 
102  return tsigma;
103 }
104 
105 
107 (
108  const dictionary& dict
109 )
110 {
111  const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict);
112 
113  TName_ = sigmaDict.lookupOrDefault<word>("T", "T");
114  sigma_ = Function1<scalar>::New("sigma", sigmaDict);
115 
116  return true;
117 }
118 
119 
121 (
122  Ostream& os
123 ) const
124 {
126  {
127  os << sigma_() << token::END_STATEMENT << nl;
128  return os.good();
129  }
130 
131  return false;
132 }
133 
134 
135 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfaceTensionModels::temperatureDependent::readDict
virtual bool readDict(const dictionary &dict)
Update surface tension coefficient from given dictionary.
Definition: temperatureDependentSurfaceTension.C:107
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::surfaceTensionModel
Abstract base-class for surface tension models which return the surface tension coefficient field.
Definition: surfaceTensionModel.H:54
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.H:1241
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:56
Foam::surfaceTensionModel::writeData
bool writeData(Ostream &os) const
Dummy write for regIOobject.
Definition: surfaceTensionModel.C:75
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::surfaceTensionModel::sigmaDict
static const dictionary & sigmaDict(const dictionary &dict)
Definition: surfaceTensionModel.H:89
Foam::surfaceTensionModels::temperatureDependent::sigma
virtual tmp< volScalarField > sigma() const
Surface tension coefficient.
Definition: temperatureDependentSurfaceTension.C:72
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::token::END_STATEMENT
End entry [isseparator].
Definition: token.H:116
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:121
Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent
virtual ~temperatureDependent()
Destructor.
Definition: temperatureDependentSurfaceTension.C:65
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:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::nl
constexpr char nl
Definition: Ostream.H:372
Foam::surfaceTensionModels::temperatureDependent::writeData
virtual bool writeData(Ostream &os) const
Write in dictionary format.
Definition: temperatureDependentSurfaceTension.C:121
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::Function1::New
static autoPtr< Function1< Type > > New(const word &entryName, const dictionary &dict, const word &redirectType=word::null)
Selector.
Definition: Function1New.C:35
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:56
sigma
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Foam::IOstream::good
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:216
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::surfaceTensionModels::temperatureDependent::temperatureDependent
temperatureDependent(const dictionary &dict, const fvMesh &mesh)
Construct from dictionary and mesh.
Definition: temperatureDependentSurfaceTension.C:52