  np  = qt/q.
    q  : port volume flux
    qt : total volume flux
$
  spc = espc/sin(pi/180*hang).
    hang : horizontal angle between diffuser pipe and current
    espc : effective spacing after spc is reduced by sin(hang) factor
$
  conc= dia*dia/rdia/rdia.
    dia  : plume diameter
    rdia : physical port diameter
$
  hang= 180/pi*arctan(espc/sqrt(spc*spc-espc*espc)).
    espc : effective spacing after spc is reduced by sin(hang) factor
    spc  : port spacing (accounting for ports on both sides)
    sqrt = square root of;
$
  vang= arctan(v/u)*180/pi.
        If u < 0 then if v > 0 then vang = vang+180 else vang = vang-180.
      = 180/pi*arcsin(v/vel) (not solved, vang is quasi-defined);
      = 180/pi*arccos(u/vel) (not solved, vang is quasi-defined);
    u   : horizontal plume speed
    v   : vertical plume speed
    vel : plume vena contracta velocity
$
  s   = sigmasal(t,den).
    den : plume density
    t   : plume temperature
    sigmasal: Newton approximation using the SigmaT function
    (if no solution to sigmasal then s is quasi-defined).
$
  ho  = no connection to other variables, used for determining the
  flow category.
$
  pdep= dia*(dena-da1) / (SP*(dena-den))
      = (bot*(dena-dat)+top*(dab-dena))/(dab-dat)
      = (bot*(uw-uat)+top*(uab-uw))/(uab-uat)
      = g/N/abs(N)*(dena-da1)/(dena+1000)
      = 0.1*press
    bot, top : bottom and top bracketing depth
    da1      : surface (level 1) density
    dab, dat : bottom and top bracketing ambient densities
    den      : plume density
    dena     : ambient density at plume depth
    dia      : plume diameter
    g        : acceleration of gravity
    N        : Brunt-Vaisala frequency
    SP       : the stratification number
    uab, uat : bottom and top bracketing ambient current speeds
    uw       : current speed at plume depth
    den, dena, etc. expressed in sigma-t units
    press    : pressure at port depth
    abs = absolute value of;
$
  dia = rdia*sqrt(conc)
      = vel*vel*(den+1000)/abs(Fr*Fr*(dena-den)*g)
      = (SP*(dena-den)*pdep) / (dena-da1)
      = sqrt(4.0/pi*q/vel)
      = lm/( Fr*(pi/4)^1/4 )
      = lmx/( sqrt(pi/4)*ak )
      = lbs^2 * N^3/2 / sqrt(pi/4 * gp * vel)
      = fnc(Fr,gp,u,v) then dia is quasi-defined
      = fnc(gp,vel,lbs,N) then dia is quasi-defined
    ak   : effluent to current velocity ratio
    conc : vena contracta contraction coefficient
    da1  : surface (level 1) density
    dena : ambient density at plume depth
    den  : plume density
    Fr   : densimetric Froude number
    g    : acceleration of gravity
    gp   : reduced gravity
    lbs  : plume stratification length
    lm   : jet/plume transition length
    N    : Brunt-Vaisala frequency
    q    : port volume flux
    rdia : physical port diameter
    u    : horizontal plume speed
    v    : vertical plume speed
    vel  : plume vena contracta velocity
    lbs  : plume stratification length
    lmx  : jet/crossflow length
  (den, dena, etc. expressed in sigma-t units); abs = absolute value of;
  fnc = function of; sqrt = square root of;
$
  espc= spc*sin(hang*pi/180)
      = gp*q/bflux.
    bflux: port buoyancy flux
    gp   : reduced gravity
    hang : horizontal angle between diffuser pipe and current
    q    : port volume flux
    spc  : port spacing (accounting for ports on both sides)
