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
MasterElementHO.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 #ifndef MasterElementHO_h
8 #define MasterElementHO_h
9 
13 
17 
18 #include <vector>
19 #include <array>
20 
21 
22 #ifdef __INTEL_COMPILER
23 #define POINTER_RESTRICT restrict
24 #else
25 #define POINTER_RESTRICT __restrict__
26 #endif
27 
28 namespace sierra{
29 namespace nalu{
30 
31  struct ContourData {
33  double weight;
34  };
35 
36 struct ElementDescription;
38 
39 class LagrangeBasis;
41 
42 class HigherOrderHexSCV final: public MasterElement
43 {
44 public:
46  ElementDescription elem,
47  LagrangeBasis basis,
48  TensorProductQuadratureRule quadrature);
49 
50  virtual ~HigherOrderHexSCV() {}
51 
52  void shape_fcn(double *shpfc) final;
53  const int * ipNodeMap(int ordinal = 0) final;
54 
55  void determinant(
56  const int nelem,
57  const double *coords,
58  double *volume,
59  double * error ) final;
60 
61  std::vector<double> shape_functions() {
62  return shapeFunctionVals_;
63  }
64 
65  std::vector<double> shape_function_derivatives() {
66  return shapeDerivs_;
67  }
68 
69  std::vector<double> ip_weights() {
70  return ipWeights_;
71  }
72 
73 
74 private:
75  void set_interior_info();
76 
77  double jacobian_determinant(
78  const double* POINTER_RESTRICT elemNodalCoords,
79  const double* POINTER_RESTRICT shapeDerivs ) const;
80 
84 
85  std::vector<double> shapeFunctionVals_;
86  std::vector<double> shapeDerivs_;
87  std::vector<double> ipWeights_;
88  std::vector<double> geoShapeDerivs_;
90 //
91 // Kokkos::View<double**> interpWeights_;
92 // Kokkos::View<double***> derivWeights_;
93 };
94 
95 // 3D Hex 27 subcontrol surface
96 class HigherOrderHexSCS final: public MasterElement
97 {
98 public:
100  ElementDescription elem,
101  LagrangeBasis basis,
102  TensorProductQuadratureRule quadrature);
103  virtual ~HigherOrderHexSCS() {}
104 
105  void shape_fcn(double *shpfc) final;
106 
107  void determinant(
108  const int nelem,
109  const double *coords,
110  double *areav,
111  double * error) final;
112 
113  void grad_op(
114  const int nelem,
115  const double *coords,
116  double *gradop,
117  double *deriv,
118  double *det_j,
119  double * error) final;
120 
121  void face_grad_op(
122  const int nelem,
123  const int face_ordinal,
124  const double *coords,
125  double *gradop,
126  double *det_j,
127  double * error) final;
128 
129  void gij(
130  const double *coords,
131  double *gupperij,
132  double *glowerij,
133  double *deriv) final;
134 
135  double isInElement(
136  const double *elemNodalCoord,
137  const double *pointCoord,
138  double *isoParCoord) final;
139 
140  void interpolatePoint(
141  const int &nComp,
142  const double *isoParCoord,
143  const double *field,
144  double *result) final;
145 
146  const int * adjacentNodes() final;
147 
148  const int * ipNodeMap(int ordinal = 0) final;
149 
150  const int * side_node_ordinals(int ordinal = 0) final;
151 
152  int opposingNodes(
153  const int ordinal, const int node) final;
154 
155  int opposingFace(
156  const int ordinal, const int node) final;
157 
158  std::vector<double> shape_functions() {
159  return shapeFunctionVals_;
160  }
161 
162  std::vector<double> shape_function_derivatives() {
163  return shapeDerivs_;
164  }
165 
166 
167 private:
168  void set_interior_info();
169  void set_boundary_info();
170 
171  template <Jacobian::Direction direction> void
172  area_vector(
173  const double *POINTER_RESTRICT elemNodalCoords,
174  double *POINTER_RESTRICT shapeDeriv,
175  double *POINTER_RESTRICT areaVector) const;
176 
177  void gradient(
178  const double* POINTER_RESTRICT elemNodalCoords,
179  const double* POINTER_RESTRICT shapeDeriv,
180  double* POINTER_RESTRICT grad,
181  double* POINTER_RESTRICT det_j ) const;
182 
183  void gradient(
184  const double* POINTER_RESTRICT elemNodalCoords,
185  const double* POINTER_RESTRICT geometricShapeDeriv,
186  const double* POINTER_RESTRICT shapeDeriv,
187  double* POINTER_RESTRICT grad,
188  double* POINTER_RESTRICT det_j ) const;
189 
193 
194  std::vector<double> shapeFunctionVals_;
195  std::vector<double> shapeDerivs_;
196  std::vector<double> expFaceShapeDerivs_;
197  std::vector<double> geometricShapeDerivs_;
199  std::vector<ContourData> ipInfo_;
201 };
202 
203 // 3D Quad 9
205 {
206 public:
208  ElementDescription elem,
209  LagrangeBasis basis,
210  TensorProductQuadratureRule quadrature);
211 
213 
214  void shape_fcn(double *shpfc) final;
215 
216  const int * ipNodeMap(int ordinal = 0);
217 
218  void determinant(
219  const int nelem,
220  const double *coords,
221  double *areav,
222  double * error );
223 
224  std::vector<double> shape_functions() {
225  return shapeFunctionVals_;
226  }
227 
228  std::vector<double> shape_function_derivatives() {
229  return shapeDerivs_;
230  }
231 
232  std::vector<double> ip_weights() {
233  return ipWeights_;
234  }
235 
236 private:
237  void set_interior_info();
238  void eval_shape_functions_at_ips();
239  void eval_shape_derivs_at_ips();
240 
241  void area_vector(
242  const double* POINTER_RESTRICT elemNodalCoords,
243  const double* POINTER_RESTRICT shapeDeriv,
244  std::array<double,3>& areaVector) const;
245 
249 
250  std::vector<double> shapeFunctionVals_;
251  std::vector<double> shapeDerivs_;
252  std::vector<double> ipWeights_;
254 };
255 
257 {
258 public:
260  ElementDescription elem,
261  LagrangeBasis basis,
262  TensorProductQuadratureRule quadrature);
264 
265  void shape_fcn(double *shpfc) final;
266 
267  const int * ipNodeMap(int ordinal = 0) final;
268 
269  void determinant(
270  const int nelem,
271  const double *coords,
272  double *volume,
273  double * error ) final;
274 
275  std::vector<double> shape_functions() {
276  return shapeFunctionVals_;
277  }
278 
279  std::vector<double> shape_function_derivatives() {
280  return shapeDerivs_;
281  }
282 
283  std::vector<double> ip_weights() {
284  return ipWeights_;
285  }
286 
287 private:
288  void set_interior_info();
289 
290  double jacobian_determinant(
291  const double* POINTER_RESTRICT elemNodalCoords,
292  const double* POINTER_RESTRICT shapeDerivs ) const;
293 
297 
298  std::vector<double> shapeFunctionVals_;
299  std::vector<double> shapeDerivs_;
300  std::vector<double> ipWeights_;
301  std::vector<double> geometricShapeDerivs_;
303 };
305 {
306 public:
308  ElementDescription elem,
309  LagrangeBasis basis,
310  TensorProductQuadratureRule quadrature);
312 
313  void shape_fcn(double *shpfc) final;
314 
315  void determinant(
316  const int nelem,
317  const double *coords,
318  double *areav,
319  double * error) final;
320 
321  void grad_op(
322  const int nelem,
323  const double *coords,
324  double *gradop,
325  double *deriv,
326  double *det_j,
327  double * error) final;
328 
329  void face_grad_op(
330  const int nelem,
331  const int face_ordinal,
332  const double *coords,
333  double *gradop,
334  double *det_j,
335  double * error) final;
336 
337  void gij(
338  const double *coords,
339  double *gupperij,
340  double *glowerij,
341  double *deriv) final;
342 
343  double isInElement(
344  const double *elemNodalCoord,
345  const double *pointCoord,
346  double *isoParCoord) final;
347 
348  void interpolatePoint(
349  const int &nComp,
350  const double *isoParCoord,
351  const double *field,
352  double *result) final;
353 
354  const int * adjacentNodes() final;
355 
356  const int * ipNodeMap(int ordinal = 0) final;
357 
358  int opposingNodes(
359  const int ordinal, const int node) final;
360 
361  int opposingFace(
362  const int ordinal, const int node) final;
363 
364  const int * side_node_ordinals(int ordinal = 0) final;
365 
366  std::vector<double> shape_functions() {
367  return shapeFunctionVals_;
368  }
369 
370  std::vector<double> shape_function_derivatives() {
371  return shapeDerivs_;
372  }
373 
374 private:
375  void set_interior_info();
376  void set_boundary_info();
377 
378  template <Jacobian::Direction direction> void
379  area_vector(
380  const double *POINTER_RESTRICT elemNodalCoords,
381  double *POINTER_RESTRICT shapeDeriv,
382  double *POINTER_RESTRICT normalVec ) const;
383 
384  void gradient(
385  const double* POINTER_RESTRICT elemNodalCoords,
386  const double* POINTER_RESTRICT shapeDeriv,
387  double* POINTER_RESTRICT grad,
388  double* POINTER_RESTRICT det_j) const;
389 
390  void gradient(
391  const double* POINTER_RESTRICT elemNodalCoords,
392  const double* POINTER_RESTRICT geometricShapeDeriv,
393  const double* POINTER_RESTRICT shapeDeriv,
394  double* POINTER_RESTRICT grad,
395  double* POINTER_RESTRICT det_j ) const;
396 
400 
401  std::vector<double> shapeFunctionVals_;
402  std::vector<double> shapeDerivs_;
403  std::vector<double> geometricShapeDerivs_;
405  std::vector<ContourData> ipInfo_;
407  std::vector<double> expFaceShapeDerivs_;
408 };
409 
411 {
412 public:
413  explicit HigherOrderEdge2DSCS(
414  ElementDescription elem,
415  LagrangeBasis basis,
416  TensorProductQuadratureRule quadrature);
418 
419  const int * ipNodeMap(int ordinal = 0) final;
420 
421  void determinant(
422  const int nelem,
423  const double *coords,
424  double *areav,
425  double * error ) final;
426 
427  void shape_fcn(
428  double *shpfc) final;
429 
430  std::vector<double> shape_functions() {
431  return shapeFunctionVals_;
432  }
433 
434  std::vector<double> shape_function_derivatives() {
435  return shapeDerivs_;
436  }
437 
438  std::vector<double> ip_weights() {
439  return ipWeights_;
440  }
441 
442 private:
443  void area_vector(
444  const double* POINTER_RESTRICT elemNodalCoords,
445  const double* POINTER_RESTRICT shapeDeriv,
446  std::array<double,2>& areaVector) const;
447 
451 
452  std::vector<double> shapeFunctionVals_;
453  std::vector<double> shapeDerivs_;
454  std::vector<double> ipWeights_;
455 };
456 
457 } // namespace nalu
458 } // namespace Sierra
459 
460 #endif
std::vector< ContourData > ipInfo_
Definition: MasterElementHO.h:405
double weight
Definition: MasterElementHO.h:33
Definition: ElementDescription.h:27
const ElementDescription elem_
Definition: MasterElementHO.h:397
std::vector< double > ip_weights()
Definition: MasterElementHO.h:438
Definition: MasterElementHO.h:410
std::vector< double > ipWeights_
Definition: MasterElementHO.h:454
int geoNodesPerElement_
Definition: MasterElementHO.h:89
const ElementDescription elem_
Definition: MasterElementHO.h:294
Definition: ABLForcingAlgorithm.C:26
Definition: MasterElement.h:53
LagrangeBasis basis_
Definition: MasterElementHO.h:295
virtual ~HigherOrderHexSCV()
Definition: MasterElementHO.h:50
virtual ~HigherOrderQuad2DSCV()
Definition: MasterElementHO.h:263
virtual ~HigherOrderQuad3DSCS()
Definition: MasterElementHO.h:212
std::vector< double > expFaceShapeDerivs_
Definition: MasterElementHO.h:407
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:401
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:279
int geometricNodesPerElement_
Definition: MasterElementHO.h:302
LagrangeBasis basis_
Definition: MasterElementHO.h:191
Definition: MasterElementHO.h:31
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:452
const ElementDescription elem_
Definition: MasterElementHO.h:448
#define POINTER_RESTRICT
Definition: MasterElementHO.h:25
Definition: MasterElementHO.h:256
LagrangeBasis basis_
Definition: MasterElementHO.h:449
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:250
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:296
int surfaceDimension_
Definition: MasterElementHO.h:253
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:402
std::vector< double > ipWeights_
Definition: MasterElementHO.h:300
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:450
std::vector< double > ip_weights()
Definition: MasterElementHO.h:283
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:370
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:195
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:192
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:248
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:65
Jacobian::Direction direction
Definition: MasterElementHO.h:32
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:83
std::vector< double > geometricShapeDerivs_
Definition: MasterElementHO.h:301
std::vector< double > ipWeights_
Definition: MasterElementHO.h:252
std::vector< double > shape_functions()
Definition: MasterElementHO.h:430
const ElementDescription elem_
Definition: MasterElementHO.h:81
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:434
Definition: LagrangeBasis.h:36
std::vector< ContourData > ipInfo_
Definition: MasterElementHO.h:199
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:85
Definition: MasterElementHO.h:304
std::vector< double > ip_weights()
Definition: MasterElementHO.h:69
virtual ~HigherOrderQuad2DSCS()
Definition: MasterElementHO.h:311
Definition: MasterElementHO.h:204
int ipsPerFace_
Definition: MasterElementHO.h:200
std::vector< double > shape_functions()
Definition: MasterElementHO.h:275
virtual ~HigherOrderEdge2DSCS()
Definition: MasterElementHO.h:417
int geometricNodesPerElement_
Definition: MasterElementHO.h:404
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:228
std::vector< double > ipWeights_
Definition: MasterElementHO.h:87
std::vector< double > geometricShapeDerivs_
Definition: MasterElementHO.h:197
Definition: MasterElementHO.h:96
LagrangeBasis basis_
Definition: MasterElementHO.h:398
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:298
const ElementDescription elem_
Definition: MasterElementHO.h:246
std::vector< double > shape_functions()
Definition: MasterElementHO.h:366
std::vector< double > expFaceShapeDerivs_
Definition: MasterElementHO.h:196
Definition: HexNElementDescription.h:20
Direction
Definition: MasterElement.h:40
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:299
const ElementDescription elem_
Definition: MasterElementHO.h:190
int ipsPerFace_
Definition: MasterElementHO.h:406
std::vector< double > shapeFunctionVals_
Definition: MasterElementHO.h:194
std::vector< double > shape_functions()
Definition: MasterElementHO.h:224
virtual ~HigherOrderHexSCS()
Definition: MasterElementHO.h:103
const TensorProductQuadratureRule quadrature_
Definition: MasterElementHO.h:399
std::vector< double > geoShapeDerivs_
Definition: MasterElementHO.h:88
std::vector< double > shape_functions()
Definition: MasterElementHO.h:158
std::vector< double > ip_weights()
Definition: MasterElementHO.h:232
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:86
int geometricNodesPerElement_
Definition: MasterElementHO.h:198
LagrangeBasis basis_
Definition: MasterElementHO.h:82
std::vector< double > shape_function_derivatives()
Definition: MasterElementHO.h:162
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:251
std::vector< double > geometricShapeDerivs_
Definition: MasterElementHO.h:403
std::vector< double > shape_functions()
Definition: MasterElementHO.h:61
Definition: TensorProductQuadratureRule.h:16
Definition: MasterElementHO.h:42
std::vector< double > shapeDerivs_
Definition: MasterElementHO.h:453
LagrangeBasis basis_
Definition: MasterElementHO.h:247