stella_config_json Subroutine

public subroutine stella_config_json()

Initialises the effective stellarator values using a json input file author: J Lion, IPP Greifswald None This routine reads in all effective variables that are given needed by the 'constructor' stella_config

The effective values are read in from a JSON-format file. None

Arguments

None

Contents

Source Code


Source Code

    subroutine stella_config_json()

        !! Initialises the effective stellarator values using a json input file
        !! author: J Lion, IPP Greifswald
        !! None
        !! This routine reads in all effective variables that
        !! are given needed by the 'constructor' stella_config
        !! <P>The effective values are read in from a JSON-format file.
        !! None
        !
        ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        use fson_library, only: fson_parse, fson_value, fson_get, fson_destroy
        use global_variables, only: output_prefix



        !  Arguments

        !  Local variables

        integer :: n_values
        character(len=180) :: filename
        type(fson_value), pointer :: stellafile

        real(dp), dimension(:), allocatable :: nustar,d11,d13
        !type(stella_config), allocatable, dimension(:) :: stella_json

        ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        !  Parse the json file

        filename = trim(output_prefix) // 'stella_conf.json'
        stellafile => fson_parse(trim(filename))

        !  Extract information arrays from the file

        call fson_get(stellafile, "name", stella_config_name)
        call fson_get(stellafile, "symmetry", stella_config_symmetry)

        call fson_get(stellafile, "coilspermodule", stella_config_coilspermodule)
        call fson_get(stellafile, "rmajor_ref", stella_config_rmajor_ref)
        call fson_get(stellafile, "rminor_ref", stella_config_rminor_ref)
        call fson_get(stellafile, "coil_rmajor", stella_config_coil_rmajor)
        call fson_get(stellafile, "coil_rminor", stella_config_coil_rminor)
        call fson_get(stellafile, "aspect_ref", stella_config_aspect_ref)
        call fson_get(stellafile, "bt_ref", stella_config_bt_ref)
        call fson_get(stellafile, "WP_area", stella_config_WP_area)
        call fson_get(stellafile, "WP_bmax", stella_config_WP_bmax)
        call fson_get(stellafile, "i0", stella_config_i0)
        call fson_get(stellafile, "a1", stella_config_a1)
        call fson_get(stellafile, "a2", stella_config_a2)
        call fson_get(stellafile, "dmin", stella_config_dmin)
        call fson_get(stellafile, "inductance", stella_config_inductance)
        call fson_get(stellafile, "coilsurface", stella_config_coilsurface)
        call fson_get(stellafile, "coillength", stella_config_coillength)
        call fson_get(stellafile, "max_portsize_width", stella_config_max_portsize_width)
        call fson_get(stellafile, "maximal_coil_height", stella_config_maximal_coil_height)
        call fson_get(stellafile, "min_plasma_coil_distance", stella_config_min_plasma_coil_distance)
        call fson_get(stellafile, "derivative_min_LCFS_coils_dist", stella_config_derivative_min_LCFS_coils_dist)
        call fson_get(stellafile, "plasma_volume", stella_config_plasma_volume)
        call fson_get(stellafile, "plasma_surface", stella_config_plasma_surface)
        call fson_get(stellafile, "WP_ratio", stella_config_WP_ratio)
        call fson_get(stellafile, "max_force_density", stella_config_max_force_density)
        call fson_get(stellafile, "max_force_density_MNm", stella_config_max_force_density_MNm)
        call fson_get(stellafile, "min_bend_radius", stella_config_min_bend_radius)
        call fson_get(stellafile, "epseff", stella_config_epseff)

        call fson_get(stellafile, "max_lateral_force_density", stella_config_max_lateral_force_density)
        call fson_get(stellafile, "max_radial_force_density", stella_config_max_radial_force_density)

        call fson_get(stellafile, "centering_force_max_MN", stella_config_centering_force_max_MN)
        call fson_get(stellafile, "centering_force_min_MN", stella_config_centering_force_min_MN)
        call fson_get(stellafile, "centering_force_avg_MN", stella_config_centering_force_avg_MN)

        call fson_get(stellafile, "neutron_peakfactor", stella_config_neutron_peakfactor)


        call fson_get(stellafile, "number_nu_star", n_values)

        if (allocated(sc_D11_star_mono_input)) deallocate(sc_D11_star_mono_input)
        if (allocated(sc_nu_star_mono_input)) deallocate(sc_nu_star_mono_input)
        allocate(sc_D11_star_mono_input(n_values))
        allocate(sc_nu_star_mono_input(n_values))


        call fson_get(stellafile, "D11_star_mono_input", sc_D11_star_mono_input)
        call fson_get(stellafile, "nu_star_mono_input", sc_nu_star_mono_input)




        !  Clean up
        call fson_destroy(stellafile)

    end subroutine stella_config_json