VertexCFD  0.0-dev
VertexCFD_FullInductionMHDProperties.hpp
1 #ifndef VERTEXCFD_FULLINDUCTIONMHDPROPERTIES_HPP
2 #define VERTEXCFD_FULLINDUCTIONMHDPROPERTIES_HPP
3 
4 #include <Teuchos_ParameterList.hpp>
5 
6 #include <Kokkos_Core.hpp>
7 
8 namespace VertexCFD
9 {
10 namespace MHDProperties
11 {
12 //---------------------------------------------------------------------------//
13 // Full induction MHD properties
14 //---------------------------------------------------------------------------//
15 
17 {
18  public:
19  FullInductionMHDProperties() = default;
20  explicit FullInductionMHDProperties(const Teuchos::ParameterList& mhd_params)
21  : _build_magn_corr(false)
22  , _build_resistive_flux(false)
23  , _variable_resistivity(false)
24  , _mu_0(1.0)
25  , _eta(std::numeric_limits<double>::quiet_NaN())
26  , _c_h(0.0)
27  {
28  if (mhd_params.isType<bool>("Build Magnetic Correction "
29  "Potential Equation"))
30  {
31  _build_magn_corr = mhd_params.get<bool>(
32  "Build Magnetic "
33  "Correction Potential "
34  "Equation");
35  }
36 
37  // Vacuum magnetic permeability
38  if (mhd_params.isType<double>("Vacuum Magnetic Permeability"))
39  {
40  _mu_0 = mhd_params.get<double>("Vacuum Magnetic Permeability");
41  }
42 
43  // Resistivity
44  if (mhd_params.isType<bool>("Build Resistive Flux"))
45  {
46  _build_resistive_flux
47  = mhd_params.get<bool>("Build Resistive Flux");
48  }
49 
50  if (_build_resistive_flux)
51  {
52  if (mhd_params.isType<bool>("Variable Resistivity"))
53  {
54  _variable_resistivity
55  = mhd_params.get<bool>("Variable Resistivity");
56  }
57  if (_variable_resistivity)
58  {
59  throw std::runtime_error(
60  "No closure models currently exist to evaluate variable "
61  "resistivity. Use a constant resistivity only.");
62  }
63  else
64  {
65  _eta = mhd_params.get<double>("Resistivity");
66  }
67  }
68 
69  // Divergence cleaning parameters
70  // Hyperbolic divergence cleaning speed
71  if (_build_magn_corr)
72  {
73  _c_h = mhd_params.get<double>(
74  "Hyperbolic Divergence Cleaning Speed");
75  }
76  // Magnetic correction potential equaiton damping factor
77  if (mhd_params.isType<double>("Magnetic Correction Damping Factor"))
78  {
79  _alpha
80  = mhd_params.get<double>("Magnetic Correction Damping Factor");
81  }
82  else
83  {
84  _alpha = _c_h / 0.18;
85  }
86  }
87 
88  // Build magnetic correction boolean
89  KOKKOS_INLINE_FUNCTION bool buildMagnCorr() const
90  {
91  return _build_magn_corr;
92  }
93 
94  // Build magnetic correction boolean
95  KOKKOS_INLINE_FUNCTION bool buildResistiveFlux() const
96  {
97  return _build_resistive_flux;
98  }
99 
100  // Variable resistivity boolean
101  KOKKOS_INLINE_FUNCTION bool variableResistivity() const
102  {
103  return _variable_resistivity;
104  }
105 
106  // Vacuum magnetic permeability
107  KOKKOS_INLINE_FUNCTION double vacuumMagneticPermeability() const
108  {
109  return _mu_0;
110  }
111 
112  // Constant resistivity
113  KOKKOS_INLINE_FUNCTION double resistivity() const { return _eta; }
114 
115  // Divergence cleaning speed
116  KOKKOS_INLINE_FUNCTION double hyperbolicDivergenceCleaningSpeed() const
117  {
118  return _c_h;
119  }
120 
121  // Magnetic correction damping factor
122  KOKKOS_INLINE_FUNCTION double magneticCorrectionDampingFactor() const
123  {
124  return _alpha;
125  }
126 
127  private:
128  bool _build_magn_corr;
129  bool _build_resistive_flux;
130  bool _variable_resistivity;
131  double _mu_0;
132  double _eta;
133  double _c_h;
134  double _alpha;
135 };
136 
137 } // namespace MHDProperties
138 } // namespace VertexCFD
139 
140 #endif // VERTEXCFD_FULLINDUCTIONMHDPROPERTIES_HPP
VertexCFD
Definition: tstMethodManufacturedSolutionBC.cpp:23
VertexCFD::MHDProperties::FullInductionMHDProperties
Definition: VertexCFD_FullInductionMHDProperties.hpp:17