dynamicContactAngleForce.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) 2020-2023 OpenCFD Ltd.
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 
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace regionModels
36 {
37 namespace areaSurfaceFilmModels
38 {
39 
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 
42 defineTypeNameAndDebug(dynamicContactAngleForce, 0);
44 (
45  force,
46  dynamicContactAngleForce,
48 );
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 dynamicContactAngleForce::dynamicContactAngleForce
54 (
55  liquidFilmBase& film,
56  const dictionary& dict
57 )
58 :
59  contactAngleForce(typeName, film, dict),
60  U_vs_thetaPtr_
61  (
62  Function1<scalar>::NewIfPresent
63  (
64  "Utheta",
65  coeffDict_,
66  word::null,
67  &film.primaryMesh()
68  )
69  ),
70  T_vs_thetaPtr_
71  (
72  Function1<scalar>::NewIfPresent
73  (
74  "Ttheta",
75  coeffDict_,
76  word::null,
77  &film.primaryMesh()
78  )
79  ),
80  rndGen_(label(0)),
81  distribution_
82  (
84  (
85  coeffDict_.subDict("distribution"),
86  rndGen_
87  )
88  )
89 {
90  if (U_vs_thetaPtr_ && T_vs_thetaPtr_)
91  {
93  << "Entries Utheta and Ttheta could not be used together"
95  }
96 }
97 
98 
99 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
100 
102 {
103  auto ttheta = tmp<areaScalarField>::New
104  (
105  IOobject
106  (
107  IOobject::scopedName(typeName, "theta"),
108  film().regionMesh().time().timeName(),
109  film().regionMesh().thisDb(),
113  ),
114  film().regionMesh(),
116  );
117  areaScalarField& theta = ttheta.ref();
118  scalarField& thetai = theta.ref();
119 
120 
121  if (U_vs_thetaPtr_)
122  {
123  // Initialize with the function of film speed
124  const areaVectorField& U = film().Uf();
125 
126  thetai = U_vs_thetaPtr_->value(mag(U()));
127  }
128 
129  if (T_vs_thetaPtr_)
130  {
131  // Initialize with the function of film temperature
132  const areaScalarField& T = film().Tf();
133 
134  thetai = T_vs_thetaPtr_->value(T());
135  }
136 
137  // Add the stochastic perturbation
138  forAll(thetai, facei)
139  {
140  thetai[facei] += distribution_->sample();
141  }
142 
143  return ttheta;
144 }
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace surfaceFilmModels
150 } // End namespace regionModels
151 } // End namespace Foam
152 
153 // ************************************************************************* //
Base-class for film contact angle force models.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
dictionary dict
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
defineTypeNameAndDebug(kinematicThinFilm, 0)
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
word timeName
Definition: getTimeIndex.H:3
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition: IOobjectI.H:40
addToRunTimeSelectionTable(liquidFilmBase, kinematicThinFilm, dictionary)
A class for handling words, derived from Foam::string.
Definition: word.H:63
const areaVectorField & Uf() const
Access const reference Uf.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
virtual tmp< areaScalarField > theta() const
Return the contact angle field.
errorManip< error > abort(error &err)
Definition: errorManip.H:139
virtual const areaScalarField & Tf() const =0
Access const reference Tf.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
U
Definition: pEqn.H:72
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:627
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Nothing to be read.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Do not request registration (bool: false)
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
const liquidFilmBase & film() const
Return const access to the film surface film model.