point Subroutine

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

isotropic point 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 point(this, spectrum, dict, seqs)
        !! isotropic point source

            use sim_state_mod, only : state
            use random,        only : ran2, seq
            use constants,     only : twoPI
            use tomlf,         only : toml_table, get_value
            use piecewiseMod

            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) :: wavelength, tmp

            this%pos = photon_origin%pos

            this%phi  = ran2()*twoPI
            this%cosp = cos(this%phi)
            this%sinp = sin(this%phi)
            this%cost = 2._wp*ran2()-1._wp
            this%sint = sqrt(1._wp - this%cost**2)

            this%nxp = this%sint * this%cosp
            this%nyp = this%sint * this%sinp
            this%nzp = this%cost

            this%tflag  = .false.
            this%cnts   = 0
            this%bounces = 0
            this%layer  = 1
            this%weight = 1.0_wp
            ! this%L = 1.0

            call spectrum%p%sample(wavelength, tmp)
            this%wavelength = wavelength

            this%energy = 1._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 point