in_plasma Subroutine

public subroutine in_plasma(xyz, inp, machine_coords, coeffs, uvw_out)

Indicator subroutine to determine if a position is in a region where the plasma parameter and fields are valid/known

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: xyz

Position in beam coordinates

logical, intent(out) :: inp

Indicates whether plasma parameters and fields are valid/known

logical, intent(in), optional :: machine_coords

Indicates that xyz is in machine coordinates

type(InterpolCoeffs2D), intent(out), optional :: coeffs

Linear Interpolation coefficients used in calculation

real(kind=Float64), intent(out), optional dimension(3):: uvw_out

Position in machine coordinates


Calls

proc~~in_plasma~~CallsGraph proc~in_plasma in_plasma interface~interpol_coeff interpol_coeff proc~in_plasma->interface~interpol_coeff proc~xyz_to_uvw xyz_to_uvw proc~in_plasma->proc~xyz_to_uvw proc~interpol2d_coeff interpol2D_coeff interface~interpol_coeff->proc~interpol2d_coeff proc~interpol1d_coeff interpol1D_coeff interface~interpol_coeff->proc~interpol1d_coeff proc~interpol2d_coeff_arr interpol2D_coeff_arr interface~interpol_coeff->proc~interpol2d_coeff_arr proc~interpol1d_coeff_arr interpol1D_coeff_arr interface~interpol_coeff->proc~interpol1d_coeff_arr proc~interpol2d_coeff_arr->proc~interpol2d_coeff proc~interpol1d_coeff_arr->proc~interpol1d_coeff

Called by

proc~~in_plasma~~CalledByGraph proc~in_plasma in_plasma proc~get_fields get_fields proc~get_fields->proc~in_plasma proc~make_beam_grid make_beam_grid proc~make_beam_grid->proc~in_plasma proc~track track proc~track->proc~in_plasma proc~fida_weights_los fida_weights_los proc~fida_weights_los->proc~in_plasma proc~fida_weights_los->proc~get_fields proc~fida_weights_los->proc~track proc~get_plasma get_plasma proc~fida_weights_los->proc~get_plasma proc~read_mc read_mc proc~read_mc->proc~in_plasma proc~get_plasma->proc~in_plasma proc~mc_nbi mc_nbi proc~mc_nbi->proc~in_plasma proc~bremsstrahlung bremsstrahlung proc~bremsstrahlung->proc~get_plasma proc~read_distribution read_distribution proc~read_distribution->proc~read_mc proc~attenuate attenuate proc~attenuate->proc~get_plasma proc~ndmc ndmc proc~ndmc->proc~track proc~ndmc->proc~mc_nbi proc~read_npa read_npa proc~read_npa->proc~get_fields program~fidasim fidasim program~fidasim->proc~make_beam_grid program~fidasim->proc~fida_weights_los program~fidasim->proc~bremsstrahlung program~fidasim->proc~read_distribution program~fidasim->proc~ndmc program~fidasim->proc~read_npa proc~npa_weights npa_weights program~fidasim->proc~npa_weights proc~fida_mc fida_mc program~fidasim->proc~fida_mc proc~halo halo program~fidasim->proc~halo proc~dcx dcx program~fidasim->proc~dcx proc~fida_f fida_f program~fidasim->proc~fida_f proc~neutron_mc neutron_mc program~fidasim->proc~neutron_mc proc~npa_f npa_f program~fidasim->proc~npa_f proc~npa_mc npa_mc program~fidasim->proc~npa_mc proc~fida_weights_mc fida_weights_mc program~fidasim->proc~fida_weights_mc proc~read_chords read_chords program~fidasim->proc~read_chords proc~neutron_f neutron_f program~fidasim->proc~neutron_f proc~store_bes_photons store_bes_photons proc~store_bes_photons->proc~get_fields proc~npa_weights->proc~get_fields proc~npa_weights->proc~attenuate proc~get_beam_cx_rate get_beam_cx_rate proc~npa_weights->proc~get_beam_cx_rate proc~store_fida_photons store_fida_photons proc~store_fida_photons->proc~get_fields proc~fida_mc->proc~get_fields proc~fida_mc->proc~track proc~mc_halo mc_halo proc~mc_halo->proc~get_plasma proc~halo->proc~track proc~halo->proc~get_plasma proc~halo->proc~mc_halo proc~dcx->proc~track proc~dcx->proc~get_plasma proc~dcx->proc~mc_halo proc~store_npa store_npa proc~store_npa->proc~get_fields proc~fida_f->proc~track proc~fida_f->proc~get_plasma proc~mc_fastion mc_fastion proc~fida_f->proc~mc_fastion proc~neutron_mc->proc~get_fields proc~neutron_mc->proc~get_plasma proc~npa_f->proc~get_plasma proc~npa_f->proc~attenuate proc~npa_f->proc~store_npa proc~npa_f->proc~get_beam_cx_rate proc~npa_f->proc~mc_fastion proc~npa_mc->proc~get_fields proc~npa_mc->proc~attenuate proc~npa_mc->proc~store_npa proc~npa_mc->proc~get_beam_cx_rate proc~get_beam_cx_rate->proc~get_plasma proc~store_fw_photons store_fw_photons proc~store_fw_photons->proc~get_fields proc~fida_weights_mc->proc~get_fields proc~fida_weights_mc->proc~track proc~fida_weights_mc->proc~get_plasma proc~read_chords->proc~track proc~neutron_f->proc~get_fields proc~neutron_f->proc~get_plasma proc~mc_fastion->proc~get_fields

Contents

Source Code


Source Code

subroutine in_plasma(xyz, inp, machine_coords, coeffs, uvw_out)
    !+ Indicator subroutine to determine if a position is in a region where
    !+ the plasma parameter and fields are valid/known
    real(Float64), dimension(3), intent(in) :: xyz
        !+ Position in beam coordinates
    logical, intent(out)                    :: inp
        !+ Indicates whether plasma parameters and fields are valid/known
    logical, intent(in), optional           :: machine_coords
        !+ Indicates that xyz is in machine coordinates
    type(InterpolCoeffs2D), intent(out), optional      :: coeffs
        !+ Linear Interpolation coefficients used in calculation
    real(Float64), dimension(3), intent(out), optional :: uvw_out
        !+ Position in machine coordinates

    real(Float64), dimension(3) :: uvw
    type(InterpolCoeffs2D) :: c
    real(Float64) :: R, W, mask
    logical :: mc
    integer :: i, j, err

    err = 1
    mc = .False.
    if(present(machine_coords)) mc = machine_coords

    if(mc) then
        uvw = xyz
    else
        !! Convert to machine coordinates
        call xyz_to_uvw(xyz,uvw)
    endif

    R = sqrt(uvw(1)*uvw(1) + uvw(2)*uvw(2))
    W = uvw(3)

    !! Interpolate mask value
    call interpol_coeff(inter_grid%r, inter_grid%z, R, W, c, err)

    inp = .False.
    if(err.eq.0) then
        i = c%i
        j = c%j
        mask = c%b11*equil%mask(i,j)   + c%b12*equil%mask(i,j+1) + &
               c%b21*equil%mask(i+1,j) + c%b22*equil%mask(i+1,j+1)

        if((mask.ge.0.5).and.(err.eq.0)) then
            inp = .True.
        endif
    endif

    if(present(coeffs)) coeffs = c
    if(present(uvw_out)) uvw_out = uvw

end subroutine in_plasma