get_plasma Subroutine

public subroutine get_plasma(plasma, pos, ind)

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


Calls

proc~~get_plasma~~CallsGraph proc~get_plasma get_plasma proc~in_plasma in_plasma proc~get_plasma->proc~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~~get_plasma~~CalledByGraph proc~get_plasma 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~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~attenuate attenuate proc~npa_f->proc~attenuate proc~get_beam_cx_rate get_beam_cx_rate proc~npa_f->proc~get_beam_cx_rate proc~halo halo proc~halo->proc~get_plasma proc~halo->proc~mc_halo proc~attenuate->proc~get_plasma proc~get_beam_cx_rate->proc~get_plasma proc~neutron_f neutron_f proc~neutron_f->proc~get_plasma proc~npa_weights npa_weights proc~npa_weights->proc~attenuate proc~npa_weights->proc~get_beam_cx_rate program~fidasim fidasim program~fidasim->proc~dcx program~fidasim->proc~bremsstrahlung program~fidasim->proc~fida_weights_mc program~fidasim->proc~fida_weights_los program~fidasim->proc~fida_f program~fidasim->proc~neutron_mc program~fidasim->proc~npa_f program~fidasim->proc~halo program~fidasim->proc~neutron_f 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)
    !+ 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

    logical :: inp
    type(InterpolCoeffs2D) :: coeffs
    real(Float64), dimension(3) :: xyz, uvw, vrot_uvw
    real(Float64) :: phi, s, c
    integer :: i, j

    plasma%in_plasma = .False.

    if(present(ind)) call get_position(ind,xyz)
    if(present(pos)) xyz = pos

    call in_plasma(xyz,inp,.False.,coeffs,uvw)
    if(inp) then
        phi = atan2(uvw(2),uvw(1))
        i = coeffs%i
        j = coeffs%j

        plasma = coeffs%b11*equil%plasma(i,j)   + coeffs%b12*equil%plasma(i,j+1) + &
                 coeffs%b21*equil%plasma(i+1,j) + coeffs%b22*equil%plasma(i+1,j+1)

        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
        plasma%vrot = matmul(beam_grid%inv_basis,vrot_uvw)
        plasma%pos = xyz
        plasma%uvw = uvw
        plasma%in_plasma = .True.
        plasma%c = coeffs
    endif

end subroutine get_plasma