pencil Subroutine

private subroutine pencil(this, spectrum, dict, seqs)

pencil beam source

Arguments

Type IntentOptional Attributes Name
class(photon) :: this
type(spectrum_t), intent(in) :: spectrum
type(toml_table), intent(inout), optional :: dict
type(seq), intent(inout), optional :: seqs(2)

Source Code

        subroutine pencil(this, spectrum, dict, seqs)
        !! pencil beam source

            use random,        only : ranu, seq
            use sim_state_mod, only : state
            use tomlf,         only : toml_table, get_value
            use piecewiseMod
            use constants,     only : TWOPI

            class(photon) :: this
            type(spectrum_t), intent(in) :: spectrum
            type(toml_table), optional, intent(inout) :: dict
            type(seq), optional, intent(inout) :: seqs(2)

            integer :: cell(3)
            real(kind=wp) :: tmp

            this%pos = photon_origin%pos
            this%nxp = photon_origin%nxp
            this%nyp = photon_origin%nyp
            this%nzp = photon_origin%nzp

            this%phi = atan2(this%nyp, this%nxp)
            this%cosp = cos(this%phi)
            this%sinp = sin(this%phi)
            this%cost = this%nzp
            this%sint = sqrt(1._wp - this%cost**2)

            this%tflag = .false.
            this%bounces = 0
            this%cnts = 0
            this%weight = 1.0_wp
            call spectrum%p%sample(this%wavelength, tmp)
            this%energy = 1.0_wp
            this%fact = TWOPI / this%wavelength

            ! Linear Grid 
            cell = state%grid%get_voxel(this%pos)
            this%xcell = cell(1)
            this%ycell = cell(2)
            this%zcell = cell(3)
        end subroutine pencil