XGCa
Public Member Functions | Public Attributes | Private Attributes | List of all members
PerturbedBField< Device > Class Template Reference

#include <perturbed_B_field.hpp>

Collaboration diagram for PerturbedBField< Device >:
Collaboration graph
[legend]

Public Member Functions

 PerturbedBField (NLReader::NamelistReader &nlr, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const Smoothing &smoothing, bool explicit_em)
 
 PerturbedBField ()
 
void initialize (NLReader::NamelistReader &nlr, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const Smoothing &smoothing, bool explicit_em)
 
void read_3db_xgc_mesh (const std::string &input_dir, const std::string &filename, const Grid< DeviceType > &grid)
 
void copy_bfield_from_fortran () const
 
void copy_to_device_if_on (int gstep)
 
void save_Ah (const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &Ah) const
 
void replace_B_grad_phi (const View< double **, CLayout, HostType > &view, int gstep, double dt) const
 
void ramp_up_As (int ipc, int gstep, double dt, double dt_full, const View< double *, CLayout, HostType > &As_local)
 
void update_rampup_and_write (bool explicit_electromagnetic, int gstep, double time)
 
void set_to_As_vac (const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &As) const
 
void subtract_As_vac_fac (const View< double *, CLayout, HostType > &rhs2) const
 
void save_rhs_poisson (int iflag, int ipc, bool em_es_step, const View< double *, CLayout, HostType > &rhs) const
 
void save_rhs_ampere (const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Plasma &plasma, const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &dpot_h, const View< double *, CLayout, HostType > &rhs, int ipc) const
 
void write_checkpoint_files (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const XGC_IO_Stream &stream) const
 
void read_checkpoint_files (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const XGC_IO_Stream &stream, const XGC_IO_Stream &em_stream)
 
KOKKOS_INLINE_FUNCTION bool is_triggered (int gstep) const
 
KOKKOS_INLINE_FUNCTION bool rampup_is_triggered (int gstep) const
 
template<Order OT>
KOKKOS_INLINE_FUNCTION void get_delta_b (const Grid< Device > &grid, const Simd< double > &phi, const SimdGridWeights< OT, PhiInterpType::None > &grid_wts, SimdVector &tdb) const
 
void read_3db_xgc_mesh (const std::string &input_dir, const std::string &filename, const Grid< DeviceType > &grid)
 
void initialize (NLReader::NamelistReader &nlr, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const Smoothing &smoothing, bool explicit_em)
 
void save_Ah (const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &Ah) const
 
void replace_B_grad_phi (const View< double **, CLayout, HostType > &view, int gstep, double dt) const
 
void update_rampup_and_write (bool explicit_electromagnetic, int gstep, double time)
 
void ramp_up_As (int ipc, int gstep, double dt, double dt_full, const View< double *, CLayout, HostType > &As_local)
 
void set_to_As_vac (const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &As) const
 
void subtract_As_vac_fac (const View< double *, CLayout, HostType > &rhs2) const
 
void save_rhs_poisson (int iflag, int ipc, bool em_es_step, const View< double *, CLayout, HostType > &rhs) const
 
void save_rhs_ampere (const Simulation< DeviceType > &sml, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Plasma &plasma, const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &dpot_h, const View< double *, CLayout, HostType > &rhs, int ipc) const
 
void write_checkpoint_files (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const XGC_IO_Stream &stream) const
 
void read_checkpoint_files (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const XGC_IO_Stream &stream, const XGC_IO_Stream &em_stream)
 
 PerturbedBField (NLReader::NamelistReader &nlr, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticField< DeviceType > &magnetic_field, const Grid< DeviceType > &grid, const Smoothing &smoothing, bool explicit_em)
 

Public Attributes

bool rampup_vac
 (.true.) Ramp up perturbed field slowly, (.false.) turn on perturbed field abruptly More...
 
int num_ntor
 Number of toroidal mode numbers (<= sml_nphi_total) More...
 
int rampup_time
 Number of time steps over which the perturbed field is ramped up. More...
 
int start_time
 Time step in which perturbed field is switched on. More...
 
int mode
 Mode of RMP operation (details in XGC_core/module_ptb_3db.F90 --> ptb_3db_mode) More...
 
bool full_spec_on
 whether to retain the full RMP spectrum from M3D-C1 or only |m/q-n|<=sml_mode_select_mres_q ; Always on for ES More...
 
