TEXT(Buoyancy Settings 
    78 start of ...buoy
  This macro facilitates the setting of buoyancy-derived sources
  of momentum.
 
  BUOYA, BUOYB and BUOYC are the gravitational accelerations in the
  cartesian x-, y- and z-directions.
 
PATCH(BUOYANCY,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
GRAVACC
 
  Determine which are the affected velocities
INTEGER(IVEL)
label again
IF(GRAVDIR.EQ.1) THEN
+ IVEL=5
+ if(.not.case4) then
+   BUOYB=GRAVACC
+ endif
+ MESG(gravdir=1; gravity acts in positive y direction
ELSE
+ IF(GRAVDIR.EQ.2) THEN
+   IVEL=5
+   if(.not.case4) then
+     BUOYB=-GRAVACC
+   endif
+   MESG( gravity acts in negative y direction
+ ELSE
+   IF(GRAVDIR.EQ.3) THEN
+     IVEL=3
+     if(.not.case4) then
+       BUOYA=GRAVACC
+     endif
+     MESG( gravity acts in positive x direction
+   ELSE
+     IF(GRAVDIR.EQ.4) THEN
+       IVEL=3
+       if(.not.case4) then
+         BUOYA=-GRAVACC
+       endif
+       MESG( gravity acts in negative x direction
+     ELSE
+       IF(GRAVDIR.EQ.5) THEN
+         IVEL=7
+         if(.not.case4) then
+           BUOYC=GRAVACC
+         endif
+         MESG( gravity acts in positive z direction
+       ELSE
+         IF(GRAVDIR.EQ.6) THEN
+           IVEL=7
+           IF(.NOT.CASE4) THEN
+              BUOYC=-GRAVACC
+           ENDIF
+           MESG( gravity acts in negative z direction
+         ELSE
+           MESG(Please specify gravity direction, gravdir (1 to 6)
+           READVDU(GRAVDIR,INT,0)
+           IF(:GRAVDIR:.EQ.0) THEN
+             GO TO AGAIN
+           ENDIF
+         ENDIF
+       ENDIF
+     ENDIF
+   ENDIF
+ ENDIF
ENDIF
GRAVDIR
 
COVAL(BUOYANCY,IVEL,FIXFLU,:BUOYOPT:)
IF(.NOT.CARTES) THEN
+ IF(:GRAVDIR:.LT.5) THEN
+   COVAL(BUOYANCY,:IVEL-2:,FIXFLU,:BUOYOPT:)
+ ENDIF
ENDIF
IF(.NOT.ONEPHS) THEN
+ COVAL(BUOYANCY,:IVEL:+1,FIXFLU,:BUOYOPT:)
+ IF(.NOT.CARTES) THEN
+   IF(:GRAVDIR:.LT.5) THEN
+     COVAL(BUOYANCY,:IVEL:-2,FIXFLU,:BUOYOPT:)
+   ENDIF
+ ENDIF
ENDIF
IF(BUOYOPT.EQ.GRND1) THEN
+ mesg(buoyancy option is DENSITY
+ GOTO END
ENDIF
               determine BOUYD,E for densdiff and bouss
IF(BUOYOPT.EQ.GRND2) THEN
+ mesg(buoyancy option is DENSDIFF
               For DENSDIFF, BUOYD is the reference density.
+ BUOYD=RHOREF
+ MESG(The reference density is :buoyd:
ELSE
+ IF(BUOYOPT.EQ.GRND4) THEN
+   mesg(buoyancy option is EXTBOUSS
   For EXTBOUSS, ie extended Boussinesq, set constants for the
   formula: force/mass = bouya + buoyb*variable_ibuoyb
                               + buoyc*variable_ibuoyc
+   buoya
+   buoyb
+   buoyc
+   ibuoyb
+   ibuoyc
+   goto end
+ ELSE
+   mesg(buoyancy option is BOUSS
  For BOUSS, DVO1DT is the volumetric expansion coefficient
    & BUOYE is the reference temperature (or enthalpy for h)
+   DVO1DT
+ ENDIF
 
+ IF(:ISLN(14)/6*6:.EQ.ISLN(14)) THEN
+   MESG(:NAME(14): is the solved-for variable
+   MESG(reference value is = :href:  OK? If not, insert other..
+   READVDU(HREF,REAL,HREF)
+   BUOYE=HREF
+ ELSE
+   IF(:ISLN(TEM1)/6*6:.EQ.ISLN(TEM1)) THEN
+     MESG(TEM1 is the solved-for variable
+     MESG(reference value is = :tref:  OK? If not, insert other..
+     READVDU(TREF,REAL,TREF)
+     BUOYE=TREF
+   ENDIF
+ ENDIF
ENDIF
LABEL END
    78 end of .....buoy