VertexCFD  0.0-dev
VertexCFD_Closure_RADLocalTimeStepSize.hpp
1 #ifndef VERTEXCFD_CLOSURE_RADLOCALTIMESTEPSIZE_HPP
2 #define VERTEXCFD_CLOSURE_RADLOCALTIMESTEPSIZE_HPP
3 
4 #include "rad_solver/species_properties/VertexCFD_ConstantSpeciesProperties.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 // Compute local time step size based on the mesh size and maximum eigenvalue.
22 // The time step size used by the solver and based on the CFL condition is
23 // computed in the observer
24 // 'VertexCFD_TempusTimeStepControl_GlobalCFL_impl.hpp'
25 //---------------------------------------------------------------------------//
26 template<class EvalType, class Traits, int NumSpaceDim>
27 class RADLocalTimeStepSize : public panzer::EvaluatorWithBaseImpl<Traits>,
28  public PHX::EvaluatorDerived<EvalType, Traits>
29 {
30  public:
31  using scalar_type = typename EvalType::ScalarT;
32  static constexpr int num_space_dim = NumSpaceDim;
33 
35  const panzer::IntegrationRule& ir,
37  const std::string& neutron_flux_name);
38 
39  void evaluateFields(typename Traits::EvalData d) override;
40 
41  KOKKOS_INLINE_FUNCTION
42  void operator()(
43  const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team) const;
44 
45  private:
46  int _num_species;
47 
48  public:
49  PHX::MDField<scalar_type, panzer::Cell, panzer::Point> _local_dt;
50 
51  private:
52  PHX::MDField<const double, panzer::Cell, panzer::Point, panzer::Dim>
53  _element_length;
54  PHX::MDField<const scalar_type, panzer::Cell, panzer::Point> _neutron_flux;
55  Kokkos::View<double**, Kokkos::LayoutLeft, PHX::mem_space> _bateman_matrix;
56  Kokkos::View<double**, Kokkos::LayoutLeft, PHX::mem_space> _mic_cross_section;
57  Kokkos::Array<PHX::MDField<const scalar_type, panzer::Cell, panzer::Point>,
58  num_space_dim>
59  _velocity;
60 
61  bool _build_bateman;
62  bool _build_transmutation;
63  bool _build_advection;
64  bool _build_diffusion;
65  double _nu;
66 
67  enum TmpVars
68  {
69  LOCAL_DT_BATEMAN,
70  LOCAL_DT_TRANSMUT,
71  LOCAL_DT_ADV,
72  LOCAL_DT_DIF,
73  NUM_TMPS
74  };
75 
77  using scratch_view
78  = Kokkos::View<scalar_type**,
79  typename PHX::DevLayout<scalar_type>::type,
80  typename PHX::exec_space::scratch_memory_space,
81  Kokkos::MemoryUnmanaged>;
82 };
83 
84 //---------------------------------------------------------------------------//
85 
86 } // end namespace ClosureModel
87 } // end namespace VertexCFD
88 
89 #endif // end VERTEXCFD_CLOSURE_RADLOCALTIMESTEPSIZE_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::SpeciesProperties::ConstantSpeciesProperties
Definition: VertexCFD_ConstantSpeciesProperties.hpp:17
VertexCFD::ClosureModel::RADLocalTimeStepSize
Definition: VertexCFD_Closure_RADLocalTimeStepSize.hpp:29