VertexCFD  0.0-dev
VertexCFD_Closure_ExternalMagneticField.hpp
1 #ifndef VERTEXCFD_CLOSURE_EXTERNALMAGNETICFIELD_HPP
2 #define VERTEXCFD_CLOSURE_EXTERNALMAGNETICFIELD_HPP
3 
4 #include <Panzer_Dimension.hpp>
5 #include <Panzer_Evaluator_WithBaseImpl.hpp>
6 
7 #include <Phalanx_Evaluator_Derived.hpp>
8 #include <Phalanx_Evaluator_WithBaseImpl.hpp>
9 #include <Phalanx_FieldManager.hpp>
10 #include <Phalanx_config.hpp>
11 
12 #include <Kokkos_Core.hpp>
13 
14 #include <string>
15 
16 namespace VertexCFD
17 {
18 namespace ClosureModel
19 {
20 //---------------------------------------------------------------------------//
21 // External magnetic field.
22 //---------------------------------------------------------------------------//
23 template<class EvalType, class Traits>
24 class ExternalMagneticField : public panzer::EvaluatorWithBaseImpl<Traits>,
25  public PHX::EvaluatorDerived<EvalType, Traits>
26 {
27  public:
28  using scalar_type = typename EvalType::ScalarT;
29  static constexpr int field_size = 3;
30 
31  ExternalMagneticField(const panzer::IntegrationRule& ir,
32  const Teuchos::ParameterList& user_params);
33 
34  void postRegistrationSetup(typename Traits::SetupData sd,
35  PHX::FieldManager<Traits>& fm) override;
36 
37  void evaluateFields(typename Traits::EvalData workset) override;
38 
39  KOKKOS_INLINE_FUNCTION
40  void operator()(
41  const Kokkos::TeamPolicy<PHX::exec_space>::member_type& team) const;
42 
43  Kokkos::Array<PHX::MDField<scalar_type, panzer::Cell, panzer::Point>, field_size>
44  _ext_magn_field;
45 
46  private:
47  Kokkos::Array<double, field_size> _ext_magn_vct;
48  Kokkos::Array<double, field_size> _d_ext_magn_vct_dt;
49  double _toroidal_field_magn;
50  int _ir_degree;
51  int _ir_index;
52  double _time;
53 
54  enum ExtMagnType
55  {
56  constant,
57  toroidal
58  };
59 
60  ExtMagnType _ext_magn_type;
61  PHX::MDField<const double, panzer::Cell, panzer::Point, panzer::Dim> _ip_coords;
62 };
63 
64 //---------------------------------------------------------------------------//
65 
66 } // end namespace ClosureModel
67 } // end namespace VertexCFD
68 
69 #endif // end VERTEXCFD_CLOSURE_EXTERNALMAGNETICFIELD_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::ClosureModel::ExternalMagneticField
Definition: VertexCFD_Closure_ExternalMagneticField.hpp:26