Nalu
Nalu: a generalized unstructured massively parallel low Mach flow code designed to support a variety of energy applications of interest (most notably Wind ECP) built on the Sierra Toolkit and Trilinos solver Tpetra/Epetra stack. The open source BSD, clause 3 license model has been chosen for the code base. See LICENSE for more information. http://NaluCFD.org
OversetManager.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2014 Sandia Corporation. */
3 /* This software is released under the license detailed */
4 /* in the file, LICENSE, which is located in the top-level nalu */
5 /* directory structure */
6 /*------------------------------------------------------------------------*/
7 
8 
9 #ifndef OversetManager_h
10 #define OversetManager_h
11 
12 // stk_mesh
13 #include <stk_mesh/base/FieldBase.hpp>
14 #include <stk_mesh/base/CoordinateSystems.hpp>
15 
16 // stk_search
17 #include <stk_search/BoundingBox.hpp>
18 #include <stk_search/IdentProc.hpp>
19 #include <stk_search/SearchMethod.hpp>
20 
21 // STL
22 #include <vector>
23 #include <map>
24 
25 // field types
26 typedef stk::mesh::Field<double> ScalarFieldType;
27 typedef stk::mesh::Field<double, stk::mesh::Cartesian> VectorFieldType;
28 typedef stk::mesh::Field<double, stk::mesh::SimpleArrayTag> GenericFieldType;
29 
30 // search types
31 typedef stk::search::IdentProc<uint64_t,int> theKey;
32 typedef stk::search::Point<double> Point;
33 typedef stk::search::Box<double> Box;
34 typedef std::pair<Point,theKey> boundingPoint;
35 typedef std::pair<Box,theKey> boundingElementBox;
36 
37 namespace stk {
38  namespace io {
39  class StkMeshIoBroker;
40  }
41  namespace mesh {
42  class Part;
43  class MetaData;
44  class BulkData;
45  class Ghosting;
46  typedef std::vector<Part*> PartVector;
47  struct Entity;
48  }
49 }
50 
51 namespace sierra {
52 namespace nalu{
53 class OversetInfo;
54 struct OversetUserData;
55 
57 {
58 public:
59 
60  // constructor/destructor
62  Realm & realm,
63  const OversetUserData &oversetUserData);
64 
65  ~OversetManager();
66 
67  // general method to delete "new" entries within info vec
68  void delete_info_vec();
69 
70  // main method called for initialization
71  void initialize();
72 
73  // allow for manager to populate orhan nodal values
74  void overset_orphan_node_field_update(
75  stk::mesh::FieldBase *theField,
76  const int sizeRow,
77  const int sizeCol);
78 
79  // initialize ghosting data structures
80  void initialize_ghosting();
81 
82  // set space for inactive part; intersection of overset with background mesh
83  void declare_inactive_part();
84 
85  // set space for inactive part exposed surfaces
86  void declare_background_surface_part();
87 
88  // define the high level overset bounding box (single in size for cutting)
89  void define_overset_bounding_box();
90 
91  // define the high level overset bounding boxes
92  void define_overset_bounding_boxes();
93 
94  // define the background mesh set of bounding boxes
95  void define_background_bounding_boxes();
96 
97  // determine all of the intersected elements (coarse search on oversetBoxVec and backgroundBoxVec)
98  void determine_intersected_elements();
99 
100  // remove all elements from internally managed parts
101  void clear_parts();
102 
103  // add elements to the inactive part
104  void populate_inactive_part();
105 
106  // skin the inactive part to obtain a surface part
107  void skin_exposed_surface_on_inactive_part();
108 
109  // push back on all surfaces that contain the orphan nodes
110  void set_orphan_surface_part_vec();
111 
112  // create an OversetInfo object for each locally owned exposed node
113  void create_overset_info_vec();
114 
115  // orphan node within element search; product is a valid ghosting and oversetInfoVec completed
116  void orphan_node_search();
117 
118  // set the element variable for intersected elements to unity
119  void set_data_on_inactive_part();
120 
121  // general coarse search method
122  void coarse_search(
123  std::vector<boundingPoint> &boundingPointVec,
124  std::vector<boundingElementBox> &boundingElementVec,
125  std::vector<std::pair<theKey, theKey> > &searchKeyPair);
126 
127  // deal with ghosting objects/data for fine search purposes
128  void manage_ghosting();
129 
130  // general complete search method (fine search)
131  void complete_search(
132  std::vector<std::pair<theKey, theKey> > searchKeyPair,
133  std::map<uint64_t, OversetInfo *> &oversetInfoMap);
134 
135  // data set at construction
138  const stk::search::SearchMethod searchMethod_;
139  int nDim_;
140  // meta, bulk and io
141  stk::mesh::MetaData *metaData_;
142  stk::mesh::BulkData *bulkData_;
143  // lots of detailed information on the search
145 
146  /* ghosting infrastructure */
147  stk::mesh::Ghosting *oversetGhosting_;
148  uint64_t needToGhostCount_;
149 
150  // part associated with inactive elements
151  stk::mesh::Part *inActivePart_;
152 
153  // part associated with exposed surfaces for inactive elements
154  stk::mesh::Part *backgroundSurfacePart_;
155 
156  // internal flag to ensure that we declare parts once
158 
159  // vector of elements to ghost
160  stk::mesh::EntityProcVec elemsToGhost_;
161 
162  // search data structures
163  std::vector<boundingElementBox> boundingElementOversetBoxVec_;
164  std::vector<boundingElementBox> boundingElementOversetBoxesVec_;
165  std::vector<boundingElementBox> boundingElementBackgroundBoxesVec_;
166  std::vector<boundingPoint> boundingPointVecBackground_;
167  std::vector<boundingPoint> boundingPointVecOverset_;
168 
169  // map for background elements (used for intersection)
170  std::map<uint64_t, stk::mesh::Entity> searchIntersectedElementMap_;
171 
172  /* save off product of search */
173  std::vector<std::pair<theKey, theKey> > searchKeyPairBackground_;
174  std::vector<std::pair<theKey, theKey> > searchKeyPairOverset_;
175 
176  // vector of elements intersected... will want to push to a part
177  std::vector<stk::mesh::Entity > intersectedElementVec_;
178 
179  // hold a vector of parts that correspond to the exposed surface orphan points
182 
183  // vector of overset information: contains orphan node -> donor element
184  std::vector<OversetInfo *> oversetInfoVec_;
185 
186  // map of node global id to overset info
187  std::map<uint64_t, OversetInfo *> oversetInfoMapOverset_;
188  std::map<uint64_t, OversetInfo *> oversetInfoMapBackground_;
189 
190 };
191 
192 } // namespace nalu
193 } // namespace Sierra
194 
195 #endif
std::pair< Point, theKey > boundingPoint
Definition: OversetManager.h:34
std::vector< Part * > PartVector
Definition: Algorithm.h:16
std::vector< boundingElementBox > boundingElementOversetBoxesVec_
Definition: OversetManager.h:164
bool firstInitialization_
Definition: OversetManager.h:157
Definition: ABLForcingAlgorithm.C:26
void initialize(int N, aligned_vector &x, aligned_vector &y)
Definition: UnitTestSimdBasic.C:37
Definition: NaluParsing.h:259
stk::mesh::Field< double > ScalarFieldType
Definition: OversetManager.h:26
std::map< uint64_t, OversetInfo * > oversetInfoMapBackground_
Definition: OversetManager.h:188
uint64_t needToGhostCount_
Definition: OversetManager.h:148
Definition: Algorithm.h:14
std::vector< OversetInfo * > oversetInfoVec_
Definition: OversetManager.h:184
stk::mesh::EntityProcVec elemsToGhost_
Definition: OversetManager.h:160
stk::mesh::Part * inActivePart_
Definition: OversetManager.h:151
stk::search::Point< double > Point
Definition: OversetManager.h:32
stk::mesh::MetaData * metaData_
Definition: OversetManager.h:141
stk::mesh::PartVector orphanPointSurfaceVecOverset_
Definition: OversetManager.h:180
Realm & realm_
Definition: OversetManager.h:136
const stk::search::SearchMethod searchMethod_
Definition: OversetManager.h:138
std::vector< boundingElementBox > boundingElementBackgroundBoxesVec_
Definition: OversetManager.h:165
stk::mesh::PartVector orphanPointSurfaceVecBackground_
Definition: OversetManager.h:181
std::vector< stk::mesh::Entity > intersectedElementVec_
Definition: OversetManager.h:177
stk::mesh::Field< double, stk::mesh::SimpleArrayTag > GenericFieldType
Definition: OversetManager.h:28
std::pair< Box, theKey > boundingElementBox
Definition: OversetManager.h:35
stk::mesh::BulkData * bulkData_
Definition: OversetManager.h:142
const OversetUserData & oversetUserData_
Definition: OversetManager.h:137
stk::mesh::Ghosting * oversetGhosting_
Definition: OversetManager.h:147
std::vector< boundingElementBox > boundingElementOversetBoxVec_
Definition: OversetManager.h:163
Definition: OversetManager.h:56
std::vector< boundingPoint > boundingPointVecOverset_
Definition: OversetManager.h:167
std::vector< std::pair< theKey, theKey > > searchKeyPairOverset_
Definition: OversetManager.h:174
stk::mesh::Part * backgroundSurfacePart_
Definition: OversetManager.h:154
Definition: Realm.h:82
std::map< uint64_t, stk::mesh::Entity > searchIntersectedElementMap_
Definition: OversetManager.h:170
stk::search::IdentProc< uint64_t, int > theKey
Definition: OversetManager.h:31
int nDim_
Definition: OversetManager.h:139
std::vector< std::pair< theKey, theKey > > searchKeyPairBackground_
Definition: OversetManager.h:173
const bool oversetAlgDetailedOutput_
Definition: OversetManager.h:144
std::map< uint64_t, OversetInfo * > oversetInfoMapOverset_
Definition: OversetManager.h:187
stk::search::Box< double > Box
Definition: OversetManager.h:33
stk::mesh::Field< double, stk::mesh::Cartesian > VectorFieldType
Definition: OversetManager.h:27
std::vector< boundingPoint > boundingPointVecBackground_
Definition: OversetManager.h:166