$
  u   = cos(vang*pi/180)/(sin(vang*pi/180)*v
      = vel*cos(vang*pi/180)
      = sqrt(abs(Fr^2*gp*dia - v^2));  sign chosen
      = sqrt(vel*vel-v*v);  sign chosen.
    dia  : vena contracta diameter
    Fr   : densimetric Froude number
    gp   : reduced gravity
    v    : vertical plume speed
    vang : vertical angle of the effluent discharge
    vel  : plume vena contracta velocity
    abs = absolute value of; sqrt = square root of;
$
  v   = sin(vang*pi/180)*u/cos(vang*pi/180).
      = vel*sin(vang*pi/180)
      = sqrt(abs(Fr^2*gp*dia - u^2));  sign chosen
      = sqrt(vel*vel-u*u);  sign chosen.
    dia  : vena contracta diameter
    Fr   : densimetric Froude number
    gp   : reduced gravity
    u    : horizontal plume speed
    vang : vertical angle of the effluent discharge
    vel  : plume vena contracta velocity
    abs = absolute value of; sqrt = square root of;
$
  t   = sigmatt(s,den).
    den     : plume density
    s       : plume salinity
    sigmatt : Newton approximation using the SigmaT function
    (if no solution to sigmatt then t is quasi-defined).
$
  Fr  = vel/sqrt(abs((dena-den)/(den+1000)*g*dia)
        If argument < 0 then  Fr = -Fr
      = sqrt(vel^2/gp * sqrt(pi*vel/(4*q)) )
      = lm / (dia * (pi/4)^1/4 )
      = ( (abs(ltt))^(3/2) )/ ( sqrt( pi/4 * ak*dia )/dia )
      = fnc(u,v,gp,dia) then Fr is quasi-defined.
    ak   : effluent to current velocity ratio
    den  : plume density
    dena : ambient density at plume depth
    dia  : plume diameter
    g    : acceleration of gravity
    gp   : reduced gravity
    ltt  : puff/thermal transition length
    q    : port volume flow
    lm   : jet/plume transition length
    u    : horizontal plume speed
    v    : vertical plume speed
    vel  : plume vena contracta velocity
    den, dena, etc. expressed in sigma-t units
    abs = absolute value of;  fnc = function of; sqrt = square root of;
$
  FRob= uw^3/bflux
    bflux : port buoyancy flux
    uw    : current speed at plume depth
$
  ak  = vel/uw
      = lmx/( sqrt(pi/4)*dia )
      = ltt*ltt*ltt*(4/pi) / (dia*dia*Fr)
    dia  : effluent vena contracta diameter
    Fr   : densimetric Froude number
    lmx  : jet crossflow length
    ltt  : puff/thermal transition length
    uw   : current speed at plume depth
    vel  : plume vena contracta velocity
    abs = absolute value of; sqrt = square root of;
$
  SP  = ((dena-da1)*dia) / ((dena-den)*pdep).
    da1  : surface (level 1) density
    den  : plume density
    dena : ambient density at plume depth
    dia  : plume diameter
    pdep : plume depth
$
  N   = sqrt(g*abs(dena-da1)/pdep/(dena+1000).  If da1 > dena then N = -N.
      = (gp*vel*pi/4)^1/3 * dia^2/3 / lbs^4/3
      = fnc(dia,gp,vel,lbs) then N is quasi-defined.
    da1  : surface (level 1) density
    dena : ambient density at plume depth
    dia  : vena contracta diameter
    g    : acceleration of gravity
    gp   : reduced gravity
    lbs  : plume stratification length
    pdep : plume depth
    vel  : vena contracta velocity
    den, dena, etc. expressed in sigma-t units; abs = absolute value of;
    fnc = function of; sqrt = square root of;
$
  q   = qt/np
      = pi*0.25*dia*dia*vel
      = pi/4*(vel^5)/((Fr^4)*gp*gp)
      = bflux*espc/gp
    bflux: port buoyancy flux
    dia  : plume diameter
    espc : effective spacing after spc is reduced by sin(hang) factor
    Fr   : densimetric Froude number
    gp   : reduced gravity
    np   : number of ports
    qt   : total volume flux
    vel  : plume vena contracta velocity
$
  qt  = q*np.
    np : number of ports
    q  : port volume flux
$
  gp  = (vel*vel) / ( abs(Fr)*Fr * sqrt((pi/4)*vel/q) )
      = (dena-den)/(den+1000)*g
      = N^3 * lbs^4 / (vel*dia*dia*pi/4)
      = fnc(Fr,u,v,dia) then gp is quasi-defined
      = fnc(dia,vel,lbs,N) then gp is quasi-defined
      = bflux*espc/q
    bflux: port buoyancy flux
    den  : plume density
    dena : ambient density at plume depth
    dia  : vena contracta diameter
    espc : effective spacing after spc is reduced by sin(hang) factor
    Fr   : densimetric Froude number
    g    : acceleration of gravity
    lbs  : plume stratification length
    N    : Brunt-Vaisala frequency
    q    : port volume flux
    u    : horizontal plume speed
    v    : vertical plume speed
    vel  : vena contracta velocity
    (den, dena, etc. expressed in sigma-t units); abs = absolute value of;
    fnc = function of; sqrt = square root of;
$
  bflux= uw^3/FRob
       = gp*q/espc
    espc : effective spacing after spc is reduced by sin(hang) factor
    FRob : Roberts' Froude number
    gp   : reduced gravity
    q    : port volume flux
    uw   : current speed
$
  rdia= dia/sqrt(conc).
    conc : vena contracta contraction coefficient
    dia  : plume diameter
    sqrt = square root of;
$
  den = (dena+1000)/(1.0 +vel*vel/(g*dia*abs(Fr)*Fr) - 1000
        { note single use of abs to retain sign }
      = (dena+1000)/(1.0+gp/g)-1000
      = dena - ((dena-da1)*dia) / (pdep*SP)
      = sigmat(s,t) (if no solution to sigmat then den is quasi-defined).
    da1  : surface (level 1) density
    dena : ambient density at plume depth
    dia  : plume diameter
    Fr   : densimetric Froude number
    g    : acceleration of gravity
    gp   : reduced acceleration of gravity
    pdep : plume depth
    t    : plume temperature
    vel  : plume vena contracta velocity
    s    : plume salinity
    SP   : the stratification number
    den, dena, etc. expressed in sigma-t units; abs = absolute value of;
$
  vel = 4.0/pi*q/(dia*dia)
      = sqrt(u*u+v*v)
      = (4/pi*(gp^2)*(Fr^4)*q)^0.2
      = abs(Fr)*sqrt((dena-den)/(den+1000)*g*dia)
      = ak*uw
      = v/sin(vang*pi/180)
      = u/cos(vang*pi/180)
      = N^3 * lbs^4 / (gp*dia*dia/(pi/4))
      = fnc(gp,dia,lbs,N) then vel is quasi-defined.
    ak   : ratio of efflux to ambient velocities
    den  : plume density
    dena : ambient density at plume depth
    dia  : plume diameter
    Fr   : densimetric Froude number
    g    : acceleration of gravity
    gp   : reduced gravity
    lbs  : plume stratification length
    N    : Brunt-Vaisala frequency
    q    : port volume flux
    u    : horizontal plume speed
    uw   : current speed at plume depth
    v    : vertical plume speed
    vang : vertical angle of the effluent discharge
  den, dena, etc. expressed in sigma-t units; abs = absolute value of;
  fnc = function of; sqrt = square root of;
$
  dena= (pdep*(den+1000) -SP)*(da1+1000)*dia)/(pdep-dia)*SP) - 1000
      = (den+1000)*(1.0 +vel*vel/((g*dia*Fr*abs(Fr)) - 1000
      = (dat*(bot-pdep)+dab*(pdep-top))/(bot-top)
      = gp/g*(den+1000)+den
      = (da1+1000)*g/(g-pdep*N*abs(N)) - 1000
    bot, top : bottom and top bracketing depth
    da1      : surface (level 1) density
    dab, dat : bottom and top bracketing ambient densities
    den      : plume density
    dia      : plume diameter
    Fr       : densimetric Froude number
    g        : acceleration of gravity
    gp       : reduced acceleration of gravity
    N        : Brunt-Vaisala frequency
    pdep     : plume depth
    vel      : plume vena contracta velocity
    den, dena, etc. expressed in sigma-t units; abs = absolute value of;
$
  uw  = (pdep-top)/(bot-top)*(uab-uat) +uat
      = vel/ak
      = (abs(bflux*Frob))^1/3.
    ak       : ratio of efflux to ambient velocities
    bflux    : port buoyancy flux
    bot, top : bottom and top bracketing depth
    Frob     : Roberts' Froude number
    pdep     : plume depth
    uab, uat : bottom and top bracketing ambient current speeds
    vel      : plume vena contracta velocity
    abs = absolute value of;
$
  ltt = (pi/4 * ak)^(1/3) * Fr^(2/3) * dia
      = lmx^4/3 / lb^1/3
    ak       : effluent to current velocity ratio
    dia      : effluent vena-contracta diameter
    Fr       : densimetric Froude number
    lb       : plume crossflow length
    lmx      : jet crossflow length
$
  lm  = Fr*dia*(pi/4)^1/4
      = lmx^3/2 / lb^1/2
      = lms^3 / lbs^2
    dia      : vena contracta diameter
    Fr       : densimetric Froude number
    lb       : plume crossflow length
    lbs      : plume stratification length
    lms      : jet stratification length
$
  lmx = sqrt(pi/4)*dia*ak
      = (lm * lb^1/2)^2/3
      = (ltt * lb^1/3)^3/4
    ak       : effluent to current velocity ratio
    dia      : vena contracta diameter
    lb       : plume crossflow length
    lm       : jet/plume transition length
    ltt      : puff/thermal transition length
    vel      : effluent velocity
    uw       : ambient current at port depth
    sqrt = square root of;
$
  lb  = lmx^3 / lm^2
      = ( lmx^4/3 / ltt )^3
    lm       : jet/plume transition length
    lmx      : jet crossflow length
    ltt      : puff/thermal transition length
$
  lms = sqrt( sqrt(pi/4) * dia * vel / |N| )
      = (lm lbs^2)^1/3
    dia      : diameter
    lbs      : plume/stratification length
    lm       : jet/plume transition length
    vel      : effluent velocity
    N        : Brunt-Vaisala frequency
    sqrt = square root of;
$
  lbs = ( (pi/4 * vel*gp)^1/4 * sqrt(dia) )/(N^3/4)
      = sqrt( lms^3 / lm )
    dia      : vena contracta diameter
    gp       : effluent reduced gravity
    lm       : jet/plume transition length
    lms      : jet stratification length
    N        : Brunt-Vaisala frequency
    vel      : vena contracta velocity
    sqrt = square root of;
$
  d1..d9= (pdep*(dab-dat)+bot*(dat-dena))/(dab-dena)
        = (top*(dena-dab)+pdep*(dab-dat))/(dena-dat)
        = (top*(uw-uab)+pdep*(uab-uat))/(uw-uat)
        = (pdep*(uab-uat)+bot*(uat-uw))/(uab-uw).
    bot, top : bottom and top bracketing depth
    dab, dat : bottom and top bracketing ambient densities
    dena     : ambient density at plume depth
    pdep     : plume depth
    uab, uat : bottom and top bracketing ambient current speeds
    uw       : current speed at plume depth
$
  sa1..sax=
        sigmasal(density at depth, temperature at depth).
    sigmasal : Newton approximation using the SigmaT function
$
  ta1..tax=
        sigmatt(density at depth, salinity at depth).
        if no solution to sigmat then ta1..tax is quasi-defined
    sigmatt : Newton approximation using the SigmaT function
$
  ua1..ua9 = (uab*(pdep-top))-uw*(bot-top))/(pdep-bot)
           = (uw*(bot-top)+uat*(pdep-bot))/(pdep-top).
    bot, top : bottom and top bracketing depth
    pdep     : plume depth
    uab, uat : bottom and top bracketing ambient current speeds
    uw       : current speed at plume depth
$
  da1 = dena -pdep*(dena-den) / (SP*dia)
      = sigmat(sa1,ta1), if no solution to sigmat then da1 is quasi-defined
      = (dab*(top-pdep)+dena*(bot-top))/(bot-pdep)
      = dena -N*abs(N)*pdep/g*(dena+1000).
    bot, top : bottom and top bracketing depth
    dab, dat : bottom and top bracketing ambient densities
    den      : plume density
    dena     : ambient density at plume depth
    dia      : plume diameter
    g        : acceleration of gravity
    N        : Brunt-Vaisala frequency
    pdep     : plume depth
    sa1      : surface (level 1) salinity
    uab, uat : bottom and top bracketing ambient current speeds
    den, dena, etc. expressed in sigma-t units; abs = absolute value of;
$
  da2..da9 = sigmat(salinity at depth, temperature at depth)
             if no solution to sigmat then da2..da9 is quasi-defined
           = (dab*(top-pdep)+dena*(bot-top))/(bot-pdep)
           = (dena*(bot-top)+dat*(pdep-bot))/(pdep-top).
    bot, top : bottom and top bracketing depth
    dab, dat : bottom and top bracketing ambient densities
    dena     : ambient density at plume depth
    pdep     : plume depth
$
  dax = sigmat(sax,tax).
        if no solution to sigmat then dax is quasi-defined
    sax : level 10 (X) salinity
    tax : level 10 (X) temperature
$

