Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
35const 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,
54 const DimensionedField<scalar, volMesh>& iF
56:
57 fixedGradientFvPatchScalarField(p, iF),
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();
76 fixedGradientFvPatchScalarField::evaluate();
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
95:
96 fixedGradientFvPatchScalarField(acpsf, p, iF, mapper),
97 limit_(acpsf.limit_)
98{}
99
100
103(
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(
129)
130{
131 if (limit_ == limitControls::lcGradient)
132 {
133 gradient() =
134 patch().deltaCoeffs()
135 *(
136 clamp(*this + gradient()/patch().deltaCoeffs(), zero_one{})
137 - *this
138 );
139 }
140 else if (limit_ == limitControls::lcZeroGradient)
141 {
142 gradient() = Zero;
143 }
144
145 fixedGradientFvPatchScalarField::evaluate();
146
155(
156 Ostream& os
157) const
158{
160 os.writeEntry("limit", limitControlNames_[limit_]);
161}
162
163
164// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
void operator=(const Field< scalar > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
commsTypes
Communications types.
Definition UPstream.H:81
Abstract base class for two-phase alphaContactAngle boundary conditions.
alphaContactAngleTwoPhaseFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
virtual void write(Ostream &) const
Write.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
Definition pTraits.H:51
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dictionary dict