dynamicAlphaContactAngleFvPatchScalarField.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) 2011-2013 OpenFOAM Foundation
9  Copyright (C) 2019 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 
32 #include "volMesh.H"
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
38 (
39  const fvPatch& p,
41 )
42 :
43  parent_bctype(p, iF),
44  theta0_(0.0),
45  uTheta_(0.0),
46  thetaA_(0.0),
47  thetaR_(0.0)
48 {}
49 
50 
53 (
54  const this_bctype& gcpsf,
55  const fvPatch& p,
57  const fvPatchFieldMapper& mapper
58 )
59 :
60  parent_bctype(gcpsf, p, iF, mapper),
61  theta0_(gcpsf.theta0_),
62  uTheta_(gcpsf.uTheta_),
63  thetaA_(gcpsf.thetaA_),
64  thetaR_(gcpsf.thetaR_)
65 {}
66 
67 
70 (
71  const fvPatch& p,
73  const dictionary& dict
74 )
75 :
76  parent_bctype(p, iF, dict),
77  theta0_(dict.get<scalar>("theta0")),
78  uTheta_(dict.get<scalar>("uTheta")),
79  thetaA_(dict.get<scalar>("thetaA")),
80  thetaR_(dict.get<scalar>("thetaR"))
81 {
82  evaluate();
83 }
84 
85 
88 (
89  const this_bctype& gcpsf,
91 )
92 :
93  parent_bctype(gcpsf, iF),
94  theta0_(gcpsf.theta0_),
95  uTheta_(gcpsf.uTheta_),
96  thetaA_(gcpsf.thetaA_),
97  thetaR_(gcpsf.thetaR_)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
105 (
106  const fvPatchVectorField& Up,
107  const fvsPatchVectorField& nHat
108 ) const
109 {
110  if (uTheta_ < SMALL)
111  {
112  return tmp<scalarField>::New(size(), theta0_);
113  }
114 
115  const vectorField nf(patch().nf());
116 
117  // Calculated the component of the velocity parallel to the wall
118  vectorField Uwall(Up.patchInternalField() - Up);
119  Uwall -= (nf & Uwall)*nf;
120 
121  // Find the direction of the interface parallel to the wall
122  vectorField nWall(nHat - (nf & nHat)*nf);
123 
124  // Normalise nWall
125  nWall /= (mag(nWall) + SMALL);
126 
127  // Calculate Uwall resolved normal to the interface parallel to
128  // the interface
129  scalarField uwall(nWall & Uwall);
130 
131  return theta0_ + (thetaA_ - thetaR_)*tanh(uwall/uTheta_);
132 }
133 
134 
136 {
137  this->parent_bctype::write(os);
138  os.writeEntry("theta0", theta0_);
139  os.writeEntry("uTheta", uTheta_);
140  os.writeEntry("thetaA", thetaA_);
141  os.writeEntry("thetaR", thetaR_);
143 }
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 namespace Foam
149 {
151  (
153  dynamicAlphaContactAngleFvPatchScalarField
154  );
155 }
156 
157 
158 // ************************************************************************* //
dimensionedScalar tanh(const dimensionedScalar &ds)
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:130
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:334
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
Definition: fvPatchField.H:425
Macros for easy insertion into run-time selection tables.
fvPatchField< scalar > fvPatchScalarField
constexpr T & get(FixedList< T, N > &list) noexcept
Definition: FixedList.H:887
A FieldMapper for finite-volume patch fields.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:217
dynamicAlphaContactAngleFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
virtual tmp< scalarField > theta(const fvPatchVectorField &Up, const fvsPatchVectorField &nHat) const
Evaluate and return dynamic contact-angle.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Namespace for OpenFOAM.