coilpy.mgrid#
- class coilpy.mgrid.Mgrid(r, z, phi, Br, Bz, Bphi, nfp=1)[source]#
- Bases: - object- bfield(rzp)[source]#
- Return interpolated B-field - Parameters:
- rzp (list) – (r,z,phi) values cylindral coodinates 
- Returns:
- [Br, Bz, Bphi] at the evaluation point 
- Return type:
- numpy.array 
 
 - classmethod compute_mgrid(bfield, rmin, rmax, zmin, zmax, nr=100, nz=100, nphi=100, nfp=1)[source]#
- Compute bfield on the grid - Parameters:
- bfield (func) – callable function to compute B at a sequence of points [N, 3] in cartesian coordinates, e.g. Bxyz = bfield(pos[0:N, 0:3]) 
- rmin (float) – minimum r value 
- rmax (float) – maximum r value 
- zmin (float) – minimum z value 
- zmax (float) – maximum z value 
- nr (int, optional) – resolution in r. Defaults to 100. 
- nz (int, optional) – resolution in z. Defaults to 100. 
- nphi (int, optional) – resolution in phi. Defaults to 100. 
- nfp (int, optional) – number of field periods. Defaults to 1. 
 
- Returns:
- return a Mgrid class with dimensions of [nr, nz, nphi+1] 
- Return type:
 
 - classmethod read_mgrid_bin(filename, extcur=None)[source]#
- Read mgrid file in binary format - Parameters:
- filename (str) – binary file path and name. 
- extcur (str/list, optional) – current (or file) for each group. Defaults to None. 
 
- Returns:
- Mgrid class containning all data with B summed together. 
- Return type:
 
 - classmethod read_mgrid_nc(filename, extcur=None)[source]#
- Read mgrid file in the netcdf format - Parameters:
- filename (str) – netcdf file path and name. 
- extcur (str/list, optional) – current (or file) for each group. Defaults to None. 
 
- Returns:
- Mgrid class containning all data with B summed together. 
- Return type: