VertexCFD  0.0-dev
VertexCFD_Closure_WallDistance.hpp
1 #ifndef VERTEXCFD_CLOSURE_WALLDISTANCE_HPP
2 #define VERTEXCFD_CLOSURE_WALLDISTANCE_HPP
3 
4 #include "mesh/VertexCFD_Mesh_GeometryData.hpp"
5 
6 #include <Panzer_Dimension.hpp>
7 #include <Panzer_Evaluator_WithBaseImpl.hpp>
8 
9 #include <Phalanx_Evaluator_Derived.hpp>
10 #include <Phalanx_Evaluator_WithBaseImpl.hpp>
11 #include <Phalanx_FieldManager.hpp>
12 #include <Phalanx_config.hpp>
13 
14 #include <Kokkos_Core.hpp>
15 
16 namespace VertexCFD
17 {
18 namespace ClosureModel
19 {
20 //---------------------------------------------------------------------------//
21 // Wall Distance evaluator.
22 //---------------------------------------------------------------------------//
23 template<class EvalType, class Traits, int NumSpaceDim>
24 class WallDistance : public panzer::EvaluatorWithBaseImpl<Traits>,
25  public PHX::EvaluatorDerived<EvalType, Traits>
26 {
27  public:
28  struct EvaluateTag
29  {
30  };
32  {
33  };
34 
35  using scalar_type = typename EvalType::ScalarT;
36  static constexpr int num_space_dim = NumSpaceDim;
37 
38  WallDistance(const panzer::IntegrationRule& ir,
39  Teuchos::RCP<Mesh::Topology::SidesetGeometry> sideset_geometry);
40 
41  void postRegistrationSetup(typename Traits::SetupData sd,
42  PHX::FieldManager<Traits>& fm) override;
43 
44  void evaluateFields(typename Traits::EvalData workset) override;
45 
46  KOKKOS_INLINE_FUNCTION
47  void operator()(EvaluateTag, const int cell) const;
48 
49  KOKKOS_INLINE_FUNCTION
50  void operator()(RegistrationTag, const int cell) const;
51 
52  public:
53  // Panzer field for storing wall distance
54  PHX::MDField<scalar_type, panzer::Cell, panzer::Point> _distance;
55 
56  private:
57  // Integration rule cubature degree needed for getting integration point
58  // coordinates
59  double _ir_degree;
60 
61  // Integration rule index needed for getting integration point coordinates
62  double _ir_index;
63 
64  // number of worksets
65  int _number_worksets;
66 
67  // current workset, needed for accessing _distance_vector in
68  // PostRegistration Setup and EvaluateFields
69  std::size_t _current_workset = 0;
70 
71  // Field of the coordinates of the integration points
72  PHX::MDField<const double, panzer::Cell, panzer::Point, panzer::Dim> _ip_coords;
73 
74  unsigned _key;
75 
76  // View for storing the vector of global side data
77  Kokkos::View<double***, PHX::mem_space> _sides;
78 
79  // View for storing the distance field across all worksets
80  Kokkos::View<double***, PHX::mem_space> _distance_vector;
81 
82  // View for storing the surface normal of global sides
83  Kokkos::View<double**, PHX::mem_space> _normals;
84 
85  // Vector which stores the workset_id for each workset
86  std::vector<std::size_t> _workset_id;
87 };
88 
89 //---------------------------------------------------------------------------//
90 
91 } // end namespace ClosureModel
92 } // end namespace VertexCFD
93 
94 #endif // end VERTEXCFD_CLOSURE_WALLDISTANCE_HPP
VertexCFD::ClosureModel::WallDistance::EvaluateTag
Definition: VertexCFD_Closure_WallDistance.hpp:29
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::ClosureModel::WallDistance::RegistrationTag
Definition: VertexCFD_Closure_WallDistance.hpp:32
VertexCFD::ClosureModel::WallDistance
Definition: VertexCFD_Closure_WallDistance.hpp:26