mc_halo Subroutine

public subroutine mc_halo(ind, vhalo, ri, plasma_in)

Sample thermal Maxwellian distribution at beam_grid indices ind

Arguments

Type IntentOptional AttributesName
integer, intent(in), dimension(3):: ind

beam_grid indices

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

Velocity [cm/s]

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

Position in beam_grid cell

type(LocalProfiles), intent(in), optional :: plasma_in

Plasma parameters


Calls

proc~~mc_halo~~CallsGraph proc~mc_halo mc_halo interface~randn randn proc~mc_halo->interface~randn interface~randu randu proc~mc_halo->interface~randu proc~get_plasma get_plasma proc~mc_halo->proc~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~~mc_halo~~CalledByGraph proc~mc_halo mc_halo proc~dcx dcx proc~dcx->proc~mc_halo proc~halo halo proc~halo->proc~mc_halo program~fidasim fidasim program~fidasim->proc~dcx program~fidasim->proc~halo

Contents

Source Code


Source Code

subroutine mc_halo(ind,vhalo,ri,plasma_in)
    !+ Sample thermal Maxwellian distribution at [[libfida:beam_grid]] indices `ind`
    integer, dimension(3), intent(in)                  :: ind
        !+ [[libfida:beam_grid]] indices
    real(Float64), dimension(3), intent(out)           :: vhalo
        !+ Velocity [cm/s]
    real(Float64), dimension(3), intent(out), optional :: ri
        !+ Position in [[libfida:beam_grid]] cell
    type(LocalProfiles), intent(in), optional          :: plasma_in
        !+ Plasma parameters

    type(LocalProfiles) :: plasma
    real(Float64), dimension(3) :: random3

    if(.not.present(plasma_in)) then
        if(present(ri)) then
            call randu(random3)
            ri(1) = beam_grid%xc(ind(1)) + beam_grid%dr(1)*(random3(1) - 0.5)
            ri(2) = beam_grid%yc(ind(2)) + beam_grid%dr(2)*(random3(2) - 0.5)
            ri(3) = beam_grid%zc(ind(3)) + beam_grid%dr(3)*(random3(3) - 0.5)
            call get_plasma(plasma,pos=ri)
        else
            call get_plasma(plasma,ind=ind)
        endif
    else
        plasma=plasma_in
    endif

    call randn(random3)

    vhalo = plasma%vrot + sqrt(plasma%ti*0.5/(v2_to_E_per_amu*inputs%ai))*random3 !![cm/s]

end subroutine mc_halo