fixedValueInletOutletFvPatchField.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) 2021 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 "volFields.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const fvPatch& p,
37 )
38 :
40  phiName_("phi")
41 {}
42 
43 
44 template<class Type>
46 (
47  const fvPatch& p,
49  const dictionary& dict,
50  const bool valueRequired
51 )
52 :
53  fixedValueFvPatchField<Type>(p, iF, dict, valueRequired),
54  phiName_(dict.lookupOrDefault<word>("phi", "phi"))
55 {}
56 
57 
58 template<class Type>
60 (
62  const fvPatch& p,
64  const fvPatchFieldMapper& mapper,
65  const bool mappingRequired
66 )
67 :
68  fixedValueFvPatchField<Type>(ptf, p, iF, mapper, mappingRequired),
69  phiName_(ptf.phiName_)
70 {}
71 
72 
73 template<class Type>
75 (
78 )
79 :
81  phiName_(ptf.phiName_)
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
87 template<class Type>
90 (
91  const tmp<scalarField>&
92 ) const
93 {
94  // Behave as a fixed value patch where there is inflow, and fixed gradient
95  // patch where there is outflow
96  const scalarField& phi =
97  this->patch().template
98  lookupPatchField<surfaceScalarField, scalar>(phiName_);
99  return (1 - pos0(phi))*Zero + pos0(phi)*pTraits<Type>::one;
100 }
101 
102 
103 template<class Type>
106 (
107  const tmp<scalarField>&
108 ) const
109 {
110  // Behave as a fixed value patch where there is inflow, and fixed gradient
111  // patch where there is outflow
112  const scalarField& phi =
113  this->patch().template
114  lookupPatchField<surfaceScalarField, scalar>(phiName_);
115  const Field<Type> pif(this->patchInternalField());
116  return (1 - pos0(phi))**this + pos0(phi)*(*this - pif);
117 }
118 
119 
120 template<class Type>
122 {
124  writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
125 }
126 
127 
128 // ************************************************************************* //
Foam::surfaceFields.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
dictionary dict
fixedValueInletOutletFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Traits class for primitives.
Definition: pTraits.H:50
A class for handling words, derived from string.
Definition: word.H:59
This boundary condition sets a fixed value. When the flow direction is inwards this acts exactly like...
Foam::fvPatchFieldMapper.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
phi
Definition: correctPhi.H:3
static const zero Zero
Definition: zero.H:97
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
dimensionedScalar pos0(const dimensionedScalar &ds)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.