Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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 "Function1.H"
30#include "distributionModel.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35namespace Foam
36{
37namespace regionModels
40{
41
42// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43
46(
47 force,
50);
51
52
53// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54
56(
58 const dictionary& dict
59)
60:
61 contactAngleForce(typeName, film, dict),
62 thetaPtr_(nullptr),
63 U_vs_thetaPtr_
64 (
65 Function1<scalar>::NewIfPresent
66 (
67 "Utheta",
69 word::null,
70 &film.primaryMesh()
71 )
72 ),
73 T_vs_thetaPtr_
74 (
75 Function1<scalar>::NewIfPresent
76 (
77 "Ttheta",
79 word::null,
80 &film.primaryMesh()
81 )
82 ),
83 rndGen_(label(0)),
84 distributionPtr_(nullptr)
85{
86 if (U_vs_thetaPtr_ && T_vs_thetaPtr_)
87 {
89 << "Only one of Utheta or Ttheta should be provided; "
90 << "both inputs cannot be used together."
92 }
93
94
95 thetaPtr_.emplace
96 (
98 (
104 ),
107 );
108
109
110 if (coeffDict_.findEntry("distribution"))
111 {
112 distributionPtr_ = distributionModel::New
113 (
114 coeffDict_.subDict("distribution"),
115 rndGen_
116 );
117 }
118}
119
120
121// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
124{} // distributionModel was forward declared
125
126
127// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
128
130{
131 areaScalarField& theta = thetaPtr_.ref();
132 scalarField& thetai = theta.ref();
133
134 if (U_vs_thetaPtr_)
135 {
136 // Initialize with the function of film speed
137 const areaVectorField& U = film().Uf();
138
139 thetai = U_vs_thetaPtr_->value(mag(U()));
140 }
141
142 if (T_vs_thetaPtr_)
143 {
144 // Initialize with the function of film temperature
145 const areaScalarField& T = film().Tf();
146
147 thetai = T_vs_thetaPtr_->value(T());
148 }
149
150 if (distributionPtr_)
151 {
152 // Add the stochastic perturbation
153 forAll(thetai, facei)
154 {
155 thetai[facei] += distributionPtr_->sample();
156 }
157 }
158
159 return thetaPtr_();
160}
161
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165} // End namespace surfaceFilmModels
166} // End namespace regionModels
167} // End namespace Foam
168
169// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition Function1.H:92
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Definition IOobjectI.H:50
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition Time.C:714
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
Definition dictionaryI.H:84
virtual const objectRegistry & thisDb() const
Reference to the mesh database.
Definition faMesh.H:1209
const Time & time() const
Return reference to time.
Definition faMesh.C:1028
Film-speed or film-temperature dependent contact-angle force with a stochastic perturbation.
dynamicContactAngleForce(liquidFilmBase &film, const dictionary &dict)
Construct from surface film model and dictionary.
virtual tmp< areaScalarField > theta() const
Return the contact angle field.
const liquidFilmBase & film() const
Return const access to the film surface film model.
Base class for film (stress-based) force models.
Definition force.H:55
virtual const areaScalarField & Tf() const =0
Access const reference Tf.
const areaVectorField & Uf() const noexcept
Access const reference Uf.
const faMesh & regionMesh() const
Return the region mesh database.
const dictionary coeffDict_
Coefficients dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
const volScalarField & T
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition error.H:629
Namespace for OpenFOAM.
const dimensionSet dimless
Dimensionless.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
GeometricField< vector, faPatchField, areaMesh > areaVectorField
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
errorManip< error > abort(error &err)
Definition errorManip.H:139
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299