Z Astromical Routines (Temporary) - StephenG1CMZ - 01-16-2017 06:53 PM
Some temporary routines I might include into an astronomy app one day
RE: Z Astromical Routines (Temporary) - StephenG1CMZ - 01-16-2017 06:56 PM
atemp-planet estimates a planets temperature
(if a planets temperature is known to be different, maybe it is being warmed by fusion or is not in equilibrium)
Code:
EST_PLANET_TEMP(R_ORBIT,STL_LUMINOSITY,ALBEDO)
//FORMULA FOR ESTIMATING ANY PLANETS TEMP ANY STAR
//PROVIDING INPUT=OUTPUT
//RADIUS IN AU
//LUMINOSITY OF STAR:SINCE THIS IS AN INPUT
//FORMULA GOOD FOR MOST STARS.UNITS TBC
//ALBEDO OF PLANET
BEGIN
LOCAL NUM;
//STEFAN BOLTZMANN CONSTANT
LOCAL KSB:=5.670400ᴇ−8;//J s−1 m−2 K−4
LOCAL TEMP_K:=0;
LOCAL DEN:=16*π*KSB*(R_ORBIT^2);
IF DEN==0 THEN //NO DATA ON PLANET
//NAN OR 0
ELSE
NUM:=STL_LUMINOSITY*(1-ALBEDO);
TEMP_K:=(NUM/DEN)^(1/4);
END;
RETURN TEMP_K;
//USING THIS FOR JUPITER ESTIMATES 112K
//ITS INTERNAL HEATING RAISES THIS TO 152K
//SO A DISCREPANCY CAN BE A USEFUL INDICATOR
END;
///TIDALLY LOCKED NO ATMOSPHERE:
//HOTTEST POLE:AVERAGE*√(2)
//COLDEST POLE-:NEAR 0K
EXPORT ATEMP_PLANET()
BEGIN
END;
Spacecraft
Code:
EXPORT DRAG(CDRAG,RHO,VEL,AREA)
//CDRAG:DRAG COEFFICIENT
//TYPICALLY 2-4 FOR EARTH ORBITING STELLITES
//VEL:SPACECRAFT VEL
//RHO: AIR DENSITY
//AREA: AREA OF BODY NORMAL TO FLOW
BEGIN
LOCAL FO:=0.5*CDRAG*RHO*VEL^2*AREA;
RETURN FO;//FORCE
END;
EXPORT SOL_ACCEL(AREA,SATMASS)
//ACCEL DUE TO SOLAR RADIATION
//FOR EARTHORBITING SATELLITES ABUVE 800K:LARGER THAN ATMOSPHERIC DRAG
//AREA:SUNWARD m2
//SATMASS:SATELLITE MASS KG
BEGIN
LOCAL AR:=0;//SUNWARD ACCELERATION
IF SATMASS THEN
//MAGIC NUM FOR SUN ONLY
AR:=(−4.5ᴇ−8*AREA)/SATMASS;
END;
RETURN AR;//+SUNWARD LIKE GSUN
END;
EXPORT ASPACECRAFT()
BEGIN
END;
Magnitudes
Code:
// NAKED EYE 6
// BINOS 9
// AMATEUR SCOPE 12
// HUBBLE 31
//NB DEFINITIONS VARY
MAG_OBS_COMET_CALC(R_HELIO,R_OBS,SLOPE_N,M_ZERO)
// CALC SOLAR COMET MAG INCLUDING COMA:RELATIVE TO GIVEN ABSOLUTE
//HELIOCENTRIC DIST AU:M
//OBS DIST/EARTH ASSUMED AU
//SLOPE_N:RATE OF BRIGHTENING
//4 AVERAGE 1S TIME 3..4 PERIODIC>4
//M0: ABSOLUTE BRIGHTNESS AT 1AU
BEGIN
LOCAL M_ONE:=M_ZERO+5*LOG(R_OBS)+2.5*SLOPE_N*LOG(R_HELIO);
RETURN M_ONE;
END;
EXPORT MAG_OBS_MPC(R_HELIO,R_OBS,MZERO,PHASEI)
//MINOR PLANETS FORMULA RESEMBLES THAT FOR PLANETS, SANS LOOKUP
//RELATIVE TO GIVEN ABSOLUTE
// MZERO: ABS MAG
// R IN AU
// PHASEI: PHASE FUNCTION OF ANGLE I
BEGIN
LOCAL MAGOBS:=MZERO+5*LOG(R_HELIO*R_OBS)+PHASEI;
RETURN MAGOBS;
END;
EXPORT EST_MPC_DIAMETER(ALBEDO,MZERO)
//RELATES DIAMETER ALBEDO ABSOLUTE MAG
BEGIN
LOCAL DIAM:=0;
IF ALBEDO==0 THEN
//UNABLE TO EST DIAM
ELSE
DIAM:=(1329/√(ALBEDO))*10^(−0.2*MZERO);
END;
RETURN DIAM;
END;
EXPORT AMAGNITUDES()
BEGIN
END;
|