mc_passive_grid Subroutine

public subroutine mc_passive_grid(ind, ri)

Sample uniformally in passive grid cell

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

Cell index

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

Position in cell


Calls

proc~~mc_passive_grid~~CallsGraph proc~mc_passive_grid mc_passive_grid interface~randu randu proc~mc_passive_grid->interface~randu proc~cyl_to_uvw cyl_to_uvw proc~mc_passive_grid->proc~cyl_to_uvw

Called by

proc~~mc_passive_grid~~CalledByGraph proc~mc_passive_grid mc_passive_grid proc~mc_fastion_pass_grid mc_fastion_pass_grid proc~mc_fastion_pass_grid->proc~mc_passive_grid proc~pfida_f pfida_f proc~pfida_f->proc~mc_fastion_pass_grid proc~pnpa_f pnpa_f proc~pnpa_f->proc~mc_fastion_pass_grid program~fidasim fidasim program~fidasim->proc~pfida_f program~fidasim->proc~pnpa_f

Contents

Source Code


Source Code

subroutine mc_passive_grid(ind, ri)
    !+ Sample uniformally in passive grid cell
    integer, dimension(3), intent(in)        :: ind
        !+ Cell index
    real(Float64), dimension(3), intent(out) :: ri
        !+ Position in cell

    real(Float64) :: rmin, rmax, zmin, phimin
    real(Float64), dimension(3) :: randomu3, ri_cyl

    call randu(randomu3)
    rmin = pass_grid%r(ind(1))
    rmax = rmin + pass_grid%dr
    zmin = pass_grid%z(ind(2))
    phimin = pass_grid%phi(ind(3))

    ! Sample uniformally in annulus
    ri_cyl(1) = sqrt(randomu3(1)*(rmax**2 - rmin**2) + rmin**2)
    ri_cyl(2) = zmin + randomu3(2)*pass_grid%dz
    ri_cyl(3) = phimin + randomu3(3)*pass_grid%dphi
    call cyl_to_uvw(ri_cyl, ri)

end subroutine mc_passive_grid