photonMod Module

This source file contains the photon type, all the photon launch routines for different light sources, and the scattering code.

Below are the current types of light sources available. Check here for parameters needed for each light source.

  • uniform
  • pencil
  • annulus
  • focus
  • point
  • circular
  • SLM (2D image source)
  • double slit
  • square aperture


Variables

Type Visibility Attributes Name Initial
type(photon), public :: photon_origin

used to save some computation time


Interfaces

public interface photon

  • public function init_source(choice)

    Bind emission function to photon object

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: choice

    Name of light source to use

    Return Value type(photon)

  • private function init_photon(val)

    set up all the variables in the photon object

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in) :: val

    value to assing to variables

    Return Value type(photon)


Abstract Interfaces

abstract interface

  • public subroutine generic_emit(this, spectrum, dict, seqs)

    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)

Derived Types

type, public ::  photon

photon class

Components

Type Visibility Attributes Name Initial
integer, public :: bounces

Debug data. Number of SDF evals

integer, public :: cnts

Debug data. Number of SDF evals

real(kind=wp), public :: cosp

direction cosines

real(kind=wp), public :: cost

direction cosines

procedure(generic_emit), public, pointer :: emit => null()

emission routine

real(kind=wp), public :: energy

Energy of the packet. TODO

real(kind=wp), public :: fact

. Used to save computational time

integer, public :: id

Thread ID of the packet

integer, public :: layer

ID of the SDF the packet is in

real(kind=wp), public :: nxp

direction vectors

real(kind=wp), public :: nyp

direction vectors

real(kind=wp), public :: nzp

direction vectors

real(kind=wp), public :: phase

Current phase of the packet

real(kind=wp), public :: phi

direction cosines

type(vector), public :: pos

postion of photon packet in cm. (0,0,0) is the center of the grid.

real(kind=wp), public :: sinp

direction cosines

real(kind=wp), public :: sint

direction cosines

real(kind=wp), public :: step

used if photon packet weights are used

logical, public :: tflag

photon alive flag

real(kind=wp), public :: wavelength

Wavelength of the packet

real(kind=wp), public :: weight

used if photon packet weights are used

integer, public :: xcell

grid cell position

integer, public :: ycell

grid cell position

integer, public :: zcell

grid cell position

Constructor

public function init_source (choice)

Bind emission function to photon object

private function init_photon (val)

set up all the variables in the photon object

Type-Bound Procedures

procedure, public :: scatter ../../

scattering routine


Functions

private function init_photon(val)

set up all the variables in the photon object

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: val

value to assing to variables

Return Value type(photon)

public function init_source(choice)

Bind emission function to photon object

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: choice

Name of light source to use

Return Value type(photon)


Subroutines

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

annular 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)

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

sample from square aperture to produce diff pattern

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)

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

circular 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)

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

sample from double slit to produce diff pattern

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)

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

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)

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)

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)

private subroutine scatter(this, hgg, g2, dects)

Scattering routine. Implments both isotropic and henyey-greenstein scattering taken from mcxyz

Arguments

Type IntentOptional Attributes Name
class(photon), intent(inout) :: this
real(kind=wp), intent(in) :: hgg

g factor

real(kind=wp), intent(in) :: g2

g factor squared

type(dect_array), intent(in), optional :: dects(:)

array of detectors. Only used if biased scattering is enabled.

public subroutine set_photon(pos, dir)

Arguments

Type IntentOptional Attributes Name
type(vector), intent(in) :: pos
type(vector), intent(in) :: dir

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

image source

Arguments

Type IntentOptional Attributes Name
class(photon) :: this
type(spectrum_t), intent(in) :: spectrum

Input image to sample position from

type(toml_table), intent(inout), optional :: dict

Metadata dictionary

type(seq), intent(inout), optional :: seqs(2)

random numbers from a sequence. Quasi-Monte Carlo

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

uniformly illuminate a surface of the simulation media

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)