VertexCFD  0.0-dev
VertexCFD_BoundaryState_AdiabaticWall_impl.hpp
1 #ifndef VERTEXCFD_BOUNDARYSTATE_ADIABATICWALL_IMPL_HPP
2 #define VERTEXCFD_BOUNDARYSTATE_ADIABATICWALL_IMPL_HPP
3 
4 #include <Panzer_HierarchicParallelism.hpp>
5 
6 #include <algorithm>
7 
8 namespace VertexCFD
9 {
10 namespace BoundaryCondition
11 {
12 //---------------------------------------------------------------------------//
13 template<class EvalType, class Traits>
14 AdiabaticWall<EvalType, Traits>::AdiabaticWall(const panzer::IntegrationRule& ir)
15  : _boundary_temperature("BOUNDARY_temperature", ir.dl_scalar)
16  , _boundary_grad_temperature("BOUNDARY_GRAD_temperature", ir.dl_vector)
17  , _temperature("temperature", ir.dl_scalar)
18  , _grad_temperature("GRAD_temperature", ir.dl_vector)
19  , _normals("Side Normal", ir.dl_vector)
20 {
21  // Evaluated fields
22  this->addEvaluatedField(_boundary_temperature);
23  this->addEvaluatedField(_boundary_grad_temperature);
24 
25  // Dependent fields
26  this->addDependentField(_temperature);
27  this->addDependentField(_grad_temperature);
28  this->addDependentField(_normals);
29 
30  // Closure model names
31  this->setName("Boundary State Adiabatic Wall");
32 }
33 
34 //---------------------------------------------------------------------------//
35 template<class EvalType, class Traits>
37  typename Traits::EvalData workset)
38 {
39  auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
40  workset.num_cells);
41  Kokkos::parallel_for(this->getName(), policy, *this);
42 }
43 
44 //---------------------------------------------------------------------------//
45 template<class EvalType, class Traits>
46 KOKKOS_INLINE_FUNCTION void AdiabaticWall<EvalType, Traits>::operator()(
47  const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team) const
48 {
49  const int cell = team.league_rank();
50  const int num_point = _boundary_temperature.extent(1);
51  const int num_grad_dim = _boundary_grad_temperature.extent(2);
52 
53  Kokkos::parallel_for(
54  Kokkos::TeamThreadRange(team, 0, num_point), [&](const int point) {
55  _boundary_temperature(cell, point) = _temperature(cell, point);
56 
57  for (int d = 0; d < num_grad_dim; ++d)
58  {
59  _boundary_grad_temperature(cell, point, d)
60  = _grad_temperature(cell, point, d);
61  for (int dim = 0; dim < num_grad_dim; ++dim)
62  {
63  _boundary_grad_temperature(cell, point, d)
64  -= (_grad_temperature(cell, point, dim)
65  * _normals(cell, point, dim))
66  * _normals(cell, point, d);
67  }
68  }
69  });
70 }
71 
72 //---------------------------------------------------------------------------//
73 
74 } // end namespace BoundaryCondition
75 } // end namespace VertexCFD
76 
77 #endif // VERTEXCFD_BOUNDARYSTATE_ADIABATICWALL_IMPL_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::BoundaryCondition::AdiabaticWall::_boundary_temperature
PHX::MDField< scalar_type, panzer::Cell, panzer::Point > _boundary_temperature
Evaluated field: temperature prescribed on the boundary.
Definition: VertexCFD_BoundaryState_AdiabaticWall.hpp:74
VertexCFD::BoundaryCondition::AdiabaticWall::evaluateFields
void evaluateFields(typename Traits::EvalData workset) override
Evaluate the fields for a given workset.
Definition: VertexCFD_BoundaryState_AdiabaticWall_impl.hpp:36
VertexCFD::BoundaryCondition::AdiabaticWall::AdiabaticWall
AdiabaticWall(const panzer::IntegrationRule &ir)
Constructor.
Definition: VertexCFD_BoundaryState_AdiabaticWall_impl.hpp:14
VertexCFD::BoundaryCondition::AdiabaticWall::_boundary_grad_temperature
PHX::MDField< scalar_type, panzer::Cell, panzer::Point, panzer::Dim > _boundary_grad_temperature
Evaluated field: gradient of the boundary temperature.
Definition: VertexCFD_BoundaryState_AdiabaticWall.hpp:81
VertexCFD::BoundaryCondition::AdiabaticWall::operator()
KOKKOS_INLINE_FUNCTION void operator()(const Kokkos::TeamPolicy< PHX::exec_space >::member_type &team) const
Kokkos functor invoked for each team in a parallel region.
Definition: VertexCFD_BoundaryState_AdiabaticWall_impl.hpp:46
VertexCFD::BoundaryCondition::AdiabaticWall::scalar_type
typename EvalType::ScalarT scalar_type
Alias for the scalar type used by the evaluation.
Definition: VertexCFD_BoundaryState_AdiabaticWall.hpp:39