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 #include "Function1.H"
31 #include "distributionModel.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace regionModels
38 {
39 namespace areaSurfaceFilmModels
40 {
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
44 defineTypeNameAndDebug(dynamicContactAngleForce, 0);
46 (
47  force,
48  dynamicContactAngleForce,
50 );
51 
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
55 dynamicContactAngleForce::dynamicContactAngleForce
56 (
57  liquidFilmBase& film,
58  const dictionary& dict
59 )
60 :
61  contactAngleForce(typeName, film, dict),
62  U_vs_thetaPtr_
63  (
64  Function1<scalar>::NewIfPresent
65  (
66  "Utheta",
67  coeffDict_,
68  word::null,
69  &film.primaryMesh()
70  )
71  ),
72  T_vs_thetaPtr_
73  (
74  Function1<scalar>::NewIfPresent
75  (
76  "Ttheta",
77  coeffDict_,
78  word::null,
79  &film.primaryMesh()
80  )
81  ),
82  rndGen_(label(0)),
83  distribution_
84  (
86  (
87  coeffDict_.subDict("distribution"),
88  rndGen_
89  )
90  )
91 {
92  if (U_vs_thetaPtr_ && T_vs_thetaPtr_)
93  {
95  << "Entries Utheta and Ttheta could not be used together"
97  }
98 }
99 
100 
101 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
102 
104 {
105  auto ttheta = tmp<areaScalarField>::New
106  (
107  IOobject
108  (
109  IOobject::scopedName(typeName, "theta"),
110  film().regionMesh().time().timeName(),
111  film().regionMesh().thisDb(),
115  ),
116  film().regionMesh(),
118  );
119  areaScalarField& theta = ttheta.ref();
120  scalarField& thetai = theta.ref();
121 
122 
123  if (U_vs_thetaPtr_)
124  {
125  // Initialize with the function of film speed
126  const areaVectorField& U = film().Uf();
127 
128  thetai = U_vs_thetaPtr_->value(mag(U()));
129  }
130 
131  if (T_vs_thetaPtr_)
132  {
133  // Initialize with the function of film temperature
134  const areaScalarField& T = film().Tf();
135 
136  thetai = T_vs_thetaPtr_->value(T());
137  }
138 
139  // Add the stochastic perturbation
140  forAll(thetai, facei)
141  {
142  thetai[facei] += distribution_->sample();
143  }
144 
145  return ttheta;
146 }
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace surfaceFilmModels
152 } // End namespace regionModels
153 } // End namespace Foam
154 
155 // ************************************************************************* //
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
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:637
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.
const areaVectorField & Uf() const noexcept
Access const reference Uf.
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:180
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.