1 #ifndef VERTEXCFD_BOUNDARYSTATE_INCOMPRESSIBLEFREESLIP_IMPL_HPP
2 #define VERTEXCFD_BOUNDARYSTATE_INCOMPRESSIBLEFREESLIP_IMPL_HPP
4 #include "utils/VertexCFD_Utils_VectorField.hpp"
6 #include <Panzer_HierarchicParallelism.hpp>
10 namespace BoundaryCondition
13 template<
class EvalType,
class Traits,
int NumSpaceDim>
14 IncompressibleFreeSlip<EvalType, Traits, NumSpaceDim>::IncompressibleFreeSlip(
15 const panzer::IntegrationRule& ir,
16 const Teuchos::ParameterList& fluid_params,
18 : _boundary_lagrange_pressure(
"BOUNDARY_lagrange_pressure", ir.dl_scalar)
19 , _boundary_grad_lagrange_pressure(
"BOUNDARY_GRAD_lagrange_pressure",
21 , _boundary_temperature(
"BOUNDARY_temperature", ir.dl_scalar)
22 , _boundary_grad_temperature(
"BOUNDARY_GRAD_temperature", ir.dl_vector)
23 , _lagrange_pressure(
"lagrange_pressure", ir.dl_scalar)
24 , _grad_lagrange_pressure(
"GRAD_lagrange_pressure", ir.dl_vector)
25 , _temperature(
"temperature", ir.dl_scalar)
26 , _grad_temperature(
"GRAD_temperature", ir.dl_vector)
27 , _normals(
"Side Normal", ir.dl_vector)
28 , _solve_temp(fluid_params.get<bool>(
"Build Temperature Equation"))
31 this->addEvaluatedField(_boundary_lagrange_pressure);
33 this->addEvaluatedField(_boundary_grad_lagrange_pressure);
34 Utils::addEvaluatedVectorField(
35 *
this, ir.dl_scalar, _boundary_velocity,
"BOUNDARY_velocity_");
37 Utils::addEvaluatedVectorField(*
this,
39 _boundary_grad_velocity,
40 "BOUNDARY_GRAD_velocity_");
44 this->addDependentField(_temperature);
45 this->addEvaluatedField(_boundary_temperature);
46 this->addDependentField(_grad_temperature);
47 this->addEvaluatedField(_boundary_grad_temperature);
50 Utils::addDependentVectorField(*
this, ir.dl_scalar, _velocity,
"velocity_");
51 this->addDependentField(_lagrange_pressure);
53 this->addDependentField(_grad_lagrange_pressure);
55 this->addDependentField(_normals);
57 Utils::addDependentVectorField(
58 *
this, ir.dl_vector, _grad_velocity,
"GRAD_velocity_");
60 this->setName(
"Boundary State Incompressible Free Slip "
61 + std::to_string(num_space_dim) +
"D");
65 template<
class EvalType,
class Traits,
int NumSpaceDim>
66 void IncompressibleFreeSlip<EvalType, Traits, NumSpaceDim>::evaluateFields(
67 typename Traits::EvalData workset)
69 auto policy = panzer::HP::inst().teamPolicy<scalar_type, PHX::Device>(
71 Kokkos::parallel_for(this->getName(), policy, *
this);
75 template<
class EvalType,
class Traits,
int NumSpaceDim>
76 KOKKOS_INLINE_FUNCTION
void
77 IncompressibleFreeSlip<EvalType, Traits, NumSpaceDim>::operator()(
78 const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team)
const
80 const int cell = team.league_rank();
81 const int num_point = _lagrange_pressure.extent(1);
82 const int num_grad_dim = _normals.extent(2);
85 Kokkos::TeamThreadRange(team, 0, num_point), [&](
const int point) {
87 _boundary_lagrange_pressure(cell, point)
88 = _lagrange_pressure(cell, point);
91 scalar_type vel_dot_n = 0.0;
92 scalar_type grad_T_dot_n = 0.0;
93 for (
int dim = 0; dim < num_grad_dim; ++dim)
95 vel_dot_n += _velocity[dim](cell, point)
96 * _normals(cell, point, dim);
99 grad_T_dot_n += _grad_temperature(cell, point, dim)
100 * _normals(cell, point, dim);
105 _boundary_temperature(cell, point) = _temperature(cell, point);
108 for (
int dim = 0; dim < num_grad_dim; ++dim)
112 _boundary_grad_lagrange_pressure(cell, point, dim)
113 = _grad_lagrange_pressure(cell, point, dim);
116 _boundary_velocity[dim](cell, point)
117 = _velocity[dim](cell, point)
118 - vel_dot_n * _normals(cell, point, dim);
120 for (
int vel_dim = 0; vel_dim < num_space_dim; ++vel_dim)
122 _boundary_grad_velocity[vel_dim](cell, point, dim)
123 = _grad_velocity[vel_dim](cell, point, dim);
128 _boundary_grad_temperature(cell, point, dim)
129 = _grad_temperature(cell, point, dim)
130 - grad_T_dot_n * _normals(cell, point, dim);
141 #endif // VERTEXCFD_BOUNDARYSTATE_INCOMPRESSIBLEFREESLIP_IMPL_HPP