95 | | |
96 | | [[BR]] |
97 | | |
98 | | |
99 | | ==== Units and Scaling ==== |
100 | | |
101 | | Astrophysical problems involve many different physical units and constants with a wide range of scales. To avoid overflow or underflow - we scale our units into ''computational units'' before storing them in the data arrays. Note with double precision this would be quite rare - but it still convenient to work within physical units appropriate to the problem. |
102 | | |
103 | | Usually, the physical scales are defined by a few parameters in the [PhysicsDataExplained physics.data] file --you simply enter the scales for density, temperature, velocity, etc in cgs units, and AstroBEAR will read them in. ''Note that nScale is in cm^{-3}^ and !TempScale is in Kelvin''. When the code runs it will calculate other scales such as the computational time scale, mass scale, magnetic field scale, and so on which are then dumped to a scales.data file in your run directory. All of those units will be in cgs with the magnetic field scale in gauss. It is often useful to know the computational time scale before running your job as this will affect the final time specified in global.data. The computational time scale can be calculated as follows: |
104 | | |
105 | | * tScale=lScale / (pScale/rScale)^1/2^ |
106 | | where you may have to first derive |
107 | | * rScale=Xmu*amu*nScale |
108 | | * pScale=nScale*k,,B,,*!TempScale |
109 | | |
110 | | You have two options for making sure that you only put scaled quantities in the data arrays: you can scale your input values before you enter them into your input file (and then assume that you are reading in scaled quantities), or you can use physical quantities in your input files and then scale them within your problem module: |
111 | | |
112 | | {{{ |
113 | | scaled_qty = physical_qty / physical_scale |
114 | | }}} |
115 | | |
116 | | Either way, a good sanity check is to print out the physical quantities your program uses after the problem is set up. This verifies that the values you think are going in are the values that are actually getting used. |
117 | | |
118 | | [[BR]] |
| 95 | * [UnitsScaling Units and Scaling] |
| 96 | |
| 97 | [[BR]] |
| 98 | |
| 99 | |