Introduction

Introduction Next
GX Simulator >

GX_Simulator is an interactive IDL widget application intended to provide a flexible tool that allows the user to generate spatially resolved radio and/or X-ray spectra. The object-based architecture of this application provides full interaction with local 3D magnetic field extrapolation models that may be embedded in a global coronal model. By the use of various mouse tools provided, the user is allowed to explore the magnetic connectivity of the model by generating magnetic field lines originating in user-specified volume voxels. Such lines may be selected to create magnetic flux tubes, which are further populated with user-defined analytical thermal/non thermal particle distribution models. By default, the application integrates IDL callable DLL and Shared libraries containing fast GS emission codes developed in FORTRAN and C++ based on the newly developed Fleishman–Kuznetsov approximation, and IDL X-ray codes developed by Eduard Kontar. However, the interactive interface allows interchanging these default libraries with any user-defined IDL or external callable codes designed to solve the radiation transfer equation in the same or other wavelength ranges of interest.

Next>>
Gelu M. Nita.
http://web.njit.edu/~gnita/


Key Features
GX Simulator >
  • The application provides 3D interaction with a Sun object that serves as container for an arbitrary number of local 3D models that may be embedded in a global built-in coronal model.
  • The default coronal model is analytically defined through an adjustable set of predefined parameters. However the user has the ability to add an arbitrary number of additional parameters that may be used to modify the default coronal model.
  • A 3D magnetic field model may be imported from a standard IDL sav file, provided that the file data structure complies with a set of predefined conventions.
  • Interactive tools are provided for generating an arbitrary number of field lines originating in any voxel of the data cube model.
  • Interactive tools are provided for defining magnetic flux tubes associated with a central field line.
  • Interactive tools are provided for populating the flux tube volume with user adjustable thermal and nonthermal electron distributions
  • A predefined set of user adjustable electron energy distributions is provided.
  • A predefined set of user adjustable electron angular distributions is provided.
  • Ability to save the final model configuration for future use is provided.
  • Interactive tools for choosing an adjustable field of view are provided.
  • Predefined fast gyrosynchrotron (GS) and X-ray codes are provided for computing the imaging maps in the wavelength interval of interest.
  • A built in calling convention provides the means of integrating alternative codes designed to solve the radiation transfer equation in the same or other wavelength ranges of interest based on the line of sight (LOS) information provided by the simulator.
  • Ability to save the imaging data output as well as the full LOS information used to compute the maps is provided.
  • A widget interface, namely GX_Explorer, compliments the GX_Simulator package by providing fast means for interactive inspection of the output data files.
  • An integrated Plotman object that provides means for model to data comparison
  • A built-in magnetic field extrapolation engine that may be used to produce potential fied extrapolation (PFE) or linear force free field extrapolation (LFFF) models based on inut magnetic fied maps.
<<Previous Next>>


Getting Started
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >

Getting Started

  • Install GX Simulator
  • Start SSWIDL or SSWIDLDE
  • Start GX Simulator by issuing the gx or gx_simulator IDL console commands
  • Customize (if needed) the built-in analytical coronal model
  • Import or create a magnetic field model
  • Add/Remove model components
  • Calculate emission
  • Explore and save the output image datacube


Installation
GX Simulator >

GX_Simulator package must be installed as part of the Solar-Soft tree (SSW).

Disclaimer: The current version of IDL has been fully tested only on IDL 8.3, although it might work on previous IDL versions.

  • Solar-Soft Installation Instructions
  • Supported Operating Systems


Solar-Soft Installation
GX Simulator > Installation >

To install GX_Simulator as part of the SSW tree one should select the GX_Simulator package on the web form located at http://www.lmsal.com/solarsoft/ssw_install.html and follow the gen eral installation instructions.

Alternatively, one may chose to upgrade an already existing SSW installation, using the IDL command line

IDL> ssw_upgrade,/gx_simulator,/gen,/spawn,/loud,/passive_ftp

However, if the latest option is chosen, one should make sure that sswidl.bat (on Windows platforms) or cshrc (on Unix or Mac platforms) scripts are properly updated such as to include gx_simulator in the SSW_INSTR path declaration, i.e.

set SSW_INSTR=gx_simulator [...]

where [..] denotes any other SSW packages installed

In addition, the GX_Simulator installation process may require a few additional OS-specific setup steps.


Supported Operating Systems
GX Simulator > Installation >

GX_Simulator may be installed on Windows, Unix, or MAC platforms. The predefined radiation transfer packages used by GX_Simulator to compute the emission in different wavelength ranges may be located in platform dependent subfolders ( named windows or unix ) under the ~gx_simulator/userslib distribution folder.

Windows

The radiation transfer IDL routines may call precompiled external dynamic link libraries (DLL) compiled for x32 or x64 architecture. If this is the case, such IDL routines are either located in predefined ~/windows/32bit or ~/windows/64bit subfolders, and/or have a _32 or _64 suffix attached to their file names. The user is responible for selecting the radiation ransfer package compatible with the OS achitecture.

Mac or Unix

For the MAC or UNIX users, beside the IDL wrapper , the "unix" subfolders contain the source codes needed to compile the platform specific shared objects called by the corresponding wrapper.

The first time after installation when an IDL wrapper located in a "unix" subolder is selected by the user, GX_Simulator attempt in the background to issue a make command in order to produce the required shared object. For this operation to be successful, the users must have the administrative rights needed to create new files in the gx_simulator distribution folder. Alternatively, the user may issue "sudo make" external commands in all "~/gx_simulator/../unix" subfolders prior the first use of the GX_Simulator package.


Coronal Model
GX Simulator >

GX_Simulator is provided with built-in analytical models defining adjustable coronal density, temperature, and energy distributions.

  • Density and Temperature Distributions
  • Predefined Energy Distributions


Density and Temperature Distributions
GX Simulator > Coronal Model >

The built in coronal model is characterized by constant temperature and uniform base temperature, which may be controlled by the input fields T0 and n0, respectively. The parameter T0, however, controls the scale height of the radial density scale according to the default expression displayed in the input field n(z), where z=h/R represents the normalized coronal height h relative to the solar radius R .

The default expression may be modified by the user at run-time and the result visualized in the corresponding plot. Although any valid IDL expression may be explicitly typed in the input text field, to increase flexibility, an expandable array field, p , is provided for adding an arbitrary number of additional parameters that may be addressed in the user defined expression by their zero based index.


Predefined Energy Distributions
GX Simulator > Coronal Model >

The built-in coronal model provides the user with three predefined energy distributions:

  1. Free-free only (FFO)
  2. Thermal distribution (THM)
  3. Kappa distribution (KAP)

which may be selected from the pull-down menu.

At any given coronal height, z=h/R, the energy distribution n(E) is normalized by n(z) .

Beside the temperature and density controls used to define the height-dependent density distribution, n(z), any additional field parameters needed to define a specific energy distribution are dynamically created based on user's selection.

Note: The Emin and Emax input fields are used just for display purposes.


Magnetic Field Models
GX Simulator >

GX_Simulator may import user created magnetic field numerical models such as those created by means of various extrapolation techniques.
The input data files should be prepared as IDL sav files containing an arbitrary named structure having a set of required and optional tags that obeys the data types and naming conventions described here.


Importing External Magnetic Field Models
GX Simulator > Magnetic Field Models >

GX_Simulator may import externally defined 3D magnetic field models from IDL sav files, as described in this section.

  • Steps to Import Magnetic Field Models
  • Input File Formatting Conventions
  • Magnetic Field Model Types

NOTE: The gx_simulator/demo/box folder contains a set of magnetic field model example files.


Steps to Import Magnetic Field Models
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models >

A magnetic field model may be imported from an IDL sav file that obeys the required formatting and naming conventions, by using the Import Model Data button under the top level Models menu entry, or by using the equivalent [image] button found on the Volume View tab.

The imported model is positioned on the solar surface according with its heliospheric coordinates, and its volume is automatically filled with the existing coronal density model. To make visible, instead, the base Bz magnetogram of the imported data cube, the visualization of coronal volume may be turned off by closing the volume view eye located on the Volume View toolbar.

The model properties are displayed in a new page of the Models tab, and a set of model tools is created to allow its editing and manipulation.


Input file Formatting Conventions
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models >

GX_Simulator expects from a 3D magnetic field model IDL sav file to contain a structure variable describing the model. The name of the variable is arbitrary, but the mandatory and optional tag must follow a strict naming convention used to recognize one o the pedefined Magnetic Field Model Types .

An IDL HELP command applied on such structure variable would produce an output like this :

IDL> help,box,/str
** Structure <14e8baa0>, 7 tags, length=6377324, data length=6377324, refs=1:
BX FLOAT Array[81, 81, 81]
BY FLOAT Array[81, 81, 81]
BZ FLOAT Array[81, 81, 81]
LAT FLOAT 1.99537
LON FLOAT -16.1987
DR FLOAT Array[3]
DATE STRING '20070518_060620'

Mandatory tags

Bx, By, Bz: a set of 3D arrays describing the local cartesian components at each grid point of the data cube model. The local system of coordinates is assumed to originate on the solar surface at the point corresponding to the center of the data cube base and having the OX and OY axis tangent to the solar surface and oriented in the West and North direction of the heliocentric coordinate system, while the OZ direction is given by the local solar radius. If not provided, a dialog message is displayed and the importing action is canceled.

NOTE: If preferred, the mandatory tags Bx, By and Bz may be replaced by an alternative Bcube tag that is expected to be a 4D array with its fourth dimension used for indexing the cartesian components of the magnetic model.

Optional, but recommended, tags

dr: a scalar or a three dimensional vector describing the spatial resolution of the data cube expressed in units of solar radius R. If not provided, a standard 2" MDI magnetogram resolution is assumed.

LON, LAT: the latitude and longitude heliospheric coordinates, expressed in degrees, corresponding to the center of the data cube base. If not provided, [0, 0] is assumed.

