================================
Cooling: (last updated: 3/18/96)
================================

Cooling is a sum of 

1/recombination cooling
2/free-free cooling
3/collisional ionization cooling
4/collisional excitation cooling of lines

You should skip 3/ whereas 2/ should be taken from Osterbrock.
Some data are not explicitly tabulated in Osterbrock, and you have to 
check the References on page 71 (etc.) in Osterbrock. For 1/ you need
only to include H and He, and that is calculated in the hherec.f.

-----------------------------------------------------------------------
4/Collisional excitation cooling of lines

Collisional excitation cooling of lines (4/) has been compiled below.
I advise you to write the cooling function so that the total cooling
per unit volume (cm-3) is

Cooling rate = Ne * Nions * Cooling function

Nions is the density of all atoms and ions, i.e., Nions = N(H) + N(He) + etc.

Many of the lines I have compiled in the fortran file forbid.f. It includes
most of the important forbidden and semi-forbidden lines. It is divided into
a few subroutines, and I choose one of them to describe how to use them.

As an exammple I choose the routine BEFORB(....)
(The naming ``BEFORB" comes from ``Line cooling from a Be-like ion".

The first entry TE = the gas temperature in K.
I = an identifier for what ion is considered. I = 1 means C III.
DENE = the electron density in cm-3
ABUND = the number density of ions with identifier I, divided by Nions.
COLTOTI = The column density of ion I from the inside of shell 1, to
	  halfway of the current shell.
COLTOT = The column density of ion I from the inside of shell 1, to
	 the outside of the outermost shell.
F31 = the emissivity in erg s-1 cm3 sr-1 for the transition from level
      3 to level 1. In the case of C III this is the 1909 Aangstroem
      line (see Osterbrock page 136.) F51 is the important 977 Aangstroem
      line. F6T43 is the sum of lines from level 6 to levels 4 and 3.
COOL = is the cooling function produced by all C III transitions in units
       of erg s-1 cm3. Note the 4*pi difference compared to the line
       emissivities. To get the cooling rate due to C III one has to
       multiply COOL by Ne * Nions
       (ABUND is in this case N(C III)/Nions).

Many of the ions in forbid.f will never be used since you are only
studying C, N and O.

C*********************************************************************
      SUBROUTINE BEFORB(TE,I,DENE,ABUND,COLTOTI,COLTOT,F31,F41,F51,
     &F6T43,F65,COOL)
C*********************************************************************
C  Forbidden lines (Be I-like). Enumeration of the ions are: (= I)
C
C  1 = C III  2 = Mg I  3 = Al II  4 = Si III
C
C  The atom is treated as a 6-level atom.
C  (Returned to RAD when E21/Tev > 20).
C
C ..........
C
C*********************************************************************
      implicit real*8(a-h,o-z)
C

etc. etc.
etc. etc.

To call on SUBROUTINE BEFORB for, e.g., C III you may write:

C
C     C III 977 A, 1907-09 A, 1070 A, 2297 A
C
      Z=AB(3)*XC(3)
      call beforb(te,1,edens,z,columi(3,3),colum(3,3),c1909,c1907,
     &c977,c1070,c2297,coolc3)

where AB(3) is the relative abundance of C compared to H + He + C + N + O
and XC(3) is fraction of carbon in C III. (XC(1) + XC(2) + ... + XC(7) = 1)
for the shell you are studying.
---------------------------------------------------------------------------
Lines not included in forbid.f are:

H I - lines
He I - lines
He II - lines
C II 1037, C II 1335, C IV 1549
O V 1218, O VI 1034
N II 1085, N III 991, N IV 1486, N V 1240.

You may skip collisional excitation of the He-lines. Use Osterbrock to
estimate collisional excitation of H I. (Check Chapter 11.)

For the other lines you may use 

      SUBROUTINE RLOSS
     &(WL,G1,G2,A,OM,EDENS,Z,TE,AMASS,COLTOTI,COLTOT,RL)

which is also found in forbid.f.

WL = is the wavelength in Aangstroem
G1 = statistical weight of lower level
G2 = statistical weight of upper level
A = transition probability of the transition
OM = effective collisional strength
EDENS = the electron density in cm-3
Z = the number density of ions with identifier I divided by Nions.
COLTOTI = The column density of ion I from the inside of shell 1, to
	  halfway of the current shell.
COLTOT = The column density of ion I from the inside of shell 1, to
	 the outside of the outermost shell.
RL = is the cooling function produced by all C III transitions in units
       of erg s-1 cm3. Note the 4*pi difference compared to the line
       emissivities. To get the cooling rate due to C III one has to
       multiply COOL by Ne * Nions
       (ABUND is in this case N(C III)/Nions).

When calling on RLOSS for the different lines you may write:

      T4=TE/1.D4
C
C     C II 1037
C
      Z=AB(3)*XA(3,2)
      OM=2.6D0*T4**0.23
      CALL RLOSS(1036.8D0,6.D0,2.D0,1.1d9,OM,edens,Z,TE,12.d0,
     &columi(3,2),colum(3,2),cc1037)
C
C     C II 1335
C
      Z=AB(3)*XA(3,2)
      OM=5.38D0*T4**0.153
      CALL RLOSS(1335.3D0,6.D0,10.D0,6.D8,OM,edens,Z,TE,12.d0,
     &columi(3,2),colum(3,2),cc1335)
C
C     C IV 1549
C
      Z=AB(3)*XA(3,4)
      OM=8.26D0*T4**0.06
      CALL RLOSS(1549.D0,2.D0,6.D0,2.65D8,OM,edens,Z,TE,12.d0,
     &columi(3,4),colum(3,4),cc1549)
C
C     N II  1085 
C
      Z=AB(4)*XA(4,2)
      OM=7.3D0*T4**0.061
      CALL RLOSS(1085.1D0,9.D0,15.D0,5.7D8,OM,edens,Z,TE,14.d0,
     &columi(4,2),colum(4,2),cc1085)
C
C     N III  991 
C
      Z=AB(4)*XA(4,3)
      OM=4.92D0*T4**0.061
      CALL RLOSS(991.D0,6.D0,10.D0,5.1D8,OM,edens,Z,TE,14.d0,
     &columi(4,3),colum(4,3),cc991)
C
C     N IV 1486
C
      Z=AB(4)*XA(4,4)
      telog=dlog10(te)
      OM=0.14035d0+0.51339d0*telog-0.080565*telog**2
      CALL RLOSS(1486.5D0,1.D0,9.D0,1.92D2,OM,edens,Z,TE,14.d0,
     &columi(4,4),colum(4,4),cc1486)
C
C     N V 1240
C
      Z=AB(4)*XA(4,5)
      OM=6.76D0*T4**0.025
      CALL RLOSS(1240.1D0,2.D0,6.D0,4.06D8,OM,edens,Z,TE,14.d0,
     &columi(4,5),colum(4,5),cc1240)
C
C     O V 1218     
C
      Z=AB(5)*XA(5,5)
      OM=0.718D0*T4**(-0.168)
      CALL RLOSS(1218.3D0,1.D0,9.D0,7.50D2,OM,edens,Z,TE,16.d0,
     &columi(5,5),colum(5,5),cc1218)
C
C     O VI 1034    
C
      Z=AB(5)*XA(5,6)
      OM=5.05D0*t4**0.01
      CALL RLOSS(1033.8D0,2.D0,6.D0,4.07D8,OM,edens,Z,TE,16.d0,
     &columi(5,6),colum(5,6),cc1034)


Note that to get the line emissivity (of, e.g., the O VI 1034 line) one
has to be divide the cooling (e.g., cc1034) by 4*pi.

The reason why the column densities are included is because escape probabi-
lities are included in the transition rates.

When you start your calculations, you don't know the final column densities.
Start with the innermost shell and work your way outwards. You will then
always have updated column densities out to your current shell, but not
exterior to this shell. Thus, you are always making an error calculating the
escape probability. To get rid off this, you must redo your first model result
using the column densities of the previous iteration. This converges quickly.
