<?php
/*
Code
© Charles Chandler
http://qdl.scs-inc.us/?top=12354
*/
/*
This first part of this code finds the average density
and the total mass of the interplanetary medium.
The second part finds the pressure for the interplanetary
medium versus the interstellar medium.
*/
// Set this to true to echo the "protons per cc" table.
$echoProtonsPerCC = true;
// Set this to true if not running within the QDL framework.
$standAlone = false;
if ($standAlone) {
function VolumeOfSphere($radius) {
return (4 * PI * pow($radius, 3)) / 3;
}
function Pressure($moles, $temperature, $volume) {
// Given the moles of a gas, the temperature (K), and the
// volume (m^3), this returns the pressure (pascals).
return ($moles * 8.3144621 * $temperature) / $volume;
}
define('kSecsInDay', 60 * 60 * 24);
define('kSecsInYear', kSecsInDay * 365);
define('solarMass', 1.9891E+30);
define('p', 1.67262178 * pow(10, -27)); // mass of proton, in kilograms
}
else {
define('solarMass', $solSys->sun->mass_kg);
// solar wind speed and the radius of the heliosphere
// It looks like the solar wind, traveling at its current speed, would make the trip from
// the Sun to the heliopause in just a little over a year. So it's obvious that the
// heliopause is not expanding simply at the rate of the solar wind, and the radius of the
// heliopause is not a simple function of the age of the Sun times the solar wind velocity.
// So what does determine the radius of the heliopause? This can only be that it is
// positively charged, while the Sun has a net negative charge, and the heliosphere will
// not expand any further, due to the electric force. Thus it is like a Debye sheath.
$v['heliosphereAgeSecs' ] = $solSys->ipm->rad_km / $solSys->ipm->wind_kps;
$v['heliosphereAgeYears'] = $v['heliosphereAgeSecs'] / kSecsInYear;
// heliosphereAgeYears = 1.0569930661255;
}
function ProtonPerCm3PerLogAU($logAU) {
// This returns the number of protons per cm^3 per log10(AU).
// Pintera, T.; Dorotovica, I.; Rybansky, M., 2009:
// The heliosphere mass variations: 1996-2006.
// Proc. of the Int. Astronomical Union, 4 (257): 291-293
return pow(10, 0.856 - (2.03 * $logAU));
}
define('au_m', 152000000000); // orbit of earth, in meters
define('sr_m', 695500000); // solar radius, in meters
define('proton_kg', 1.672621777e-27); // mass of proton, in kg
$oldVolume = VolumeOfSphere(sr_m); // solar volume, in meters^3
$totalProtons = 0;
if ($echoProtonsPerCC) echo kLF.'AU'.chr(9).'protons per cc'.kLF;
for ($i = -2.33; $i < 2; $i += .01) {
// This finds the volumes of spheres, starting at just a little bit
// bigger than the radius of the Sun, and going out to 100 AU. Then it
// subtracts the volume of the previous sphere, to get the volume of a
// shell at the specified outer radius. Then it finds the proton density
// at that radius, and multiplies that by the volume, to get the total
// number of protons in that shell, which it adds to the running total.
// This uses log steps, partly because the relationship between
// density and radius is logarithmic, and partly because the inner
// shells should be calculated at a finer resolution, where the
// slope of the curve is very steep.
$numOfAU = pow(10, $i);
$newVolume = VolumeOfSphere($numOfAU * au_m);
$atomsPerCm3 = ProtonPerCm3PerLogAU($i);
$atomsPerM3 = $atomsPerCm3 * 1e6;
$atomsShell = $atomsPerM3 * ($newVolume - $oldVolume);
$totalProtons += $atomsShell;
$oldVolume = $newVolume;
if ($echoProtonsPerCC) echo $numOfAU.chr(9).$atomsPerCm3.kLF;
}
$v['ipmTotalKg' ] = $totalProtons * proton_kg;
$v['ipmOverSun' ] = $v['ipmTotalKg'] / solarMass;
$v['ipmProPerM3' ] = $totalProtons / $newVolume;
// Noerdlinger, P. D., 2008: Solar Mass Loss, the Astronomical
// Unit, and the Scale of the Solar System. arxiv, 0801.3807
$v['massLossKgSec' ] = 5.750e9; // kg/s, maximum
$v['massLossKgSec' ] = 1.375e9; // kg/s, minimum
$v['massLossKgYear'] = $v['massLossKgSec'] * kSecsInYear;
$v['ipmYearsToFill'] = ($v['ipmTotalKg'] / $v['massLossKgSec']) / kSecsInYear;
$v['hydrogen per mole (g)' ] = 1.00794; // http://www.convertunits.com/from/grams+Hydrogen/to/moles
$v['hydrogen per mole (kg)'] = $v['hydrogen per mole (g)'] * 1000;
// Interstellar Medium
// http://www-ssg.sr.unh.edu/ism/LISM.html
// https://arxiv.org/abs/0906.2827
$v['temperature' ] = 6500; // in K
$v['hydrogen atoms per m3' ] = .1 * pow(10, 6);
$v['kg hydrogen' ] = $v['hydrogen atoms per m3'] * p;
$v['hydrogen moles' ] = $v['kg hydrogen'] / $v['hydrogen per mole (kg)'];
$v['ism pressure' ] = Pressure($v['hydrogen moles'], $v['temperature'], 1);
// result = 8.9683093818471E-21
// Interplanetary Medium
// https://www.physics.upenn.edu/nineplanets/medium.html
$v['temperature' ] = 100000; // in K,
$v['hydrogen atoms per m3' ] = 1889.0785589846; // http://qdl.scs-inc.us/?top=12354
$v['kg hydrogen' ] = $v['hydrogen atoms per m3'] * p;
$v['hydrogen moles' ] = $v['kg hydrogen'] / $v['hydrogen per mole (kg)'];
$v['ipm pressure' ] = Pressure($v['hydrogen moles'], $v['temperature'], 1);
// result = 2.6064370713212E-21
if ($standAlone) {
echo '<table>';
foreach($v as $key => $val) {
echo '<tr><td>'.$key.'</td><td> </td><td>'.$val.'</td></tr>';
}
echo '</table>';
}
?>
|