par.cu
This section contains functions defined in the par.cu file related to reading the parameters structure taken from parameter input files.
Macros
Functions
Functions
-
__host__ void load_par_from_argv(int argc, char *argv[], Params *params)
Initializes simulation parameters with default values and parses command-line arguments.
This function sets up the initial environment for the Monte Carlo simulation.
Default Parameter Values:
seed: If not specified, the random seed is set to -1, which triggers time-based seeding for randomness.
scattering: Enables scattering by default (set to 1).
biasTuning: Default bias tuning factor is set to 1.0. BIAS TUNING STILL NOT IMPLEMENTED.
fitBias: Default fitting bias factor is set to 1.0. FITTING BIAS STILL NOT IMPLEMENTED.
fitBiasNs: Scale input number of superphotons generated in each zone. Default is 1.0 (no scaling). FITTING BIAS STILL NOT IMPLEMENTED.
tp_over_te: Sets the default proton-to-electron temperature ratio \( T_p/T_e \) for the simulation. Default is 3.0.
beta_crit: Sets the default critical plasma beta \( \beta_{\rm crit} \) for R-low/R-high models. Default is 1.0.
trat_small: Sets the minimum proton-to-electron temperature ratio \( T_p/T_e \) for R-low/R-high models. Default is 1.0.
trat_large: Sets the maximum proton-to-electron temperature ratio \( T_p/T_e \) for R-low/R-high models. Default is 10.0.
Thetae_max: Sets the maximum electron temperature \( \Theta_e \) for R-low/R-high models. Default is \( 10^{100} \).
Black Hole Mass: Defaults to \( 4.1 \times 10^6 M_\odot \) (Sgr A*).
Note
R-high and R-low models are only applied to iharm_model simulations.
- Parameters:
argc – Number of command-line arguments.
argv – Array of command-line argument strings.
params – Pointer to the global
Paramsstructure to be populated.
- Returns:
void
-
__host__ void load_par(const char *fname, Params *params)
Parses the simulation parameter file and generates a formatted initialization report.
File Parsing: Scans for keywords defined in the Params structure and reads their corresponding values.
Validation Report: Outputs a color-coded terminal summary (using ANSI escape codes) to inform the user which parameters were successfully loaded from the file (
[SET]) and which are falling back to hardcoded defaults ([MISSING]).Status Flag: Sets
params->loaded = 1upon completion to signal that the simulation environment is ready.
- Parameters:
fname – Path to the input parameter file.
params – Pointer to the global
Paramsstructure to be populated.
- Returns:
void
-
__host__ void read_param(const char *line, const char *key, void *val, int type)
Reads a single parameter from the input file and assigns it to the provided variable.
This function supports reading integer, double, and string parameters based on the specified type.
- Parameters:
fname – Path to the input parameter file.
parname – Name of the parameter to read.
var – Pointer to the variable where the read value will be stored.
type – Data type of the parameter (TYPE_INT, TYPE_DBL, TYPE_STR).
- Returns:
void