XGCa
solver_ampere.hpp
Go to the documentation of this file.
1 #ifndef SOLVER_AMPERE_HPP
2 #define SOLVER_AMPERE_HPP
3 
4 #include "solver.hpp"
5 
6 class SolverAmpere : public Solver{
7 
8  double skin_norm;
9 
10  public:
11 
13 
14  SolverAmpere(NLReader::NamelistReader& nlr, bool is_XGCa, bool is_em, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid, std::string label_in, bool spectral_in, bool use_pade_in, bool update_solver, int update_solver_nstep)
15  : Solver(label_in, A, A_SPEC, spectral_in, 2, grid.ntriangle, use_pade_in, update_solver, update_solver_nstep)
16  {
17  TIMER("EXTEND_BOUNDARY",
18  setup_boundaries(nlr, is_XGCa, is_em, magnetic_field, grid) );
19 
20  if(is_rank_zero()){
21  write_solver_boundary(bd_rhs, "Efield_excluded_bnd.jbdH");
22  write_solver_boundary(bd, "Efield_excluded_bnd.AbdH");
23  }
24 
25  // skin term correction (finite sphere)
26  // note sml_flat_marker_cutoff1 (para) can in principle be different
27  // from sml_flat_marker_cutoff2 (perp)
28  nlr.use_namelist("sml_param");
29  em_mixed_variable = nlr.get<bool>("sml_em_mixed_variable",true);
30  double v_para_cutoff = nlr.get<double>("sml_flat_marker_cutoff1", 4.0);
31  skin_norm = std::erf(v_para_cutoff) - (1.0 + v_para_cutoff*v_para_cutoff*2.0/3.0)*2.0/sqrt(PI)*v_para_cutoff*exp(-v_para_cutoff*v_para_cutoff);
32  }
33 
34  void lhs_set_alpha_beta(const SolverInitData<HostType>& solver_data, const View<double*,CLayout,HostType>& alpha, const View<double*,CLayout,HostType>& beta, double& scale) override;
35  void rhs2_set_alpha_beta(const SolverInitData<HostType>& solver_data, double scale, const View<double*,CLayout,HostType>& alpha, const View<double*,CLayout,HostType>& beta) override;
36 
37  void setup_boundaries(NLReader::NamelistReader& nlr, bool is_XGCa, bool explicit_electromagnetic, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid);
38 };
39 
40 #endif
Definition: magnetic_field.hpp:12
Definition: NamelistReader.hpp:199
T get(const string &param, const T default_val, int val_ind=0)
Definition: NamelistReader.hpp:392
void use_namelist(const string &namelist, Options required=Required)
Definition: NamelistReader.hpp:366
Definition: solver_ampere.hpp:6
void rhs2_set_alpha_beta(const SolverInitData< HostType > &solver_data, double scale, const View< double *, CLayout, HostType > &alpha, const View< double *, CLayout, HostType > &beta) override
Definition: solver_ampere.cpp:34
SolverAmpere(NLReader::NamelistReader &nlr, bool is_XGCa, bool is_em, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, std::string label_in, bool spectral_in, bool use_pade_in, bool update_solver, int update_solver_nstep)
Definition: solver_ampere.hpp:14
void lhs_set_alpha_beta(const SolverInitData< HostType > &solver_data, const View< double *, CLayout, HostType > &alpha, const View< double *, CLayout, HostType > &beta, double &scale) override
Definition: solver_ampere.cpp:5
void setup_boundaries(NLReader::NamelistReader &nlr, bool is_XGCa, bool explicit_electromagnetic, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid)
Definition: solver_ampere.cpp:48
double skin_norm
Definition: solver_ampere.hpp:8
bool em_mixed_variable
Definition: solver_ampere.hpp:12
Definition: solver.hpp:17
Boundary bd
Definition: solver.hpp:36
@ A
Definition: solver.hpp:21
@ A_SPEC
Definition: solver.hpp:21
Boundary bd_rhs
Definition: solver.hpp:35
constexpr double PI
Definition: constants.hpp:9
bool is_rank_zero()
Definition: globals.hpp:28
Definition: magnetic_field.F90:1
void write_solver_boundary(const Boundary &excluded_boundary, std::string filename)
Definition: setup_solver_boundaries.cpp:3
Definition: solver_init_data.hpp:9
#define TIMER(N, F)
Definition: timer_macro.hpp:24