Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Functions
mhd Namespace Reference

Namespace for MHD code. More...

Functions

__global__ void calculateMagneticDivergence (Real const *dev_conserved, Real *maxDivergence, Real const dx, Real const dy, Real const dz, int const nx, int const ny, int const nz, int const n_cells)
 Kernel to compute the maximum divergence of the magnetic field in the grid. Uses reduction_utilities::gridReduceMax and as such should be called with the minimum number of blocks. Recommend using the occupancy API.
 
Real checkMagneticDivergence (Grid3D const &G)
 Compute the maximum magnetic divergence in the grid and report an error if it exceeds the magnetic divergence limit or is negative. The magnetic divergence limit is 1E-14 as determined by Athena as a reasonable upper bound for correctness.
 
__global__ void Update_Magnetic_Field_3D (Real *sourceGrid, Real *destinationGrid, Real *ctElectricFields, int const nx, int const ny, int const nz, int const n_cells, Real const dt, Real const dx, Real const dy, Real const dz)
 Update the magnetic field using the CT electric fields.
 

Detailed Description

Namespace for MHD code.

Function Documentation

◆ calculateMagneticDivergence()

__global__ void mhd::calculateMagneticDivergence ( Real const *  dev_conserved,
Real *  maxDivergence,
Real const  dx,
Real const  dy,
Real const  dz,
int const  nx,
int const  ny,
int const  nz,
int const  n_cells 
)

Kernel to compute the maximum divergence of the magnetic field in the grid. Uses reduction_utilities::gridReduceMax and as such should be called with the minimum number of blocks. Recommend using the occupancy API.

Parameters
[in]dev_conservedThe device array of conserved variables
[out]maxDivergenceThe device scalar to store the reduced divergence at
[in]dxCell size in the X-direction
[in]dyCell size in the Y-direction
[in]dzCell size in the Z-direction
[in]nxNumber of cells in the X-direction
[in]nyNumber of cells in the Y-direction
[in]nzNumber of cells in the Z-direction
[in]n_cellsTotal number of cells

◆ checkMagneticDivergence()

Real mhd::checkMagneticDivergence ( Grid3D const &  G)

Compute the maximum magnetic divergence in the grid and report an error if it exceeds the magnetic divergence limit or is negative. The magnetic divergence limit is 1E-14 as determined by Athena as a reasonable upper bound for correctness.

Parameters
GThe grid object
Returns
Real The maximum magnetic divergence found in the grid. Can usually be ignored since all checking is done in the fucntion, mostly this return is for testing.

◆ Update_Magnetic_Field_3D()

__global__ void mhd::Update_Magnetic_Field_3D ( Real *  sourceGrid,
Real *  destinationGrid,
Real *  ctElectricFields,
int const  nx,
int const  ny,
int const  nz,
int const  n_cells,
Real const  dt,
Real const  dx,
Real const  dy,
Real const  dz 
)

Update the magnetic field using the CT electric fields.

Parameters
[in]sourceGridThe array which holds the old values of the magnetic field
[out]destinationGridThe array to hold the updated values of the magnetic field
[in]ctElectricFieldsThe array of constrained transport electric fields
[in]nxThe number of cells in the x-direction
[in]nyThe number of cells in the y-direction
[in]nzThe number of cells in the z-direction
[in]n_cellsThe total number of cells
[in]dtThe time step. If doing the half time step update make sure to divide it by two when passing the time step to this kernel
[in]dxThe size of each cell in the x-direction
[in]dyThe size of each cell in the y-direction
[in]dzThe size of each cell in the z-direction