' program tide7a.bas' 08/28/04 RJH

DECLARE SUB centrifugalforce (weight!, period!, radius!, force!)
DECLARE SUB gravforce (weight!, mass2!, distance!, force!)

CLS
INPUT "Enter Filename: "; n$
OPEN n$ FOR APPEND AS #1

' all units in meters, seconds, or kilograms
' forces are newtons per kilogram weight
' bcf! = barycentric centrifugal force,the same at all points of earth
' ebcf! = effective bcf, depends on orientation of bcf relative to earth radius
ER! = 6378000!: 'radius of Earth
BD! = 4669743!: 'barycenter distance from center of Earth recalculated below
MD! = 3.849482E+08: 'Moon and Earth distance
SD! = 1.496481E+11: 'Sun and Earth distance
EM! = 5.983E+24: 'mass of Earth
MM! = 7.347E+22: 'mass of Moon
SM! = 1.991E+30: 'mass of Sun
weight! = 1!: '1 kg of ocean water
g! = 9.80665: ' meters / sec^2: 'acceleration due to earth gravity
PI! = 3.1415926536#
LP! = 27.322 * 24 * 60 * 60: 'Lunar period
SP! = 365.25 * 24 * 60 * 60: 'Solar period
BD! = MM! / (EM! + MM!) * MD!

'*** Barycentric (point orbit) centrifugal force at any point of earth
period! = LP!
radius! = BD!
CALL centrifugalforce(weight!, period!, radius!, force!)
bcf! = force!

intervals! = 20
FOR ang = 0 TO 360 STEP 360 / intervals: 'longitude steps around the equator
theta! = ang * PI! / 180: 'convert to radians

costheta = COS(theta!)
x! = ER * costheta: 'the distance to be subtracted from MD! or SD!
'******************************
'* costheta, cosine factor for Lunar & Solar centrif & grav forces,
'* is positive in near half of Earth and negative in far half
'******************************
ebcf! = -costheta! * bcf!: 'point orbit component on earth radius

'*** Lunar grav
mass2! = MM!
distance! = MD! - x!
CALL gravforce(weight!, mass2!, distance!, force!)
lgforce! = costheta! * force!
bcmg! = ebcf! + lgforce!: 'total lunar force

'*** Solar centrifugal force
period! = SP!
radius! = SD! - x!
CALL centrifugalforce(weight!, period!, radius!, force!)
scforce! = -costheta! * force!
'***********************************
'* -costheta since solar centrifugal force decreases tide on
'* side of earth nearer sun and increases it on the opposite side
'***********************************
'*** Solar gravitational force
mass2! = SM!
distance! = SD! - x!
CALL gravforce(weight!, mass2!, distance!, force!)
sgforce! = costheta! * force!
scg! = sgforce! + scforce!
totforce! = bcmg! + scg!: 'total tide force

PRINT #1, ang!; ebcf!; lgforce; scforce!; sgforce!; bcmg!; scg!; totforce!
NEXT ang!
PRINT #1, "---------"
END

SUB centrifugalforce (weight!, period!, radius!, force!)
' units are kilograms, meters, seconds
PI! = 3.1415926536#
g! = 9.80665: 'meters/sec^2
force! = weight! / g! * (2 * PI! / period!) ^ 2 * radius!
END SUB

SUB gravforce (weight!, mass2!, distance!, force!)
' units are kilograms, meters, seconds
' mass1 is kilograms weight. mass2 is kilograms mass
gravconst! = 6.67259E-11
' gravconst is in Newtons * m^2 / kg^2
force! = gravconst! * weight! / 9.80665 * mass2! / (distance! ^ 2)
END SUB