alphaContactAngleTwoPhaseFvPatchScalarField.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-2015 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 
30 #include "fvPatchFieldMapper.H"
31 #include "volMesh.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 const Foam::Enum
36 <
38 >
40 ({
41  { limitControls::lcNone, "none" },
42  { limitControls::lcGradient, "gradient" },
43  { limitControls::lcZeroGradient, "zeroGradient" },
44  { limitControls::lcAlpha, "alpha" },
45 });
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
52 (
53  const fvPatch& p,
55 )
56 :
57  fixedGradientFvPatchScalarField(p, iF),
58  limit_(lcZeroGradient)
59 {}
60 
61 
64 (
65  const fvPatch& p,
67  const dictionary& dict
68 )
69 :
70  fixedGradientFvPatchScalarField(p, iF), // Bypass dictionary constructor
71  limit_(limitControlNames_.get("limit", dict))
72 {
73  if (this->readGradientEntry(dict))
74  {
75  fixedGradientFvPatchScalarField::updateCoeffs();
77  }
78  else
79  {
80  // Fallback: set to zero-gradient
81  extrapolateInternal();
82  gradient() = Zero;
83  }
84 }
85 
86 
89 (
90  const alphaContactAngleTwoPhaseFvPatchScalarField& acpsf,
91  const fvPatch& p,
92  const DimensionedField<scalar, volMesh>& iF,
93  const fvPatchFieldMapper& mapper
94 )
95 :
96  fixedGradientFvPatchScalarField(acpsf, p, iF, mapper),
97  limit_(acpsf.limit_)
98 {}
99 
100 
103 (
105 )
106 :
107  fixedGradientFvPatchScalarField(acpsf),
108  limit_(acpsf.limit_)
109 {}
110 
111 
114 (
117 )
118 :
119  fixedGradientFvPatchScalarField(acpsf, iF),
120  limit_(acpsf.limit_)
121 {}
122 
123 
124 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
125 
127 (
128  const Pstream::commsTypes
129 )
130 {
131  if (limit_ == lcGradient)
132  {
133  gradient() =
134  patch().deltaCoeffs()
135  *(
136  clamp(*this + gradient()/patch().deltaCoeffs(), zero_one{})
137  - *this
138  );
139  }
140  else if (limit_ == lcZeroGradient)
141  {
142  gradient() = Zero;
143  }
144 
146 
147  if (limit_ == lcAlpha)
148  {
150  }
151 }
152 
153 
155 (
156  Ostream& os
157 ) const
158 {
160  os.writeEntry("limit", limitControlNames_[limit_]);
161 }
162 
163 
164 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
dictionary dict
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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:321
virtual void write(Ostream &) const
Write.
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.
Abstract base class for two-phase alphaContactAngle boundary conditions.
OBJstream os(runTime.globalPath()/outputName)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
void operator=(const Field< scalar > &)
Copy assignment.
Definition: Field.C:747
alphaContactAngleTwoPhaseFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
Definition: pTraits.H:65
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: error.H:64
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
volScalarField & p
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
Definition: dimensionSet.C:271
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127