### Install dependencies on Fedora 40+ Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Install required packages via dnf and load the OpenMPI module. Needed before building ARTIS. ```sh sudo dnf install gcc-c++ openmpi-devel libzstd-devel zstd git make curl xz rsync python3 perl module load mpi/openmpi-$(uname -m) ``` -------------------------------- ### Install dependencies on Debian/Ubuntu 24.04+ Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Install required packages via apt and set OMPI_CXX to g++-14. Needed before building ARTIS. ```sh sudo apt-get install g++-14 openmpi-bin libopenmpi-dev libzstd-dev zstd git make curl xz-utils rsync python3 perl export OMPI_CXX=g++-14 ``` -------------------------------- ### Install prek with uv Source: https://github.com/artis-mcrt/artis/blob/main/docs/development.md Installs the 'prek' tool using uv and adds its binary directory to the PATH. Required for the pre-commit hooks. ```sh uv tool install prek export PATH="$(uv tool dir --bin):$PATH" ``` -------------------------------- ### Install dependencies on macOS Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Install required packages via Homebrew and set PATH for LLVM and GNU coreutils. Needed before building ARTIS. ```sh brew install llvm open-mpi pkgconf zstd coreutils export PATH="$(brew --prefix llvm)/bin:$(brew --prefix coreutils)/libexec/gnubin:$PATH" ``` -------------------------------- ### Install artistools with uv Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Installs artistools via uv and adds its bin directory to the current shell's PATH. The export is temporary; uv tool update-shell adds it permanently. ```sh uv tool install artistools export PATH="$(uv tool dir --bin):$PATH" ``` -------------------------------- ### Install pre-commit hooks and create compilation database Source: https://github.com/artis-mcrt/artis/blob/main/docs/development.md Installs the pre-commit hooks, selects a preset by symlinking artisoptions.h, and generates a compilation database with TESTMODE=ON for clang tools. ```sh prek install ln -s artisoptions_nltenebular.h artisoptions.h make TESTMODE=ON compile_commands.json ``` -------------------------------- ### Source uv environment on Linux Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Loads the uv environment into the current shell after the Linux installer. Needed because the installer only updates the profile for future shells. ```sh source "$HOME/.local/bin/env" # Linux ``` -------------------------------- ### Install uv package manager Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Install uv, required by artistools, on macOS or Linux. The Linux installer adds uv to the shell profile, but the current shell needs to source the environment. ```sh brew install uv # macOS curl -LsSf https://astral.sh/uv/install.sh | sh # Linux ``` -------------------------------- ### Build documentation locally Source: https://github.com/artis-mcrt/artis/blob/main/docs/development.md Builds the documentation site locally using Sphinx with warnings treated as errors. Requires Python 3.14 and the docs requirements. ```sh uv run --python 3.14 --with-requirements docs/requirements.txt sphinx-build -W --keep-going docs docs/_build/html ``` -------------------------------- ### Symlink a preset and build Source: https://github.com/artis-mcrt/artis/blob/main/docs/installation.md Symlinks a preset to artisoptions.h and runs make. The file artisoptions.h is gitignored. make builds sn3d and exspec and creates symlinks in the repository root. ```sh ln -s artisoptions_classic.h artisoptions.h make ``` -------------------------------- ### Run linting and formatting checks Source: https://github.com/artis-mcrt/artis/blob/main/docs/development.md Runs pre-commit hooks on all files, regenerates the compilation database, and runs clang-tidy on a specified file (replace 'grid.cc' with your changed files). ```sh prek run --all-files make TESTMODE=ON compile_commands.json run-clang-tidy grid.cc ``` -------------------------------- ### Clone the repository Source: https://github.com/artis-mcrt/artis/blob/main/docs/development.md Clones the ARTIS source code repository and checks out the default branch 'main'. ```sh git clone https://github.com/artis-mcrt/artis.git cd artis ``` -------------------------------- ### Create model folder from test model input files Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Run the first command in the clone of step 2. The script creates the folder, a symlink 'artis' to the clone, and an 'input.txt' from 'scripts/input-template.txt'. The last command replaces that 'input.txt' with the test model's file. ```sh scripts/new-model-folder.sh --symlink ~/mymodel cd ~/mymodel tar -xf artis/tests/atomicdata_feconi.tar.xz rsync -a --exclude 'results_md5_*' artis/tests/kilonova_1d_inputfiles/ ./ cp input-newrun.txt input.txt ``` -------------------------------- ### Select compile-time options and build Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Run inside the model folder. Creates a symlink 'artisoptions.h' to the preset file 'artisoptions_kilonova_lte.h' and builds. Note: 'artisoptions.h' is a symlink, so edits change the preset file of the clone and affect all model folders sharing the clone. ```sh cd artis ln -s artisoptions_kilonova_lte.h artisoptions.h make cd .. ``` -------------------------------- ### Configure timesteps in input.txt Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Changes three lines in input.txt to run 50 timesteps from 170 to 250 days, running all of them. Keep other lines unchanged. ```text 50 # 1: ntimesteps: number of timesteps 000 050 # 2: timestep_start timestep_finish: ... 170 250 # 3: tmin_days tmax_days: start and end times [day] ``` -------------------------------- ### Clone and run ARTIS quickstart test Source: https://github.com/artis-mcrt/artis/blob/main/README.md Clones the ARTIS repository, enters the directory, and runs the kilonova_1d test via tests/runtest.sh. This builds the code and runs a small 1D kilonova model in two jobs, then post-processes the packets with exspec. ```sh git clone https://github.com/artis-mcrt/artis.git cd artis tests/runtest.sh kilonova_1d ``` -------------------------------- ### Run the kilonova_1d test model Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Runs the quickest complete simulation. Downloads atomic data (~15 MB), builds sn3d and exspec, creates tests/kilonova_1d_testrun, runs two jobs, and compares checksums. Different compilers/CPUs may cause checksum mismatches; output from the first job remains usable. ```sh tests/runtest.sh kilonova_1d ``` -------------------------------- ### Symlink NLTE nebular preset to artisoptions.h Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Creates a symlink from the NLTE nebular preset to artisoptions.h in the artis directory. Required before changing NUM_PACKETS. ```sh cd artis ln -s artisoptions_nltenebular.h artisoptions.h cd .. ``` -------------------------------- ### Clone the ARTIS source code into the model folder Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Creates the model folder and clones the ARTIS repository into the `artis` subfolder so that the options in section 4 belong to this simulation only. ```sh mkdir ~/nebular_w7 cd ~/nebular_w7 git clone https://github.com/artis-mcrt/artis.git ``` -------------------------------- ### Install dependencies with Homebrew on macOS Source: https://github.com/artis-mcrt/artis/blob/main/docs/installation.md Installs LLVM tools, Open MPI, and other dependencies via Homebrew. Needed before building on macOS. ```sh brew install llvm lld libomp open-mpi pkgconf zstd coreutils prek ``` -------------------------------- ### Set MAKEFLAGS for parallel builds Source: https://github.com/artis-mcrt/artis/blob/main/docs/installation.md Adds a MAKEFLAGS line to your shell startup file to enable parallel builds. Uses nproc or sysctl to determine the number of jobs. ```sh export MAKEFLAGS="--jobs=$(nproc 2>/dev/null || sysctl -n hw.ncpu)" ``` -------------------------------- ### Set NUM_PACKETS for laptop Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md The preset has a value of NUM_PACKETS for about 1000 MPI ranks; a laptop needs a much smaller value. Change it in 'artis/artisoptions.h'. ```c++ constexpr std::int64_t NUM_PACKETS = 1e6; ``` -------------------------------- ### Start the run with mpirun -np 4 artis/sn3d Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Start the simulation. Look for the lines 'timestep 3 is complete' in output_0-0.txt. To run the remaining timesteps, set timestep_finish in input.txt to 20 and start sn3d again. ```sh mpirun -np 4 artis/sn3d ``` -------------------------------- ### Describe input model with artistools inputmodel describe Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Run this command to inspect the model grid, total mass, and element masses. For the example model, it reports a 1D model with three spherical shells, an outer velocity of 12415 km/s, and a total mass of 0.635 solar masses with 49.67% iron group. ```sh artistools inputmodel describe . ``` -------------------------------- ### Add Homebrew LLVM and coreutils to PATH on macOS Source: https://github.com/artis-mcrt/artis/blob/main/docs/installation.md Prepends the Homebrew LLVM bin and coreutils GNU tools to PATH. Required because Homebrew keeps these out of the standard path. ```sh export PATH="$(brew --prefix llvm)/bin:$(brew --prefix coreutils)/libexec/gnubin:$PATH" ``` -------------------------------- ### Select compiler with Open MPI (OMPI_CXX) Source: https://github.com/artis-mcrt/artis/blob/main/docs/installation.md Set the C++ compiler used by Open MPI's mpicxx wrapper. Required before building when using Open MPI. ```sh export OMPI_CXX=g++ ``` -------------------------------- ### Build and run sn3d with mpirun Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Builds the ARTIS code and runs the sn3d executable with 4 processes in the background. The job folder name is written to standard output; tail -F follows the log of rank 0. Press Ctrl+C to stop following. ```sh cd artis && make && cd .. mpirun -np 4 artis/sn3d & tail -F output_0-0.txt ``` -------------------------------- ### Set timestep range in input.txt Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md The line with the comment '# 2: timestep_start timestep_finish' holds the first timestep of the job and the stop timestep. The job does not run the stop timestep, so the test runs the first nine of twenty timesteps. Change that line to run the whole model. ```text 000 020 # 2: timestep_start timestep_finish: ... ``` -------------------------------- ### Use new-model-folder.sh script Source: https://github.com/artis-mcrt/artis/blob/main/docs/clusters.md Alternative to manual setup: runs the 'scripts/new-model-folder.sh' script from an existing clone to create a new model folder, then changes into the new model's artis subfolder. ```sh artis/scripts/new-model-folder.sh ../mymodel cd ../mymodel/artis ``` -------------------------------- ### Set first timesteps in input.txt Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Sets the first four timesteps to solve the gas state in LTE, with every cell thick due to optical depth limit of 0. Keep other lines unchanged. ```text 4 # 18: num_lte_timesteps 0.0 4 # 19: optical_depth_is_thick num_grey_timesteps ``` -------------------------------- ### Run initial checks with artistools describe, check, logsummary Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Start by running these three commands on the model folder. `describe` shows grid, timesteps, and run options; `check` lists result checks; `logsummary` counts warning types in rank 0 logs. ```sh artistools describe artistools check artistools logsummary ``` -------------------------------- ### Describe, check, and plot test model Source: https://github.com/artis-mcrt/artis/blob/main/docs/quickstart.md Runs artistools commands to describe the model, check results, and plot light curves and spectra. artistools check gives one row per check and warns about reduced atomic data and low packet count. plotspectra requires a time in days (-t). ```sh artistools describe tests/kilonova_1d_testrun artistools check tests/kilonova_1d_testrun artistools plotlightcurves tests/kilonova_1d_testrun artistools plotspectra -t 1 tests/kilonova_1d_testrun ``` -------------------------------- ### Copy test input files and download atomic data Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Copies the input files of the `nebular_1d_3dgrid` test into the model folder, downloads the atomic data archive named by `artis/tests/atomic_data_release.txt`, unpacks it, and sets `input.txt` from `input-newrun.txt`. The model folder then contains the model, atomic data, recombination rates, and run-time parameters. ```sh rsync -a --exclude 'results_md5_*' --exclude 'input-resume.txt' artis/tests/nebular_1d_3dgrid_inputfiles/ ./ curl -fLO "https://github.com/artis-mcrt/artis/releases/download/$(cat artis/tests/atomic_data_release.txt)/atomicdata_feconi.tar.xz" tar -xf atomicdata_feconi.tar.xz cp input-newrun.txt input.txt ``` -------------------------------- ### Plot electron temperature of cell 0 Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Plots the electron temperature of cell 0 against the timestep using artistools plotestimators. The curve shows stages: LTE timesteps, Spencer-Fano solver start, detailed bound-free estimators, and stable temperature range. ```sh artistools plotestimators Te -x timestep --cell 0 . ``` -------------------------------- ### Set NUM_PACKETS in artisoptions.h Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Sets NUM_PACKETS to 1e7 for about 1000 MPI ranks. Each of four ranks holds 2.5e6 packets, using 572 MB memory per rank. ```c++ constexpr std::int64_t NUM_PACKETS = 1e7; ``` -------------------------------- ### Check progress after each timestep Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Greps the log of rank 0 for the latest 'is complete' line to show progress after each timestep. The output shows the timestep number, total timesteps, and estimated remaining time. ```sh grep "is complete" output_0-0.txt | tail -n 1 ``` ```text timestep 23 is complete (24 of 50 timesteps of the model) after 0.00 hours. If each timestep takes this time, the remaining 26 requested timesteps take 0.01 hours. ``` -------------------------------- ### Run checks with artistools check Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Runs the artistools check command to validate the run. The output gives one row per check; for this run, one row has a warning about temperature limits. ```sh artistools check . ``` ```text "temperature limits" warning "... over all 50 time steps, 66.7% of the values of Te are at a limit ..." ``` -------------------------------- ### Edit and submit job script with sbatch on Cosma8 Source: https://github.com/artis-mcrt/artis/blob/main/docs/clusters.md Edit the job script (e.g., rank count, account, email) and queue it with `sbatch`. The example uses `artis/scripts/artis-cosma8.sh` on the Cosma8 cluster. ```sh vim artis/scripts/artis-cosma8.sh sbatch artis/scripts/artis-cosma8.sh ``` -------------------------------- ### Show end state and cost of the job Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md The last lines of the log show the end state and the cost of the job. The output includes 'No need for restart' and the wallclock and core hours. ```text No need for restart sn3d finished (job: pktprop ts 0 to ts 49 grid-preprop, 0.021 wallclock hours * 4 processes * 1 threads = 0.083 core hours) ``` -------------------------------- ### compositiondata.txt level limit configuration Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md This file selects elements, ion stages, and levels read from atomic data. The first line is the number of elements; the next two lines must be 0. Each later line specifies atomic number, number of ion stages, lowest ion stage (1 = neutral), highest ion stage, max levels per ion (-1 for all), an unused value (must be zero or positive), and mean atomic mass. The example selects Fe I–V, Co II–IV, and Ni II–V with at most 500 levels per ion. Lower limits speed up runs and reduce memory but change results; the run stops if a kept level photoionises to a level above the limit. ```text 3 0 0 26 5 1 5 500 0.0 55.8450 27 3 2 4 500 0.0 58.9332 28 4 2 5 500 0.0 58.6934 ``` -------------------------------- ### Plot spectrum with artistools plotspectra Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Use this command to plot the spectrum at a given time (220 days) with emission and absorption. Without the --emissionabsorption flag, only the spectrum is drawn. The time must be within the arrival times range (177.04 to 232.07 days) for this run. ```sh artistools plotspectra -t 220 --emissionabsorption . ``` -------------------------------- ### Check memory usage of packets and arrays Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Greps the log for mem_usage lines to show memory usage of packets and large arrays. The output lists memory in MB for packets, linelist, and transition lists. ```sh grep mem_usage output_0-0.txt ``` ```text [info] mem_usage: packets occupy 572.205 MB [info] mem_usage: linelist occupies 15.848 MB (node shared memory) [info] mem_usage: transition lists occupy 20.800 MB (node shared memory) ... ``` -------------------------------- ### Warning for cells at MAXTEMP Source: https://github.com/artis-mcrt/artis/blob/main/docs/example.md Log warning for cells where heating exceeds cooling over the whole T_e range, forcing T_e to MAXTEMP. These cells lack atomic data for silicon and sulphur, so results are not physical. ```text [warning] call_T_e_finder: heating bigger than cooling over the whole T_e range [1000,30000] in modelcell 1 (...). T_e forced to be MAXTEMP ``` -------------------------------- ### Run updatechecksums.yml workflow and watch run Source: https://github.com/artis-mcrt/artis/blob/main/AGENTS.md Use these commands to start the updatechecksums.yml workflow with a specific branch and then wait for the run to complete. The first command prints the URL of the new run, which ends with the run ID. The second command fails if the run fails. ```sh gh workflow run updatechecksums.yml -f branch= gh run watch --exit-status ``` -------------------------------- ### Run updatechecksums.yml workflow Source: https://github.com/artis-mcrt/artis/blob/main/CONTRIBUTING.md Use this command to start the updatechecksums.yml workflow after an intended change of numerical results. It runs from main and takes your branch as an input, so do not give a --ref. The workflow needs write access to the repository and the branch must be in artis-mcrt/artis. ```sh gh workflow run updatechecksums.yml -f branch= ``` -------------------------------- ### Escaped packet count log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Log line from each rank giving the number of packets that escaped during a timestep. This count is only a guide; it includes all escaped packet types (e.g., gamma packets) while the spectrum holds only r-packets, and light travel time can move a packet to the timestep of its arrival. ```text During timestep 33 on MPI process 0, 47523 pellets decayed and 49411 packets escaped. (t=220.124 [d]) ``` -------------------------------- ### artistools commands for first look at simulation output Source: https://github.com/artis-mcrt/artis/blob/main/docs/outputfiles.md Use these commands to inspect a model folder after a simulation. They provide a quick overview: describe, check, plot light curves, plot spectra at a given time, and plot estimators. Requires the artistools package. ```sh artistools describe artistools check artistools plotlightcurves artistools plotspectra -t artistools plotestimators ``` -------------------------------- ### Generate compile database and run clang-tidy Source: https://github.com/artis-mcrt/artis/blob/main/AGENTS.md Creates the compile database with TESTMODE=ON and runs clang-tidy on a changed file. The database is also written by each program build and the make pre-commit hook; it requires python3 and replaces the file only when content changes. Never use compiledb because it drops mpicxx and causes false diagnostics. ```shell make TESTMODE=ON compile_commands.json run-clang-tidy grid.cc ``` -------------------------------- ### Create model folder and clone release branch Source: https://github.com/artis-mcrt/artis/blob/main/docs/clusters.md Sets up a new model folder, clones the 'release' branch of the ARTIS repository, copies the input template, and enters the artis subfolder. The source code and git metadata must reside in the 'artis' subfolder so the code finds its data files in 'artis/data'. ```sh mkdir mymodel cd mymodel git clone --branch release https://github.com/artis-mcrt/artis.git cp artis/scripts/input-template.txt input.txt cd artis ``` -------------------------------- ### Build ARTIS with preset symlink and make Source: https://github.com/artis-mcrt/artis/blob/main/AGENTS.md Sets parallel build jobs, symlinks the classic preset to artisoptions.h (required, gitignored), and builds sn3d and exspec. The symlink keeps artisoptions.h correct when the preset changes, e.g. after a branch change. ```sh export MAKEFLAGS="--jobs=$(nproc)" ln -s artisoptions_classic.h artisoptions.h # required, gitignored make # builds sn3d and exspec ``` -------------------------------- ### Create model folder and download atomic data Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Run in a clone of the repository to create a new model folder, then download and extract the atomic data archive for Fe, Co, and Ni. The model can only contain these elements; cells with mass only in other elements become empty. ```sh scripts/new-model-folder.sh --symlink ~/ownmodel cd ~/ownmodel curl -fLO https://github.com/artis-mcrt/artis/releases/download/v2026.5.15/atomicdata_feconi.tar.xz tar -xf atomicdata_feconi.tar.xz ``` -------------------------------- ### Build and run unit tests Source: https://github.com/artis-mcrt/artis/blob/main/docs/testing.md Builds and runs the unit tests covering numeric and parsing helpers and some physics functions. CI runs them for the classic and NLTE nebular presets. ```sh make unittests && ./unittests ``` -------------------------------- ### Symlink options preset to artisoptions.h Source: https://github.com/artis-mcrt/artis/blob/main/docs/clusters.md Creates a symlink from a preset (e.g., 'artisoptions_classic.h') to 'artisoptions.h'. The preset's value may not be correct for a production run; adjust NUM_PACKETS for your rank count. ```sh ln -s artisoptions_classic.h artisoptions.h ``` -------------------------------- ### Compile and return to model folder Source: https://github.com/artis-mcrt/artis/blob/main/docs/clusters.md Compiles the code with 'make' and changes back to the model folder (parent of 'artis'). ```sh make cd .. ``` -------------------------------- ### Write model.txt and abundances.txt with make_model.py Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Place this script in the model folder as make_model.py. It creates a 1D model with an exponential density profile, 20 shells, and Ni56 in the inner shells. The script writes model.txt and abundances.txt, and prints the total and Ni56 masses. ```python """Write model.txt and abundances.txt of a 1D model with an exponential density profile.""" import math from pathlib import Path MSUN = 1.989e33 # g DAY = 86400.0 # s KM = 1.0e5 # cm t_model_days = 1.0 ncells = 20 v_max_kms = 15000.0 v_scale_kms = 3000.0 # the e-folding velocity of the density mass_total_msun = 1.0 v_ni56_max_kms = 6000.0 # the Ni56 is inside this velocity x_ni56_inner = 0.7 t_model_s = t_model_days * DAY v_outer_kms = [v_max_kms * (i + 1) / ncells for i in range(ncells)] v_inner_kms = [0.0, *v_outer_kms[:-1]] # volume of each shell at t_model, and an unscaled density at the middle velocity of the shell volume_cm3 = [ 4.0 / 3.0 * math.pi * ((v_o * KM * t_model_s) ** 3 - (v_i * KM * t_model_s) ** 3) for v_i, v_o in zip(v_inner_kms, v_outer_kms, strict=True) ] rho_unscaled = [ math.exp(-0.5 * (v_i + v_o) / v_scale_kms) for v_i, v_o in zip(v_inner_kms, v_outer_kms, strict=True) ] # scale the density to the total mass mass_unscaled = sum(r * v for r, v in zip(rho_unscaled, volume_cm3, strict=True)) rho_g_cm3 = [r * mass_total_msun * MSUN / mass_unscaled for r in rho_unscaled] x_ni56 = [x_ni56_inner if v_o <= v_ni56_max_kms else 0.0 for v_o in v_outer_kms] with Path("model.txt").open("w", encoding="utf-8") as model_file: model_file.write(f"{ncells}\n{t_model_days}\n") model_file.write("#inputcellid vel_r_max_kmps logrho X_Fegroup X_Ni56 X_Co56 X_Fe52 X_Cr48\n") for cell_id in range(ncells): logrho = math.log10(rho_g_cm3[cell_id]) model_file.write(f"{cell_id} {v_outer_kms[cell_id]} {logrho:.6f} 1.0 {x_ni56[cell_id]} 0.0 0.0 0.0\n") with Path("abundances.txt").open("w", encoding="utf-8") as abundances_file: for cell_id in range(ncells): x_by_atomic_number = [0.0] * 28 # Z = 1 to 28 x_by_atomic_number[28 - 1] = x_ni56[cell_id] x_by_atomic_number[26 - 1] = 1.0 - x_ni56[cell_id] abundances_file.write(f"{cell_id} " + " ".join(str(x) for x in x_by_atomic_number) + "\n") mass_ni56_msun = sum( r * v * x for r, v, x in zip(rho_g_cm3, volume_cm3, x_ni56, strict=True) ) / MSUN print(f"total mass {mass_total_msun:.3f} Msun, Ni56 mass {mass_ni56_msun:.3f} Msun") ``` -------------------------------- ### Run make_model.py Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Run the script to generate the model files. It prints the total and Ni56 masses. ```sh python3 make_model.py ``` -------------------------------- ### Select preset and set packet count Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Select the preset nearest to the model by symlinking artisoptions_classic.h to artisoptions.h. Then change NUM_PACKETS in artisoptions.h to 1e5 and build. artisoptions.h is a symlink, so git restore artisoptions_classic.h in the clone removes the change. ```sh cd artis ln -sf artisoptions_classic.h artisoptions.h ``` ```sh make cd .. ``` -------------------------------- ### Create symlink to preset artisoptions_nltenebular.h Source: https://github.com/artis-mcrt/artis/blob/main/docs/presets.md Select a preset by symlinking it to artisoptions.h. The build requires this symlink, and artisoptions.h is gitignored. Do not copy the preset; the symlink keeps options correct when the preset changes. ```sh ln -s artisoptions_nltenebular.h artisoptions.h ``` -------------------------------- ### Run sn3d locally with mpirun and follow the log Source: https://github.com/artis-mcrt/artis/blob/main/docs/running.md Run sn3d in the model folder with eight MPI ranks. `tail -F` waits until sn3d creates the log file; press Ctrl+C to stop following it. ```sh mpirun -np 8 artis/sn3d & tail -F output_0-0.txt ``` -------------------------------- ### Check input with mpirun -np 4 artis/sn3d -c Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Run the input check. The standard output has the line 'input check: complete' when the check finds no error. Read the warnings of the check. ```sh mpirun -np 4 artis/sn3d -c ``` ```sh grep warning inputcheck/output_0-0.txt ``` -------------------------------- ### Expected output of make_model.py Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md The script prints this line, showing the total mass and Ni56 mass in solar masses. ```text total mass 1.000 Msun, Ni56 mass 0.260 Msun ``` -------------------------------- ### Edit input.txt timestep and time settings Source: https://github.com/artis-mcrt/artis/blob/main/docs/ownmodel.md Change these lines of input.txt and keep the comment of each line. tmin_days must be at or after the snapshot time of model.txt, or the run stops. This job runs the first four timesteps. ```text 20 # 1: ntimesteps ... 000 004 # 2: timestep_start timestep_finish ... 2 30 # 3: tmin_days tmax_days ... 3 # 18: num_lte_timesteps 3.0 3 # 19: optical_depth_is_thick num_grey_timesteps ``` -------------------------------- ### NLEVELS_ADD_MISSING_COLLISIONAL_TRANSITIONS kilonova_lte preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Adds 80 missing collisional transitions for Fe (Z=26) or Ni (Z=28) with ionstage >= 1, otherwise 0. ```c++ { return ((element_z == 26 || element_z == 28) && ionstage >= 1) ? 80 : 0; } ``` -------------------------------- ### Run exspec with mpirun Source: https://github.com/artis-mcrt/artis/blob/main/docs/exspec.md Run exspec in the model folder with any number of ranks from one up to the number of packet files. It reads the same input.txt, model, and atomic data files as sn3d, so it must run in the same folder. Rank 0 writes the log to exspec.txt. ```sh mpirun -np 8 artis/exspec ``` -------------------------------- ### Plot bolometric light curve with artistools plotlightcurves Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Generates a PDF of the bolometric light curve. The model folder is a positional argument; `.` can be used for the current folder. ```sh artistools plotlightcurves ``` -------------------------------- ### Write spectra of each timestep as text with artistools writespectra Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Writes the spectra for each timestep as text files. The model folder is the positional argument. ```sh artistools writespectra ``` -------------------------------- ### Documentation Preview Link Template Source: https://github.com/artis-mcrt/artis/blob/main/AGENTS.md Required first line of a pull request that changes docs/ or artisoptions_doc.md. Replace with the pull request number in both places. ```text Preview the documentation: https://artis-mcrt--.org.readthedocs.build/en// ``` -------------------------------- ### FORCE_SAHA_ION_BALANCE classic preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Returns false for the classic preset, meaning Saha ionisation balance is not forced. ```c++ { return false; } ``` -------------------------------- ### Plot spectrum from packet files with artistools plotspectra --frompackets Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the spectrum directly from the packet files. Use the `--frompackets` flag with a valid time. ```sh artistools plotspectra -t --frompackets ``` -------------------------------- ### Check input files with sn3d -c Source: https://github.com/artis-mcrt/artis/blob/main/docs/running.md Run sn3d with the `-c` option before submitting a job to validate input files. The check stops before the first timestep and writes `input check: complete` to standard output when no error is found. ```sh mpirun -np 4 artis/sn3d -c ``` -------------------------------- ### ION_NLEVELS_EXCITED_NLTE classic preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Returns 0 for the classic preset, meaning no excited levels in full NLTE. ```c++ { return 0; } ``` -------------------------------- ### Plot time each rank took with artistools plotlogfiles Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the time that each rank took. The model folder is the positional argument. ```sh artistools plotlogfiles ``` -------------------------------- ### Set sanitizer environment variables for TESTMODE=ON Source: https://github.com/artis-mcrt/artis/blob/main/docs/testing.md Required environment variables when TESTMODE=ON enables sanitizers and extra assertions. Sets ASAN_OPTIONS to detect stack-use-after-return and disable leak detection, and OMPI_MCA_memory to disable the patcher. ```sh export ASAN_OPTIONS=detect_stack_use_after_return=1:detect_leaks=0 export OMPI_MCA_memory='^patcher' ``` -------------------------------- ### ION_NLEVELS_EXCITED_NLTE nltephotospheric preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Returns 100 for elements with atomic number less than 20, otherwise 200 in the nltephotospheric preset. ```c++ { if (element_z < 20) { return 100; } return 200; } ``` -------------------------------- ### Plot emission of each element with artistools plotspectra --showemission --groupby element Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the emission contribution of each element. Requires the `--showemission` and `--groupby element` flags. ```sh artistools plotspectra -t --showemission --groupby element ``` -------------------------------- ### Plot deposition rates of cells with artistools deposition Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the deposition rates of the cells. The model folder is the positional argument. ```sh artistools deposition ``` -------------------------------- ### Plot populations of one ion with artistools plotnltepops Fe --ion-stages --cell Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the NLTE populations of Fe ion stage 2 for a specific cell at a given time. Requires a run with NLTE levels. ```sh artistools plotnltepops Fe --ion-stages 2 --cell -t ``` -------------------------------- ### Timestep progress log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Log line showing timestep completion time and an estimate for remaining timesteps based on the last timestep's duration. ```text timestep 23 is complete (24 of 50 timesteps of the model) after 0.00 hours. If each timestep takes this time, the remaining 26 requested timesteps take 0.01 hours. ``` -------------------------------- ### ION_NLEVELS_EXCITED_NLTE nltenebular preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Returns 197 for Fe II (element_z 26, ionstage 2) and 80 for other ions in the nltenebular preset. ```c++ { if (element_z == 26 && ionstage == 2) { return 197; } return 80; } ``` -------------------------------- ### Job completion log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Final log line reporting wallclock time, process count, thread count, and total core hours for the job. ```text sn3d finished (job: pktprop ts 0 to ts 49 grid-preprop, 0.021 wallclock hours * 4 processes * 1 threads = 0.083 core hours) ``` -------------------------------- ### Packet memory and count log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Log lines from each rank showing the number of packets in memory and their memory usage. The packet count is NUM_PACKETS divided equally among ranks; the memory size depends on the build, so read the value from your log. ```text Simulation propagates 2500000 packets on this rank (total 1e+07 with nprocs 4) [info] mem_usage: packets occupy 572.205 MB ``` -------------------------------- ### NLTE levels summary log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Log line showing the total number of excited NLTE levels and superlevels across all ions. The NLTE solver uses these to build the rate matrix. ```text [info] Total NLTE levels: 1008, of which 11 are superlevels ``` -------------------------------- ### NLEVELS_ADD_MISSING_COLLISIONAL_TRANSITIONS nltephotospheric preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Adds 100 missing collisional transitions for elements with Z < 20, otherwise 200. ```c++ { return (element_z < 20) ? 100 : 200; } ``` -------------------------------- ### Atomic data summary log output Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Log line printed after reading atomic data, listing total ions, levels, lines, and photoionisation transitions. Useful for verifying data loading and estimating memory usage. ```text [info] in total 12 ions, 5263 levels (4262 ionising), 519292 lines, 14780 photoionisation transitions ``` -------------------------------- ### Check packet count with artistools check --frompackets Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Run this command to check if the packet count is sufficient. The `packet noise` row gives the largest relative noise of a timestep and the noise at the peak. The check reads packet files, so it is slow. With packets of equal energy, 100 times more packets give 10 times less noise. ```sh artistools check --frompackets ``` -------------------------------- ### Plot core hours of all jobs with artistools corehours Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the core hours of all jobs. The model folder is the positional argument. ```sh artistools corehours ``` -------------------------------- ### Plot spectrum by emission and absorption process with artistools plotspectra --emissionabsorption Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the spectrum broken down by emission and absorption processes. Use the `--emissionabsorption` flag with a valid time. ```sh artistools plotspectra -t --emissionabsorption ``` -------------------------------- ### Download and unpack Shingles et al. (2022) atomic database Source: https://github.com/artis-mcrt/artis/blob/main/docs/data.md Downloads the atomic database for the nebular phase of a Type Ia supernova and unpacks it in the model folder. Requires the `zstd` package because GNU tar calls the `zstd` command for `.zst` archives; the `libzstd-dev` package does not supply that command. ```sh curl -fLO https://github.com/artis-mcrt/artis/releases/download/v2026.5.15/atomicdata_shinglesetal2022.tar.zst tar --zstd -xf atomicdata_shinglesetal2022.tar.zst ``` -------------------------------- ### Plot deposition of decay products with artistools plotlightcurves --deposition Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots deposition of gamma and beta-plus decay products. The model folder must precede the `--deposition` option. ```sh artistools plotlightcurves --deposition gamma betaplus ``` -------------------------------- ### FORCE_SAHA_ION_BALANCE kilonova_lte preset Source: https://github.com/artis-mcrt/artis/blob/main/docs/options.md Forces Saha ionisation balance for elements with Z between 38 and 40 (exclusive), i.e., Z < 38 or Z > 40. ```c++ { return element_z < 38 || element_z > 40; } ``` -------------------------------- ### Plot light curves for filters B and V with artistools plotlightcurves --filter Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots light curves for the specified filters. Put the model folder before the `--filter` option because it takes multiple values. ```sh artistools plotlightcurves --filter B V ``` -------------------------------- ### grep mem_usage command Source: https://github.com/artis-mcrt/artis/blob/main/docs/planning.md Shell command to extract memory usage lines from the rank 0 log file, showing packet memory and large array memory. ```sh grep mem_usage output_0-0.txt ``` -------------------------------- ### Plot spectrum at one time with artistools plotspectra -t Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the spectrum at a given time in days. `plotspectra` accepts only times when the whole model can have sent light to the observer; the `arrival times` row of `artistools check` gives that range. ```sh artistools plotspectra -t ``` -------------------------------- ### Plot direction-resolved spectra, light curves, and direction map Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Use these commands to plot direction-resolved results from a 2D or 3D model. Each `--plotviewingangle` number is one observer direction bin. `plotspherical` draws a direction map from the escaped packets. ```sh artistools plotspectra -t --plotviewingangle 0 ``` ```sh artistools plotlightcurves --plotviewingangle 0 10 ``` ```sh artistools plotspherical ``` -------------------------------- ### Plot radiation field of a cell with artistools plotradfield --cell Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the radiation field of a specific cell at a given time. Use `--cell` to specify the cell. ```sh artistools plotradfield --cell -t ``` -------------------------------- ### Plot estimators of all cells at one time with artistools plotestimators -t -p Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots estimators `Te` and `nne` for all cells at a given time. Use `-t` for time and `-p` for the estimators. ```sh artistools plotestimators -t -p Te nne ``` -------------------------------- ### Plot estimator of one cell against timestep with artistools plotestimators Te -x timestep --cell Source: https://github.com/artis-mcrt/artis/blob/main/docs/analysis.md Plots the estimator `Te` for a specific cell against the timestep. Use `--cell` to specify the cell. ```sh artistools plotestimators Te -x timestep --cell ```