get_plasma Subroutine

public subroutine get_plasma(plasma, pos, ind, input_coords, output_coords)

Gets plasma parameters at position pos or beam_grid indices ind

Arguments

Type IntentOptional AttributesName
type(LocalProfiles), intent(out) :: plasma

Plasma parameters at pos/ind

real(kind=Float64), intent(in), optional dimension(3):: pos

Position in beam grid coordinates

integer(kind=Int32), intent(in), optional dimension(3):: ind

beam_grid indices

integer(kind=Int32), intent(in), optional :: input_coords

Indicates coordinate system of inputs. Beam grid (0), machine (1) and cylindrical (2)

integer(kind=Int32), intent(in), optional :: output_coords

Indicates coordinate system of outputs. Beam grid (0), machine (1) and cylindrical (2)


Calls

proc~~get_plasma~~CallsGraph proc~get_plasma get_plasma proc~get_position get_position proc~get_plasma->proc~get_position proc~xyz_to_uvw xyz_to_uvw proc~get_plasma->proc~xyz_to_uvw proc~in_plasma in_plasma proc~get_plasma->proc~in_plasma proc~uvw_to_xyz uvw_to_xyz proc~get_plasma->proc~uvw_to_xyz proc~cyl_to_xyz cyl_to_xyz proc~get_position->proc~cyl_to_xyz proc~in_plasma->proc~xyz_to_uvw proc~cyl_to_uvw cyl_to_uvw proc~in_plasma->proc~cyl_to_uvw interface~interpol_coeff interpol_coeff proc~in_plasma->interface~interpol_coeff proc~cyl_interpol3d_coeff cyl_interpol3D_coeff interface~interpol_coeff->proc~cyl_interpol3d_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~interpol2d_coeff interpol2D_coeff interface~interpol_coeff->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr cyl_interpol3D_coeff_arr interface~interpol_coeff->proc~cyl_interpol3d_coeff_arr proc~interpol1d_coeff_arr interpol1D_coeff_arr interface~interpol_coeff->proc~interpol1d_coeff_arr proc~cyl_to_xyz->proc~uvw_to_xyz proc~cyl_to_xyz->proc~cyl_to_uvw proc~cyl_interpol3d_coeff->proc~interpol2d_coeff proc~interpol2d_coeff_arr->proc~interpol2d_coeff proc~cyl_interpol3d_coeff_arr->proc~cyl_interpol3d_coeff proc~cyl_interpol3d_coeff_arr->proc~interpol2d_coeff proc~interpol1d_coeff_arr->proc~interpol1d_coeff

Called by

proc~~get_plasma~~CalledByGraph proc~get_plasma get_plasma proc~pnpa_f pnpa_f proc~pnpa_f->proc~get_plasma proc~attenuate attenuate proc~pnpa_f->proc~attenuate proc~dcx_spec dcx_spec proc~dcx_spec->proc~get_plasma proc~dcx dcx proc~dcx->proc~get_plasma proc~mc_halo mc_halo proc~dcx->proc~mc_halo proc~bremsstrahlung bremsstrahlung proc~bremsstrahlung->proc~get_plasma proc~fida_weights_mc fida_weights_mc proc~fida_weights_mc->proc~get_plasma proc~fida_weights_los fida_weights_los proc~fida_weights_los->proc~get_plasma proc~pfida_mc pfida_mc proc~pfida_mc->proc~get_plasma proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~get_plasma proc~pnpa_mc->proc~attenuate proc~fida_f fida_f proc~fida_f->proc~get_plasma proc~neutron_mc neutron_mc proc~neutron_mc->proc~get_plasma proc~mc_halo->proc~get_plasma proc~npa_f npa_f proc~npa_f->proc~get_plasma proc~npa_f->proc~attenuate proc~get_beam_cx_rate get_beam_cx_rate proc~npa_f->proc~get_beam_cx_rate proc~cold_spec cold_spec proc~cold_spec->proc~get_plasma proc~pfida_f pfida_f proc~pfida_f->proc~get_plasma proc~attenuate->proc~get_plasma proc~neutron_f neutron_f proc~neutron_f->proc~get_plasma proc~get_beam_cx_rate->proc~get_plasma proc~halo_spec halo_spec proc~halo_spec->proc~get_plasma proc~halo halo proc~halo->proc~get_plasma proc~halo->proc~mc_halo proc~npa_weights npa_weights proc~npa_weights->proc~attenuate proc~npa_weights->proc~get_beam_cx_rate program~fidasim fidasim program~fidasim->proc~pnpa_f program~fidasim->proc~dcx_spec program~fidasim->proc~dcx program~fidasim->proc~bremsstrahlung program~fidasim->proc~fida_weights_mc program~fidasim->proc~fida_weights_los program~fidasim->proc~pfida_mc program~fidasim->proc~pnpa_mc program~fidasim->proc~fida_f program~fidasim->proc~neutron_mc program~fidasim->proc~npa_f program~fidasim->proc~cold_spec program~fidasim->proc~pfida_f program~fidasim->proc~neutron_f program~fidasim->proc~halo_spec program~fidasim->proc~halo program~fidasim->proc~npa_weights proc~npa_mc npa_mc program~fidasim->proc~npa_mc proc~npa_mc->proc~attenuate proc~npa_mc->proc~get_beam_cx_rate