double rampup_fac
 The current relative amplitude of the vacuum vector potential (if ptb_3db_mode==2) - this is updated during the simulation. More...
 
double rampup_fac0
 The previous (backup) relative amplitude of the vacuum vector potential (if ptb_3db_mode==2) More...
 
int dasdt_opt
 Selector for how to compute dAs/dt for RMP penetration. More...
 
int mstep_es
 
int mstep_em
 
int es_to_em_dt_ratio
 Ratio of EM to ES time step size in RMP penetration calculation. More...
 
bool active
 Whether the field is in device memory and should be used in the push etc. Could be renamed for clarity. More...
 
View< int *, CLayout, Device > ntor
 Array to store the toroidal mode numbers. More...
 
View< Field< VarType::Vector, PhiInterpType::None > **, CLayout, Device > bfield_im_vac
 perturbed vacuum field on XGC mesh, imaginary part More...
 
View< Field< VarType::Vector, PhiInterpType::None > **, CLayout, Device > bfield_re_vac
 perturbed vacuum field on XGC mesh, real part, dimensions: (grid vertex, R-Z-phi components, tor. mode number) More...
 

Private Attributes

View< double **, CLayout, HostTypejpar0
 
View< double ***, CLayout, HostTypecden0
 
View< double **, CLayout, HostTypeAs_vac
 
View< double ***, CLayout, HostTypeAh_rmp
 

Constructor & Destructor Documentation

◆ PerturbedBField() [1/3]

template<class Device >
PerturbedBField< Device >::PerturbedBField ( NLReader::NamelistReader nlr,
const DomainDecomposition< DeviceType > &  pol_decomp,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const Smoothing smoothing,
bool  explicit_em 
)

◆ PerturbedBField() [2/3]

template<class Device >
PerturbedBField< Device >::PerturbedBField ( )
inline

◆ PerturbedBField() [3/3]

PerturbedBField< DeviceType >::PerturbedBField ( NLReader::NamelistReader nlr,
const DomainDecomposition< DeviceType > &  pol_decomp,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const Smoothing smoothing,
bool  explicit_em 
)

Constructor for perturbed magnetic field class

< Selector for how to compute dAs/dt for RMP penetration

Here is the call graph for this function:

Member Function Documentation

◆ copy_bfield_from_fortran()

template<class Device >
void PerturbedBField< Device >::copy_bfield_from_fortran ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_to_device_if_on()

template<class Device >
void PerturbedBField< Device >::copy_to_device_if_on ( int  gstep)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_delta_b()

template<class Device >
template<Order OT>
KOKKOS_INLINE_FUNCTION void PerturbedBField< Device >::get_delta_b ( const Grid< Device > &  grid,
const Simd< double > &  phi,
const SimdGridWeights< OT, PhiInterpType::None > &  grid_wts,
SimdVector tdb 
) const

Get magnetic field perturbation vector for a vector of particle locations

Parameters
[in]gridThe grid object
[in]phiPhi coordinate
[in]grid_wtsTriangle the particles are in
[out]tdbMagnetic field perturbation vector
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize() [1/2]

void PerturbedBField< DeviceType >::initialize ( NLReader::NamelistReader nlr,
const DomainDecomposition< DeviceType > &  pol_decomp,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const Smoothing smoothing,
bool  explicit_em 
)

< Inner boundary of RMP representation in A_s

< Outer boundary of RMP representation in A_s

< Blending width between A_s and full A representation

Here is the call graph for this function:

◆ initialize() [2/2]

template<class Device >
void PerturbedBField< Device >::initialize ( NLReader::NamelistReader nlr,
const DomainDecomposition< DeviceType > &  pol_decomp,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const Smoothing smoothing,
bool  explicit_em 
)
Here is the caller graph for this function:

◆ is_triggered()

template<class Device >
KOKKOS_INLINE_FUNCTION bool PerturbedBField< Device >::is_triggered ( int  gstep) const
Here is the caller graph for this function:

◆ ramp_up_As() [1/2]

void PerturbedBField< DeviceType >::ramp_up_As ( int  ipc,
int  gstep,
double  dt,
double  dt_full,
const View< double *, CLayout, HostType > &  As_local 
)
Here is the call graph for this function:

◆ ramp_up_As() [2/2]

