XGCa
solvers.hpp
Go to the documentation of this file.
1 #ifndef SOLVERS_HPP
2 #define SOLVERS_HPP
3 
4 #include "plasma.hpp"
5 #include "electric_field.hpp"
6 #include "perturbed_B_field.hpp"
7 #include "charge.hpp"
8 #include "sml.hpp"
9 #include "solver_settings.hpp"
10 #include "step_trigger.hpp"
11 #include "simple00_solver.hpp"
12 #include "bias_potential.hpp"
13 #include "solver.hpp"
14 
15 class Solvers{
17  // If true, an adiabatic wall condition is used (no polarization, n_i=0, n_e!=0)
18  // in the axisymmetric solver; this is an experimental option and should
19  // be used together with sml_sheath_mode=1 and sml_sheath_init_pot_factor=0.
25  bool use_pade;
26 
27  // Simple 00
29 
30  // Bias potential
32 
33 
35 
36  public:
37 
38  std::unique_ptr<Solver> axisym_poisson;
39  std::unique_ptr<Solver> turb_poisson;
40  std::unique_ptr<Solver> ampere;
41  std::unique_ptr<Solver> ampere_cv;
42 
43  Solvers(){}
44 
46 
48 
49 
50  // Poisson axisym
51 
52  View<double*,CLayout,DeviceType> get_initial_guess_axisym(const Simulation<DeviceType>& sml, const Grid<DeviceType>& grid, const View<double*,CLayout,DeviceType>& cden00_1d) const;
53 
54  View<double*,CLayout,HostType> solve_for_E(const Simulation<DeviceType>& sml, const DomainDecomposition<DeviceType>& pol_decomp, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid, Plasma& plasma, Smoothing& smoothing, const Charges& charges, SolverSetting solver_setting) const;
55 
56  void solve_poisson_axisym(const Simulation<DeviceType>& sml, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, Smoothing& smoothing, Plasma& plasma, const Charges& charges, SolverSetting solver_setting, ElectricField<DeviceType>& electric_field) const;
57 
58  // Poisson turb
59  void solve_poisson_turb(const Simulation<DeviceType>& sml, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, Smoothing& smoothing, Plasma& plasma, const Charges& charges, int ipc, SolverSetting solver_setting, const ElectricField<DeviceType>& electric_field, const PerturbedBField<DeviceType>& perturbed_B_field) const;
60 
61  void solve(const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, const MagneticField<DeviceType>& magnetic_field, Smoothing& smoothing, const View<double*,CLayout,HostType>& rhs, const View<double*,CLayout,HostType>& dpot_double) const;
62 
63 
64  // Ampere
65  void solve_ampere(const Simulation<DeviceType>& sml, const MagneticField<DeviceType>& magnetic_field, const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, Plasma& plasma, const Charges& charges, Smoothing& smoothing, int ipc, bool is_cv_solve, ElectricField<DeviceType> &electric_field, const PerturbedBField<DeviceType>& perturbed_B_field) const;
66 
67  void solve(const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, const MagneticField<DeviceType>& magnetic_field, Smoothing& smoothing, const View<double*,CLayout,HostType>& rhs, const View<double*,CLayout,HostType>& rhs2, const View<double*,CLayout,HostType>& dpot_double, bool is_cv_solve) const;
68 
69  void control_variate(int ipc, Simulation<DeviceType> &sml, const Grid<DeviceType> &grid,
71  Charges& charges, Plasma& plasma,
72  const VelocityGrid& vgrid, const DomainDecomposition<DeviceType>& pol_decomp,
73  Smoothing& smoothing, const PerturbedBField<DeviceType>& perturbed_B_field) const;
74 
75  // General
76  void solve_algorithm(int ipc, Simulation<DeviceType> &sml, const Grid<DeviceType> &grid,
78  Charges& charges, Plasma& plasma,
79  const VelocityGrid& vgrid, const DomainDecomposition<DeviceType>& pol_decomp,
80  Smoothing& smoothing, const PerturbedBField<DeviceType>& perturbed_B_field) const;
81 
82  void solve_for_fields(int ipc, Simulation<DeviceType> &sml, const Grid<DeviceType> &grid,
84  Charges& charges, Plasma& plasma,
85  const VelocityGrid& vgrid, const DomainDecomposition<DeviceType>& pol_decomp,
86  Smoothing& smoothing, const PerturbedBField<DeviceType>& perturbed_B_field) const;
87 };
88 
89 #endif
Definition: bias_potential.hpp:7
Definition: magnetic_field.hpp:12
Definition: NamelistReader.hpp:199
Definition: perturbed_B_field.hpp:12
Definition: plasma.hpp:13
Definition: simple00_solver.hpp:7
Definition: sml.hpp:10
Definition: solvers.hpp:15
bool heuristic_priv_pot
Definition: solvers.hpp:20
std::unique_ptr< Solver > ampere
Definition: solvers.hpp:40
void solve_for_fields(int ipc, Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, ElectricField< DeviceType > &electric_field, Charges &charges, Plasma &plasma, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, Smoothing &smoothing, const PerturbedBField< DeviceType > &perturbed_B_field) const
Definition: solve_algorithm.cpp:170
std::unique_ptr< Solver > turb_poisson
Definition: solvers.hpp:39
std::unique_ptr< Solver > axisym_poisson
Definition: solvers.hpp:38
Solvers()
Definition: solvers.hpp:43
bool poisson_0m_full_geo
Definition: solvers.hpp:22
void solve_algorithm(int ipc, Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, ElectricField< DeviceType > &electric_field, Charges &charges, Plasma &plasma, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, Smoothing &smoothing, const PerturbedBField< DeviceType > &perturbed_B_field) const
Definition: solve_algorithm.cpp:105
Simple00Solver simple00
Definition: solvers.hpp:28
void solve_poisson_turb(const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Smoothing &smoothing, Plasma &plasma, const Charges &charges, int ipc, SolverSetting solver_setting, const ElectricField< DeviceType > &electric_field, const PerturbedBField< DeviceType > &perturbed_B_field) const
Definition: solve_poisson_turb.cpp:255
void solve_ampere(const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Plasma &plasma, const Charges &charges, Smoothing &smoothing, int ipc, bool is_cv_solve, ElectricField< DeviceType > &electric_field, const PerturbedBField< DeviceType > &perturbed_B_field) const
Definition: solve_ampere.cpp:206
void init_solvers(const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, Plasma &plasma)
Definition: solvers.cpp:9
BiasPotential bias_potential
Definition: solvers.hpp:31
void control_variate(int ipc, Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, ElectricField< DeviceType > &electric_field, Charges &charges, Plasma &plasma, const VelocityGrid &vgrid, const DomainDecomposition< DeviceType > &pol_decomp, Smoothing &smoothing, const PerturbedBField< DeviceType > &perturbed_B_field) const
Definition: solve_algorithm.cpp:73
View< double *, CLayout, DeviceType > get_initial_guess_axisym(const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const View< double *, CLayout, DeviceType > &cden00_1d) const
Definition: solve_poisson_axisym.cpp:46
bool use_pade
Use Pade approximation for short wavelengths.
Definition: solvers.hpp:25
void solve_poisson_axisym(const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Smoothing &smoothing, Plasma &plasma, const Charges &charges, SolverSetting solver_setting, ElectricField< DeviceType > &electric_field) const
Definition: solve_poisson_axisym.cpp:440
std::unique_ptr< Solver > ampere_cv
Definition: solvers.hpp:41
bool poisson_use_bc
(XGCa only) False: 00-bc is phi=0 everywhere; true: 00-boundary
Definition: solvers.hpp:23
void update(const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, Plasma &plasma)
Definition: solvers.cpp:57
bool helmholtz_spectral
Whether to solve Helmholtz-type equations with toroidally spectral solver.
Definition: solvers.hpp:24
bool poisson_adia_wall
EXPERIMENTAL! DON'T USE UNLESS ADVISED BY AN EXPERT.
Definition: solvers.hpp:16
void solve(const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, Smoothing &smoothing, const View< double *, CLayout, HostType > &rhs, const View< double *, CLayout, HostType > &dpot_double) const
Definition: solve.cpp:13
View< double *, CLayout, HostType > solve_for_E(const Simulation< DeviceType > &sml, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, Plasma &plasma, Smoothing &smoothing, const Charges &charges, SolverSetting solver_setting) const
Definition: solve_poisson_axisym.cpp:287
Definition: magnetic_field.F90:1
subroutine plasma(grid, itr, p, dene_out, deni_out, Te_out, Ti_out, Vparai_out, ignore_vacuum)
Calculate the plasma density, temperature, and parallel velocity for a point in triangle itr using pl...
Definition: neutral_totalf.F90:1541
SolverSetting
Definition: solver_settings.hpp:4
Definition: charge.hpp:66
Definition: electric_field.hpp:76
Definition: smoothing.hpp:10
Definition: velocity_grid.hpp:8