DATE: A string describing the time and date formatted according to any standard time format accepted by the SSW anytim routine. If not provided, the today date is assumed.

Optional tags or variables

Any stand-alone variables present in the data file structure tags that do not correspond to any of the predefined Magnetic Field Model Types are quietly ignored by GX_Simulator.


Magnetic Field Model Types
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models >

GX_Simulator recognizes the follwing distinct types of magnetic field models:

  • BxByBz Model
  • BxByBz-NT Model

More magntic field models may be defined in future releases of the tool.


BxByBz Magnetic Field Model
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models > Magnetic Field Model Types >

GX_Simulator creates this type of model if the data structure imported from IDL contains only the mandatory tags Bx By and Bz, or Bcube and the optional tags describing the solar disk position and voxel resolution, as described in the Input File Formatig Convention section of this document.

A typical BxByBz IDL structure is described below.

IDL> help,box,/str
** Structure <4a82558>, 9 tags, length=26900808, data length=26900804, refs=1:
BX FLOAT Array[100, 100, 100]
BY FLOAT Array[100, 100, 100]
BZ FLOAT Array[100, 100, 100]
DR DOUBLE Array[3]
LAT FLOAT 17.1310
LON FLOAT 36.3370

GX_simuator is distributed with a set of BxByBz models located in the gx_simulator/demo/box folder.

If GX_Simulator recognizes this model type, it creates a Model Attributes page that contains a magnetic field scaling factor input field, which may be used to linearly scale the absolute value of the magnetic field in the model.

The Model Attributes plot area may be used to display 2D correlation plots of any combination of two of Bx, By, Bz or B model parameters, or 1D distributions of those.


BxByBz-NT Magnetic Field Model
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models > Magnetic Field Model Types >

GX_Simulator creates this type of model if the data structure imported from IDL contains, beside the mandatory and optional tags described in the Input File Formatig Convention section of this document, three aditional tags coresponding to externally defined numerical distributions of thermal electron density and temperature for all or a subset of the volume voxels.

A typical BxByBz-NT IDL structure is described below.

IDL> help,box,/str
** Structure <4a82558>, 9 tags, length=26900808, data length=26900804, refs=1:
BX FLOAT Array[128, 128, 128]
BY FLOAT Array[128, 128, 128]
BZ FLOAT Array[128, 128, 128]
N FLOAT Array[144579]
T FLOAT Array[144579]
DR DOUBLE Array[3]
LAT FLOAT 17.1310
LON FLOAT 36.3370
IDX LONG Array[144579]

Where the additional one dimensional array tags N and T define the electron density and temperature in the volume voxels references by the one dimensinal index tag IDX .

If GX_Simulator recognizes this model type, it creates a Model Attributes page that contains magnetic field, density, and temperature scaling factor input fields, which may be used to lindependently scale the magnetic field, density, and temperature defined in the model.

The Model Attributes plot area may be used to display 2D correlation plots of any combination of two of Bx, By, Bz, B, N, and T model parameters, or 1D distributions of those.

The numerical density and temperature internaly defined by a BxByBz-NT model are embeded by GX_Simulator in its global Coronal Model according to the mechanism described in the Integration of Numerical Models in the Global Coronal Model section of this document.


Integration of Numerical Models in the Global Coronal Model
GX Simulator > Magnetic Field Models > Importing External Magnetic Field Models >

When embedding a model having intrinsic numerical thermal electron density ant tempearture models into the global coronal model , GX_Simulator offers the option of replacing the analytical defined coronal density and temperatures by the numerical values, or blends the numerical coronal models based on a formula taking into account partial plasma pressures corresponding to the the numerical and analytical models.

When the option Blend Analytical And Numerical Coronal Models is selected, GX_simulator computes for each voxel a density-temperature pair n-T according to:

n=  n1+n2

T=(n1*T1+n2*T2)/(n1+n2)


Creating Magnetic Field Extrapolation Models
GX Simulator > Magnetic Field Models >

GX_Simulator provides the tools for creating magnetic field extrapolation models on the fly based on input photospheric magnetic field maps.

The current version supports two extrapolation engines, Potential Field Extrapolation (PFE) and a Linear Force Free (LFF), based on a line of sight input magnetic field map. However, provisions were made to accomodate future upgrades allowing the use of user defined extrapolation engines.

  • Magnetic Field Extrapolation Project


Magnetic Field Extrapolation Project
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models >

To start a GX_Simulator magnetic field extrapolation project the user must expose the left hand side Map View tab and the right hand side Magnetic Field Extrapolation Project tab.

This page exposes functionality that allows:

Importing Input Maps

Creating a Reference Map

Adding maps to the project

Selecting the LOS magnetic field map

Selecting the Extrapolation Engine

Launching the Extrapolation Engine

Sending the Magnetic Field Model to the Simulator


Importing Input Maps
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

The File menu located on the MAP VIEW tab offers several options for importing maps into the built in Plotman display window.

  1. Import FITS map from file: This menu entry exposes a list of standard SSW routines that may be called to import individual maps or map cubes from map FITS files adequately formatted.
  2. Import MAP structure from file: This menu entry allows the user to restore a SSW map structure or SSW map object from an IDL sav file

The user may start a magnetic field extrapolation project by importing a region of interest map containing a event-related image such as an X-ray map first, before importing the magnetic field map. The advantage of this is that after importing the event-related image one can select "GET FOV FROM CURRENT MAP" in order to apply that region of interest (field of view) to the magnetic field map during import.


Creating a Reference Map
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

An already imported map, whether or not is a photospheric magnetic field map, may be used to create an Extrapolation Project Reference Map by following these steps:

  1. Select the desired field of view FOV either by directly typing into the XRANGE and YRANGE numerical imput fields, or by using the mouse tool for zoomin into the original map, if necessary, followed by pushing the GET FOV FROM CURRENT MAPbutton.
  2. If needed, change the original map resolution to a desired figure using the dx and dy numerical input fields.
  3. Push the CREATE REFERENCE MAP button to validate the selected FOV and Resolution and create a Reference Map that is added on top of the Project Map List .


Adding maps to the project
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

Once a Reference Map is defined for the Magnetic Field Extrapolation Project, the user has the following options to add an arbirary number of maps to the project:

  1. Add MAP from FITS file to the project
  2. Add MAP structure from IDL file to the project
  3. ADD THIS MAP TO THE PROJECT (this button adds the currently displayed map to the project)

When added to the project, the original maps are first differentially rotated to the time frame of the reference map, cut to the field of view of the reference map, and rebinned to the same resolution as the reference map.


Selecting the LOS magnetic field map
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

The Magnetic Field Extrapolation Project map list must contain at least one magnetic field map, which may not be necessary the Reference Mapitself.

To be allowed to launch the extrapolation engine, the user must manually select the magnetic field map from the list and confirm it as being a magnetic field map by pushing the SELECT B MAP FROM LIST button.


Selecting the Extrapolation Engine
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

The Extrapolation Engine may be selected by choosing [image] one of the built-in or user defined IDL wrappers located in the '\\gx_simulator\userlib\Extrapolation folder. Upon Selection, the IDL routine template is displayed in a text field where the user may manually edit the template to specify any optional input parameters.

To allow integration in the GX_Simulator, any user defined IDL Wrapper, an Extrapolation Engine must comply with the following IDL procedure template:

IDL_Wrapper, Bin, nz, dr,Bout