template<class Device >
void PerturbedBField< Device >::ramp_up_As ( int  ipc,
int  gstep,
double  dt,
double  dt_full,
const View< double *, CLayout, HostType > &  As_local 
)
Here is the caller graph for this function:

◆ rampup_is_triggered()

template<class Device >
KOKKOS_INLINE_FUNCTION bool PerturbedBField< Device >::rampup_is_triggered ( int  gstep) const

◆ read_3db_xgc_mesh() [1/2]

void PerturbedBField< DeviceType >::read_3db_xgc_mesh ( const std::string &  input_dir,
const std::string &  filename,
const Grid< DeviceType > &  grid 
)
Here is the call graph for this function:

◆ read_3db_xgc_mesh() [2/2]

template<class Device >
void PerturbedBField< Device >::read_3db_xgc_mesh ( const std::string &  input_dir,
const std::string &  filename,
const Grid< DeviceType > &  grid 
)

◆ read_checkpoint_files() [1/2]

void PerturbedBField< DeviceType >::read_checkpoint_files ( const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
const XGC_IO_Stream stream,
const XGC_IO_Stream em_stream 
)
Here is the call graph for this function:

◆ read_checkpoint_files() [2/2]

template<class Device >
void PerturbedBField< Device >::read_checkpoint_files ( const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
const XGC_IO_Stream stream,
const XGC_IO_Stream em_stream 
)
Here is the caller graph for this function:

◆ replace_B_grad_phi() [1/2]

void PerturbedBField< DeviceType >::replace_B_grad_phi ( const View< double **, CLayout, HostType > &  view,
int  gstep,
double  dt 
) const
Here is the call graph for this function:

◆ replace_B_grad_phi() [2/2]

template<class Device >
void PerturbedBField< Device >::replace_B_grad_phi ( const View< double **, CLayout, HostType > &  view,
int  gstep,
double  dt 
) const
Here is the caller graph for this function:

◆ save_Ah() [1/2]

Here is the call graph for this function:

◆ save_Ah() [2/2]

template<class Device >
void PerturbedBField< Device >::save_Ah ( const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &  Ah) const
Here is the caller graph for this function:

◆ save_rhs_ampere() [1/2]

void PerturbedBField< DeviceType >::save_rhs_ampere ( const Simulation< DeviceType > &  sml,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
Plasma plasma,
const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &  dpot_h,
const View< double *, CLayout, HostType > &  rhs,
int  ipc 
) const
Here is the call graph for this function:

◆ save_rhs_ampere() [2/2]

template<class Device >
void PerturbedBField< Device >::save_rhs_ampere ( const Simulation< DeviceType > &  sml,
const MagneticField< DeviceType > &  magnetic_field,
const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
Plasma plasma,
const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &  dpot_h,
const View< double *, CLayout, HostType > &  rhs,
int  ipc 
) const
Here is the caller graph for this function:

◆ save_rhs_poisson() [1/2]

void PerturbedBField< DeviceType >::save_rhs_poisson ( int  iflag,
int  ipc,
bool  em_es_step,
const View< double *, CLayout, HostType > &  rhs 
) const
Here is the call graph for this function:

◆ save_rhs_poisson() [2/2]

template<class Device >
void PerturbedBField< Device >::save_rhs_poisson ( int  iflag,
int  ipc,
bool  em_es_step,
const View< double *, CLayout, HostType > &  rhs 
) const
Here is the caller graph for this function:

◆ set_to_As_vac() [1/2]

Here is the call graph for this function:

◆ set_to_As_vac() [2/2]

template<class Device >
void PerturbedBField< Device >::set_to_As_vac ( const GridField< HostType, VarType::Scalar, PhiInterpType::None, TorType::MultiplePlanes, KinType::DriftKin > &  As) const
Here is the caller graph for this function:

◆ subtract_As_vac_fac() [1/2]

void PerturbedBField< DeviceType >::subtract_As_vac_fac ( const View< double *, CLayout, HostType > &  rhs2) const
Here is the call graph for this function:

◆ subtract_As_vac_fac() [2/2]

template<class Device >
void PerturbedBField< Device >::subtract_As_vac_fac ( const View< double *, CLayout, HostType > &  rhs2) const
Here is the caller graph for this function:

◆ update_rampup_and_write() [1/2]

