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-2023 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() = Field<Type>("outletValue", dict, p.size());
59 
60  if (dict.found("value"))
61  {
63  (
64  Field<Type>("value", dict, p.size())
65  );
66  }
67  else
68  {
70  }
71 
72  this->refGrad() = Zero;
73  this->valueFraction() = 0.0;
74 }
75 
76 
77 template<class Type>
79 (
81  const fvPatch& p,
83  const fvPatchFieldMapper& mapper
84 )
85 :
86  mixedFvPatchField<Type>(ptf, p, iF, mapper),
87  phiName_(ptf.phiName_)
88 {}
89 
90 
91 template<class Type>
93 (
96 )
97 :
98  mixedFvPatchField<Type>(ptf, iF),
99  phiName_(ptf.phiName_)
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
105 template<class Type>
107 {
108  if (this->updated())
109  {
110  return;
111  }
112 
113  const Field<scalar>& phip =
114  this->patch().template lookupPatchField<surfaceScalarField, scalar>
115  (
116  phiName_
117  );
118 
119  this->valueFraction() = pos0(phip);
120 
122 }
123 
124 
125 template<class Type>
127 {
129  if (phiName_ != "phi")
130  {
131  writeEntry(os, "phi", phiName_);
132  }
133  writeEntry(os, "outletValue", this->refValue());
134  writeEntry(os, "value", *this);
135 }
136 
137 
138 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
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:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:231
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:251
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:204
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.