patchFluxToFace.H
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 Class
25  Foam::patchFluxToFace
26 
27 Description
28  A topoSetSource to select patch faces according to the flux direction.
29 
30 Usage
31  Example topoSetDict to generate faceSets for inflow and outflow faces
32  on the outlet patch:
33  \verbatim
34  actions
35  (
36  {
37  action new;
38  type faceSet;
39  name inflow;
40  source patchFluxToFace;
41  field phi;
42  patch outlet;
43  inflow true;
44  }
45 
46  {
47  action new;
48  type faceSet;
49  name outflow;
50  source patchFluxToFace;
51  field phi;
52  patch outlet;
53  inflow false;
54  }
55  );
56  \endverbatim
57 
58 SourceFiles
59  patchFluxToFace.C
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef patchFluxToFace_H
64 #define patchFluxToFace_H
65 
66 #include "topoSetSource.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class patchFluxToFace Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class patchFluxToFace
78 :
79  public topoSetSource
80 {
81  // Private Data
82 
83  //- Name of surfaceScalarField
84  word fieldName_;
85 
86  //- Name of patch
87  word patchName_;
88 
89  //- Switch for inflow/outflow
90  bool inflow_;
91 
92 
93  // Private Member Functions
94 
95  //- Depending on patchFluxField values add to or delete from faceSet.
96  void applyToSet
97  (
98  const topoSetSource::setAction action,
99  const scalarField& patchFluxField,
100  topoSet& set
101  ) const;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("patchFluxToFace");
108 
109 
110  // Constructors
111 
112  //- Construct from components
114  (
115  const polyMesh& mesh,
116  const word& fieldName,
117  const word& patchName,
118  const bool inflow
119  );
120 
121  //- Construct from dictionary
123  (
124  const polyMesh& mesh,
125  const dictionary& dict
126  );
127 
128 
129  //- Destructor
130  virtual ~patchFluxToFace();
131 
132 
133  // Member Functions
134 
135  virtual sourceType setType() const
136  {
137  return FACESETSOURCE;
138  }
139 
140  virtual void applyToSet
141  (
142  const topoSetSource::setAction action,
143  topoSet&
144  ) const;
145 
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A topoSetSource to select patch faces according to the flux direction.
virtual ~patchFluxToFace()
Destructor.
TypeName("patchFluxToFace")
Runtime type information.
virtual sourceType setType() const
patchFluxToFace(const polyMesh &mesh, const word &fieldName, const word &patchName, const bool inflow)
Construct from components.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Base class of a source for a topoSet.
Definition: topoSetSource.H:64
sourceType
Enumeration defining the types of sources.
Definition: topoSetSource.H:71
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:83
const polyMesh & mesh() const
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:65
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict