diagnose_poincare Program

This program generates poincare data, based on a parameter file specified via the command line, and writes that data to NetCDF.


Variables

Type Attributes Name Initial
character(len=64) :: geometry = 'CIRCULAR'

Specifies equilibrium type

character(len=256) :: equi_filename = ""

Equilibrium parameter filename (if blank, the equilibrium will be initialized with its default parameters)

integer :: n_planes = 1

Number of toroidal planes

integer :: n_turns = 50

Number of toroidal rotations 2pi

integer :: n_surfaces = 6

Number of flux surfaces

logical :: trace_start_loc_polar = .false.

Switch whether the starting locations for tracing trace_start_loc are specified in (x, y) or (rho, theta) coordinates

real(kind=FP) :: phi_min = 0.0_FP

Lower bound of default phi array

real(kind=FP) :: phi_max = TWO_PI

Upper bound of default phi_array

character(len=256) :: poincare_filename = "poincare_data.nc"

File name under which to save the Poincare data

real(kind=FP), dimension(:), allocatable :: phi_array

Toroidal angles phi of Poincare data. By default, this array is size(n_planes) and spans [phi_min, phi_max).

real(kind=FP), dimension(:,:), allocatable :: trace_start_loc

Trace starting locations for each surface, for the first plane. By default, the starting locations will span horizontally from the magnetic axis to either xmax (polar=false) or rhomax (polar=true). The starting locations for the subsequent planes will be calculated using tracing, so that the same flux surfaces are shown on all planes.

class(equilibrium_t), allocatable :: equi
integer :: ierror
integer :: nprocs
integer :: n_threads
integer :: argc
integer :: eq_id
character(len=256), allocatable, dimension(:) :: argv
character(len=256) :: parameter_file
character(len=256) :: io_errmsg
integer :: funit
integer :: io_error
integer :: i
real(kind=FP) :: x
real(kind=FP) :: y

Subroutines

subroutine print_usage()

Prints the intended usage of the executable

Arguments

None

subroutine generate_poincare_data(equi, n_surfaces, n_turns, n_planes, phi_array, trace_start_loc, filename)

For a given equilibrium equi, this routine generates Poincare data on the toroidal planes with angles given in phi_array.

Read more…

Arguments

Type IntentOptional Attributes Name
class(equilibrium_t), intent(inout) :: equi

Equilibrium instance

integer, intent(in) :: n_surfaces

Number of flux surfaces

integer, intent(in) :: n_turns

Number of toroidal rotations 2pi

integer, intent(in) :: n_planes

Number of toroidal planes

real(kind=FP), intent(in), dimension(n_planes) :: phi_array

Toroidal angles at which to save data

real(kind=FP), intent(in), dimension(2, n_surfaces) :: trace_start_loc

Trace starting locations (x, y) for each surface, for the first plane

character(len=*), intent(in) :: filename

File name under which to save the Poincare data

subroutine write_poincare(filename, n_surfaces, n_turns, n_planes, phi_array, poincare_data)

Writes generated poincare data to a NetCDF file

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

File name to save to

integer, intent(in) :: n_surfaces

Number of flux surfaces

integer, intent(in) :: n_turns

Number of toroidal rotations

integer, intent(in) :: n_planes

Number of toroidal planes

real(kind=FP), intent(in), dimension(n_planes) :: phi_array

Toroidal angles of each plane

real(kind=FP), intent(in), dimension(2, n_planes, n_turns + 1, n_surfaces) :: poincare_data

Generated Poincare data: x and y locations of the field lines for every surface, turn, and plane