where

  1. Bin: input map in a form of a 2D array (LOS magnetogram) or 3D array (vector magnetogram)
  2. nz: requested number of equally spaced vertical extrapolation layers
  3. dr: a vector [dz, dy, dz] indicating the steps in each direction, measured in arcseconds (not necessarily used by the extrapolation engine, but needed by the GX_Simulator for proper scaling of the output datacube.
  4. Bout: output variable that must return a 4D magnetic field datacube, with the fourth dimension indexing the Cartesian components Bx, By and Bz

NOTE: Although the user defined IDL Wrapper may use any name for these four manadatory variables, GX_Simulator automatically rename them according with its internal naming convention before displaying the template in the corresponding text field. If the IDL Wrapper does not have at least four variable arguments, an error is issued and the selection process is stopped.

In addition to these mandatory araguments, the IDL Wrapper may contain any number of aditional variables of keyword, which may be manually edited at any time in the input text window, according with the IDL syntax rules.

The keywords are
alpha1=alpha1
seehafer=seehafer
sub_b00=sub_b00
sub_plan=sub_plan
alpha1 is the input parameter for the currents in force free. The unit is 1/(pixel size). The pixel distance is the one from the magnetogram.

The Seehafer is the keyword to double the magnetogram due to lines near the border are not closed then it mirror the magnetogram. It gives better results accordingly to the paper of Seehafer (1978, ref below). Used by default.

The sub_b00 is because if you see the equation of the magnetic field in the paper of Nakagawa and Radu (1972) it is a Fourier transform but there is no term of frequency zero (the average of the magnetic field). So, for the process to work it is necessary that the piece of magnetogram you selected have average equal zero. That is almost true but you will see that the average is sometimes about 10 to 100 Gauss. Thus, you may have to decide what is better:
- to subtract the average (the program uses the flag sub_b00 to do it),
- to subtract a plan (see the program when using the flag sub_plan) or
- do nothing (default).
References: Nakagawa and Raadu 1972, Solar Physics, 25, 127
            Seehafer 1978, Solar Physics, 58, 215
NOTE:The IDL Wrapper syntax is not checked for errors after it is edited. GX_Simulator reports instead any compilation or execution errors after the extrapolation is launched, and suggests the user the steps that may be taken in order to fix the error.

An edited syntax of the IDL Wrapper may be reverted to its original definition by pushing the Reset [image] button.


Launching the Extrapolation Engine
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

The Extrapolation Engine may be controlled using the radio buttons located on the Engine Toolbar, which perform the following actions:

  • : Runs the extrapolation process in a parallel execution thread without blocking the current execution thread. When running the extrapolation in this mode, all IDL console messages are logged in the Extrapolation Bridge.log file, which is automatically created in the current IDL working directory.
  • : Pauses the current extrapolation process
  • : Aborts the current extrapolation process
  • : Runs the extrapolation process in the IDL execution thread, which is blocked until the extrapolation procedure returns. This options allows the user to debug the IDL code using the standard IDL debugging tools.

Any grid layer of the output datacube may be displayed as an image using the vertical scrollbar for selecting the vertical index of the datacube layer.

Using the Multi-Level Extrapolation Option

Optionally, the extrapolation may be divided in an adjustable number of vertical Levels, each of them containing Nz grid layers. When using this option, the data cube layer computed in a precedent execution level may be displayed while the next level is computed in a parallel thread.

However, this option should be used with caution since, when using an extrapolation engine based on a 2D LOS magnetic map, each new level uses as input map only the Bz component of the top output map of the preceding level, which inherently introduces artifacts in magnetic datacube.


Sending the Magnetic Field Model to the Simulator
GX Simulator > Magnetic Field Models > Creating Magnetic Field Extrapolation Models > Magnetic Field Extrapolation Project >

The extrapolated magnetic field data cube may be saved, for later use, in an IDL sav file as magnetic field model structure , through the SAVE B CUBE TO FILE button, or, together with its associated reference maps, may be included directly into the global GX_Simulator Sun model, by using the SEND B CUBE TO THE SIMULATOR button.

After importing it from a file, or sending it directly to the GX_Simulator, the 3D magnetic field model may be edited and explored using various tools.


Model Editing and Visualization
GX Simulator >

For easy manipulation, for adding or editing the properties of the 3D magnetic model, the visualization should be switched from the Full Sun View to the Model View by the use of the zoom-in tool, [image], that is located on the model's toolbar.

Being in this visualization, the user may create magnetic field lines and define magnetic field tubes to be added to the model, or inspect different aspects of the 3D structure of the model.


Magnetic Field Lines
GX Simulator > Model Editing and Visualization >

An arbitrary number of magnetic field lines may be added to a magnetic data cube model, which may be created by linear interpolation, or imported from external data files associated with the original model.

The magnetic field lines entirely contained within the data cube volume are green colored, while the open magnetic field lines are yellow.

Any given field line may be locked by the user to prevent its accidental destruction, the locked field lines having a thicker appearance than the unlocked lines.


How to Create Magnetic Field Lines
GX Simulator > Model Editing and Visualization > Magnetic Field Lines >

Magnetic field lines may be created by linear interpolation of the magnetic data cube model using one of the methods described in this section.
The step size of the interpolation (sub grid steps) and the maximum number of the computed line points (Bline steps) may be controlled by the corresponding input field located on the model's own page.

Note: Disregarding these two parameters, which are used internally by the field line creation routine, for computer memory management reasons, the field lines retain only one point per volume voxel.

Warning: Inappropriate combination of these two parameters may result in long a computation time and/or truncated field lines before hitting a surface boundary.

Field Line Creation Tool

When the field line creation tool is toggled, the user may click the left mouse button on any pixel of the base map to create a field line originating from the selected pixel

Field Line Creation Contextual Menu

Disregarding the tool currently toggled, the user may click the right mouse button on any pixel of the base map to pop-up a contextual menu giving the option of creating a field line originating from the selected pixel.

Field Line Creation Dialog Box

To create a field line origination in any grid point of the volume, the user may use the field line creation button located on the Model toolbar to display a dialog box in which the desired grid point indices may be entered.

If the input values are beyond the data cube dimensions, an error message is displayed and the action is canceled.


How to Import Magnetic Field Lines
GX Simulator > Model Editing and Visualization > Magnetic Field Lines >

One or multiple magnetic field lines created outside of the application may be imported by GX_Simulator from a standard IDL sav file provided that it contains an arbitrary named structure or an array of structures owning a set of mandatory and optional tags that follow a predefined naming convention.

In the example pictured below, an IDL HELP command has been applied to a valid such structure describing a collection of 15 field lines, producing the following output:

IDL> help,lines
LINES STRUCT = -> <Anonymous> Array[15]
IDL> help,lines,/str

 ** Structure <1a442ad0>, 4 tags, length=16, data length=16, refs=1:
X FLOAT 200.000
Y FLOAT 200.000
Z FLOAT 200.000
BT FLOAT 200.000

Required structure tags

X, Y, Z: equal size one-dimensional floating point arrays representing the cartesian coordinates of the field line, expressed in fractional indices of the data cube grid.

Optional, but recommended, tags

BT: a floating point array having the same size as the coordinate arrays, which represents the tangential magnetic field in each point of the field line. If this tag is missing, GX_Simulator computes the local magnetic field at each line coordinate by linear interpolation of the model data cube.

Optional tags or variables

Any number of additional tags or stand-alone variables present in the data file are quietly ignored by GX_Simulator.


How to Lock/Unlock Magnetic Field Lines
GX Simulator > Model Editing and Visualization > Magnetic Field Lines >

A magnetic field line may be locked or unlocked to prevent or allow its global destruction by using the field line contextual menu that is displayed when the users clicks the right mouse button on the field line.


How to Remove Magnetic Field Lines
GX Simulator > Model Editing and Visualization > Magnetic Field Lines >

How to remove a single field line

An individual magnetic field line may be removed by using the field line contextual menu displayed when the user clicks the right hand mouse button on the fileld line. If the field line has been previously locked, it must be unlocked first to allow its destruction.

Alternatively, the user may select the field line removal tool, [image], located on the Volume View toolbar and click on the field line that wants to remove.

How to remove multiple field lines

All unlocked field lines belonging to the same magnetic field model may be globaly destroyed clicking on the Clean button located on model's own toolbar.

Warning: Using the global cleaning tool, all unlocked fluxtubes are also removed from the model.


Magnetic Field Line Contextual Menu
GX Simulator > Model Editing and Visualization > Magnetic Field Lines >

Contextual Menu of an Unlocked Magnetic Field Line

The contextual menu of an unlocked magnetic field line presents the options of creating a fluxtube , locking the line for preventing its global destruction, or deleting the field line.

Contextual Menu of a Locked Magnetic Field Line

The contextual menu of a locked field line presents the options of creating a fluxtube and unlocking the line to allow its global destruction. The deleting button is activated only after the field line is unlocked.


Magnetic Flux Tubes
GX Simulator > Model Editing and Visualization >

GX_Simulator may create magnetic flux tubes around an existent central field line, which upon selection, is displayed in red color, while a set of additional field lines passing trough a user defined circular or elliptical contour are displayed in green. In addition, a cloud of red points, laying on a circular surface centered on the central field line, and corresponding to a user defined cross-section, indicates the distance relative to the central field line at which the magnetic flux tube may influence the structure of the data cube model.

To create a magnetic flux tube, and establish or modify its properties, the user should follow the steps described here .


How To Create Magnetic Flux Tubes
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

Magnetic flux tubes surrounding a central field line may be created using the field line contextual menu. At the time of its creation, a magnetic flux tube receives its own multi-tab property page , located on the magnetic model property tab.

After its creation, the default properties of a magnetic field tube may be adjusted using the following options:

  • The multi-tab property page
  • The magnetic flux tube toolbar menu
  • The flux tube contextual menu


How to Lock/Unlock Magnetic Flux Tubes
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

A fluxtube may be locked or unlocked to prevent or allow its global destruction by using the flux tube contextual menu that is displayed when the users clicks the right mouse button on the field line or by toggling the state of the lock [image] /unlock [image] button located on the flux tube toolbar menu .


How to Remove Magnetic Flux Tubes
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

How to remove a single magnetic flux tube

An individual magnetic flux tube may be removed by using the flux tube contextual menu displayed when the user clicks the right hand mouse button on the flux tube. If the flux tube has been previously locked, it must be unlocked in order to allow its destruction.

Alternatively, a flux tube may be removed by using the removal button, [image] , located on its own toolbar menu. If the flux tube has been previously locked, the remove button is disabled and the fluxtube must be unlocked in order to to enable it.

How to remove multiple magnetic flux tubes

All unlocked flux tubes belonging to the same magnetic field model may be globaly destroyed clicking on the Clean button located on model's own toolbar.

Warning: Using the global cleaning tool, all unlocked field lines are also removed from the model.


Magnetic Flux Tube Contextual Menu
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

Contextual menu of an unlocked magnetic flux tube

The flux tube contextual menu provides the options of deleting or locking the fluxtube for preventing its accidental destruction.

Contextual menu of a locked magnetic flux tube

If the flux tube is in the locked state, the delete option is disabled and the flux tube must be unlocked in order to enable its individual or global destruction.


Magnetic Flux Tube Toolbar Menu
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

The flux tube toolbar menu offers the following actions:

Remove the flux tube from the model and memory

/ [image] Loc/Unlock the flux tube

/ [image] Set circular/elliptical flux tube cross section

/ [image] Hide/Unhide the central field line of the flux tube

/ [image] Hide/Unhide the boundary field lines of the flux tube

/ [image] Unhide/Hide the minimum magnetic field points corresponding to each boundary field line of the flux tube


Magnetic Flux Tube Property Tabs
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes >

When a flux tube is created, a multi-tab property page is generated to displays its default properties, which may be subsequently modified by the user.

  • Geometry
  • Thermal Electron Density Distribution
  • Nonthermal Electron Density Distribution
  • Electron Energy Distribution
  • Electron Pitch Angle Distribution


Geometry
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs >

The Geometry page of a flux tube property displays its geometrical properties and presents the controls needed to modify these properties. The appearance of this page depends on the circular or elliptical shape of the cross section selected by the user by toggling the shape button located on the toolbar menu.

Cross section position slider

This slider controls the position of the flux tube defining cross section along the central field line, which may vary between the two end points of the central field line in discreet steps determined by the individual positions of the points belonging to it, as described in the section How to Create Magnetic Field Lines . The initial position of the flux tube cross section correspond to the s=0 field line coordinate, which corresponds to the point of minimum of the magnetic field strength along the field line. By changing this default position, the appearance of the flux tube is changed due to the fact that the flux tube boundary lines are recomputed such as to originate in the grid points of the cross section surface.

Along with the s coordinate corresponding to the selected cross section, the length of the central field line, magnetic field strength, and data cube voxel location of the surface position are also displayed.

Cross Section Radius

This input field, available if the circular cross section shape is selected in the flux tube toolbar menu , controls the radius of the cross section in units of data cube grid points. The default value is 1 grid point, but larger values may be considered to produce larger cross sections.

Cross section a semiaxis and Cross section b semiaxis

These input fields, available if the elliptical cross section shape is selected in the flux tube toolbar menu, control the semiaxes of the cross section ellipse in units of data cube grid points. When switching from circular to elliptical shape, both fields are set equal to the same value as the circular cross section radius. When switching from elliptical to circular cross section, the radius is set to the current value of the a semiaxis.

Note on R , a, and b flux tube cross section parameters

To mitigate the unique ownership of a voxel volume between more than one flux tube and between the existent flux tubes and corona, GX_Simulator always takes in consideration the voxels situated within a 3R or 3a distance from the central line of a given flux tube. Therefore, the flux tube voxel ownership may actually extend up to a distance of 3R or 3a, beyond the visible field lines that intersects a given cross section. The true boundary of a given flux tube may be visualized by opening the Volume View eye located on the Volume View toolbar .

For this reason, it is recommended to open the Volume View eye immediately after the first flux tube is added to the model.

Cross section radial and polar grid points

These two parameters determine how many field lines interseting the cross section, one for each polar grid of the cross section surface, are computed for display purposes. The default settings results in displaying only a set of cross-section boundary field lines.

B/B0 profile plot

This plot displays the magnetic field strength variation along the central field line relative to a reference value B0, which is measurred in a reference point of the central field line having the coordinate s0 relative to the point of minimum magnetic field line along the central field line. The abscissa of this plot represents the central field line corordinate, s, measured from the point of minimum magnetic field (s=0) normalized by the length of the central field line, l .

Reference surface slider

This slider sets the position of the reference point, s0, chosen by the user along the central field line. Based on this selection, the reference magnetic field strength is used, and the B/B0 profile is computed. In addition, in the Volume View display, a cloud of red points, laying on a circular normal surface of radius R (or a ) that crosses the central field line at s=s0, indicates the distance relative to the central field line at which the magnetic flux tube may influence the structure of the data cube model.


Thermal Electron Density Distribution
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs >


Nonthermal Electron Density Distribution
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs >


Electron Energy Distributions
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs >

The default GX_Simulator rendering routines use a set of 10 built-in nonthermal electron distributions over energy (see Fleishman, G. D. & Kuznetsov, A. A. 2010, 'Fast Gyrosynchrotron Codes', 721, 1127-1141 and its on-line supplements ), which may be selected by assigning a value between 1 and 11 to the DIST_E parameter listed in the editable Parameter Table . Substitution of any non-integer value between 1 and 11 will result in the use of downward rounded integer number. Substitution of any number outside the 1 to 11 range will result in the use of a default value '1'.

The following electron energy distributions are implemented:

  1. Free-free only(FFO)
  2. Thermal(THM)
  3. Single power law over kinetic energy(PWL)
  4. Double power law over kinetic energy(DPL)
  5. Thermal/nonthermal over kinetic energy(TNT)
  6. Kappa(KAP)
  7. Power law over absolute value of momentum(PLP)
  8. Power law over Lorentz factor
  9. Therrmal/nonthermal over the absolute value of momentum(TNP)
  10. Thermal/nonthermal over Loretz factor(TNG)


Free-free only (FFO)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >

Index= 0

This is the same as the thermal distribution (THM) with the only difference being that the default microwave radiation transfer routines ignore the gyroresonance contribution, taking into account only the free-free emission.


Thermal(THM)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Single power law over kinetic energy(PWL)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Double power law over kinetic energy (DPL)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Thermal/nonthermal over kinetic energy(TNT)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Kappa(KAP)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Power law over absolute value of momentum(PLP)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Power law over Lorentz factor
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Thermal/nonthermal over the absolute value of momentum(TNP)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Thermal/nonthermal over Loretz factor(TNG)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Energy Distributions >


Electron Pitch Angle Distributions
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs >

The default GX_Simulator rendering routines use a set of 5 built-in electron distributions over pitch-angle (see Fleishman, G. D. & Kuznetsov, A. A. 2010, 'Fast Gyrosynchrotron Codes', 721, 1127-1141 and its on-line supplements ), which may be selected by assigning a value between 0 and 5 to the DIST_ANG parameter listed in the editable Parameter Table . Substitution of any non-integer value between 0 and 5 will result in the use of downward rounded integer number. Substitution of any number outside the 0 to 5 range will result in the use of a default value '1'; numbers above 100 must be avoided as they can cause unexpected results.

The following distributions over the electron pitch angle are implemented:

  • Isotropic*(ISO)
  • Isotropic(ISO)
  • Exponential loss-cone(GLC)
  • Gaussian loss-cone(GLC)
  • Gaussian(GAU)
  • Super-Gaussian(SGA)


Isotropic*(ISO)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

Isotropic Distribution (ISO; index=0 or 1)

In this case, the electron distribution does not depend on pitch-angle, that is

g(m)=1/2

The ISO distribution may be selected from the pull-down menu or by assigning the DIST_ANG= 0 or 1 in the editable Parameter Table .

For the provided library MW _Transfer: the use of indices 0 and 1 yields equivalent results, given all other parameters are identical.

For the provided library GS_Transfer: the use of index 1 yields the result computed according to the new continuous code, while the use of index 0 activates the original (less accurate but the fastest) Petrosian-Klein code.

For a general description of the controls displayed on this page click here.


Isotropic(ISO)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

Isotropic Distribution (ISO; index=0 or 1)

In this case, the electron distribution does not depend on pitch-angle, that is

g(m)=1/2

The ISO distribution may be selected from the pull-down menu or by assigning the DIST_ANG= 0 or 1 in the editable Parameter Table .

For the provided library MW _Transfer: the use of indices 0 and 1 yields equivalent results, given all other parameters are identical.

For the provided library GS_Transfer: the use of index 1 yields the result computed according to the new continuous code, while the use of index 0 activates the original (less accurate but the fastest) Petrosian-Klein code.

For a general description of the controls displayed on this page click here.


Exponential loss-cone(ELC)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

For a general description of the controls displayed on this page click here.


Gaussian loss-cone(GLC)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

For a general description of the controls displayed on this page click here.


Gaussian(GAU)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

For a general description of the controls displayed on this page click here.


Super-Gaussian(SGA)
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

For a general description of the controls displayed on this page click here.


How the pitch angle distribution controls work
GX Simulator > Model Editing and Visualization > Magnetic Flux Tubes > Magnetic Flux Tube Property Tabs > Electron Pitch Angle Distributions >

When one of the built-in electron distributions over the pitch-angle is selected from the pull-down menu located on the Pitch-angle distribution tab ,

a set of controls common to all distributions is displayed, as well as a set of specific controls and indicators relevant for the selected distribution.

The s/l slider selects the flux tube longitudinal coordinate, s, normalized to the central field line length, l, for which the functional form of the pitch angle distribution is displayed in the plot area. The origin of the longitudinal s corresponds to the minimum magnetic field strength along the cental field line, as described in the flux tube Geometry section of this document. This slider also controls the point for which the distribution-specific parameters are displayed in the corresponding greyed-out display fields.

The s0/l slider controls the position of the reference cross section for which the distribution-specific input parameters are defined in the corresponding fields. This control duplicates the functionality of the corresponding controls located on the flux tube Geometry and Nonthermal Electron Distribution tabs.

The Use B/B0 geometry check mark indicates wheter or not the distribution-specific input parameters are kept constant for any longitudibal coordinate s/l, or are computed based on the local B/B0 ratio, where B represents the local magnetic field strengths, and B0 the value coresponding to the reference crosss section s0/l . Based on the selected reference cross section, the longitudinal dependence of this ratio is displayed on the flux tubeGeometry tab.

In the example depicted above, which coresponds to the ELC distribution, the distribution-specific input parameters dMu(s0) and theta_c(s0) chosen by the user are displayed in the corresponding input fields. Note that, when the Use B/B0 geometry is not checked, the local parameters dMu(s) and theta_c(s) are the same as the input parameters, while their local values, and implicitly the functional form of the distribution, are computed in each cross-ection according to the geometrical dependence of the B/B0 ratio.


Model Volume Visualization
GX Simulator > Model Editing and Visualization >

Selecting Visualization

GX_Simulator may render and display the 3D distribution of different parameter models such as, but not limited to, temperature, thermal electron density, or nonthermal electron distribution. The selection of the volume to be displayed is made using the Volume Selection pull-down menu located on the Volume View toolbar. The volume visualization may be turned on or off by switching the state of the Volume eye button located on the same toolbar.

Turning on/off various accompanying volume visualization components

The user may chose to turn off some or all of the accompanying volume visualization components by setting the desired states of the switches implemented for hiding/unhiding them.

When turning off all these components, only the volume distribution of the selected component is displayed in the volume view.


Creating Emissions Maps
GX Simulator >

This section describes the steps needed to create emmision maps

  • Field of view selection
  • Selection of the Radiation Computation Package
  • Map Computation


Field of View Selection
GX Simulator > Creating Emissions Maps >

GX_Simulator has a built in set of automatic routines for computing inscribing regions of interests (ROI) and the square imaging field of view (FOV) comprising these ROIs.
The user is provided with a set of tools that may be used to control the final result of these FOV computation routines.

Model ROI Selection

FOV Computation

Setting FOV and LOS resolutions

LOS Visulalization


Model ROI Selection
GX Simulator > Creating Emissions Maps > Field of View Selection >

Selecting a full volume ROI

By default, at the time of its creation, the magnetic field model is assigned a region of interest (ROI), shown in red color, that comprises the entire data cube volume. The full-ROI state of a model is indicated by the state of the Full ROI switch located on the model's toolbar.

Selecting a restricted ROI

If the Full ROI button is depressed, GX_Simulator sets the ROI associated with the model to the smallest rectangle inscribing all flux tubes belonging to the model

NOTE: To compute the smallest inscribing ROI, GX_Simulator considers only the boundary set by the cross-section grid field lines used to define the flux tube (green lines in the picture above). However, since the voxel ownership of a given flux tube may extend beyond these geometric boundaries (blue density distribution in the picture above), restricting the ROI volume may result in cutting off some of the flux tube volume.

Excluding a ROI from the image FOV

The user may chose to exclude a given model from the global FOV computation by using the Ignore ROI switch located on the model's toolbar. This state is also indicated by the cyan color of the ROI associated with the volume.

If more than one model is included in the global solar model, the FOV is computed based on the other models. If no model is selected, a full Sun FOV is computed.


FOV Computation
GX Simulator > Creating Emissions Maps > Field of View Selection >

Full Sun FOV

Before requestion the FOV computation, the default FOV is set to a Full Sun square with sides equal to 1.5 solar radii.

Computing the smallest inscribing FOV

To compute the smallest inscribing square-shaped FOV, the user must click on the Compute FOV button located on the Volume View toolbar.

Zooming in to the FOV

If the Zoom in to FOV button, [image], is pressed, a FOV image is displayed. To reverse to a full Sun view, without changing the actual FOV, the Zoom out to full Sun view, [image], must be pressed.


FOV and LOS resolutions
GX Simulator > Creating Emissions Maps > Field of View Selection >

In this version, GX_Simulator automatically computes the number of image pixels Nx= Ny, and the number of rendering steps in the line of sight direction Nz, based on the finest resolution found among all models existent in the Sun container at the time of FOV computation.

Warning: If the global Sun models contains more than one data cube model, and they are located far apart from each other, limitations in the available memory may result in a noticeable increase of the computation time, or even in the generation of an out of available memory run-time error.


LOS Visualization
GX Simulator > Creating Emissions Maps > Field of View Selection >

GX_Simulator scans the properties of the model along the line of sight (LOS) one image row at the time and displays it in the LOS PROFILES plot. The index of the image row to be scanned is set by the right hand side vertical slider, while the parameter displayed is determined by the selection made using the pull-down menu located on the Volume View toolbar.

For debug purposes, the LOS information for all rows of the FOV may be saved to a file in a self describing format using the SSW routine MULTI_SAVE, which may be restored using the MULTI_RESTORE routine.


Selection of the Radiation Computation Package
GX Simulator > Creating Emissions Maps >

GX_Simulator is already equipped with a set of methods that solve the radiation transfer equation along the line of sight of the model for microwave and X-ray wavelength ranges.
These built in routines are located in the distribution folder in the .\userslib\radio and .\userslib.\xray directories.

The default Rendering Method may be replaced using a file dialog that can be launched from the Rendering Method page located on the SCANNERtab page.

At the time of this selection, the LOS parameters needed to be sent to the selected Rendering Method are published in its associated parameter table.

The user should keep in mind that this table represents just a data template displayed just for information purposes, while the actual values of the LOS parameters sent to the Rendering methods, are those resulted from LOS scanning of the global model's properties, generally without updating the values displayed in the tables, except for the image pixel array dS, and the line of sight step, dr, which are updated every time a new FOV is computed.

However, some global Rendering Method parameters, which are independent of the line of sight, such as the number of channels, and desired channel range, may be directly edited by the user in the parameter table before computing a new imaging data cube.


Map Computation
GX Simulator > Creating Emissions Maps >

The Task Manager page located on the SCANNER tab manages all the tasks related to the GX_Simulator's image creation engine.

The toolbar menu of the Task Manager offers the options of starting, [image], pausing, [image], or aborting, [image], of all running tasks.

The Task Manager table displays run-time information about the state of the threads runing in parallel, the image row currently processed by a given thread, number of calls to each thread, as weell as any error message that might be issued by these threads.

In this version, the number of parallel threads used by GX_Simulator is fixed for a working session, but may be user selected at the time of launching the application as a command line parameters using the calling sequence

gx_simulator, nthreads

The default number of threads is 4, but a a number of 2 may be considered for a single CPU computer.


Map Visualization
GX Simulator >
  • Image View
  • GX_Explorer


Image View
GX Simulator > Map Visualization >

The output image data cube produced by GX_Simulator is displayed on the IMAGE VIEW tab page, where tools are provided to select which of the available data channels to be mapped.

The horizontal slider located at the bottom of the page may be used to saturate the intensity map at a fraction of its maximum value in the map, to allow better contrast for faint features.

The image profiles at a given location of the cursor are displayed on the adjacent IMAGE PROFILES tab page. Based on the option selected by the user, the spectral plot may display either the spatially resolved spectrum corresponding to the cursor position (Pixel), or to the entire integrated image (Image).

The toolbar of the IMAGE VIEW provides the options of changing the color table, [image], printing the map, [image], exporting the image to a standard image format, [image], saving the image data cube as a multidimensional SSW map structure, [image], or save the LOS slices corresponding to each image row, [image] , in a SSW MULTI_SAVE file format that may be directly restored using the SSW MULTI_RESTORE function, or conveniently explored by using the widget interface GX_Explorer , which is part of the GX_Simulator installation package.

The image datacube may be also sent to the Plotman display window of the GX_Simulation, [image], which offers additional functionalities.


GX_Explorer
GX Simulator > Map Visualization >

The GX_Simulator installation package provides a stand-alone widget, GX_Explorer, that may be used to explore the imaging data files produced by GX_Simulator. In addition to the Image View and Profile Plots display that are identical to those offered by GX_Simulator, this widget also provides a display that pictures,upon selection, the volume distribution of ony of the LOS parameters used to produce the image data cube.


Default Magnetic Field Extrapolation Packages
GX Simulator >

Potential Field Extrapolation

Linear Force Free Extrapolation


Potential Field Extrapolation
GX Simulator > Default Magnetic Field Extrapolation Packages >

GX_Simulator provides a built-in Potential Field Extrapolation (PFE) engine that is based on a pre-compiled external FORTRAN code developed by V. Abramenko and V. Yurchishin(BBSO) , wrapped into an IDL routine that follows a predefined template.

The current version of GX_Simulator supports only a WIN32 platform implementation of the code in a form of a Dynamic Link Library (DLL), but an equivalent WIN64 DLL and an UNIX Shared Library may be provided by future updates.

pro gx_bz2pfe,Bz,nz,dr,Bcube
;bz must be a two dimensional array containing the base Bz data
sz=size(bz)
Nx=sz[1]
Ny=sz[2]
N=[Nx,Ny]
if sz[0] ge 4 then bz=reform(bz[*,*,*,2])
if sz[0] ge 3 then bz=reform(bz[*,*,sz[3]-1])
;Nz specifies the height of the extrapolation
if n_elements(Nz) eq 0 then Nz= min([Nx,Ny])
N=long([N,Nz])
;dr represents voxel size in each direction (arcsec)
if n_elements(dr) eq 0 then dr=[2.,2.,2.]
;Bcube is the four dimensinal datacube output
Bcube=fltarr(Nx,Ny,Nz,3)
;if not in the current directory, pathPFE must indicate the absolute location of the PFE_Dll2.dll file
pathPFE=gx_findfile('PFE_Dll2.dll',folder='userslib\Extrapolation\Windows\32bit')
RESULT=call_external(pathPFE,'GET_PFE_DATACUBE',N,dr,bz,Bcube,/F_VALUE,/unload )
end


Linear Force Free Extrapolation
GX Simulator > Default Magnetic Field Extrapolation Packages >

GX_Simulator provides a built-in Linear Force Free (LFF) extrapolation engine that is based on an IDL code developed by J.R. Costa (j_b_lff), wrapped into an IDL routine that follows a predefined template.

pro gx_bz2lff,Bz,nz,dr,Bcube,alpha1=alpha1,seehafer=seehafer, sub_b00=sub_b00, sub_plan=sub_plan
;bz must be a two dimensional array containing the base Bz data
sz=size(bz)
Nx=sz[1]
Ny=sz[2]
N=[Nx,Ny]
if sz[0] ge 4 then bz=reform(bz[*,*,*,2])
if sz[0] ge 3 then bz=reform(bz[*,*,sz[3]-1])
;Nz specifies the height of the extrapolation
if n_elements(Nz) eq 0 then Nz= min([Nx,Ny])
N=long([N,Nz])
;dr represents voxel size in each direction (arcsec)
if n_elements(dr) eq 0 then dr=[2.,2.,2.]
z=findgen(Nz)
;use J.R.Costa j_b_lff extrapolation routine
j_b_lff, bz, z, bxout, byout, bzout,alpha1=alpha1,seehafer=seehafer, sub_b00=sub_b00, sub_plan=sub_plan
;Bcube is the four dimensinal datacube output
;Bcube is the four dimensinal datacube output
Bcube=fltarr(Nx,Ny,Nz,3)
Bcube[*,*,*,0]=temporary(bxout)
Bcube[*,*,*,1]=temporary(byout)
Bcube[*,*,*,2]=temporary(bzout)
end

;+
;
; NAME :
; J_B_LFF
; PURPOSE :
; Linear Force-Free Extrapolation of Magnetic Field
; CALLING SEQUENCE:
; J_B_LFF, bz0, z, bx, by, bz, alpha=alpha, seehafer=seehafer
;
; INPUT :
; bz0 : 2-d array of vertical field at z=0 plane
; z : 1-d array of heights (in unit of pixels)
; OUTPUT :
; bx, by, bz : 3-d arrays of field components
; MODIFICATION HISTORY:
; J.E.R.Costa 2004, v.1
; Reference: Nakagawa and Raadu 1972, Solar Physics, 25, 127
; Seehafer 1978, Solar Physics, 58, 215
; jercosta: alpha1 is an input keyword
;-
pro j_b_lff     , bz0,z,bx,by,bz,alpha1=alpha1,seehafer=seehafer $
, sub_b00=sub_b00, sub_plan=sub_plan
if n_elements(alpha1) eq 0 then alpha1=0.
nx1=n_elements(bz0(*,0))
ny1=n_elements(bz0(0,*))
nz=n_elements(z)
b00=0.0
if (keyword_set(sub_b00) and keyword_set(sub_plan)) then begin
print, 'You cannot set both keyword: sub_b00 and sub_plan together!!'
return
endif
if keyword_set(sub_b00) then b00=mean(bz0)
if keyword_set(sub_plan) then b00=sfit(bz0,1)

if keyword_set(seehafer) then begin
nx=2*nx1 & ny=2*ny1
bz0e=fltarr(nx, ny)
bz0e(0:nx1-1, 0:ny1-1)=bz0-b00
bz0e(nx1:nx-1, 0:ny1-1)= - rotate(bz0, 5)
bz0e(0:nx1-1, ny1:ny-1)= - rotate(bz0, 7)
bz0e(nx1:nx-1, ny1:ny-1)= -rotate(bz0e(0:nx1-1, ny1:ny-1), 5)
endif else begin
nx=nx1 & ny= ny1
bz0e=bz0-b00
endelse
kx = 2*!pi*[findgen(nx/2+1),reverse(-1-findgen(nx-nx/2-1))]/nx
ky = 2*!pi*[findgen(ny/2+1),reverse(-1-findgen(ny-ny/2-1))]/ny
if abs(alpha1) ge 1. then begin
print, 'The magnitude of alpha is too big! '
print, '|alpha| should be less than 1.'
return
endif
alpha=alpha1
print,'alpha=',alpha
kx=kx#replicate(1, ny)
ky=replicate(1,nx)#ky
fbz0 = fft(bz0e, -1)
kz=sqrt((kx^2+ky^2 - alpha^2)>0.) ; Positive solutions
; see Nakagawa e Raadu p. 132
argx=fbz0*complex(0,-1)*(kx*kz-alpha*ky)/((kz^2+ alpha^2)>kx(1,0)^2)
argy=fbz0*complex(0,-1)*(ky*kz+alpha*kx)/((kz^2+alpha^2)>ky(0,1)^2)
bx=fltarr(nx1,ny1,nz)
by=bx
bz=bx
for j=0, nz-1 do begin
bx(*,*,j) = (float(fft(argx*exp(-kz*z(j)),1)))[0:nx1-1, 0:ny1-1]
by(*,*,j) = (float(fft(argy*exp(-kz*z(j)),1)))[0:nx1-1, 0:ny1-1]
bz(*,*,j) = (float(fft(fbz0*exp(-kz*z(j)),1)))[0:nx1-1, 0:ny1-1]+b00
endfor
help, kx
end


User Defined Radiation Transfer Packages
GX Simulator >

In addition to the default radiation transfer packages provided in the instalation tree, the GX_Simulaor plugg-in architecture allows users to integrate IDL or external codes for which an IDL Wrapper Template following the GX_Simulator calling conventions should be provided.


IDL Wrapper Template
GX Simulator > User Defined Radiation Transfer Packages >

Any user defined IDL Wrapper should be prepared according the GX_Simulator calling conventions and must strictly comply with the template used to build the default radiation transfer packages.

Any IDL Wrapper must be consistent with the strict template

pro IDL_Wrapper , parms, rowdata, info=info

However, in addition to these three mandatory arguments, the ID wrapper may accept any additional arguments and keywords needed to implement its particular functionality.

The input parms argument is expected to be a three dimensional float array used to describe the model data

The output rowdata argument is expected to return a multidimensinal float array containing the result of the computation, formatted according to the user defined desciption contained in the keyword parameter info.

When called with the info=info option set, any user-defined IDL_Wrapper routine must ingnore any other arguments and simply return the info structure describing the computation output rowdata.

The built-in radiation transfer packages should be used by the advanced users as reference for definining their own info structure.


Default Radiation Transfer Packages
GX Simulator >

GX_Simulator installation tree contains a set of default radiation transfer packages that may be platform independent IDL routines or IDL wrappers calling OS-specific external libraries.

Since the collection of these packages may be updated at any time, this section presents the IDL wrappers corresponding just to a subset of the complete collection distributed with the current version, which is locted in the ~/gx_simulator/userslib distribution folder.


GS_Transfer_Slice
GX Simulator > Default Radiation Transfer Packages >
pro GS_Transfer_Slice,parms,rowdata,path,parmin,datain,info=info
if n_elements(path) eq 0 then begin
dirpath=file_dirname((ROUTINE_INFO('GS_Transfer_Slice',/source)).path,/mark)
path=dirpath+'GS_Transfer_Slice.dll'
end
if arg_present(info) then begin
if n_elements(parms) gt 0 then dummy=temporary(parms)
if n_elements(info) eq 0 then begin
result=call_external(path,'GET_PARMS',/F_VALUE,/unload )
openr,lun,'parms.txt',/get,error=error
if error eq 1 then return
line=''
WHILE ~ EOF(lun) DO BEGIN
READF, lun, line
info=strsplit(line,';',/extract)
if n_elements(info) eq 3 then info=[info,'']
if n_elements(parms) eq 0 then begin
parms={name:strcompress(info[0],/rem),value:float(info[1]),unit:strcompress(info[2],/rem),hint:info[3]}
endif else begin
parms=[parms,{name:strcompress(info[0],/rem),value:float(info[1]),unit:strcompress(info[2],/rem),hint:info[3]}]
end
ENDWHILE
free_lun,lun
endif else parms=info.parms
Nvox=1L
Npix=1L
dummy_parmin=fltarr(n_elements(parms),Nvox,Npix)
dummy_parmin[*]=parms.value
dummy_datain=fltarr(7,parms[18].value,Npix)
test_call=call_external(path,'GET_MW_SLICE',Npix,Nvox,dummy_parmin,dummy_datain,/F_VALUE,/unload )
info={parms:parms,$
pixdim:[parms[18].value,2,3],$
spectrum:{x:{axis:reform(dummy_datain[0,*]),label:'Frequency',unit:'GHz'},$
y:{label:['LCP','RCP','[RCP+LCP]','[RCP-LCP]','[R-L]/[R+L]'],unit:['sfu','sfu','sfu','sfu','%']}},$
channels:['Exact Coupling', 'Weak Coupling', 'Strong Coupling']}
return
end
sz=size(rowdata,/dim)
Npix=sz[0]
Nfreq=sz[1]
Npol=sz[2]
Ncouplings=sz[3]
sz=size(parms,/dim)
Npix=sz[0]
Nvox=sz[1]
Nparms=sz[2]
if n_elements(datain) eq 0 then datain=fltarr(7,Nfreq,Npix)
if n_elements(parmin) eq 0 then parmin=fltarr(Nparms,Nvox,Npix)
for i=0, npix-1 do begin
parmin[*,*,i]=transpose(parms[i,*,*])
end
test_call=call_external(path,'GET_MW_SLICE',Npix,Nvox,parmin,datain,/F_VALUE,/unload )
rowdata[*,*,0,0]=transpose(datain[5,*,*]);eL
rowdata[*,*,1,0]=transpose(datain[6,*,*]);eR
rowdata[*,*,0,1]=transpose(datain[1,*,*]);wL
rowdata[*,*,1,1]=transpose(datain[2,*,*]);wR
rowdata[*,*,0,2]=transpose(datain[3,*,*]);sL
rowdata[*,*,1,2]=transpose(datain[4,*,*]);sR
end


MW_Transfer_Slice
GX Simulator > Default Radiation Transfer Packages >
pro MW_Transfer_Slice,parms,rowdata,path,parmin,datain,info=info
if n_elements(path) eq 0 then begin
dirpath=file_dirname((ROUTINE_INFO('MW_Transfer_Slice',/source)).path,/mark)
path=dirpath+'MW_Transfer_Slice.dll'
end
if arg_present(info) then begin
if n_elements(parms) gt 0 then dummy=temporary(parms)
if n_elements(info) eq 0 then begin
result=call_external(path,'GET_PARMS',/F_VALUE,/unload )
openr,lun,'parms.txt',/get,error=error
if error eq 1 then return
line=''
WHILE ~ EOF(lun) DO BEGIN
READF, lun, line
info=strsplit(line,';',/extract)
if n_elements(info) eq 3 then info=[info,'']
if n_elements(parms) eq 0 then begin
parms={name:strcompress(info[0],/rem),value:float(info[1]),unit:strcompress(info[2],/rem),hint:info[3]}
endif else begin
parms=[parms,{name:strcompress(info[0],/rem),value:float(info[1]),unit:strcompress(info[2],/rem),hint:info[3]}]
end
ENDWHILE
free_lun,lun
endif else parms=info.parms
Nvox=1L
Npix=1L
dummy_parmin=fltarr(n_elements(parms),Nvox,Npix)
dummy_parmin[*]=parms.value
dummy_datain=fltarr(7,parms[18].value,Npix)
test_call=call_external(path,'GET_MW_SLICE',Npix,Nvox,dummy_parmin,dummy_datain,/F_VALUE,/unload )
info={parms:parms,$
pixdim:[parms[18].value,2,3],$
spectrum:{x:{axis:reform(dummy_datain[0,*]),label:'Frequency',unit:'GHz'},$
y:{label:['LCP','RCP','[RCP+LCP]','[RCP-LCP]','[R-L]/[R+L]'],unit:['sfu','sfu','sfu','sfu','%']}},$
channels:['Exact Coupling', 'Weak Coupling', 'Strong Coupling']}
return
end
sz=size(rowdata,/dim)
Npix=sz[0]
Nfreq=sz[1]
Npol=sz[2]
Ncouplings=sz[3]
sz=size(parms,/dim)
Npix=sz[0]
Nvox=sz[1]
Nparms=sz[2]
if n_elements(datain) eq 0 then datain=fltarr(7,Nfreq,Npix)
if n_elements(parmin) eq 0 then parmin=fltarr(Nparms,Nvox,Npix)
for i=0, npix-1 do begin
parmin[*,*,i]=transpose(parms[i,*,*])
end
test_call=call_external(path,'GET_MW_SLICE',Npix,Nvox,parmin,datain,/F_VALUE,/unload )
rowdata[*,*,0,0]=transpose(datain[5,*,*]);eL
rowdata[*,*,1,0]=transpose(datain[6,*,*]);eR
rowdata[*,*,0,1]=transpose(datain[1,*,*]);wL
rowdata[*,*,1,1]=transpose(datain[2,*,*]);wR
rowdata[*,*,0,2]=transpose(datain[3,*,*]);sL
rowdata[*,*,1,2]=transpose(datain[4,*,*]);sR
end


XRay
GX Simulator > Default Radiation Transfer Packages >

pro xray,parms,rowdata,xray_cs=xray_cs,info=info
if arg_present(info) then begin
if n_elements(info) eq 0 then begin
Parms=Replicate({Name:'unused',Value:0d,Unit:'',Hint:''},19)
Parms=Replicate({Name:'unused',Value:0d,Unit:'',Hint:''},19)
Parms[0].Name='dS' & Parms[0].Value=0.180E+19 & Parms[0].Unit='cm^2' & Parms[0].Hint='Source/pixel Area'
Parms[1].Name='dR' & Parms[1].Value=0.600E+09 & Parms[1].Unit='cm' & Parms[1].Hint='Source/voxel Depth'
Parms[2].Name='T_0' & Parms[2].Value=0.200E+08 & Parms[2].Unit='K' & Parms[2].Hint='Plasma Temperature'
Parms[3].Name='eps' & Parms[3].Value=0.500E-01 & Parms[3].Unit='none' & Parms[3].Hint='Matching parm. for TNT distr-ns'
Parms[4].Name='kappa' & Parms[4].Value=4.00 & Parms[4].Unit='none' & Parms[4].Hint='Index of Kappa-distr-n'
Parms[5].Name='N' & Parms[5].Value=16 & Parms[5].Unit='none' & Parms[5].Hint='Number of integration nodes'
Parms[6].Name='Emin' & Parms[6].Value=0.100 & Parms[6].Unit='MeV' & Parms[6].Hint='Low energy cutoff'
Parms[7].Name='Emax' & Parms[7].Value=10.0 & Parms[7].Unit='MeV' & Parms[7].Hint='High energy cutoff'
Parms[8].Name='E_break' & Parms[8].Value=1.00 & Parms[8].Unit='MeV' & Parms[8].Hint='Break E for DPL'
Parms[9].Name='delta1' & Parms[9].Value=4.00 & Parms[9].Unit='none' & Parms[9].Hint='(LE) Power-Law index'
Parms[10].Name='delta2' & Parms[10].Value=6.00 & Parms[10].Unit='none' & Parms[10].Hint='(HE) Power-Law index for DPL'
Parms[11].Name='n_0' & Parms[11].Value=0.500E+10 & Parms[11].Unit='cm^{-3}' & Parms[11].Hint='Thermal e density'
Parms[12].Name='n_b' & Parms[12].Value=0.300E+08 & Parms[12].Unit='cm^{-3}' & Parms[12].Hint='Nonthermal e density'
Parms[13].Name='B' & Parms[13].Value=200. & Parms[13].Unit='G' & Parms[13].Hint='Magnetic field'
Parms[14].Name='theta' & Parms[14].Value=35.0 & Parms[14].Unit='degrees' & Parms[14].Hint='Viewing angle'
Parms[15].Name='Eph_min' & Parms[15].Value=3 & Parms[15].Unit='keV' & Parms[15].Hint='Starting photon energy'
Parms[16].Name='dEph' & Parms[16].Value=0.02 & Parms[16].Unit='Log(keV)' & Parms[16].Hint='Logarithmic step in photon energy'
Parms[17].Name='Dist_E' & Parms[17].Value=3 & Parms[17].Unit='none' & Parms[17].Hint='Type of distribution over energy'
Parms[18].Name='N_E' & Parms[18].Value=101 & Parms[18].Unit='none' & Parms[18].Hint='Number of energy channels'
endif else parms=info.parms
E1=Parms[15].value
dEph=Parms[16].value
Eph=10^(Alog10(E1)+findgen(Parms[18].value)*dEph)
; output photon energy array
logdE=Parms[16].value
EE =10^(Alog10(E1)+findgen(Parms[18].value+round(1./logDe))*logdE)
DE =10^(Alog10(E1)+(findgen(Parms[18].value+round(1./logDe))+1)*logdE)-EE
EE=EE + min(dEph)*0.5
;electron energies so that max(ee) =10 x max(eph)
info={parms:parms,$
pixdim:[parms[18].value],$
spectrum:{x:{axis:Eph,label:'Energy',unit:'keV'},$
y:{label:'Flux',unit:'1/(s cm^2 keV)'}}}
return
end
sz=size(rowdata,/dim)
nrows=sz[0]
rowdata[*]=0
for r=0, nrows-1 do begin
rparms=transpose(parms[r,*,*])
point_in=where(rparms[2,*] gt 0, Nvox);added
if Nvox gt 0 then begin
parmin=rparms[*,point_in];added
E1=parmin[15,0]
logdE=parmin[16,0]
Eph =10^(Alog10(E1)+findgen(parmin[18,0])*logdE)
DEph= 10^(Alog10(E1)+(findgen(parmin[18,0])+1)*logdE)-eph
; output photon energy array
EE =10^(Alog10(E1)+findgen(parmin[18,0]+round(1./logDe))*logdE)
DE =10^(Alog10(E1)+(findgen(parmin[18,0]+round(1./logDe))+1)*logdE)-EE
EE=EE + min(dEph)*0.5
;electron energies so that max(ee) =10 x max(eph)
if n_elements(xray_cs) eq 0 then xray_cross_section, ee, Eph, Xray_CS
Ve= sqrt(2.*EE*1.6e-9/9.8d-28)
e_dataout=fltarr(N_elements(ee))
; normalisation
;****************************************************************
V_vox=parmin[0,*]*parmin[1,*]
; Voxel volume in cm^3
Np_vox=parmin[11,*]
; plasma number density in the voxel
AU2_4pi=(4.*!PI*1.496d13^2)
;4pi*1AU^2
norm=V_vox*Np_vox/AU2_4pi
; normalisation factor
;main loop over all voxels
for i=0,Nvox-1 do begin
;**********************************************************
; If electron distribution is a power-law
IF (ROUND(Parmin[17,i]) EQ 3 OR ROUND(Parmin[17,i]) EQ 11 ) THEN BEGIN
; Electron distribution is a power-law
E_dist =((ee GE Parmin[6,i]*1000.) AND (ee LT Parmin[7,i]*1000.))*EE ^(-Parmin[9,i])
E_dist_norm=total(E_dist*de)
IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm
ENDIF
; end of power-law case
;**********************************************************
;**********************************************************
; Electron distribution is doble power-law
IF (ROUND(Parmin[17,i]) EQ 4 OR ROUND(Parmin[17,i]) EQ 12) THEN BEGIN
E_dist=((ee GE Parmin[6,i]*1e3) AND (ee LT Parmin[8,i]*1e3))*(EE/(Parmin[8,i]*1e3))^(-Parmin[9,i])+$
((ee GE Parmin[8,i]*1e3) AND (ee LT Parmin[7,i]*1e3))*(EE/(Parmin[8,i]*1e3))^(-Parmin[10,i])
E_dist_norm=total(E_dist*de)
IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/E_dist_norm
ENDIF
;**********************************************************
;**********************************************************
; Electron distribution is thermal/non-thermal over energy
IF (ROUND(Parmin[17,i]) EQ 5) THEN BEGIN
kb=8.617343e-8 ;(keV K-1)
Te=parmin[2,i]*kb
E_cr=Te/parmin[3,i]
; critial energy in keV
E_dist_cr=sqrt(E_cr/(!PI*Te))*exp(-E_cr/Te)
dens_e=Parmin[11, i]*(parmin[2,i] GT 2e5)+0.* (parmin[2,i] LE 2e5)
; density if ionised Te > 2e5K
E_dist =((ee GE Parmin[6,i]*1000.) AND (ee LT E_cr))*sqrt(EE/(!PI*Te))*exp(-EE/Te)
E_dist =((ee GE E_cr) AND (ee LT Parmin[7,i]*1000.))*E_dist_cr*(EE/E_cr) ^(-Parmin[9,i])
E_dist_norm=total(E_dist*de)
IF (E_dist_norm GT 0) THEN e_dataout+=dens_e*ve*E_dist*norm[i]/E_dist_norm
ENDIF
;**********************************************************
;**********************************************************
; Electron distribution is kappa distribution
IF (ROUND(Parmin[17,i]) EQ 6) THEN BEGIN
kb=8.617343e-8 ;(keV K-1)
Te=parmin[2,i]*kb
Thet=Te/511.
; critial energy in keV
gam=1.d0+EE/511.
dens_e=Parmin[11, i]*(parmin[2,i] GT 2e5)+0.* (parmin[2,i] LE 2e5)
; density if ionised Te > 2e5K
E_dist =((ee GE Parmin[6,i]*1000.) AND (ee LT Parmin[7,i]*1000.))*$
gam*sqrt(gam*gam-1.)/(1.+(gam-1.)/(Parmin[4,i]-1.5)/Thet)^(Parmin[4,i]+1)/thet^(1.5)
E_dist_norm=total(E_dist*de)
IF (E_dist_norm GT 0) THEN e_dataout+=dens_e*ve*E_dist*norm[i]/E_dist_norm
ENDIF
;**********************************************************
;**********************************************************
; If electron distribution is a power-law in momentum p*c
IF (ROUND(Parmin[17,i]) EQ 7 ) THEN BEGIN
; Electron distribution is a power-law
pc=sqrt((ee+511.)^2-511.^2)
d_pc=(ee+511.)*de/pc
pc_min=sqrt((Parmin[6,i]*1000.+511.)^2-511.^2)
pc_max=sqrt((Parmin[7,i]*1000.+511.)^2-511.^2)
E_dist =((pc GE pc_min) AND (pc LT pc_max))*pc^(-Parmin[9,i])
E_dist_norm=total(E_dist*d_pc)
IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm
ENDIF
; end of power-law case
;**********************************************************
; If electron distribution is a power-law in momentum p*c
IF (ROUND(Parmin[17,i]) EQ 7 ) THEN BEGIN
; Electron distribution is a power-law
pc=sqrt((ee+511.)^2-511.^2)
d_pc=(ee+511.)*de/pc
pc_min=sqrt((Parmin[6,i]*1000.+511.)^2-511.^2)
pc_max=sqrt((Parmin[7,i]*1000.+511.)^2-511.^2)
E_dist =((pc GE pc_min) AND (pc LT pc_max))*pc^(-Parmin[9,i])
E_dist_norm=total(E_dist*d_pc)
IF (E_dist_norm GT 0) THEN e_dataout+=Parmin[12, i]*ve*E_dist*norm[i]/e_dist_norm
ENDIF
; end of power-law case
;**********************************************************
;**********************************************************
; Electron background distribution is thermal - should be always added
; IF (ROUND(Parmin[17,i]) EQ 1) THEN BEGIN
; Electron distribution is thermal
kb=8.617343e-8 ;(keV K-1)
Te=parmin[2,i]*kb
;local temperature in keV
e_dataout+=norm[i]*ve*parmin[11,i]*sqrt(EE/(!PI*Te))*exp(-EE/Te)
; electron flux for 3D maxwellian
; ENDIF
;**********************************************************
; background thermal electron distribution
ENDFOR
;ends FOR loop over voxels
rowdata[r,*]=(xray_cs#(e_dataout*DE))
;turning mean LOS electron flux into photon flux
end
end
;ends FOR over row
END


SXR Previous
GX Simulator > Default Radiation Transfer Packages >

pro SXR, parms, rowdata, info=info

if arg_present(info) then begin

if n_elements(info) eq 0
then begin

Parms=Replicate({Name:'unused',Value:0d,Unit:'',Hint:''},29)

Parms[0].Name='dS' &
Parms[0].Value=0.180E+19 & Parms[0].Unit='cm^2' &
Parms[0].Hint='Source/pixel Area

Parms[1].Name='dR' &
Parms[1].Value=0.600E+09 & Parms[1].Unit='cm' &
Parms[1].Hint='Source/voxel Depth

Parms[2].Name='T_0' &
Parms[2].Value=0.200E+08 & Parms[2].Unit='K' &
Parms[2].Hint='Plasma
Temperature

Parms[3].Name='eps' &
Parms[3].Value=0.500E-01 & Parms[3].Unit='none' &
Parms[3].Hint='Matching
parm. for TNT distr-ns

Parms[4].Name='kappa' &
Parms[4].Value=4.00 & Parms[4].Unit='none' &
Parms[4].Hint='Index of
Kappa-distr-n

Parms[5].Name='N' &
Parms[5].Value=16 & Parms[5].Unit='none' &
Parms[5].Hint='Number of
integration nodes

Parms[6].Name='Emin' &
Parms[6].Value=0.100 & Parms[6].Unit='MeV' &
Parms[6].Hint='Low energy
cutoff

Parms[7].Name='Emax' &
Parms[7].Value=10.0 & Parms[7].Unit='MeV' &
Parms[7].Hint='High
energy cutoff

Parms[8].Name='E_break' &
Parms[8].Value=1.00 & Parms[8].Unit='MeV' &
Parms[8].Hint='Break E
for DPL

Parms[9].Name='delta1' &
Parms[9].Value=4.00 & Parms[9].Unit='none' &
Parms[9].Hint='(LE)
Power-Law index

Parms[10].Name='delta2' &
Parms[10].Value=6.00 & Parms[10].Unit='none' &
Parms[10].Hint='(HE)
Power-Law index for DPL

Parms[11].Name='n_0' &
Parms[11].Value=0.500E+10 & Parms[11].Unit='cm^{-3}' &
Parms[11].Hint='Thermal e
density

Parms[12].Name='n_b' &
Parms[12].Value=0.300E+08 & Parms[12].Unit='cm^{-3}' &
Parms[12].Hint='Nonthermal
e density

Parms[13].Name='B' &
Parms[13].Value=200. & Parms[13].Unit='G' &
Parms[13].Hint='Magnetic
field

Parms[14].Name='theta' &
Parms[14].Value=35.0 & Parms[14].Unit='degrees' &
Parms[14].Hint='Viewing
angle

Parms[15].Name='Eph_min' &
Parms[15].Value=1
& Parms[15].Unit='keV' &
Parms[15].Hint='Starting
photon energy

Parms[16].Name='dEph' &
Parms[16].Value=0.02 & Parms[16].Unit='Log(keV)'&
Parms[16].Hint='Logarithmic step in photon energy

Parms[17].Name='Dist_E' &
Parms[17].Value=3
& Parms[17].Unit='none' &
Parms[17].Hint='Type of
distribution over energy

Parms[18].Name='N_E' &
Parms[18].Value=101 & Parms[18].Unit='none' &
Parms[18].Hint='Number of
energies'

Parms[19].Name='Dist_Ang' &
Parms[19].Value=1
& Parms[19].Unit='none' &
Parms[19].Hint='Type of
angular distribution

Parms[20].Name='theta_C' &
Parms[20].Value=60.0 & Parms[20].Unit='degrees' &
Parms[20].Hint='Loss-cone
boundary

Parms[21].Name='theta_b' &
Parms[21].Value=90.0 & Parms[21].Unit='degrees' &
Parms[21].Hint='Angle of
beam direction

Parms[22].Name='dMu' &
Parms[22].Value=0.100 & Parms[22].Unit='none' &
Parms[22].Hint='dMu for
gau/exp/SuGau loss-cone

Parms[23].Name='a_4' &
Parms[23].Value=10.0 & Parms[23].Unit='none' &
Parms[23].Hint='Coeff for
a*(Mu-xMu0)^4 for SuGau

Parms[24].Name='Unused' &
Parms[24].Value=0
& Parms[24].Unit='none' &
Parms[24].Hint=''

Parms[25].Name='Unused' &
Parms[25].Value=12 & Parms[25].Unit='f_ce' &
Parms[25].Hint=''

Parms[26].Name='Unused' &
Parms[26].Value=12 & Parms[26].Unit='f_ce' &
Parms[26].Hint=''

Parms[27].Name='Unused' &
Parms[27].Value=1
& Parms[27].Unit='1/0' &
Parms[27].Hint=''

Parms[28].Name='Unused' &
Parms[28].Value=2
& Parms[28].Unit='2/1/0' &
Parms[28].Hint=''

endif else
parms=info.parms

E1=Parms[15].value

dE=Parms[16].value

E=10^(Alog10(E1)+findgen(Parms[18].value)*dE)

dataout=fltarr(parms[18].value)

dirpath=file_dirname((ROUTINE_INFO('SXR',/source)).path,/mark)

info={parms:parms,$

pixdim:[parms[18].value],$

spectrum:{x:{axis:E,label:'Energy',unit:'keV'},$

y:{label:'Flux',unit:'keV/(s cm^2 keV)'}}}

return

end

sz=size(rowdata,/dim)

Npix=sz[0]

rowdata[*]=0

for pix=0,
Npix-1 do
begin

rparms=transpose(parms[pix,*,*])

point_in=where(rparms[2,*]
gt 0,
Nvox)

if Nvox gt
0 then
begin

parmin=rparms[*,point_in]

kb=8.617343e-8 ;(keV
K-1)

norm=(8.1e-39)*parmin[0,0]*parmin[1,0]

E1=parmin[15,0]

dE=parmin[16,0]

E=10^(Alog10(E1)+findgen(parmin[18,0])*dE)

for i=0,
n_elements(E)-1
do rowdata[pix,i]=total(exp(-E[i]/kb/reform(parmin[2,*]))*reform(parmin[11,*]^2)/reform(sqrt(parmin[2,*])))*norm

print,'***************'

print,minmax(e),minmax(rowdata[pix,*]),minmax(parmin[2,*]),minmax(parmin[11,*])

end

endfor

end
<<Previous


Examples
GX Simulator >

($title$)

Here's two examples of entering CODE samples:

Entering through Source tab:

Look at the Source, every line shown as-is and must have no indentation from the left side.

IDL> help,box,/str
** Structure <14e8baa0>, 7 tags, length=6377324, data length=6377324, refs=1:
BX FLOAT Array[81, 81, 81]
BY FLOAT Array[81, 81, 81]
BZ FLOAT Array[81, 81, 81]
LAT FLOAT 1.99537
LON FLOAT -16.1987
DR FLOAT Array[3]
DATE STRING '20070518_060620'

Entering through Edit tab:

Insert breaks at the end of each line (not [Enter]), use [BR] button:

IDL> help,box,/str
** Structure <14e8baa0>, 7 tags, length=6377324, data length=6377324, refs=1:
BX FLOAT Array[81, 81, 81]
BY FLOAT Array[81, 81, 81]
BZ FLOAT Array[81, 81, 81]
LAT FLOAT 1.99537
LON FLOAT -16.1987
DR FLOAT Array[3]
DATE STRING '20070518_060620'