Loading...
Searching...
No Matches
fixedFluxPressureFvPatchScalarField.H
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-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 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
27Class
28 Foam::fixedFluxPressureFvPatchScalarField
29
30Group
31 grpInletBoundaryConditions grpWallBoundaryConditions
32
33Description
34 This boundary condition sets the pressure gradient to the provided value
35 such that the flux on the boundary is that specified by the velocity
36 boundary condition.
37
38 Example of the boundary condition specification:
39 \verbatim
40 <patchName>
41 {
42 type fixedFluxPressure;
43 }
44 \endverbatim
45
46See also
47 Foam::fixedGradientFvPatchField
48
49SourceFiles
50 fixedFluxPressureFvPatchScalarField.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef fixedFluxPressureFvPatchScalarField_H
55#define fixedFluxPressureFvPatchScalarField_H
56
57#include "fvPatchFields.H"
59#include "updateableSnGrad.H"
60
61// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62
63namespace Foam
64{
66/*---------------------------------------------------------------------------*\
67 Class fixedFluxPressureFvPatchScalarField Declaration
68\*---------------------------------------------------------------------------*/
69
71:
72 public fixedGradientFvPatchScalarField,
74{
75 // Private data
76
77 //- Current time index (used for updating)
78 label curTimeIndex_;
79
80
81public:
82
83 //- Runtime type information
84 TypeName("fixedFluxPressure");
85
86
87 // Constructors
88
89 //- Construct from patch and internal field
91 (
92 const fvPatch&,
94 );
95
96 //- Construct from patch, internal field and dictionary
98 (
99 const fvPatch&,
101 const dictionary&
102 );
103
104 //- Construct by mapping given fixedFluxPressureFvPatchScalarField onto
105 // a new patch
107 (
109 const fvPatch&,
111 const fvPatchFieldMapper&
112 );
113
114 //- Construct as copy
116 (
118 );
119
120 //- Construct as copy setting internal field reference
122 (
125 );
126
127 //- Return a clone
128 virtual tmp<fvPatchField<scalar>> clone() const
129 {
130 return fvPatchField<scalar>::Clone(*this);
131 }
132
133 //- Clone with an internal field reference
135 (
137 ) const
138 {
139 return fvPatchField<scalar>::Clone(*this, iF);
141
142
143 // Member functions
144
145 //- Update the patch pressure gradient field from the given snGradp
146 virtual void updateSnGrad(const scalarField& snGradp);
147
148 //- Update the patch pressure gradient field
149 virtual void updateCoeffs();
150
151 //- Write
152 virtual void write(Ostream&) const;
153};
154
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158} // End namespace Foam
159
160// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161
162#include "volFields.H"
163
164namespace Foam
165{
166 template<class GradBC>
167 inline void setSnGrad
168 (
170 const FieldField<fvsPatchField, scalar>& snGrad
171 )
172 {
173 forAll(bf, patchi)
174 {
175 if (isA<GradBC>(bf[patchi]))
176 {
177 refCast<GradBC>(bf[patchi]).updateSnGrad(snGrad[patchi]);
178 }
179 }
180 }
181
182 template<class GradBC>
183 inline void setSnGrad
184 (
188 {
189 setSnGrad<GradBC>(bf, tsnGrad());
190 }
191}
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#endif
196
197// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
fixedFluxPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the patch pressure gradient field.
virtual void updateSnGrad(const scalarField &snGradp)
Update the patch pressure gradient field from the given snGradp.
TypeName("fixedFluxPressure")
Runtime type information.
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
void setSnGrad(volScalarField::Boundary &bf, const FieldField< fvsPatchField, scalar > &snGrad)
runTime write()
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68