Exemple #1
0
        public static double GetBeltMagneticFieldRadial(this CelestialBody body, CelestialBody homeworld, double altitude, double lat)
        {
            double mlat = lat / 180 * Math.PI + Math.PI / 2;

            double relmp = body.Mass / homeworld.Mass;
            double relrp = body.Radius / homeworld.Radius;
            double relrt = body.rotationPeriod / homeworld.rotationPeriod;

            double altituded = altitude + body.Radius;
            double Bmag      = -2 / relrt * relmp * VanAllen.B0 * Math.Pow((body.Radius / altituded), 3) * Math.Cos(mlat) * body.specialMagneticFieldScaling();

            if (KopernicusHelper.GetLuminocity(body) > 0)
            {
                Bmag /= 1000;
            }

            if (body.atmosphere)
            {
                Bmag *= body.atmosphereDepth / 70000;
            }
            else
            {
                Bmag *= 0.01;
            }

            return(Bmag);
        }
Exemple #2
0
        public static double GetBeltAntiparticles(this CelestialBody body, CelestialBody homeworld, double altitude, double lat)
        {
            if (body.flightGlobalsIndex != 0 && altitude <= PluginHelper.getMaxAtmosphericAltitude(body))
            {
                return(0);
            }

            BeltData beltdata;

            if (!BeltDataCache.TryGetValue(body.name, out beltdata))
            {
                double relrp = body.Radius / homeworld.Radius;
                double relrt = body.rotationPeriod / homeworld.rotationPeriod;

                beltdata = new BeltData()
                {
                    density = body.Mass / homeworld.Mass * relrp / relrt * 50,
                    ampere  = 1.5 * homeworld.Radius * relrp / sqrt2,
                };

                BeltDataCache.Add(body.name, beltdata);
            }

            double beltparticles = beltdata.density
                                   * sqrt2divPi
                                   * Math.Pow(altitude, 2)
                                   * Math.Exp(-Math.Pow(altitude, 2) / (2 * Math.Pow(beltdata.ampere, 2)))
                                   / (Math.Pow(beltdata.ampere, 3));

            if (KopernicusHelper.GetLuminocity(body) > 0)
            {
                beltparticles /= 1000;
            }

            if (body.atmosphere)
            {
                beltparticles *= body.atmosphereDepth / 70000;
            }
            else
            {
                beltparticles *= 0.01;
            }

            return(beltparticles * Math.Abs(Math.Cos(lat / 180 * Math.PI)) * body.specialMagneticFieldScaling());
        }