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
Definition: IOobject.H:195
volFields.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::surfaceTensionModels::temperatureDependent::readDict
virtual bool readDict(const dictionary &dict)
Update surface tension coefficient from given dictionary.
Definition: temperatureDependentSurfaceTension.C:108
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::surfaceTensionModel
Abstract base-class for surface tension models which return the surface tension coefficient field.
Definition: surfaceTensionModel.H:55
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: propellerInfo.H:291
Foam::surfaceTensionModel::writeData
bool writeData(Ostream &os) const
Dummy write for regIOobject.
Definition: surfaceTensionModel.C:101
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
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:73
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:154
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:123
Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent
virtual ~temperatureDependent()
Destructor.
Definition: temperatureDependentSurfaceTension.C:66
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:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::surfaceTensionModels::temperatureDependent::writeData
virtual bool writeData(Ostream &os) const
Write in dictionary format.
Definition: temperatureDependentSurfaceTension.C:122
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
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::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:148
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::surfaceTensionModels::temperatureDependent::temperatureDependent
temperatureDependent(const dictionary &dict, const fvMesh &mesh)
Construct from dictionary and mesh.
Definition: temperatureDependentSurfaceTension.C:53