Data Scaling
The wide variety of scales in astrophysical variables is a chronic problem for numerical simulation codes. When variables of widely disparate scales are combined in a machine calculation, the results are vulnerable to truncation error, especially if the order-of-magnitude difference between two values is below machine precision. Handled improperly, these scaling differences can cause massive problems in a simulation.
AstroBEAR handles the problem by dividing a scaling constant out of certain variables. The equations of ideal MHD are scale-free, so the scaling of variables does not change the results of the simulation. This does not hold true if physical source terms such as cooling or gravity are present; during source term steps, physical scaling must be reintroduced.
Quantities divided by a scaling term are sometimes referred to as scaled quantities. These scaled quantities are dimensionless, being described in terms of computational units.
Scaling in AstroBEAR
Data File Parameters
The most basic physical scaling options are set by the user in the physics.data file:
variable name | scale name (units) |
nScale | number density scale (cm-3) |
rScale | density scale (g cm-3) |
pScale | pressure scale (dynes cm-2) |
TempScale | temperature scale (K) |
lScale | length scale (cm) |
AstroBEAR derives other scaling constants such as magnetic pressure and velocity from these basic parameters:
variable name | scale name (units) | formula |
VelScale | velocity scale (cm s-1) | |
BScale | magnetic field scale (esu) | |
TimeScale | time scale (s) | |
ScaleGrav * | gravity scale (cm3) | |
ScaleCool ** | cooling scale (erg-1 cm3) |
*requires elliptic source terms.
**requires cooling source terms.
Example of Scaling Calculations
As an example, we will construct the scaling terms for the MHD clump simulations. We start with the following physical parameters for the simulation:
ambient density | 100 cm-3 |
ambient temperature | 104 K |
wind speed | Mach 25 |
clump radius | 200 AU |
plasma beta | 1 |
The first thing we notice is that the ambient wind speed is expressed as a Mach number instead of in cm/s. In essence, this quantity is pre-scaled to the sound speed of the problem, and does not need to be scaled any further. Similarly, the plasma beta term is a dimensionless quantity that specifies the strength of the magnetic field in terms of the pressure, so there is no need to concern ourselves with the scaling of the magnetic field.
The quantities that do need scaling are density, temperature, and distance.Since the clump radius is on the order of 100 AU, that seems like a reasonable value for lScale
. AstroBEAR assumes that distance scales are given in centimeters, and 1 AU = 1.495 x 1013 cm; therefore, the scaling term in physics.data
is:
lScale = 1.49598d15,
This gives us a scaled clump radius of 2 computational units.
Ideally, we would like to scale the ambient density to 1. Since we are given the number density but not the mass density, the density scales in physics.data
should be set as follows:
nScale = 1.d2, rScale = 0.d0,
This causes rScale
to be derived from nScale
, the known quantity.
Similarly, we would like to scale the ambient temperature to 1. To do this, we set the temperature and pressure scaling options in physics.data
as follows:
pScale = 0.d0, TempScale = 1.d4,
With this configuration, AstroBEAR both scales the ambient temperature to 1 and derives the pressure scale from the temperature scale. With rScale
and pScale
, we can now derive values for VelScale
and BScale
(see ''Data File Parameters" above). VelScale
can now be used in conjunction with lScale
to derive the TimeScale
, which in turn allows us to obtain a value for ScaleCool
.