dynamicContactAngle.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "dynamicContactAngle.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace contactAngleModels
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 :
45  theta0_(dict.lookup<scalar>("theta0", unitDegrees)),
46  uTheta_(dict.lookup<scalar>("uTheta", dimVelocity)),
47  thetaAdv_(dict.lookup<scalar>("thetaAdv", unitDegrees)),
48  thetaRec_(dict.lookup<scalar>("thetaRec", unitDegrees))
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
53 
55 {}
56 
57 
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 
62 (
63  const fvPatchVectorField& Up,
64  const vectorField& nHat
65 ) const
66 {
67  const vectorField nf(Up.patch().nf());
68 
69  // Calculated the component of the velocity parallel to the wall
70  vectorField U(Up.patchInternalField() - Up);
71  U -= (nf & U)*nf;
72 
73  // Find the direction of the interface parallel to the wall and normalise
74  vectorField n(nHat - (nf & nHat)*nf);
75  n /= (mag(n) + small);
76 
77  // Calculate the velocity coefficient
78  // from the component of U normal to the interface
79  const scalarField uCoeff(tanh((n & U)/uTheta_));
80 
81  return cos
82  (
83  theta0_
84  + (thetaRec_ - theta0_)*max(uCoeff, scalar(0))
85  - (thetaAdv_ - theta0_)*min(uCoeff, scalar(0))
86  );
87 }
88 
89 
91 {
92  writeEntry(os, "theta0", unitDegrees, theta0_);
93  writeEntry(os, "uTheta", dimVelocity, uTheta_);
94  writeEntry(os, "thetaAdv", unitDegrees, thetaAdv_);
95  writeEntry(os, "thetaRec", unitDegrees, thetaRec_);
96 }
97 
98 
99 // ************************************************************************* //
label n
Macros for easy insertion into run-time selection tables.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Abstract base-class for contact-angle models which return the cosine contact angle field.
Dynamic contact angle model.
virtual void write(Ostream &os) const
Write data in dictionary format.
virtual tmp< scalarField > cosTheta(const fvPatchVectorField &Up, const vectorField &nHat) const
Cosine of the contact angle.
dynamic(const dictionary &dict)
Construct from dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:170
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:356
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:130
A class for managing temporary objects.
Definition: tmp.H:55
U
Definition: pEqn.H:72
addToRunTimeSelectionTable(contactAngleModel, constant, dictionary)
defineTypeNameAndDebug(constant, 0)
Namespace for OpenFOAM.
dimensionedScalar tanh(const dimensionedScalar &ds)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimVelocity
dimensionedScalar cos(const dimensionedScalar &ds)
const unitConversion unitDegrees
dictionary dict