Skip to main content
QUICK REVIEW

[Paper Review] Flaremodel: An open-source Python package for one-zone numerical modelling of synchrotron sources

Yigit Dallilar, S. D. von Fellenberg|arXiv (Cornell University)|Nov 30, 2021
Astrophysics and Cosmic PhenomenaPhysics and Astronomy21 references4 citations
TL;DR

Flaremodel is an open-source Python package for one-zone numerical modelling of synchrotron sources, combining high-performance C-based physics functions with a user-friendly Python interface. It enables flexible, scalable simulations of electron distributions, radiative processes (synchrotron, SSC, IC), and SED fitting, with support for multi-threading (OpenMP) and GPU offloading (OpenCL), making it ideal for studying flaring phenomena near black holes like Sgr A*.

ABSTRACT

Synchrotron processes, the radiative processes associated with the interaction of energetic charged particles with magnetic field, are of interest in many areas in astronomy, from the interstellar medium to extreme environments near compact objects. Consequently, observations of synchrotron sources carry information on the physical properties of the sources themselves and those of their close vicinity. In recent years, novel observations of such sources with multi-wavelength collaborations reveal complex features and peculiarities, especially near black holes. Exploring the nature of these sources in more detail necessitates numerical tools complementary to analytical one-zone modelling efforts. In this paper, we introduce an open-source Python package tailored to this purpose, flaremodel. The core of the code consists of low-level utility functions to describe physical processes relevant to synchrotron sources, which are written in C for performance and parallelised with OpenMP for scalability. The Python interface provides access to these functions and built-in source models are provided as a guidance. At the same time, the modular design of the code and the generic nature of these functions enable users to build a variety of source models applicable to many astrophysical synchrotron sources. We describe our methodology and the structure of our code along with selected examples demonstrating capabilities and options for future modelling efforts.

Motivation & Objective

  • To develop a flexible, high-performance numerical tool for modelling synchrotron emission from astrophysical sources, particularly flaring environments near black holes.
  • To address the limitations of analytical one-zone models by enabling dynamic, time-dependent simulations of particle injection, cooling, and radiative transfer.
  • To provide a modular, extensible framework that supports both low-end and high-end computing hardware through efficient C-based computation and OpenMP parallelization.
  • To facilitate detailed investigation of complex flare features observed in multi-wavelength campaigns, such as those from Sgr A*, by enabling rapid prototyping of diverse source models.
  • To integrate SED fitting capabilities via lmfit, allowing users to constrain physical parameters through optimization methods including MCMC.

Proposed method

  • The core of flaremodel consists of low-level, C-compiled utility functions for key physical processes (synchrotron emission, synchrotron self-absorption, inverse Compton scattering, electron cooling) to ensure high computational performance.
  • These C functions are parallelized using OpenMP to enable efficient multi-threading, bypassing the Python GIL and allowing scalable performance on multi-core systems.
  • A high-level Python interface exposes these functions and provides built-in source models (e.g., homogeneous sphere, radial sphere) as templates for users to extend.
  • The package supports time-dependent simulations with user-defined particle injection profiles (e.g., Gaussian injection) and tracks evolving electron distributions under synchrotron cooling.
  • It includes a dedicated SED fitting module built on the lmfit Python package, enabling optimization of model parameters using various algorithms (least-squares, MCMC).
  • Experimental GPU support is provided via OpenCL for selected components (currently only IC calculations), enabling offloading of computationally intensive tasks.

Experimental results

Research questions

  • RQ1How can one efficiently simulate time-dependent electron distributions and their associated synchrotron emission in a one-zone model for flaring astrophysical sources?
  • RQ2What is the impact of particle injection timescale and magnetic field strength on the evolution of the electron distribution and resulting SED in a flaring event?
  • RQ3How can numerical models be designed to balance computational efficiency with flexibility for diverse astrophysical source configurations?
  • RQ4To what extent can analytical approximations (e.g., broken power-law, power-law) accurately represent complex, time-evolving electron distributions in synchrotron sources?
  • RQ5How can multi-threaded and GPU-accelerated computation be effectively integrated into a scientific Python package for astrophysical modelling?

Key findings

  • For a homogeneous sphere model, SED computation takes approximately 1 ms for synchrotron emission and 100 ms for SSC emission on a single-threaded i7-8700 CPU.
  • For a radial sphere model, synchrotron SED computation takes around 100 ms, while SSC computation takes several seconds under the same conditions.
  • When SSC calculations are offloaded to the CPU’s integrated graphics, execution time is reduced to about 1 second, demonstrating the benefit of hardware-aware optimization.
  • The electron distribution evolves from a broken power-law with exponential cutoff (at t = 15 min post-injection peak) to a simple power-law (at t = 30 min), consistent with synchrotron cooling erasing injection history.
  • The model successfully reproduces the evolution of a Gaussian particle injection profile with tinj ≈ 2.35σ/2 and B = 20 G, showing that analytical approximations are viable for key phases of flare evolution.
  • The package has already been applied in GRAVITY Collaboration et al. (2021a) to investigate the emission mechanisms of a peculiar NIR/X-ray flare from Sgr A*, demonstrating its utility in real observational analysis.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.