Program: Mass_Gal.bas

Implementation Select: Implementation
Operation Select: Program: MASS_GAL.BAS

DECLARE SUB PRINTTAB (posx#, num#)
DECLARE FUNCTION Densscor# (r#, nr#, n#)
DECLARE FUNCTION DISK# (r#)
DEFDBL A-Z
'                       MASS_GAL.BAS
'       Revision 1.0    Original                          28 Nov 1995
'       Revision 1.1    Corection massdisk & massdisk1    29 Dec 1995
'       Revision 2      Added Sun Corr factor             17 Feb 2002
'       Revision 2.1    Added DISK sub  3-5                1 May 2011
'                       Added test 12                      1 May 2011
DIM SHARED dist9(70), v91(70), v92(70), mass9(70), ax1&(70), ax2&(70)       ' test 9
DIM SHARED disktype, dzdisk, shape, rvisgal, dbulge, rtotgal        'DISK

CONST ESC = 27, ENTER = 13
CONST pi = 3.141592653589#
CONST lightyear = 9460000000000#
CONST D41 = 1D+41

Title$ = "Sun Radius Calculation"

'  READDATA                         ' Convert SUNRAD.DB to SUNRAD.BAS

RESTORE s20:
READ nnr, nnz, ndalpha, radsun, eradsun
FOR i = 0 TO 70: READ dist9(i), v91(i), v92(i), mass9(i): NEXT i
FOR i = 0 TO 70: READ ax1&(i), ax2&(i): NEXT i

test% = 1
savedata = 0                        ' 0 = create your own curve
calib = 1                           ' calibration
ddisk = 2000                        ' height disk
rbulge = 7500                       ' radius bulge
rvgal = 60000
cnr = 10: dalpha = 45: nz = 1
cnr = 5: dalpha = 10: nz = 3
spvel = 250                         ' setpoint velocity
shape = .1                          ' disk height at end
disktype = 2                        ' disk type
denscor = .6#                       ' disk density correction

s0:

SCREEN 12

s1:
IF test% = 1 OR test% = 4 THEN
  CLS : 
  test% = 1
  COLOR 15: PRINT TAB(2); "1 = # r  ";
  COLOR 14: PRINT TAB(15); cnr;
  COLOR 15: PRINT TAB(30); "2 = # z";
  COLOR 14: PRINT TAB(40); nz;
  COLOR 15: PRINT TAB(58); "3 = d alpha  ";
  COLOR 14: PRINT dalpha;
  COLOR 15: PRINT TAB(2); "4 = Rad bulge";
  COLOR 14: PRINT rbulge;
  COLOR 15: PRINT TAB(30); "5 = Rad v galaxy";
  COLOR 14: PRINT rvgal;
  COLOR 15: PRINT TAB(58); "6 = z disk ";
  COLOR 14: PRINT ddisk;
  COLOR 15: PRINT TAB(2); "7 = shape disk ";
  COLOR 14: PRINT USING "#.#"; shape;
  COLOR 15: PRINT TAB(30); "8 = sp vel   ";
  COLOR 14: PRINT spvel;
  COLOR 15: PRINT TAB(58); "9 = disk type ";
  COLOR 14: PRINT disktype;
  COLOR 15: PRINT TAB(2); "10 = disk Dens correct";
  COLOR 14: PRINT denscor;
  COLOR 15: PRINT TAB(30); "11 = Calibration";
  COLOR 14: PRINT calib
  PRINT " "
  COLOR 15: PRINT " Enter value 1 - 11 to modify parameter"
  COLOR 15: PRINT " Enter value 12 perform disk type height test"
  COLOR 15: PRINT " Enter -1 to end program"
  COLOR 14: PRINT " or press ENTER key to start simulation"
  COLOR 15: INPUT "Parameter "; par
  IF par < 0 THEN PRINT "END 1": END
  IF par <> 0 THEN
    IF par > 0 AND par <= 11 THEN INPUT "value "; Value
    SELECT CASE par
    CASE 1
      cnr = Value
      IF cnr < 2 THEN cnr = 2
    CASE 2
      nz = Value
      IF nz < 1 THEN nz = 1
    CASE 3
      dalpha = Value
      IF dalpha < 3 THEN dalpha = 3
    CASE 4
      rbulge = Value
      IF rbulge < 2000 THEN rbulge = 2000
    CASE 5
      rvgal = Value
      IF rvgal > 70000 THEN rvgal = 70000
    CASE 6
      ddisk = Value
      IF ddisk > 10000 THEN ddisk = 10000
      IF ddisk < 1000 THEN ddisk = 1000
    CASE 7
      shape = Value
      IF shape > 1 THEN shape = 1
      IF shape < 0 THEN shape = 0
    CASE 8
      spvel = Value
      IF spvel < 100 THEN spvel = 100
    CASE 9
      disktype = INT(Value)
      IF disktype < 1 THEN disktype = 1
      IF disktype > 5 THEN disktype = 5
    CASE 10
      denscor = Value
      IF denscor < 0 THEN denscor = 0
    CASE 11
      calib = INT(Value)
    CASE ELSE
	dbulge = rbulge * lightyear        ' radius bulge
	dsun = 25000 * lightyear           ' distance sun
	rvisgal = rvgal * lightyear        ' radius outer visible galaxy
	rtotgal = 70000 * lightyear        ' radius outer galaxy
	dzdisk = ddisk * lightyear         ' height disk
	dzdisk = dzdisk / 2                ' half height disk
	dsuncal = dsun
 
      PRINT TAB(9); "1"; TAB(17); "2"; TAB(25); "3"; TAB(33); "4";
      PRINT TAB(41); "5"
      savedt = disktype
      FOR r = 0 TO 70000 STEP 5000
	PRINT r;
	  FOR disktype = 1 TO 5
	    r1 = r * lightyear
	    dzdiskcor = DISK(r1)
	    PRINT TAB(disktype * 8); INT(dzdiskcor / lightyear);
	  NEXT disktype
	PRINT ""
      NEXT r
      INPUT a$
      disktype = savedt
    END SELECT
    IF par >= 1 AND par <= 11 THEN test% = 1: savedata = 0
    GOTO s1
  END IF
END IF

CLS
 
  dbulge = rbulge * lightyear        ' radius bulge
  dsun = 25000 * lightyear           ' distance sun
  rvisgal = rvgal * lightyear        ' radius outer visible galaxy
  rtotgal = 70000 * lightyear        ' radius outer total galaxy
  dzdisk = ddisk * lightyear         ' height disk
  dzdisk = dzdisk / 2                ' half height disk
  dsuncal = dsun
  dsdisk = SQR(dbulge * dbulge - dzdisk * dzdisk)  'distance start disk

  IF savedata = 1 AND test% = 1 THEN test% = 2

SELECT CASE test%

CASE IS = 1
  G = 6.67E-20
  m0 = 2E+30 * 110000000000#           ' Galaxy  mass in kg
  m1 = 2E+30                           ' Sun
  Year = 365.25 * 24 * 60 * 60
  scren% = 12: SCREEN scren%
  ychrmax = 29
  PRINT "distance"; TAB(21); "v km/sec"; TAB(40); "rev time in million years"
  ddsun = 5000 * lightyear           ' step size distance
  ddsun = ddsun / 5

' Calculation mass in the center
IF calib > 0 THEN
FOR dsun1 = ddsun TO rtotgal STEP ddsun
  dist = dsun1
  mm01 = m0 + m1
  r0 = dist * m1 / mm01
  r1 = dist - r0
  vr0 = SQR(r0 * m1 * G) / dist
  vr1 = SQR(r1 * m0 * G) / dist          ' meter/sec
  i = dsun1 / ddsun - 1: dist9(i) = dsun1: v91(i) = vr1
  IF dist = dsun THEN COLOR 7 ELSE COLOR 15
  dll = dist / lightyear
  IF dll < 52000 AND dll MOD 5000 = 0 THEN PRINT dll, vr1, 2 * pi * r1 / (vr1 * Year * 1000000)
NEXT dsun1
END IF

calib1 = calib               ' calibration
IF calib1 = 1 THEN
  masgal0 = m0                 ' total mass inner galaxy
  dmasgal = 0
END IF
nrend = cnr * 70
nr = nrend * dbulge / rvisgal

PRINT "distance"; TAB(13); "mass < dist"; TAB(29); "mass correct"; TAB(48); "v km/sec";
PRINT TAB(60); "ax bulge"; TAB(72); "ax disk"

cal1:
masgal = masgal0 - dmasgal                 ' total mass inner galaxy
volcent = 4 / 3 * pi * dbulge * dbulge * dbulge
densgal = masgal / volcent
dd = dbulge / nr: dphi = dalpha                ' radius bulge / nr
' nrend = rvisgal / dbulge * nr                   ' based on inner maximum
accuz = nz

' disk calculation

FOR dsun1 = 1 * ddsun TO rtotgal STEP ddsun          ' modified    rvisgal = ddsun
IF calib1 >= 1 THEN dsun1 = dsuncal
  voldisk = 0: massdisk = 0: massdisk1 = 0: axdisk = 0

  FOR r = 1 TO nrend
    r1 = (r - .5) * dd
    a$ = INKEY$: IF a$ = CHR$(ESC) THEN GOTO s10
    dzdiskcor = DISK(r1)
    FOR phi = 0 TO 180 - dphi STEP dphi
      phi1 = (phi + dphi / 2) * pi / 180
      x = r1 * COS(phi1): y = r1 * SIN(phi1)
      dx = dsun1 - x:

'      dzdiskcor = (dzdisk / rvisgal) * SQR(rvisgal * rvisgal - r1 * r1) * ((shape - 1) / rvisgal * r1 + 1)'ellipse
      IF dzdiskcor > 0 THEN
	dvol = pi * dd * dphi / 180 * dzdiskcor * r1
	'dm = dvol * densgal * denscor
	dm = dvol * densgal * denscor * Densscor((r - .5), nrend, .5)
	ddzdiskcor = dzdiskcor / accuz:
	ddvol = dvol / accuz:
	'ddm = ddvol * densgal * denscor
	ddm = ddvol * densgal * denscor * Densscor((r - .5), nrend, .5)
	FOR z = 1 TO accuz
	  z1 = (z - .5) * ddzdiskcor
	  rd = SQR(z1 * z1 + dx * dx + y * y)
	  da = ddm / (rd * rd)
	  dax = da * dx / rd        'dbulge
	  axdisk = axdisk + 4 * dax
	NEXT z
	voldisk = voldisk + 4 * dvol
	massdisk = massdisk + 4 * dm
      ELSE
	PRINT "END dzdiskcor"; dzdiskcor; "r1"; INT(r1 / lightyear); disktype
	END
      END IF
    NEXT phi
    IF r1 < dsun1 THEN massdisk1 = massdisk
  NEXT r

'  central part of galaxy calculation

  IF dsun1 < dbulge OR calib1 >= 1 THEN
    axcent = 0: masscent = 0: masscent1 = 0: volcent1 = 0
    FOR r = 1 TO nr
      r1 = (r - .5) * dd
      a$ = INKEY$: IF a$ = CHR$(ESC) THEN GOTO s10
      FOR phi = 0 TO 180 - dphi STEP dphi
	phi1 = (phi + dphi / 2) * pi / 180
	x = r1 * COS(phi1): y = r1 * SIN(phi1)
	dx = dsun1 - x:
	z = SQR(dbulge * dbulge - r1 * r1)         ' pos height of galaxy
	dvol = pi * dd * dphi / 180 * z * r1
	'dm = dvol * densgal:
	dm = dvol * densgal * Densscor(r, nr, .1)
	dz = z / accuz: ddvol = dvol / accuz
	'ddm = ddvol * densgal
	ddm = ddvol * densgal * Densscor(r, nr, .1)
	FOR z = 1 TO accuz
	  z1 = (z - .5) * dz
	  rd = SQR(z1 * z1 + dx * dx + y * y)
	  da = ddm / (rd * rd)
	  dax = da * dx / rd
	  dax1& = 4 * dax
	  axcent = axcent + dax1&
	  masscent = masscent + 4 * ddm
	  volcent1 = volcent1 + 4 * ddvol
	NEXT z
      NEXT phi
      IF r1 < dsun1 THEN masscent1 = masscent
    NEXT r
  ELSE
    axcent = masscent / (dsun1 * dsun1)                'ax central galaxy
  END IF
  masgalcor = (axdisk + axcent) * dsun1 * dsun1
  m0 = masgalcor:
  dist = dsun1
  mm01 = m0 + m1
  r0 = dist * m1 / mm01
  r1 = dist - r0
  vr0 = SQR(r0 * m1 * G) / dist
  vr1 = SQR(r1 * m0 * G) / dist          ' meter/sec
     i = dsun1 / ddsun - 1:
     dist9(i) = dsun1: v92(i) = vr1: mass9(i) = massdisk1 + masscent1
     ax1&(i) = axcent: ax2&(i) = axdisk
  Year = 365.25 * 24 * 60 * 60
  IF dsun1 = dsun THEN
	COLOR 7
	IF calib = 0 THEN spvel = INT((10 * vr1) + .5) / 10
  ELSE
	COLOR 15
  END IF
  IF dsun1 / lightyear MOD 5000 = 0 THEN
  ' IF dsun1 / lightyear MOD 1000 = 0 AND dsun1 / lightyear < 10000 THEN
    PRINT dsun1 / lightyear; TAB(12);
    PRINT USING "##.####^^^^^"; massdisk1 + masscent1;
    PRINT USING "##.####^^^^^"; TAB(28); masgalcor; TAB(48);
    PRINT USING "####.#"; vr1;
    PRINTTAB 68, INT(axcent)
    PRINTTAB 80, INT(axdisk)
  END IF

  IF calib1 >= 1 THEN
    masssave = masgalcor
    dvr1 = vr1 - spvel:
    calib1 = calib1 + 1
    IF ABS(dvr1) < 1 OR calib1 > 30 THEN
	calib1 = 0: PRINT "": INPUT "Calibration finished - Start calculation "; aa$: GOTO cal1
    END IF
    ddmasgal = .8 * (vr1 - spvel) * masgal0 / spvel
    IF ddmasgal > masgal * .2 THEN ddmasgal = .2 * masgal
    dmasgal = dmasgal + ddmasgal: GOTO cal1
  END IF
NEXT dsun1
PRINT TAB(7); "mass bulge"; TAB(31); "mass disk"; TAB(49); "total mass galaxy"
PRINT TAB(7);
PRINT USING "##.#####"; (masscent) / D41;
PRINT " D+41"; TAB(31);
PRINT USING "##.#####"; (massdisk) / D41;
PRINT " D+41"; TAB(49);
PRINT USING "##.#####"; (masscent + massdisk) / D41;
PRINT " D+41"
pc3 = 3.26 * 3.26 * 3.26        'par sec
lightyear3 = lightyear * lightyear * lightyear
volly1 = volcent1 / lightyear3: massM0 = masscent / m1
volpc1 = volly1 / pc3
PRINT USING "vol ###############"; volly1;
PRINT USING " ly  mass bulge ###############"; massM0;
PRINT USING "m0  dens ##.#####"; massM0 / volly1;
PRINT " m0/ly"
PRINT USING "vol ###############"; volpc1;
PRINT USING " pc  mass bulge ###############"; massM0;
PRINT USING "m0  dens ##.#####"; massM0 / volpc1;
PRINT " m0/pc"
volly = (volcent1 + voldisk) / lightyear3: massM0 = (masscent + massdisk) / m1
volly = (voldisk) / lightyear3: massM0 = (massdisk) / m1
volpc = volly / pc3:
PRINT USING "vol ###############"; volly;
PRINT USING " ly  mass disk  ###############"; massM0;
PRINT USING "m0  dens ##.#####"; massM0 / volly;
PRINT " m0/ly"
PRINT USING "vol ###############"; volpc;
PRINT USING " pc  mass disk  ###############"; massM0;
PRINT USING "m0  dens ##.#####"; massM0 / volpc;
PRINT " m0/pc"
r = 25000 / 70000 * nrend
volx = dvol / lightyear3 / pc3
' PRINT densgal * denscor * Densscor((r - .5), nrend, .5) * (lightyear3 * pc3) / m1

CASE IS = 2

SCREEN scren%: ychrmax = 29: ychrmax = ychrmax - 3
vmax = 900                    ' max display speed
rvisgal = 60000

FOR i = 1 TO 69
  COLOR 7
  LOCATE 1, 1:
' PRINT i, dist9(i) / lightyear / 100, v91(i) / 2
  LINE (dist9(i - 1) * 600 / lightyear / rvisgal, 479 - v91(i - 1) * 450 / vmax)-(dist9(i) * 600 / lightyear / rvisgal, 479 - v91(i) * 450 / vmax)
NEXT i
FOR i = 1 TO 69
  COLOR 15
  LOCATE 1, 1:
' PRINT i, dist9(i) / lightyear / 100, v92(i) / 2
  LINE (dist9(i - 1) * 600 / lightyear / rvisgal, 479 - v92(i - 1) * 450 / vmax)-(dist9(i) * 600 / lightyear / rvisgal, 479 - v92(i) * 450 / vmax)
NEXT i
FOR i = 0 TO rvisgal STEP rvisgal / 12
  LINE (i * 600 / rvisgal, 479 - 1)-(i * 600 / rvisgal, 479 - 10)
NEXT i
FOR i = 0 TO vmax STEP vmax / 9
  LINE (1, 479 - i * 450 / vmax)-(10, 479 - i * 450 / vmax)
NEXT i
i3& = 6 * vmax / 9: LOCATE 11, 2: PRINT i3&;
i3& = 3 * vmax / 9: LOCATE 21, 2: PRINT i3&;
i3& = 2 * rvisgal / 12: LOCATE 29, 11: PRINT i3&;
i3& = 5 * rvisgal / 12: LOCATE 29, 30: PRINT i3&;
i3& = 10 * rvisgal / 12: LOCATE 29, 60: PRINT i3&;
i3& = rvisgal: LOCATE 29, 73: PRINT i3&;
LOCATE 12, 10: PRINT "A"
LOCATE 20, 30: PRINT "B"
LOCATE 1, 25: PRINT "GALAXY ROTATION CURVE"
LOCATE 2, 25: PRINT "Vertical speed in km/sec"
LOCATE 3, 25: PRINT "Horizontal distance in lightyear"
COLOR 7
LOCATE 5, 20: PRINT "A = mass of galaxy concentrated in one point"
LOCATE 6, 20: PRINT "B = mass of galaxy distributed in bulge and disk"
COLOR 15

CASE IS = 3
 
  COLOR 15
  scren% = 12: SCREEN scren%: ychrmax = 29
  PRINT "distance"; TAB(12); "v km/sec"; TAB(24); "v km/sec";
  PRINT TAB(36); "mass < dist"; TAB(50); "ax bulge"; TAB(61); "ax disk"; TAB(71); "hgt disk";
  PRINT TAB(12); "in center"; TAB(24); "mass = 3d"

  FOR i = 0 TO 8
    dzdiskcor = DISK(dist9(i))
    PRINT dist9(i) / lightyear; TAB(12);
    PRINT USING "#####.##"; v91(i); TAB(24); v92(i); TAB(36);
    PRINT USING "##.###^^^^^"; mass9(i);
    PRINT USING "########"; TAB(50); ax1&(i); TAB(60); ax2&(i); TAB(70); dzdiskcor * 2 / lightyear
  NEXT i
  FOR i = 9 TO 69 STEP 5
    dzdiskcor = DISK(dist9(i))
    IF dist9(i) = dsun THEN COLOR 7 ELSE COLOR 15
    PRINT dist9(i) / lightyear; TAB(12);
    PRINT USING "#####.##"; v91(i); TAB(24); v92(i); TAB(36);
    PRINT USING "##.###^^^^^"; mass9(i);
    PRINT USING "########"; TAB(50); ax1&(i); TAB(60); ax2&(i); TAB(70); dzdiskcor * 2 / lightyear
  NEXT i
  PRINT " "
  PRINT "distance Sun   = "; dsun / lightyear; "lightyear"
  PRINT "height disk    =  "; ddisk; "lightyear"
  PRINT "diameter bulge = "; 2 * rbulge; "lightyear"

  savedata = 1

CASE ELSE
PRINT "END 2"; test%
END
END SELECT
s99:

s10:
COLOR 14
test% = test% + 1
LOCATE ychrmax, 20: PRINT "NEXT DISPLAY ? ";

DO: a$ = INKEY$: LOOP UNTIL a$ <> ""
GOTO s0

nr = 75: nz = 20: dalpha = 3

s20:
DATA 75, 20, 3, 700000, 280000
DATA 9.46E+15, 1245.45, 44.63, 3.27011756617339E+39
DATA 1.892E+16, 880.67, 89.18, 1.29090725491316E+40
DATA 2.838E+16, 719.06, 133.65, 2.83965352749871E+40
DATA 3.784E+16, 622.72, 178.08, 4.88115752959631E+40
DATA 4.73E+16, 556.98, 222.49, 7.27087304571802E+40
DATA 5.676E+16, 508.45, 266.86, 9.78247347814539E+40
DATA 6.622E+16, 470.73, 311.16, 1.20129796964217E+41
DATA 7.568E+16, 440.33, 324.08, 1.28797587921703E+41
DATA 8.514E+16, 415.15, 307.95, 1.3254422058432E+41
DATA 9.46E+16, 393.84, 294.92, 1.36675331807844E+41
DATA 1.0406E+17, 375.51, 284.32, 1.41177997120313E+41
DATA 1.1352E+17, 359.53, 275.67, 1.46039024904857E+41
DATA 1.2298E+17, 345.42, 268.63, 1.51244968033897E+41
DATA 1.3244E+17, 332.86, 262.94, 1.56782135149311E+41
DATA 1.419E+17, 321.57, 258.38, 1.62636601593202E+41
DATA 1.5136E+17, 311.36, 254.8, 1.68794219991402E+41
DATA 1.6082E+17, 302.06, 252.07, 1.75240630489078E+41
DATA 1.7028E+17, 293.55, 250.07, 1.81961270634842E+41
DATA 1.7974E+17, 285.72, 248.7, 1.88941384906526E+41
DATA 1.892E+17, 278.49, 247.89, 1.96166033868172E+41
DATA 1.9866E+17, 271.78, 247.56, 2.03620102943703E+41
DATA 2.0812E+17, 265.53, 247.66, 2.11288310788151E+41
DATA 2.1758E+17, 259.69, 248.13, 2.19155217232015E+41
DATA 2.2704E+17, 254.22, 248.92, 2.27205230768161E+41
DATA 2.365E+17, 249.09, 250, 2.35422615543546E+41
DATA 2.4596E+17, 244.25, 251.32, 2.43791497809629E+41
DATA 2.5542E+17, 239.68, 252.85, 2.52295871775268E+41
DATA 2.6488E+17, 235.36, 254.56, 2.60919604794031E+41
DATA 2.7434E+17, 231.27, 256.42, 2.69646441803513E+41
DATA 2.838E+17, 227.38, 258.41, 2.78460008916816E+41
DATA 2.9326E+17, 223.69, 260.51, 2.87343816045253E+41
DATA 3.0272E+17, 220.16, 262.7, 2.96281258405353E+41
DATA 3.1218E+17, 216.8, 264.96, 3.05255616731166E+41
DATA 3.2164E+17, 213.59, 267.28, 3.14250055972962E+41
DATA 3.311E+17, 210.52, 269.63, 3.232476222133E+41
DATA 3.4056E+17, 207.57, 272.01, 3.32231237468256E+41
DATA 3.5002E+17, 204.75, 274.4, 3.41183691960772E+41
DATA 3.5948E+17, 202.03, 276.8, 3.50087633349292E+41
DATA 3.6894E+17, 199.43, 279.18, 3.58925552259958E+41
DATA 3.784E+17, 196.92, 281.55, 3.67679763293274E+41
DATA 3.8786E+17, 194.5, 283.9, 3.76332380440906E+41
DATA 3.9732E+17, 192.17, 286.21, 3.84865285531362E+41
DATA 4.0678E+17, 189.93, 288.48, 3.93260087891506E+41
DATA 4.1624E+17, 187.75, 290.7, 4.01498072812741E+41
DATA 4.257E+17, 185.66, 292.86, 4.09560135568573E+41
DATA 4.3516E+17, 183.63, 294.96, 4.17426696522407E+41
DATA 4.4462E+17, 181.66, 296.99, 4.25077591094845E+41
DATA 4.5408E+17, 179.76, 298.94, 4.32491925706199E+41
DATA 4.6354E+17, 177.92, 300.8, 4.39647886721361E+41
DATA 4.73E+17, 176.13, 302.58, 4.46522482928169E+41
DATA 4.8246E+17, 174.39, 304.25, 4.53091191381628E+41
DATA 4.9192E+17, 172.71, 305.82, 4.59327458066915E+41
DATA 5.0138E+17, 171.07, 307.25, 4.65201971624732E+41
DATA 5.1084E+17, 169.48, 308.55, 4.70681564569088E+41
DATA 5.203E+17, 167.93, 309.67, 4.75727463998519E+41
DATA 5.2976E+17, 166.43, 310.58, 4.80292310233684E+41
DATA 5.3922E+17, 164.96, 311.14, 4.84314565485626E+41
DATA 5.4868E+17, 163.53, 311.07, 4.87706391143873E+41
DATA 5.5814E+17, 162.14, 309.38, 4.90319764919571E+41
DATA 5.676E+17, 160.78, 303.83, 4.91748447872511E+41
DATA 5.7706E+17, 159.46, 294.74, 4.91748447872511E+41
DATA 5.8652E+17, 158.17, 286.2, 4.91748447872511E+41
DATA 5.9598E+17, 156.91, 279.2, 4.91748447872511E+41
DATA 6.0544E+17, 155.68, 273.34, 4.91748447872511E+41
DATA 6.149E+17, 154.47, 268.24, 4.91748447872511E+41
DATA 6.2436E+17, 153.3, 263.7, 4.91748447872511E+41
DATA 6.3382E+17, 152.15, 259.59, 4.91748447872511E+41
DATA 6.4328E+17, 151.03, 255.82, 4.91748447872511E+41
DATA 6.5274E+17, 149.93, 252.33, 4.91748447872511E+41
DATA 6.622E+17, 148.86, 249.07, 4.91748447872511E+41
DATA 0, 0, 0, 0
DATA 3022808, 134902, 6039896, 262353, 9058515, 378740, 12079064, 486742
DATA 15102325, 588338, 18126536, 684590, 21145140, 776200, 19943896, 863688
DATA 15752767, 947454, 12757005, 1027810, 10541840, 1105007, 8857501, 1179245
DATA 7546895, 1250687, 6507071, 1319465, 5668250, 1385690, 4981771, 1449453
DATA 4412855, 1510828, 3936112, 1569878, 3532653, 1626656, 3188194, 1681207
DATA 2891766, 1733571, 2634837, 1783780, 2410690, 1831864, 2213974, 1877850
DATA 2040391, 1921762, 1886450, 1963621, 1749295, 2003449, 1626572, 2041264
DATA 1516325, 2077085, 1416919, 2110929, 1326977, 2142813, 1245334, 2172753
DATA 1171001, 2200764, 1103130, 2226860, 1040993, 2251057, 983962, 2273366
DATA 931493, 2293800, 883111, 2312372, 838403, 2329090, 797006, 2343966
DATA 758601, 2357007, 722907, 2368220, 689674, 2377609, 658681, 2385176
DATA 629731, 2390922, 602649, 2394841, 577277, 2396926, 553474, 2397160
DATA 531113, 2395518, 510081, 2391963, 490274, 2386438, 471598, 2378855
DATA 453970, 2369077, 437312, 2356876, 421554, 2341856, 406633, 2323243
DATA 392490, 2299271, 379072, 2265029, 366331, 2204879, 354222, 2084259
DATA 342703, 1914436, 331737, 1762115, 321289, 1639800, 311327, 1538833
DATA 301822, 1452602, 292745, 1377156, 284071, 1310031, 275778, 1249578
DATA 267842, 1194629, 260244, 1144318
DATA 0, 0

FUNCTION Densscor (r, nr, n)
  a = (n - 1) / (nr / 2)
  b = 2 - n
  Densscor = a * r + b
END FUNCTION

FUNCTION DISK (r)
'                                                           DISK
' dzdisk = height of disk / 2
delr = r - dbulge
h1 = shape * dzdisk              ' bottom heigt
h2 = (1 - shape) * dzdisk        ' top height
distdisk = rtotgal - dbulge      ' distance diskIF r > rvisgal THEN
IF r > rvisgal THEN
  rcor = 0
ELSE
  IF r < dbulge THEN
     rcor = dzdisk
  ELSE
    SELECT CASE disktype
    CASE 1
      rcor = h1 + h2 * (distdisk - delr) / distdisk            ' lineair
    CASE 2
      rcor = h1 + h2 * COS(delr / distdisk * pi / 2)           '  cosinus  0 - 90 degrees
    CASE 3
      rcor = h1 + h2 + h2 * COS(pi / 2 + delr / distdisk * pi / 2)  ' cosinus   90 - 180 degrees
    CASE 4
      rcor = h1 + h2 / 2 + h2 / 2 * COS(delr / distdisk * pi)     ' cosinus  0 - 180 degrees
    END SELECT
  END IF
END IF
DISK = rcor
END FUNCTION

SUB PRINTTAB (posx, num)
IF num >= 10000000 THEN l = 10: GOTO p1
IF num >= 1000000 THEN l = 9: GOTO p1
IF num >= 100000 THEN l = 8: GOTO p1
IF num >= 10000 THEN l = 7: GOTO p1
IF num >= -10000 THEN l = 6: GOTO p1
IF num >= -100000 THEN l = 7: GOTO p1
IF num >= -1000000 THEN l = 8: GOTO p1
l = 9
p1: PRINT TAB(posx - l); num;

END SUB

SUB READDATA
'                                                                    READDATA
DIM mdb(10), sdb(10), fdb(10), rdb(10)
DIM zm(7, 7), z(7), zz(7), st(14)           ' GET COEF parameters
DIM zvenus(7), zall(7)                      ' GET COEF results
DIM ax1(70), ax2(70)
Data1$ = "DATA "
filenm$ = "C:\NOW\FIG\sunrad.db  "
ioerr% = 0
    OPEN filenm$ FOR INPUT AS #1
    IF ioerr% > 0 THEN EXIT SUB
    INPUT #1, nnr, nnz, ndalpa, radsun, eradsun
    IF ioerr% > 0 THEN EXIT SUB
    FOR i = 0 TO 10
      INPUT #1, rdb(i), sdb(i), mdb(i), fdb(i)
    NEXT i
    FOR i = 0 TO 7: INPUT #1, zvenus(i): NEXT i
    FOR i = 0 TO 7: INPUT #1, zall(i): NEXT i
    FOR i = 0 TO 70: INPUT #1, dist9(i), v91(i), v92(i), mass9(i): NEXT i
    FOR i = 0 TO 70: INPUT #1, ax1&(i), ax2&(i): NEXT i
    CLOSE

ioerr% = 0
filenm$ = "C:\INTERNET\NETSCAPE\HTMLED\sunrad.bas  "
' filenm$ = "C:\NICK\HTMLED\sunrad.bas  "
PRINT filenm$

    OPEN filenm$ FOR OUTPUT AS #1
    IF ioerr% > 0 THEN EXIT SUB
    WRITE #1, Data1$, nnr, nnz, ndalpa, radsun, eradsun
    IF ioerr% > 0 THEN EXIT SUB
    FOR i = 0 TO 70:
      vst1 = INT(v91(i) * 100) / 100
      vst2 = INT(v92(i) * 100) / 100
      WRITE #1, Data1$, dist9(i), vst1, vst2, mass9(i)
    NEXT i
    FOR i = 0 TO 67 STEP 4
      WRITE #1, Data1$, ax1&(i), ax2&(i), ax1&(i + 1), ax2&(i + 1), ax1&(i + 2), ax2&(i + 2), ax1&(i + 3), ax2&(i + 3)
    NEXT i
    i = 68: WRITE #1, Data1$, ax1&(i), ax2&(i), ax1&(i + 1), ax2&(i + 1)
    i = 70: WRITE #1, Data1$, ax1&(i), ax2&(i)
    CLOSE

END SUB





Back to my home page Contents of This Document