   Input file: ../examples/ex12a
  Output file: ex12a.out
Database file: ../database/phreeqc.dat

------------------
Reading data base.
------------------

	SOLUTION_MASTER_SPECIES
	SOLUTION_SPECIES
	PHASES
	GAS_BINARY_PARAMETERS
	EXCHANGE_MASTER_SPECIES
	EXCHANGE_SPECIES
	SURFACE_MASTER_SPECIES
	SURFACE_SPECIES
	MEAN_GAMMAS
	RATES
	END
------------------------------------
Reading input data for simulation 1.
------------------------------------

	TITLE Example 12a.--Advective and diffusive transport of heat and solutes.
	      Constant boundary condition at one end, closed at other.
	      The problem is designed so that temperature should equal Na-conc 
	      (in mmol/kgw) after diffusion. Compares with analytical solution
	      for 20-cell and 60-cell models.
	EXCHANGE_SPECIES
	  Na+ + X- = NaX
	    log_k       0.0
	    gamma      4.0     0.075
	  H+ + X- = HX
	    log_k       -99.
	    gamma      9.0     0.0
	  K+ + X- = KX
	    log_k       0.0
	    gamma       3.5     0.015
	SOLUTION 0   Fixed temp 24C, and NaCl conc (first type boundary cond) at inlet
	    units  mol/kgw
	    temp 24
	    pH  7.0
	    pe  12.0   O2(g) -0.67
	    Na  24.e-3
	    Cl  24.e-3
	SOLUTION 1-19   24.0 mM KNO3
	    units mol/kgw
	    temp  0                 # Incoming solution 0C
	    pH    7.0
	    pe   12.0   O2(g) -0.67
	    K    24.e-3
	    N(5) 24.e-3
	EXCHANGE 1-19
	    KX    0.048
	SOLUTION 20  Same as soln 0 in cell 20 at closed column end (second type boundary cond)
	    units  mol/kgw
	    temp 24
	    pH  7.0
	    pe  12.0   O2(g) -0.67
	    Na  24.e-3
	    Cl  24.e-3
	EXCHANGE 20
	    NaX    0.048
	PRINT
	   reset      false
	   status     false
	COPY solution 20 58-60 # for 60-cell model   
	COPY exchange 20 58-60 # for 60-cell model   
	END
	TRANSPORT   # Diffuse 24C, NaCl solution from column ends
	   cells   20
	   shifts  1
	   flow_direction diffusion
	   boundary_conditions  constant  closed
	   lengths           20*1.0
	   thermal_diffusion 3.0        # Heat is retarded equal to Na
	   dispersivities    20*0.0        # No dispersion
	   diffusion_coefficient 0.3e-9 # m^2/s
	   time_step         1.0e+10    # 317 years, 19 substeps will be used
	SELECTED_OUTPUT
	   file           ex12a.sel
	   high_precision true
	   reset          false
	   distance       true
	   temperature    true
	USER_PUNCH
	  heading Na_mmol K_mmol Cl_mmol error_Cl  error_Na
	  10  PUNCH TOT("Na")*1000, TOT("K")*1000, TOT("Cl")*1000
	  20  x = DIST
	  30  if (x > 8.5 OR SIM_TIME <= 0) THEN END
	  40  IF (ABS(x MOD 0.5) > 1e-3) OR (TC <= 0) THEN END
	  50  DATA 0.254829592, -0.284496736, 1.421413741, -1.453152027, 1.061405429, 0.3275911
	  60  READ a1, a2, a3, a4, a5, a6
	  70      REM  calculate error in Cl
	  80  z = x / (2*SQRT(3e-10 * SIM_TIME / 1.0))
	  90  GOSUB 2000 # erfc(z)...
	  100 erfc_Cl = erfc
	  110     REM  calculate error in Na, 3 times retarded
	  120 z = z * SQRT(3.0)
	  130 GOSUB 2000 # erfc(z)...
	  140 erfc_Na = erfc
	  150     REM punch results
	  160 error_Cl = 0.024 * erfc_Cl - TOT("Cl")
	  170 error_Na = 0.024 * erfc_Na - TOT("Na")
	  180 PUNCH error_Cl, error_Na
	  190     REM store results
	  200 j = x - 0.5
	  210 PUT(error_Cl, SIM_NO, j, 1) 
	  220 PUT(error_Na, SIM_NO, j, 2) 
	  500 END
	  2000 REM calculate erfc...
	  2050 b = 1 / (1 + a6 * z)
	  2060 erfc = b * (a1 + b * (a2 + b * (a3 + b * (a4 + b * a5)))) * EXP(-(z * z))
	  2080 RETURN
	END

Calculating transport: 20 (mobile) cells, 1 shifts, 14 mixruns...

	SELECTED_OUTPUT
	   active        false     # See also PRINT; selected_output false
	SOLUTION 1-57   24.0 mM KNO3
	    units mol/kgw
	    temp  0                 # Incoming solution 0C
	    pH    7.0
	    pe   12.0   O2(g) -0.67
	    K    24.e-3
	    N(5) 24.e-3
	EXCHANGE 1-57
	    KX    0.048
	END
	TRANSPORT  # no need to redefine parameters that don't change from 20 cell model
	   cells        60
	   lengths      60*0.33333333333333333
	   disp         60*0.0
	   punch_cells  1-60
	SELECTED_OUTPUT
	   active        true      # See also PRINT; selected_output false
	END

Calculating transport: 60 (mobile) cells, 1 shifts, 122 mixruns...

	SOLUTION                    # Initial solution calculation for pure water
	PRINT
	   reset      false        # Initial solution calculation not printed
	   user_print true
	   high_precision false    # formerly USER_PRINT precision controlled by SELECTED_OUTPUT
	USER_PRINT
	  10  PRINT "             Error in Cl concentration Error in Na concentration"
	  20  PRINT "             ------------------------- -------------------------"    
	  30  PRINT "    Distance      20-cell      60-cell      20-cell      60-cell"
	  40  PRINT " "
	  50  FOR j = 0 TO 8
	  60    PRINT j + 0.5, GET(2, j, 1), GET(4, j, 1), GET(2, j, 2), GET(4, j, 2)
	  70  NEXT j
	END
----------------------------------User print-----------------------------------

             Error in Cl concentration Error in Na concentration 
             ------------------------- ------------------------- 
    Distance      20-cell      60-cell      20-cell      60-cell 
  
  5.0000e-01   4.3817e-06   9.0009e-08   5.0683e-04   3.9986e-05 
  1.5000e+00   1.7304e-05   1.0407e-06   5.1271e-04   5.7063e-05 
  2.5000e+00   3.5613e-05   3.2028e-06   9.1860e-05   1.6175e-05 
  3.5000e+00   4.9599e-05   5.2170e-06  -3.6825e-05  -3.3665e-06 
  4.5000e+00   5.0063e-05   5.6393e-06  -1.9684e-05  -2.4769e-06 
  5.5000e+00   3.8208e-05   4.4560e-06  -4.0513e-06  -4.9123e-07 
  6.5000e+00   2.2627e-05   2.6979e-06  -4.8731e-07  -4.8141e-08 
  7.5000e+00   1.0547e-05   1.2626e-06  -3.9008e-08  -2.6645e-09 
  8.5000e+00   3.8231e-06   2.9867e-07  -2.2212e-09  -8.8983e-11 

