Monte Carlo Configuration

The montecarlo section describes the parameters for the Monte Carlo radiation transport and convergence criteria:

type

object

properties

  • nthreads

The number of Numba threads for parallelisation. Must be between 1 and the environment variable NUMBA_NUM_THREADS (by default NUMBA_NUM_THREADS is equal to the number of CPU cores on the local system).

type

number

multipleOf

1.0

default

1

  • seed

Seed for the random number generator

type

number

multipleOf

1.0

default

23111963

  • no_of_packets

Seed for the random number generator

type

number

multipleOf

1.0

  • iterations

Number of maximum iterations

type

number

multipleOf

1.0

  • last_no_of_packets

This can set the number of packets for the last run. If set negative it will remain the same as all other runs.

type

number

multipleOf

1.0

default

-1

  • no_of_virtual_packets

Setting the number of virtual packets for the last iteration.

type

number

multipleOf

1.0

default

0

  • virtual_spectrum_spawn_range

Limits of virtual packet spawn spectrum (giving maximum and minimum packet frequency)

type

object

default

properties

  • start

type

quantity

default

0 angstrom

  • end

type

quantity

default

inf angstrom

  • enable_reflective_inner_boundary

experimental feature to enable a reflective boundary.

type

boolean

default

False

  • inner_boundary_albedo

albedo of the reflective boundary

type

number

default

0.0

  • convergence_strategy

default

type

damped

oneOf

Damped Convergence Strategy

Custom Convergence Strategy

  • enable_full_relativity

Enables a more complete treatment of relativitic effects. This includes angle aberration as well as use of the fully general Doppler formula.

type

boolean

default

False

  • debug_packets

Decide whether to go into debugging mode. [EXPERIMENTAL FEATURE DO NOT RELY ON IT]

type

boolean

default

False

  • logger_buffer

Provides option to not log every line.

type

number

default

1

  • single_packet_seed

If debug_packets is true, this is the seed for the only packet.

type

number

default

-1

additionalProperties

False

The seed parameter seeds the random number generator first for the creation of the packets (\(\nu\) and \(\mu\)) and then the interactions in the actual Monte Carlo process. The no_of_packets parameter can take a float number for input convenience and gives the number of packets normally used in each Monte Carlo loop. The parameters last_no_of_packets and no_of_virtual_packets influence the last run of the Monte Carlo loop (which calculates the final spectrum!) when the radiation field should have converged. last_no_of_packets is normally higher than no_of_packets to create a less noisy output spectrum. no_of_virtual_packets can also be set to greater than 0 (a useful number is 3) to use the Virtual Packet formalism. Increasing this number drastically increases computational costs (and memory requirements if they are logged). The iterations parameter describes the maximum number of Monte Carlo loops executed in a simulation before it ends. Convergence criteria can be used to make the simulation stop sooner when the convergence threshold has been reached (see Convergence).

Convergence Strategy

The convergence_criteria section has a type keyword. Currently, one type is allowed: damped. All convergence criteria can be specified separately for the three variables for which convergence can be checked (t_inner, t_rad, ws) by specifying subsections in the convergence_criteria of the same name. These then override the defaults. Two more schemas are presented that further explain the damped and custom convergence strategies:

Damped Convergence Strategy

type

object

properties

  • type

enum

damped

  • default

damped

  • stop_if_converged

stop plasma iterations before number of specified iterations are reached if the simulation is plasma and inner boundary state is converged

type

boolean

default

False

  • fraction

the fraction of shells that have to converge to the given convergence threshold. For example, 0.8 means that 80% of shells have to converge to the threshold that convergence is established

type

number

minimum

0

default

0.8

  • hold_iterations

the number of iterations that the convergence criteria need to be fulfilled before TARDIS accepts the simulation as converged

type

number

multipleOf

1.0

default

3

  • damping_constant

damping constant

type

number

minimum

0

default

1.0

  • threshold

specifies the threshold that is taken as convergence (i.e. 0.05 means that the value does not change more than 5%)

type

number

minimum

0

default

0.05

  • t_inner

type

object

properties

  • damping_constant

damping constant

type

number

minimum

0

default

0.5

  • threshold

specifies the threshold that is taken as convergence (i.e. 0.05 means that the value does not change more than 5%)

type

number

minimum

0

additionalProperties

False

  • t_rad

type

object

properties

  • damping_constant

damping constant

type

number

minimum

0

default

0.5

  • threshold

specifies the threshold that is taken as convergence (i.e. 0.05 means that the value does not change more than 5%)

type

number

minimum

0

additionalProperties

False

  • w

type

object

properties

  • damping_constant

damping constant

type

number

minimum

0

default

0.5

  • threshold

specifies the threshold that is taken as convergence (i.e. 0.05 means that the value does not change more than 5%)

type

number

minimum

0

additionalProperties

False

  • lock_t_inner_cycles

The number of cycles to lock the update of the inner boundary temperature. This process helps with convergence. The default is to switch it off (1 cycle)

type

number

multipleOf

1.0

default

1

  • t_inner_update_exponent

L=4*pi*r**2*T^y

type

number

default

-0.5

additionalProperties

False

damped only has one parameter damping-constant and does not check for convergence. This can be used to fix the temperature of the inner boundary.

Custom Convergence Strategy

type

object

properties

  • type

enum

custom

  • description

Use this convergence_strategy for your specific needs. You need to change the codebase accordingly

additionalProperties

False

Parallel Execution with Numba

The montecarlo section of the Configuration file accepts the parameter nthreads which sets the number of threads to be used for parallelisation. Setting the value of the parameter between 1 and the environment variable NUMBA_NUM_THREADS (which is, by default, the number of CPU cores on your system) will automatically invoke Numba to parallelise the code. (See Configuration (Required Input) section).