outletInletFvPatchField.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) 2011-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 
27 #include "surfaceFields.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const fvPatch& p,
36 )
37 :
38  mixedFvPatchField<Type>(p, iF),
39  phiName_("phi")
40 {
41  this->refValue() = *this;
42  this->refGrad() = Zero;
43  this->valueFraction() = 0.0;
44 }
45 
46 
47 template<class Type>
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
55  mixedFvPatchField<Type>(p, iF, dict, false),
56  phiName_(dict.lookupOrDefault<word>("phi", "phi"))
57 {
58  this->refValue() =
59  Field<Type>("outletValue", iF.dimensions(), dict, p.size());
60 
61  if (dict.found("value"))
62  {
64  (
65  Field<Type>("value", iF.dimensions(), dict, p.size())
66  );
67  }
68  else
69  {
71  }
72 
73  this->refGrad() = Zero;
74  this->valueFraction() = 0.0;
75 }
76 
77 
78 template<class Type>
80 (
82  const fvPatch& p,
84  const fieldMapper& mapper
85 )
86 :
87  mixedFvPatchField<Type>(ptf, p, iF, mapper),
88  phiName_(ptf.phiName_)
89 {}
90 
91 
92 template<class Type>
94 (
97 )
98 :
99  mixedFvPatchField<Type>(ptf, iF),
100  phiName_(ptf.phiName_)
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 template<class Type>
108 {
109  if (this->updated())
110  {
111  return;
112  }
113 
114  const Field<scalar>& phip =
115  this->patch().template lookupPatchField<surfaceScalarField, scalar>
116  (
117  phiName_
118  );
119 
120  this->valueFraction() = pos0(phip);
121 
123 }
124 
125 
126 template<class Type>
128 {
130  if (phiName_ != "phi")
131  {
132  writeEntry(os, "phi", phiName_);
133  }
134  writeEntry(os, "outletValue", this->refValue());
135  writeEntry(os, "value", *this);
136 }
137 
138 
139 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
Pre-declare SubField and related Field type.
Definition: Field.H:83
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:249
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:202
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
virtual Field< Type > & refGrad()
This boundary condition provides a generic inflow condition, with specified outflow for the case of r...
virtual void write(Ostream &) const
Write.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
outletInletFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for handling words, derived from string.
Definition: word.H:62
static const zero Zero
Definition: zero.H:97
dimensionedScalar pos0(const dimensionedScalar &ds)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dictionary dict
volScalarField & p
Foam::surfaceFields.