void PerturbedBField< DeviceType >::update_rampup_and_write ( bool  explicit_electromagnetic,
int  gstep,
double  time 
)
Here is the call graph for this function:

◆ update_rampup_and_write() [2/2]

template<class Device >
void PerturbedBField< Device >::update_rampup_and_write ( bool  explicit_electromagnetic,
int  gstep,
double  time 
)
Here is the caller graph for this function:

◆ write_checkpoint_files() [1/2]

void PerturbedBField< DeviceType >::write_checkpoint_files ( const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
const XGC_IO_Stream stream 
) const
Here is the call graph for this function:

◆ write_checkpoint_files() [2/2]

template<class Device >
void PerturbedBField< Device >::write_checkpoint_files ( const Grid< DeviceType > &  grid,
const DomainDecomposition< DeviceType > &  pol_decomp,
const XGC_IO_Stream stream 
) const
Here is the caller graph for this function:

Member Data Documentation

◆ active

template<class Device >
bool PerturbedBField< Device >::active

Whether the field is in device memory and should be used in the push etc. Could be renamed for clarity.

◆ Ah_rmp

template<class Device >
View<double***,CLayout,HostType> PerturbedBField< Device >::Ah_rmp
private

◆ As_vac

template<class Device >
View<double**,CLayout,HostType> PerturbedBField< Device >::As_vac
private

◆ bfield_im_vac

template<class Device >
View<Field<VarType::Vector,PhiInterpType::None>**,CLayout,Device> PerturbedBField< Device >::bfield_im_vac

perturbed vacuum field on XGC mesh, imaginary part

◆ bfield_re_vac

template<class Device >
View<Field<VarType::Vector,PhiInterpType::None>**,CLayout,Device> PerturbedBField< Device >::bfield_re_vac

perturbed vacuum field on XGC mesh, real part, dimensions: (grid vertex, R-Z-phi components, tor. mode number)

◆ cden0

template<class Device >
View<double***,CLayout,HostType> PerturbedBField< Device >::cden0
private

◆ dasdt_opt

template<class Device >
int PerturbedBField< Device >::dasdt_opt

Selector for how to compute dAs/dt for RMP penetration.

◆ es_to_em_dt_ratio

template<class Device >
int PerturbedBField< Device >::es_to_em_dt_ratio

Ratio of EM to ES time step size in RMP penetration calculation.

◆ full_spec_on

template<class Device >
bool PerturbedBField< Device >::full_spec_on

whether to retain the full RMP spectrum from M3D-C1 or only |m/q-n|<=sml_mode_select_mres_q ; Always on for ES

◆ jpar0

template<class Device >
View<double**,CLayout,HostType> PerturbedBField< Device >::jpar0
private

◆ mode

template<class Device >
int PerturbedBField< Device >::mode

Mode of RMP operation (details in XGC_core/module_ptb_3db.F90 --> ptb_3db_mode)

◆ mstep_em

template<class Device >
int PerturbedBField< Device >::mstep_em

Number of electromagnetic time steps for RMP penetration calculation with damped Newton iteration

◆ mstep_es

template<class Device >
int PerturbedBField< Device >::mstep_es

Number of electrostatic time steps for RMP penetration calculation with damped Newton iteration

◆ ntor

template<class Device >
View<int*,CLayout,Device> PerturbedBField< Device >::ntor

Array to store the toroidal mode numbers.

◆ num_ntor

template<class Device >
int PerturbedBField< Device >::num_ntor

Number of toroidal mode numbers (<= sml_nphi_total)

◆ rampup_fac

template<class Device >
double PerturbedBField< Device >::rampup_fac

The current relative amplitude of the vacuum vector potential (if ptb_3db_mode==2) - this is updated during the simulation.

◆ rampup_fac0

template<class Device >
double PerturbedBField< Device >::rampup_fac0

The previous (backup) relative amplitude of the vacuum vector potential (if ptb_3db_mode==2)

◆ rampup_time

template<class Device >
int PerturbedBField< Device >::rampup_time

Number of time steps over which the perturbed field is ramped up.

◆ rampup_vac

template<class Device >
bool PerturbedBField< Device >::rampup_vac

(.true.) Ramp up perturbed field slowly, (.false.) turn on perturbed field abruptly

◆ start_time

template<class Device >
int PerturbedBField< Device >::start_time

Time step in which perturbed field is switched on.


The documentation for this class was generated from the following files: