LocalInteraction.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-2017 OpenFOAM Foundation
9  Copyright (C) 2018-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::LocalInteraction
29 
30 Group
31  grpLagrangianIntermediatePatchInteractionSubModels
32 
33 Description
34  Patch interaction specified on a patch-by-patch basis
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef LocalInteraction_H
39 #define LocalInteraction_H
40 
41 #include "PatchInteractionModel.H"
43 #include "Switch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class LocalInteraction Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CloudType>
55 class LocalInteraction
56 :
57  public PatchInteractionModel<CloudType>
58 {
59  // Private data
60 
61  //- List of participating patches
62  const patchInteractionDataList patchData_;
63 
64 
65  // Bookkeeping for particle fates
66 
67  //- Number of parcels escaped
68  List<List<label>> nEscape_;
69 
70  //- Mass of parcels escaped
71  List<List<scalar>> massEscape_;
72 
73  //- Number of parcels stuck to patches
74  List<List<label>> nStick_;
75 
76  //- Mass of parcels stuck to patches
77  List<List<scalar>> massStick_;
78 
79 
80  //- Flag to output data as fields
81  bool writeFields_;
82 
83  //- InjectorId to index map, when outputting escaped/stick/...
84  // particles sorted by injectorID
85  Map<label> injIdToIndex_;
86 
87  //- Mass escape field
88  autoPtr<volScalarField> massEscapePtr_;
89 
90  //- Mass stick field
91  autoPtr<volScalarField> massStickPtr_;
92 
93 
94 protected:
95 
96  // Protected Member Functions
97 
98  //- Output file header information
99  virtual void writeFileHeader(Ostream& os);
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("localInteraction");
106 
107 
108  // Constructors
109 
110  //- Construct from dictionary
111  LocalInteraction(const dictionary& dict, CloudType& owner);
112 
113  //- Construct copy from owner cloud and patch interaction model
115 
116  //- Construct and return a clone using supplied owner cloud
118  {
120  (
121  new LocalInteraction<CloudType>(*this)
122  );
123  }
124 
125 
126  //- Destructor
127  virtual ~LocalInteraction() = default;
128 
129 
130  // Member Functions
131 
132  //- Return access to the massEscape field
134 
135  //- Return access to the massStick field
137 
138  //- Apply velocity correction
139  // Returns true if particle remains in same cell
140  virtual bool correct
141  (
142  typename CloudType::parcelType& p,
143  const polyPatch& pp,
144  bool& keepParticle
145  );
146 
147 
148  //- Write patch interaction info to stream
149  virtual void info(Ostream& os);
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "LocalInteraction.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
PatchInteractionModel.H
p
volScalarField & p
Definition: createFieldRefs.H:8
patchInteractionDataList.H
Foam::patchInteractionDataList
List container for patchInteractionData class.
Definition: patchInteractionDataList.H:49
Foam::Map< label >
Foam::LocalInteraction::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: LocalInteraction.C:34
Foam::LocalInteraction::LocalInteraction
LocalInteraction(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: LocalInteraction.C:56
Foam::LocalInteraction::clone
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const
Construct and return a clone using supplied owner cloud.
Definition: LocalInteraction.H:116
Foam::LocalInteraction::~LocalInteraction
virtual ~LocalInteraction()=default
Destructor.
Foam::PatchInteractionModel
Templated patch interaction model class.
Definition: KinematicCloud.H:89
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Switch.H
Foam::LocalInteraction::TypeName
TypeName("localInteraction")
Runtime type information.
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::LocalInteraction::info
virtual void info(Ostream &os)
Write patch interaction info to stream.
Definition: LocalInteraction.C:344
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::LocalInteraction
Patch interaction specified on a patch-by-patch basis.
Definition: LocalInteraction.H:54
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::LocalInteraction::correct
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
Definition: LocalInteraction.C:214
LocalInteraction.C
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::LocalInteraction::massEscape
volScalarField & massEscape()
Return access to the massEscape field.
Definition: LocalInteraction.C:155
Foam::LocalInteraction::massStick
volScalarField & massStick()
Return access to the massStick field.
Definition: LocalInteraction.C:184