File size: 10,666 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::InteractionLists
Description
Builds direct interaction list, specifying which local (real)
cells are potentially in range of each other.
Builds referred interaction list, specifying which cells are
required to provide interactions across coupled patches (cyclic or
processor). Generates referred cells, and refers particles to the
correct processor, applying the appropriate transform.
Simultaneous communication and computation is possible using:
\verbatim
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
label startOfRequests = Pstream::nRequests();
il_.sendReferredData(cellOccupancy_, pBufs);
// Do other things
il_.receiveReferredData(pBufs, startOfRequests);
\endverbatim
Requiring data:
\verbatim
List<DynamicList<typename CloudType::parcelType*>> cellOccupancy_;
\endverbatim
SourceFiles
InteractionListsI.H
InteractionLists.C
InteractionListsIO.C
\*---------------------------------------------------------------------------*/
#ifndef InteractionLists_H
#define InteractionLists_H
#include "polyMesh.H"
#include "referredWallFace.H"
//#include "distributionMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class globalIndexAndTransform;
class distributionMap;
/*---------------------------------------------------------------------------*\
Class InteractionLists Declaration
\*---------------------------------------------------------------------------*/
template<class ParticleType>
class InteractionLists
{
// Private Data
//- Reference to mesh
const polyMesh& mesh_;
//- Dummy cloud to give to particles
lagrangian::Cloud<ParticleType> cloud_;
//- Switch controlling whether or not the cloud gets populated
// with the referred particles, hence gets written out
const Switch writeCloud_;
//- distributionMap to exchange referred particles into referred cells
autoPtr<distributionMap> cellMapPtr_;
//- distributionMap to exchange wall face data
autoPtr<distributionMap> wallFaceMapPtr_;
//- Maximum distance over which interactions will be detected
scalar maxDistance_;
//- Direct interaction list
labelListList dil_;
//- Wall faces on this processor that are in interaction range
// of each each cell (direct wall face interaction list)
labelListList dwfil_;
//- Referred interaction list - which real cells are to be
// supplied with particle interactions from the referred
// particle container with the same index.
labelListList ril_;
//- Inverse addressing for referred cells, specifies which
// referred cells (indices of entries in the ril_ and
// referredParticles_ lists) interact with the real cell
// indexed in this container.
labelListList rilInverse_;
//- Which real cells on this on this processor are in
// interaction range of each referred wall face (referred
// wall face interaction list)
labelListList rwfil_;
//- Inverse addressing for referred wall faces, specifies
// which referred wall faces interact with the real cells
// indexed in this container.
labelListList rwfilInverse_;
//- Which cells are to be sent via the cellMap, and an index
// specifying how they should be transformed.
List<labelPair> cellIndexAndTransformToDistribute_;
//- Which wallFaces are to be sent via the wallFaceMap, and an index
// specifying how they should be transformed.
List<labelPair> wallFaceIndexAndTransformToDistribute_;
//- Referred wall faces
List<referredWallFace> referredWallFaces_;
//- Velocity field name, default to "U"
const word UName_;
//- Referred wall face velocity field values;
List<vector> referredWallData_;
//- Referred particle container
List<IDLList<ParticleType>> referredParticles_;
// Private Member Functions
//- Construct all interaction lists
void buildInteractionLists();
//- Find the other processors which have interaction range
// extended bound boxes in range
void findExtendedProcBbsInRange
(
const treeBoundBox& procBb,
const List<treeBoundBox>& allExtendedProcBbs,
const globalIndexAndTransform& globalTransforms,
List<treeBoundBox>& extendedProcBbsInRange,
List<label>& extendedProcBbsTransformIndex,
List<label>& extendedProcBbsOrigProc
);
//- Build the distributionMap from information about which entry
// is to be sent to which processor
void buildMap
(
autoPtr<distributionMap>& mapPtr,
const List<label>& toProc
);
//- Fill the referredParticles container with particles that
// will be referred
void prepareParticlesToRefer
(
const List<DynamicList<ParticleType*>>& cellOccupancy
);
//- Prepare particle to be referred
void prepareParticleToBeReferred
(
ParticleType* particle,
labelPair iat
);
//- Fill the referredParticles so that it will be written out
void fillReferredParticleCloud();
//- Populate the referredWallData container with data that
// will be referred.
void prepareWallDataToRefer();
//- Write the referred wall faces out for debug
void writeReferredWallFaces() const;
public:
// Constructors
//- Construct null from mesh
InteractionLists(const polyMesh& mesh);
//- Construct and call function to create all information from
// the mesh
InteractionLists
(
const polyMesh& mesh,
scalar maxDistance,
Switch writeCloud = false,
const word& UName = "U"
);
//- Disallow default bitwise copy construction
InteractionLists(const InteractionLists&) = delete;
// Destructor
~InteractionLists();
// Member Functions
//- Prepare and send referred particles and wall data,
// nonBlocking communication
void sendReferredData
(
const List<DynamicList<ParticleType*>>& cellOccupancy,
PstreamBuffers& pBufs
);
//- Receive referred data
void receiveReferredData
(
PstreamBuffers& pBufs,
const label startReq = 0
);
// Access
//- Return access to the mesh
inline const polyMesh& mesh() const;
//- Return access to the cellMap
inline const distributionMap& cellMap() const;
//- Return access to the wallFaceMap
inline const distributionMap& wallFaceMap() const;
//- Return access to the direct interaction list
inline const labelListList& dil() const;
//- Return access to the direct wall face interaction list
inline const labelListList& dwfil() const;
//- Return access to the referred interaction list
inline const labelListList& ril() const;
//- Return access to the inverse referred interaction list
inline const labelListList& rilInverse() const;
//- Return access to the referred wall face interaction list
inline const labelListList& rwfil() const;
//- Return access to the inverse referred wall face
// interaction list
inline const labelListList& rwfilInverse() const;
//- Return access to the cellIndexAndTransformToDistribute list
inline const List<labelPair>&
cellIndexAndTransformToDistribute() const;
//- Return access to the wallFaceIndexAndTransformToDistribute list
inline const List<labelPair>&
wallFaceIndexAndTransformToDistribute() const;
//- Return access to the referred wall faces
inline const List<referredWallFace>& referredWallFaces() const;
//- Return the name of the velocity field
inline const word& UName() const;
//- Return access to the referred wall data
inline const List<vector>& referredWallData() const;
//- Return access to the referred particle container
inline const List<IDLList<ParticleType>>&
referredParticles() const;
//- Return non-const access to the referred particle container
inline List<IDLList<ParticleType>>& referredParticles();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const InteractionLists&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "InteractionListsI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "InteractionLists.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
|