kernels Module

Contains the main program and scattering loop. Calls all other routine to setup, run and break down the simulation.


Subroutines

private subroutine display_settings(state, input_file, packet, kernel_type)

Displays the settings used in the current simulation run

Arguments

Type IntentOptional Attributes Name
type(settings_t), intent(in) :: state

Simulation state

character(len=*), intent(in) :: input_file

Input filenname

type(photon), intent(in) :: packet

Photon packet

character(len=*), intent(in) :: kernel_type

Kernel type to run

private subroutine finalise(dict, dects, nscatt, start, history)

Routine writes out simulation data, deallocates arrays and prints total runtime

Arguments

Type IntentOptional Attributes Name
type(toml_table), intent(inout) :: dict

Dictionary of metadata

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

Detector array

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

Total number of scattered photon packets

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

Start time of simulation. Used to calculate total runtime.

type(history_stack_t), intent(in) :: history

Photon histyor object

public subroutine pathlength_scatter(input_file)

Arguments

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

private subroutine setup(input_file, tev, dects, array, packet, spectrum, dict, distances, image, nscatt, start, display)

setup simulation by reading in setting file, and setup variables to be used.

Arguments

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

Filename for toml settings to be used

type(tevipc), intent(out) :: tev

handle for communicating with TEV

type(dect_array), intent(out), allocatable :: dects(:)

array of photon detectors

type(sdf), intent(out), allocatable :: array(:)

array of SDF objects that create the geometry

type(photon), intent(out) :: packet

photon that is to be simulated

type(spectrum_t), intent(out) :: spectrum
type(toml_table), intent(out) :: dict

toml table of meta-data to be written to output files.

real(kind=wp), intent(out), allocatable :: distances(:)
real(kind=wp), intent(out), allocatable :: image(:,:,:)
real(kind=wp), intent(out) :: nscatt
real(kind=wp), intent(out) :: start
logical, intent(in), optional :: display

flag to display simulation init settings

public subroutine test_kernel(input_file, end_early)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: input_file
logical, intent(in) :: end_early

public subroutine weight_scatter(input_file)

Arguments

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