wiki:DataScaling

Version 1 (modified by Brandon Shroyer, 14 years ago) ( diff )

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.

Scaling in AstroBEAR

Data File Parameters

The "true" scales are:

rScaledensity scale
pScalepressure scale
lScalelength scale
VelScalevelocity scale
RunTimeSctime scale
BScaleMagnetic field scale
ScaleGravacceleration scale

In addition there are a few proxies:

EOSConstants - Used to find the physical Temperature: T = EOSConstants*P/rho

nscale - Used to find the physical number density: n = nscale*rho

[Note if nscale were truly a scale then nscale=1/(lscale3)]

ScaleCool - ScaleCool is used to scale the cooling rate Lambda which has units of erg cm3/s = erg/cm3 * cm6/s, so in theory ScaleCool = pScale*lScale6/RunTimeSc. However instead of dividing the physical cooling rate by ScaleCool to get the computational cooling rate, it is easier to multiply by the reciprocal, so ScaleCool is actually the inverse: ScaleCool=RunTimeSc/pscale/lscale6. Since the cooling rate also depends on the physical number density2, we include a factor of nScale2 so that de/dt = rho2*ScaleCool*(Physical Cooling rate). So, ScaleCool=RunTimeSc*nScale2/(pScale*lScale6) = rScale*lScale/((hMass2)*Xmu2*VelScale3))

In general to convert from a quantity in cgs units to computational units you divide by the corresponding scale, and there are only three independent scales. Fundamentally these would be mass length and time, however its usually easier to set the density (or number density) scale, pressure (or temperature) scale, and length scale. In the code, the pressure and density scales are set first. These combine to define a velocity scale, but the three fundamental scales of mass, length, and time are still free. Setting the length scale then determines the time scale and the mass scale. If there were a mass scale it would just be rScale*lScale3. (Again, setting the mass scale to be rScale/nScale would not be right since nScale isn't a true scale.)

To convert computational magnetic field strengths to gauss multiply by sqrt(4*Pi*pScale). See the second page of the attached pdf for the reasoning.

Additional information on the scaling parameters may be found in the attached PDF.


Called In:

setprob :: setprob()


Modules Used:

None are brought in by the USE statement, but it assumes that ReadPhysics() has been called.


Files Included:

None.

Note: See TracWiki for help on using the wiki.