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
ActuatorLinePointDrag.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 ActuatorLinePointDrag_h
10 #define ActuatorLinePointDrag_h
11 
12 #include "Actuator.h"
13 
14 namespace sierra{
15 namespace nalu{
16 
17 class Realm;
18 
20 public:
23 
24  // for each type of probe, e.g., line of site, hold some stuff
27  std::string turbineName_;
28  double radius_;
29  double omega_;
30  double twoSigSq_;
34 };
35 
36 // class that holds all of the action... for each point, hold the current location and other useful info
38  public:
40  size_t localId, Point centroidCoords, double radius, double omega, double twoSigSq, double *velocity);
42  size_t localId_;
44  double radius_;
45  double omega_;
46  double twoSigSq_;
47  double bestX_;
48  stk::mesh::Entity bestElem_;
49 
50  // mesh motion specifics
51  double velocity_[3];
52 
53  std::vector<double> isoParCoords_;
54  std::vector<stk::mesh::Entity> elementVec_;
55 };
56 
58 {
59 public:
60 
62  Realm &realm,
63  const YAML::Node &node);
65 
66  // load all of the options
67  void load(
68  const YAML::Node & node);
69 
70  // setup part creation and nodal field registration (before populate_mesh())
71  void setup();
72 
73  // setup part creation and nodal field registration (after populate_mesh())
74  void initialize();
75 
76  // determine element bounding box in the mesh
77  void populate_candidate_elements();
78 
79  // fill in the map that will hold point and ghosted elements
80  void create_actuator_line_point_info_map();
81 
82  // figure out the set of elements that belong in the custom ghosting data structure
83  void determine_elems_to_ghost();
84 
85  // deal with custom ghosting
86  void manage_ghosting();
87 
88  // manage rotation, now only in the y-z plane
89  void set_current_coordinates(
90  double *lineCentroid, double *centroidCoords, const double &omega, const double &currentTime);
91  void set_current_velocity(
92  double *lineCentroid, const double *centroidCoords, double *velocity, const double &omega);
93 
94  // populate vector of elements
95  void complete_search();
96 
97  // populate nodal field and output norms (if appropriate)
98  void execute();
99 
100  // support methods to gather data; scalar and vector
101  void resize_std_vector(
102  const int &sizeOfField,
103  std::vector<double> &theVector,
104  stk::mesh::Entity elem,
105  const stk::mesh::BulkData & bulkData);
106 
107  // general gather methods for scalar and vector (both double)
108  void gather_field(
109  const int &sizeOfField,
110  double *fieldToFill,
111  const stk::mesh::FieldBase &stkField,
112  stk::mesh::Entity const* elem_node_rels,
113  const int &nodesPerElement);
114 
115  void gather_field_for_interp(
116  const int &sizeOfField,
117  double *fieldToFill,
118  const stk::mesh::FieldBase &stkField,
119  stk::mesh::Entity const* elem_node_rels,
120  const int &nodesPerElement);
121 
122  // element volume and scv volume populated
123  double compute_volume(
124  const int &nDim,
125  stk::mesh::Entity elem,
126  const stk::mesh::BulkData & bulkData);
127 
128  // interpolate field to point centroid
129  void interpolate_field(
130  const int &sizeOfField,
131  stk::mesh::Entity elem,
132  const stk::mesh::BulkData & bulkData,
133  double *isoParCoords,
134  const double *fieldAtNodes,
135  double *pointField);
136 
137  // drag at the point centroid
138  void compute_point_drag(
139  const int &nDim,
140  const double &pointRadius,
141  const double *pointVelocity,
142  const double *pointGasVelocity,
143  const double &pointGasViscosity,
144  const double &pointGasDensity,
145  double *pointDrag,
146  double &pointDragLHS);
147 
148  // centroid of the element
149  void compute_elem_centroid(
150  const int &nDim,
151  double *elemCentroid,
152  const int &nodesPerElement);
153 
154  // radius from element centroid to point centroid
155  double compute_radius(
156  const int &nDim,
157  const double *elemCentroid,
158  const double *pointCentroid);
159 
160  // drag fource at given radius
161  void compute_elem_drag_given_radius(
162  const int &nDim,
163  const double &radius,
164  const double &twoSigSq,
165  const double *pointDrag,
166  double *elemDrag);
167 
168  // finally, perform the assembly
169  void assemble_source_to_nodes(
170  const int &nDim,
171  stk::mesh::Entity elem,
172  const stk::mesh::BulkData & bulkData,
173  const double &elemVolume,
174  const double *drag,
175  const double &dragLHS,
176  stk::mesh::FieldBase &actuator_source,
177  stk::mesh::FieldBase &actuator_source_lhs,
178  const double &lhsFac);
179 
180  // hold the realm
182 
183  // type of stk search
184  stk::search::SearchMethod searchMethod_;
185 
186  // custom ghosting
187  stk::mesh::Ghosting *actuatorLineGhosting_;
188 
189  // how many elements to ghost?
191  stk::mesh::EntityProcVec elemsToGhost_;
192 
193  // local id for set of points
194  uint64_t localPointId_;
195 
196  // does the actuator line move?
198 
199  // everyone needs pi
200  const double pi_;
201 
202  // save off product of search
203  std::vector<std::pair<theKey, theKey> > searchKeyPair_;
204 
205  // bounding box data types for stk_search */
206  std::vector<boundingSphere> boundingSphereVec_;
207  std::vector<boundingElementBox> boundingElementBoxVec_;
208 
209  // target names for set of bounding boxes
210  std::vector<std::string> searchTargetNames_;
211 
212  // vector of averaging information
213  std::vector<ActuatorLinePointDragInfo *> actuatorLineInfo_;
214 
215  // map of point info objects
216  std::map<size_t, ActuatorLinePointDragPointInfo *> actuatorLinePointInfoMap_;
217 
218  // scratch space
219  std::vector<double> ws_coordinates_;
220  std::vector<double> ws_scv_volume_;
221  std::vector<double> ws_velocity_;
222  std::vector<double> ws_density_;
223  std::vector<double> ws_viscosity_;
224 
225 };
226 
227 
228 } // namespace nalu
229 } // namespace Sierra
230 
231 #endif
stk::mesh::EntityProcVec elemsToGhost_
Definition: ActuatorLinePointDrag.h:191
Definition: ActuatorLinePointDrag.h:37
uint64_t localPointId_
Definition: ActuatorLinePointDrag.h:194
Definition: ABLForcingAlgorithm.C:26
int processorId_
Definition: ActuatorLinePointDrag.h:25
void initialize(int N, aligned_vector &x, aligned_vector &y)
Definition: UnitTestSimdBasic.C:37
std::vector< std::pair< theKey, theKey > > searchKeyPair_
Definition: ActuatorLinePointDrag.h:203
std::vector< boundingSphere > boundingSphereVec_
Definition: ActuatorLinePointDrag.h:206
Definition: ActuatorLinePointDrag.h:57
Coordinates tipCoordinates_
Definition: ActuatorLinePointDrag.h:31
size_t localId_
Definition: ActuatorLinePointDrag.h:42
std::vector< double > ws_density_
Definition: ActuatorLinePointDrag.h:222
int numPoints_
Definition: ActuatorLinePointDrag.h:26
Coordinates tailCoordinates_
Definition: ActuatorLinePointDrag.h:32
std::vector< boundingElementBox > boundingElementBoxVec_
Definition: ActuatorLinePointDrag.h:207
std::vector< double > ws_velocity_
Definition: ActuatorLinePointDrag.h:221
double radius_
Definition: ActuatorLinePointDrag.h:28
std::vector< double > ws_viscosity_
Definition: ActuatorLinePointDrag.h:223
stk::mesh::Entity bestElem_
Definition: ActuatorLinePointDrag.h:48
stk::search::Point< double > Point
Definition: Actuator.h:39
Realm & realm_
Definition: ActuatorLinePointDrag.h:181
Definition: ActuatorLinePointDrag.h:19
std::vector< double > ws_scv_volume_
Definition: ActuatorLinePointDrag.h:220
~ActuatorLinePointDragInfo()
Definition: ActuatorLinePointDrag.C:68
stk::mesh::Ghosting * actuatorLineGhosting_
Definition: ActuatorLinePointDrag.h:187
std::vector< double > isoParCoords_
Definition: ActuatorLinePointDrag.h:53
double radius_
Definition: ActuatorLinePointDrag.h:44
double bestX_
Definition: ActuatorLinePointDrag.h:47
Definition: NaluParsing.h:38
std::vector< std::string > searchTargetNames_
Definition: ActuatorLinePointDrag.h:210
const double pi_
Definition: ActuatorLinePointDrag.h:200
double twoSigSq_
Definition: ActuatorLinePointDrag.h:30
double omega_
Definition: ActuatorLinePointDrag.h:45
std::string turbineName_
Definition: ActuatorLinePointDrag.h:27
std::vector< ActuatorLinePointDragInfo * > actuatorLineInfo_
Definition: ActuatorLinePointDrag.h:213
Definition: Actuator.h:47
std::map< size_t, ActuatorLinePointDragPointInfo * > actuatorLinePointInfoMap_
Definition: ActuatorLinePointDrag.h:216
std::vector< stk::mesh::Entity > elementVec_
Definition: ActuatorLinePointDrag.h:54
Point centroidCoords_
Definition: ActuatorLinePointDrag.h:43
Tpetra::Map< LocalOrdinal, GlobalOrdinal >::node_type Node
Definition: LinearSolver.h:32
std::vector< double > ws_coordinates_
Definition: ActuatorLinePointDrag.h:219
ActuatorLinePointDragInfo()
Definition: ActuatorLinePointDrag.C:54
Coordinates coordinates_
Definition: ActuatorLinePointDrag.h:33
uint64_t needToGhostCount_
Definition: ActuatorLinePointDrag.h:190
Definition: Realm.h:82
double omega_
Definition: ActuatorLinePointDrag.h:29
stk::search::SearchMethod searchMethod_
Definition: ActuatorLinePointDrag.h:184
bool actuatorLineMotion_
Definition: ActuatorLinePointDrag.h:197
double twoSigSq_
Definition: ActuatorLinePointDrag.h:46