Contents

Source Code


Source Code

subroutine get_plasma(plasma, pos, ind, input_coords, output_coords)
    !+ Gets plasma parameters at position `pos` or [[libfida:beam_grid]] indices `ind`
    type(LocalProfiles), intent(out)                   :: plasma
        !+ Plasma parameters at `pos`/`ind`
    real(Float64), dimension(3), intent(in), optional  :: pos
        !+ Position in beam grid coordinates
    integer(Int32), dimension(3), intent(in), optional :: ind
        !+ [[libfida:beam_grid]] indices
    integer(Int32), intent(in), optional               :: input_coords
        !+ Indicates coordinate system of inputs. Beam grid (0), machine (1) and cylindrical (2)
    integer(Int32), intent(in), optional               :: output_coords
        !+ Indicates coordinate system of outputs. Beam grid (0), machine (1) and cylindrical (2)

    logical :: inp
    type(InterpolCoeffs3D) :: coeffs
    real(Float64), dimension(3) :: xyz, uvw, cyl, vrot_uvw
    real(Float64) :: phi, s, c
    integer :: i, j, k, k2, ics, ocs

    plasma%in_plasma = .False.

    if(present(input_coords)) then
        ics = input_coords
    else
        ics = 0
    endif
    if(present(output_coords)) then
        ocs = output_coords
    else
        ocs = 0
    endif

    if(present(ind)) then
        if(ics.eq.0) then
            call get_position(ind,xyz)
        endif
        if(ics.eq.2) then
            call get_position(ind,xyz,input_coords=2)
        endif
    endif

    if(present(pos)) then
        if(ics.eq.0) then
            xyz = pos
            call xyz_to_uvw(xyz, uvw)
        endif
        if(ics.eq.1) then
            uvw = pos
            call uvw_to_xyz(uvw, xyz)
        endif
    endif

    call in_plasma(xyz,inp,0,coeffs)
    if(inp) then
        phi = atan2(uvw(2),uvw(1))
        i = coeffs%i
        j = coeffs%j
        k = coeffs%k
        if(inter_grid%nphi .eq. 1) then
            k2 = min(k+1,inter_grid%nphi)
        else
            k2 = k+1
        endif

        plasma = coeffs%b111*equil%plasma(i,j,k)    + coeffs%b121*equil%plasma(i,j+1,k) +   &
                 coeffs%b112*equil%plasma(i,j,k2)   + coeffs%b122*equil%plasma(i,j+1,k2) +  &
                 coeffs%b211*equil%plasma(i+1,j,k)  + coeffs%b221*equil%plasma(i+1,j+1,k) + &
                 coeffs%b212*equil%plasma(i+1,j,k2) + coeffs%b222*equil%plasma(i+1,j+1,k2)

        s = sin(phi) ; c = cos(phi)
        vrot_uvw(1) = plasma%vr*c - plasma%vt*s
        vrot_uvw(2) = plasma%vr*s + plasma%vt*c
        vrot_uvw(3) = plasma%vz
        if(ocs.eq.0) then
            plasma%vrot = matmul(beam_grid%inv_basis,vrot_uvw)
            plasma%pos = xyz
        endif
        if(ocs.eq.1) then
            plasma%vrot = vrot_uvw
            plasma%pos = uvw
        endif
        plasma%uvw = uvw
        plasma%in_plasma = .True.
        plasma%b = coeffs
    endif

end subroutine get_plasma