This package is a wrapper around ebtelplusplus designed to quickly run a large number of coronal loop models to generate a grid of solutions used by GX Simulator.
To use this package, follow the ebtelplusplus installation instructions. Be sure to install the rsp_toolkit submodule from within the ebtelplusplus directory with:
git submodule init
git submodule updateIf you get difficult to interprete errors about variables not being of the right type when compiling with scons, check your GNU compiler.
Then, download this package in the desired directory with:
git clone https://github.com/schonfsj/ebtel_parallel.gitTo create a compatible anaconda environment, from inside the ebtel_parallel directory run:
conda env create -f environment.ymlYou can also install the package locally (so that it can be imported from any working directory) with anaconda:
conda develop .or pip:
pip install -e .Finally, line 19 of ebtel_parallel.py should be changed to point to the top directory of ebtelplusplus in the local installation. This is necessary to call the ebtelplusplus c++ program as a subprocess. It is also possible although less convenient to provide this directory as a keyword argument every time one of the main routines is run.
Directories:
/runscontains configuration files for running ebtelplusplus and all the aggregated output files./tmpwill contain temporary files from each individual model generated from running ebtelplusplus usingruns/demo_grid.cfg.xml/gx_savwill contain IDL save files holding grids for GX simulator generated byebtelplusplus_read.pro
Jupyter notebooks:
ebtel_grid.ipynbdemonstrates how to callebtel_parallel.pyto generate grids of solutions for use with GX Simulator
Python files:
ebtel_parallel.pyis the main module that contains all the routines for working with ebtelplusplus.power_functions.pymodule contains functions for working with power law distributions. Used byebtel_parallel.pyto generate random distributions of heating events.setup.pycontains the module definition that enables installation as an anaconda or pip package.
IDL files:
ebtelplusplus_read.proreads in theruns/*.txtfiles generated withebtel_parallel.epp_grid()and creates the save files used by GX Simulator.
A sample GX Simulator grid can be computed by running (from within this directory) the following commands in a python script, jupyter notebook, or in a python environemnt:
import ebtel_parallel
ebtel_parallel.epp_grid(file='runs/demo_grid', heating='power', stable=0.1)Then run the IDL program ebtelplusplus_read.pro to generate the necessary save file for GX Simulator with:
ebtelplusplus_read, 'ebtel'ebtel_parallel.py is mainly a wrapper around ebtelplusplus to facilitate the parallel computation of many ebtel simulations simultaneously. It contains two primary routines:
epp_grid()computes a grid of solutions for use in GX Simulator. These grids cover a different, smaller parameter space than the original grids generated by Nicki Viall. This is because this program does not gracefully handle failed simulations, and further extending the parameter space leads to instability, depending on the random realization of heating events.epp_repeat()computes repeated heating realizations using the same heating parameters. In principle, this could be combined withepp_grid()in order to emulate extremely long simulations and produce grids with more stable DEMs, but this has not been implemented.
This file also contains a number of utility routines used to generate a series of heating events (either regular repeating trains or random samples from power laws), a routine to generate the radiative loss function used in ebtelplusplus, routines to calculate the characteristic loop cooling time, and a routine for calculating the differential dispersion measure (DDM) from standard output files.
In addition to running the simulations in parallel and properly handling the outputs from these batch runs, the main modifications are around the generation of heating events to apply to the individual runs. This is done by applying tags included in the runs/demo_repeat.cfg.xml configuration file that define properties of the heating events that are automatically generated and would otherwise need to be manually included in the configuration file. These automatic heating events can either be 'constant' regular trains of identical heating events or randomly generated events drawn from a defined 'power' law distribution.
For epp_grid(), the loop length and heating rate parameter space is predefined, so the only additional tags that need to be defined are:
duration: The duration of individual heating events [s]alpha: The power law slope (y~x^alpha) of the distribution from which random heating events are drawnfrequency_scale: a multiplicative scale factor applied to the characteristic cooling time to determine the average time between heating events.frequency_scale=1means that the average time between heating events is the average cooling time.max_factor: Designates the maximum delay between heating eventstau_maxas a multiplicative factor of the cooling time, defaults to3. Iffrequency_scaleis set,tau_max = max_factor * frequency_scale * 'loop cooling time'cooling_times: Overridestotal_time = cooling_times * frequency_scale * 'loop cooling time'random_seed: An optional integer that determines the random seed used for each model inebtel_parallel.epp_grid(). Useful to ensure that each model experiences identical heating event characteristics.
For epp_repeat(), the loop_length must be set just as with the default ebtelplusplus configuration file format. In addition, it is necessary to set the heating rate using:
energy: The heating rate [erg cm^-2 s^-1] applied to the simulated strand. This is converted into a volumetric heating rate (when calculating heating events) by dividing by theloop_length
And, while it is possible to define the heating with the same parameters used by epp_grid(), it is also possible to define the heating function more manually with the following tags:
delay: The median (or exact) delay between heating events [s]delay_minimum: The minimum delay between consecutive heating events [s]. Defers todelayif applying the minimum would change the median time between events.delay_maximum: The maximum delay between consecutive heating events [s]. Defers todelayif applying the maximum would change the median time between events.
The tags alpha, delay_minimum, and delay_maximum are ignored (and can be omitted) if using 'constant' heating.
Note: If you want to output the ebtelplusplus working files to a subdirectory (recommended, because there are many), you need to create that directory before the run, as it will not be generated automatically. This has already been done in the sample directory \tmp. The same is true of the directory for IDL save files \gx_sav.
If using this code in any published work, please cite the GX Simulator paper:
- Nita et al. (2022)
and the relevant ebtelplusplus papers: