Quick Start¶
To run DAO, you must provide an input file that specifies the physical parameters and grid configurations.
We provide a template file located at templates/input.nml.j2.
1. Configure the Template
Before running a test, open the template file and change the rfcomp_file and rfdataenv parameters to match your local paths (where you downloaded the data files).
2. Run the Simulation
Execute the following command to run a simple test:
./dao.x templates/input.nml.j2
3. Check Results This task will generate four output files containing the log, intensity, mean intensity, illumination, and ion abundances.
For detailed file descriptions, please refer to Output Files.
Run Code with Python¶
To streamline the workflow, we provide a Python helper script (modelrun.py) optimized for batch processing and parameter sweeps. This tool ensures data traceability by generating a unique hash value derived from the complete set of input parameters.
When combined with a user-defined diy_tag (see Sample Output), this hash creates a unique identifier for each simulation. The script uses this identifier to:
Generate the model input file.
Archive all parameters into a JSON file for record-keeping.
This mechanism ensures that output files are strictly determined by the parameter configuration and the tag, preventing accidental overwrites. The script operates in two distinct modes:
Generation Mode: Generates the standard input file (
.nml) and simultaneously archives the input parameters into a JSON file for record-keeping.Slurm Submission Mode: Generates the input file and automatically submits the job to a computing cluster via the Slurm workload manager.
Note
Cluster Configuration
If you intend to use the Slurm Submission Mode, you must first configure the submission template.
Please modify templates/submission.slurm.j2 to match your specific cluster environment (e.g., partition names, time limits, and memory requirements).
The MODEL_PARAMETERS dictionary in mopar.py serves as the central registry for all input parameters.
Note
Variable Name Mapping
Please note that the variable names used in the Python interface differ from the internal names expected by the main Fortran program.
To bridge this gap, the code implements an internal mapping system that automatically translates Python variables into the corresponding Fortran Namelist parameters during runtime.
Bash script¶
The run.sh file serves as a practical example for executing the modelrun.py utility. This script is designed to be highly customizable to suit specific research needs.
Parameter Sweeps: You can extend the script by adding loops to iterate over a specific range of parameter values.
Extended Configuration: Users are encouraged to modify the script to include any additional parameters that are available in the
mopar.pyregistry.
Execution Script (run.sh)¶
You can use this Bash script to manage parameter sweeps or single runs.
1#!/bin/bash
2
3PYTHON_SCRIPT="modelrun.py"
4DIY="User_Guide"
5
6# --- Execution & Model Flags ---
7exec=0 # 0: Generate files only, 1: Submit sbatch, 2: Run locally
8debug=0 # Debug switch
9model=0 # 0: Reflection, 1: Pure scattering
10ity=2 # Type of angle bins and integral method
11
12# --- Computational Grids ---
13nmaxmain=15 # Max main iteration steps
14nmaxrte=200 # Max radiative transfer steps
15ndrt=200 # Number of depth grids (tau)
16nfrt=5000 # Number of energy grids
17
18# --- Physical Parameters ---
19temp_gas=1e8 # Initial gas temperature
20inci_type="nthcomp"
21gamma=2 # Photon index
22inmu=0.55 # Incident angle cosine
23fe=0.5 # Iron abundance
24
25# --- Loop Example ---
26# You can uncomment loops to perform parameter sweeps
27# for gamma in 1.0 1.2 1.4; do
28 python ${PYTHON_SCRIPT} \
29 --exec ${exec} \
30 --debug ${debug} \
31 --model ${model} \
32 --ity ${ity} \
33 --nmaxmain ${nmaxmain} \
34 --nmaxrte ${nmaxrte} \
35 --temp-gas ${temp_gas} \
36 --inci-type "${inci_type}" \
37 --gamma ${gamma} \
38 --inmu ${inmu} \
39 --fe ${fe} \
40 --diy "${DIY}"
41# done
Sample Output¶
When running the script, you should see output indicating the configuration loading and file generation:
----------------------------------------
Starting model run with DIY tag: User_Guide
----------------------------------------
--- Generated Unique Run ID: b912ee2e38_User_Guide ---
--- Final Python Configuration ---
==================================================
Current Model Configuration
==================================================
inci_file : incident/nthcomp_g2.0_t60.txt
kernelpath : kernel_exact5000
op_spec : out/User_Guide/spec_b912ee2e38_User_Guide.dat
...
nmaxmain : 15
temp_gas : 100000000.0
fe : 0.5
...
h : 1.0
he : 1.0
fe : 0.5
ni : 1.0
... (other elements omitted) ...
==================================================
Parsing Fortran namelist file: templates/input.nml.j2
Successfully wrote updated parameters to 'inputFILE/inp_b912ee2e38_User_Guide.in'
--- Saving run metadata to JSON ---
Successfully saved metadata to 'metadata/meta_b912ee2e38_User_Guide.json'
----------------------------------------
Job submission script has finished.