Ejemplo n.º 1
0
        private void SetInitialConditions(Length inner_limit_of_dust, Length outer_limit_of_dust)
        {
            _histHead = new Generation();

            _planetHead           = null;
            _dustHead             = new DustRecord();
            _dustHead.NextBand    = null;
            _dustHead.OuterEdge   = outer_limit_of_dust.AstronomicalUnits;
            _dustHead.InnerEdge   = inner_limit_of_dust.AstronomicalUnits;
            _dustHead.DustPresent = true;
            _dustHead.GasPresent  = true;
            _dustLeft             = true;
            _cloudEccentricity    = CloudEccentricity;

            _histHead.Dusts  = _dustHead;
            _histHead.Bodies = _planetHead;
            _histHead.Next   = _histHead;
        }
Ejemplo n.º 2
0
        private Mass CollectDust(Mass last_mass, ref Mass new_dust, ref Mass new_gas, Length a, Ratio e, Mass crit_mass, ref DustRecord dust_band)
        {
            double temp = last_mass.SolarMasses / (1.0 + last_mass.SolarMasses);

            _reducedMass = Math.Pow(temp, 1.0 / 4.0);
            _rInner      = InnerEffectLimit(a.AstronomicalUnits, e.DecimalFractions, _reducedMass);
            _rOuter      = OuterEffectLimit(a.AstronomicalUnits, e.DecimalFractions, _reducedMass);

            if (_rInner < 0.0)
            {
                _rInner = 0.0;
            }

            if (dust_band == null)
            {
                return(Mass.FromSolarMasses(0.0));
            }
            else
            {
                double gas_density = 0.0;
                double temp_density;
                double mass_density;
                if (dust_band.DustPresent == false)
                {
                    temp_density = 0.0;
                }
                else
                {
                    temp_density = _dustDensity;
                }

                if (last_mass < crit_mass || dust_band.GasPresent == false)
                {
                    mass_density = temp_density;
                }
                else
                {
                    mass_density = GasDustRatio.DecimalFractions * temp_density / (1.0 + Math.Sqrt(crit_mass / last_mass) * (GasDustRatio.DecimalFractions - 1.0));
                    gas_density  = mass_density - temp_density;
                }

                if (dust_band.OuterEdge <= _rInner || dust_band.InnerEdge >= _rOuter)
                {
                    return(CollectDust(last_mass, ref new_dust, ref new_gas, a, e, crit_mass, ref dust_band.NextBand));
                }
                else
                {
                    double bandwidth = _rOuter - _rInner;

                    double temp1 = _rOuter - dust_band.OuterEdge;
                    if (temp1 < 0.0)
                    {
                        temp1 = 0.0;
                    }
                    double width = bandwidth - temp1;

                    double temp2 = dust_band.InnerEdge - _rInner;
                    if (temp2 < 0.0)
                    {
                        temp2 = 0.0;
                    }
                    width = width - temp2;

                    temp = 4.0 * Math.PI * Math.Pow(a.AstronomicalUnits, 2.0) * _reducedMass * (1.0 - e.DecimalFractions * (temp1 - temp2) / bandwidth);
                    double volume = temp * width;

                    Mass new_mass = Mass.FromSolarMasses(volume * mass_density);
                    new_gas  = Mass.FromSolarMasses(volume * gas_density);
                    new_dust = new_mass - new_gas;

                    Mass next_dust = Mass.FromSolarMasses(0.0);
                    Mass next_gas  = Mass.FromSolarMasses(0.0);
                    Mass next_mass = CollectDust(last_mass, ref next_dust, ref next_gas, a, e, crit_mass, ref dust_band.NextBand);

                    new_gas  = new_gas + next_gas;
                    new_dust = new_dust + next_dust;

                    return(new_mass + next_mass);
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateDustLanes(double min, double max, Mass mass, Mass crit_mass, Length body_inner_bound, Length body_outer_bound)
        {
            bool       gas;
            DustRecord node1 = null;
            DustRecord node2 = null;
            DustRecord node3 = null;

            _dustLeft = false;
            if (mass > crit_mass)
            {
                gas = false;
            }
            else
            {
                gas = true;
            }

            node1 = _dustHead;
            while (node1 != null)
            {
                if (node1.InnerEdge < min && node1.OuterEdge > max)
                {
                    node2           = new DustRecord();
                    node2.InnerEdge = min;
                    node2.OuterEdge = max;
                    if (node1.GasPresent == true)
                    {
                        node2.GasPresent = gas;
                    }
                    else
                    {
                        node2.GasPresent = false;
                    }
                    node2.DustPresent = false;
                    node3             = new DustRecord();
                    node3.InnerEdge   = max;
                    node3.OuterEdge   = node1.OuterEdge;
                    node3.GasPresent  = node1.GasPresent;
                    node3.DustPresent = node1.DustPresent;
                    node3.NextBand    = node1.NextBand;
                    node1.NextBand    = node2;
                    node2.NextBand    = node3;
                    node1.OuterEdge   = min;
                    node1             = node3.NextBand;
                }
                else if (node1.InnerEdge < max && node1.OuterEdge > max)
                {
                    node2             = new DustRecord();
                    node2.NextBand    = node1.NextBand;
                    node2.DustPresent = node1.DustPresent;
                    node2.GasPresent  = node1.GasPresent;
                    node2.OuterEdge   = node1.OuterEdge;
                    node2.InnerEdge   = max;
                    node1.NextBand    = node2;
                    node1.OuterEdge   = max;
                    if (node1.GasPresent == true)
                    {
                        node1.GasPresent = gas;
                    }
                    else
                    {
                        node1.GasPresent = false;
                    }
                    node1.DustPresent = false;
                    node1             = node2.NextBand;
                }
                else if (node1.InnerEdge < min && node1.OuterEdge > min)
                {
                    node2             = new DustRecord();
                    node2.NextBand    = node1.NextBand;
                    node2.DustPresent = false;
                    if (node1.GasPresent == true)
                    {
                        node2.GasPresent = gas;
                    }
                    else
                    {
                        node2.GasPresent = false;
                    }
                    node2.OuterEdge = node1.OuterEdge;
                    node2.InnerEdge = min;
                    node1.NextBand  = node2;
                    node1.OuterEdge = min;
                    node1           = node2.NextBand;
                }
                else if (node1.InnerEdge >= min && node1.OuterEdge <= max)
                {
                    if (node1.GasPresent == true)
                    {
                        node1.GasPresent = gas;
                    }
                    node1.DustPresent = false;
                    node1             = node1.NextBand;
                }
                else if (node1.OuterEdge < min || node1.InnerEdge > max)
                {
                    node1 = node1.NextBand;
                }
            }

            // GL: This seems to be combining adjacent dust bands?
            node1 = _dustHead;
            while (node1 != null)
            {
                if (node1.DustPresent && node1.OuterEdge >= body_inner_bound.AstronomicalUnits && node1.InnerEdge <= body_outer_bound.AstronomicalUnits)
                {
                    _dustLeft = true;
                }

                node2 = node1.NextBand;
                if (node2 != null)
                {
                    if (node1.DustPresent == node2.DustPresent && node1.GasPresent == node2.GasPresent)
                    {
                        node1.OuterEdge = node2.OuterEdge;
                        node1.NextBand  = node2.NextBand;
                        node2           = null;
                    }
                }
                node1 = node1.NextBand;
            }
        }