IONIC STRENGTH LIMIT: I've been perusing the user's guide to PHREEQC and note that it works well at low ionic strength. What's the upper ionic strength limit you recommend?
You also say it MAY be reliable at higher ionic strength solutions for sodium chloride-dominated systems. How high do you mean by higher? (upper limit). Does seawater qualify as sodium chloride-dominated, or do you mean virtual absence of ions other than sodium and chloride?
Hedging, I say between .1 and 1 molal (seawater is ~0.7). A non-sodium- chloride solution would be toward the lower end and a sodium-chloride (or at least chloride-) dominated solution would be toward the higher end.
For the major cations, the activity coefficients as a function of ionic strength are derived from chloride salts. In a pure sodium-chloride solution, the activity coefficients of sodium and chloride are fit to perhaps 6 molal. For other strong electrolyte cations that are fit from chloride salts, the calculations are probably not too bad as long as chloride is the dominant anion. As anions other than chloride are introduced, things get progressively worse. In addition, most complexes have only the non-ion-specific Davies equation for the activity coefficient, so large amounts of complexing at high ionic strength is much less reliable. In general I would be very cautious (skeptical) with calculations at ionic strengths over 2 molal. Between .5 and 2 molal, I would consider the calculations as qualitiative and check to the extent possible with the specific interaction approach.
You can use other programs (EQ3/6, PHRQPITZ, Geochemists Workbench) that implement the specific interaction approach of Pitzer. This approach fits activity coefficients, frequently to 2-6 molal, in mixed electrolyte solutions. This is definitely the better approach for high ionic strengths, but the drawback is the data are not available for redox reactions or aluminosilicate reactions.
TITLE example.--Diffusion only (all time units in days) (20 cells) SOLUTION 0 CaCl2 units mmol/kgw pH 7.0 charge temp 25.0 Ca 0.5 Cl 1.0 SOLUTION 1-20 Initial solution for column units mmol/kgw pH 7.0 charge temp 25.0 TRANSPORT -cells 20 -shifts 20 -time_step 5.e3 -flow_direction diffusion_only -boundary_conditions constant -lengths 0.05 -diffusion_coefficient 2.59e-5 -punch 20 PRINT -reset false SELECTED_OUTPUT -file ex9dif.pun -totals Cl END
You have been defining an extremely large diffusion coefficient. Note that -diffc should be given in m2/s, and that 2.59e-9 is reasonable. With your diffusion coefficient of 2.59e-5 m2/s you have no longer the boundary condition at x = 1 that dc/dx = 0 for the analytical solution. It is better, still, to first calculate how far the diffusion front will come with the analytical solution, and then dimension the PHREEQC grid.
TITLE example.--Diffusion only (all time units in days) PHREEQC-2 WORKS IN SECONDS (it is so fast...) (20 cells) SOLUTION 0 CaCl2 units mmol/kgw pH 7.0 charge temp 25.0 Ca 0.5 Cl 1.0 SOLUTION 1-20 Initial solution for column units mmol/kgw pH 7.0 charge temp 25.0 TRANSPORT -cells 20 -shifts 20 -time_step 5.e3 # in seconds -flow_direction diffusion_only -boundary_conditions constant -lengths 0.05 -diffusion_coefficient 2.59e-9 # in m2/s -punch 20 PRINT -reset false SELECTED_OUTPUT -file ex9dif.pun -totals Cl END
You should have downloaded the file pci1_03.exe which has a size of 3885042 bytes. Check to make sure this is the right file and the right size. If you used ftp you need to use "type binary" or "type image". It may be that your browser made an ascii translation that it shouldn't have or there may have been some errors in transmission.
I think you are missing the program called Win32s for Windows 3.1. (Windows95 and WindowsNT have this package as part of the operating system.) As far as I know, there should be a directory win32s in the \windows\system directory. Windows 3.1 doesn't have the capability to run 32-bit programs without this package. You can download Win32s from microsoft or from our site. Check out Win32s installation instructions at URL: http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqci
"SO4" will not work, element concentrations are always entered solely as the element symbol, optionally with a valence state in parentheses. S(6) is safest because it means specifically sulfate (sulfur of valence 6). You could also enter "S", but that would be interpreted as total sulfur and would be distributed between sulfate and sulfide according to the pe (or redox couple). If the pe is sufficiently low, the sulfur could end up as sulfide instead of sulfate in the distribution of species.
First do you have administrator rights?
Try running the setup.exe program through Start/Run on the taskbar. Turn on the "Run in Separate Memory Space" click box.
If that doesn't work, check the task manager. Right click on a blank area of the task bar (or ctrl-alt-del) and select task manager. See if you have any old versions of phreeqci running or something that looks suspicious under the Processes tab. It will be listed as an item under NTVDM.EXE. I think under some conditions there can be a conflict with a previously running program called wowexec.exe.
I need to start being more careful in keeping records. I can give you a few references. If anyone emails additional references, it would be appreciated. Click for a list of references. I'll try to keep the list as current as possible. I've included references to PHREEQM, which is a precursor of PHREEQC that had dispersive transport capability. PHREEQC version 2 contains all of the capabilities of PHREEQM.
You have to add some more input to do pure mixing properly. Normally, there are mineral sources and sinks for most of the major elements and PHREEQC automatically includes mole-balance equations for all of the elements included in the phases. If there are elements for which there should be mole-balance equations, but these elements are not in the phases, then you have to request a mole-balance equation using the -balances option. For your mixing case, where you have few or no minerals, then you have to request the mole-balances manually. You should include all of the major elements Ca, Mg, Na, Cl, S, C and probably K. You may want to include Br. (If you have isotopic data for D and O-18, the beta test version 2.0 will handle these as well. http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc.)
Ideally, mixing will account for all of the elements simultaneously. However, you may not be able to account for all of the elements by mixing alone. If this is the case, you will have to rethink your conceptual mixing model and consider whether the waters are related, you have all the endmembers, and if there are plausible reactants for the system.
If you run the program without the -minimal option, the first model that is printed has the smallest sum of residuals. However, other models may have an equally small sum of residuals. The sum of residuals is essentially how much the analytical data have been fudged. Think of a residual of 1.0 meaning that one analytical datum has been changed by its maximum uncertainty; 10.0 meaning that 10 analytical data have been changed by their maximum uncertainty.
I usually include the -minimal option, which decreases the number of models. This mode of running generates larger residuals because it tries to eliminate phases by changing more of the analytical data. The first model will not necessarily have the smallest sum of residuals. However, it seems to give the simplest and most important reactions. Kind of an Occam's razor approach. At any time that you think the data have been unduly adjusted, you can decrease the uncertainty for any or all of the data. You generally can't use an uncertainty of 0 for all of the data because the program has to adjust things a little to obtain charge balance.
You could try the EQ3/6 database, it used to be on the web, but I have been unable to find it recently. Ball and Nordstrom have been working on an evaluation of chromium thermodynamic data. Chromium is also in the MINTEQ database in the distribution of PHREEQC. I had some questions about some of the species and particularly about some of the chromium species. However, I never got a response from EPA.
Phreeqc has a few options for carbon, I'm not sure if any fit your data exactly:
(1) Enter pH and alkalinity. Total moles of carbon(4) is calculated by the program.
(2) Enter pH and total carbon(4). Alkalinity is calculated by the program.
(3) Enter alkalinity and total carbon. pH is calculated by the program.
(4) Enter pH, estimate of total carbon, and a partial pressure of CO2. Program will adjust total carbon until desired PCO2 is attained.
(5) Enter total alkalinty or total carbon, estimate of pH, and a partial pressure of CO2. If possible, the program will adjust the pH to attain the desired PCO2.
Now if by "free gas content" you mean the total of all the carbonate species (H2CO3, HCO3-, CO3-2, plus pairs) then you can use method 3 to obtain a pH. Otherwise, you probably want to enter pH and alkalinity and compare calculated CO2(aq) to your measured values. Let me know if you still have questions.
Ppm is mg/kg solution. Molality is mol/kg water. The conversion is as follows:
Convert mg of a solute to moles of a solute. Subtract the mass of the dissolved constituents from the kg of solution to get the mass of water. Divide moles of solute by mass of water to get molality. The initial solution is then assumed to have 1 kg of water and moles of solutes are scaled accordingly.
Density does not affect the calculation unless input units are per liter.
You're in luck. We have released PhreeqcI, an interactive version for PCs and I've put together a web site for downloading the codes. Try http://wwwbrr.cr.usgs.gov/projects/GWC_coupled. This program will be available soon at http://water.usgs.gov/software.
Solid solutions were not included in the 1995 release. However, a beta test version of PHREEQC version 2 is available (http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc.). You can model binary, nonideal solid solutions and multicomponent ideal solid solutions. It is capable of dissolving and precipitating solid solutions in equilibrium with an aqueous phase. Unlike SOLISOL, the solid solution need not always be present initially. The main deficiency of the model is that the entire solid solution reequilibrates with each reaction, whereas it is more reasonable that only the outer layer should reequilibrate.
The program allows for the possibility that any of the ions could change within their uncertainties. Which ones it actually changes is in part to make the mole balances work out for a given set of minerals, in part determined by the magnitude of concentrations (given a choice between changing a small concentration or a large concentration by the same absolute amount, it will choose the large concentration), and in part arbitrary in that it may not be a unique choice of deltas for a given set of phases.
The objective function is to minimize the sum (delta/Uncertainty), so if using group would decrease the sum, it should do it. In practice, it probably adjusts the largest concentration, because that gives the smallest delta/uncertainty.
Pretty much the same answer as the first question. The choice of deltas is required to produce charge balance, the choice of deltas is required to have mole balance for all the elements with mole transfers of a set of minerals, and, in addition, the sum of the deltas/uncertainties is required to be a minimum for that set of minerals. The program solves for combinations of deltas and mineral mole transfers that satisfy all these criteria.
I published a paper that describes the approach, but it may seem a repeat of the PHREEQC manual: Parkhurst, D.L., 1997, Geochemical mole-balance modeling with uncertain data: Water Resources Research, v. 33, no. 8, pp. 1957-1970.
I generally discourage people from trying to fix pe during reaction calculations (it's fine for speciation calculation). The reactions should determine the pe just as the reactions determine the pH. Bad things can happen, for example it is possible to slip out of the stability field for water if pe is fixed, say at low pH initially, and then the pH rises.
If the modeled pe is not what you expect, I think there are two possible reasons (1) redox disequilibrium in your system, or (2) unexpected reactions.
Disequilibrium can be modeled with some effort. It is necessary to rewrite the database to split out each redox state as an "element". If all redox elements are split, then all redox reactions would have to be performed with REACTIONs that transfer elements from one redox state to another. Partial disequilibrium may be more reasonable.
You can fix pe the same way as pH. However, you must choose a reactant that enters or leaves the solution to cause the pe to be fixed. It is best if this is a plausible reactant. The example below assumes atmospheric oxygen entered your system? Oxygen could also leave the system, which would be implausible.
PHASES Fix_pe e- = e- log_k 0.0 EQUILIBRIUM_PHASES Fix_pe 4 O2(g) # fixes pe to be -4 by adding or removing O2
The fractional error should be less than the global uncertainty that you set (-uncertainty), unless you have overridden the global uncertainty with specific uncertainties with the -balances option, in which case the maximum fractional error should be less than the larger of the global and the specific uncertainties. I look at the sum of residuals as a measure of the number of analytical data that were adjusted by their maximum amount. The larger the sum of residuals the more data that were fudged by their maximum amount. Given two models, the one with the smaller sum of residuals is more consistent with the original data.
You can generate water through chemical reactions. For example if you dissolve 25 moles of gypsum, you generate 50 moles of water (~1 kg). Usually models with very large mole transfers (> 1 mole) are not realistic. As a hint, make sure you charge balance the pure water in these problems. The program has trouble with small numbers, like the alkalinity of pure water, which is around 1e-10 if the water is not charge balanced. Otherwise, just ignore models that use 0 of the initial solution.
It's not that one answer is wrong and the other right, there are two answers to the problem you formulated. The one you expected with pH 7, pCO2 near -2, is what you get if you add a little CO2, driving the pH down and making the concentration of CO3-2 smaller until you reach calcite equilibrium. The other answer gets to calcite equilibrium by taking CO2 out; if nearly all the carbon is removed, the concentration of CO3-2 can be made small and thereby attain equilibrium with calcite.
Unfortunately, there is no way to know in general, which answer PHREEQC will find. It appears to be a random result of the numerical procedure. The slight difference between equilibrating with CO2 at -2.9 seems to be enough to switch from one answer to the other. In your case, it is possible to force the pH-10.5 answer by having no CO2 reactant initially (replace 10.0 with 0.0 in equilibrium_phases), but I don't know how to force the pH-7 answer.
The thermodynamic data in PHREEQE is included in a database file for PHREEQC called phreeqc.dat. This data is largely a subset of another database file for PHREEQC called wateq4f.dat. As the name implies, wateq4f.dat is derived from the thermodynamic data included in the speciation model WATEQ4F. Sources of thermodynamic data are included in the documentation for that program:
Ball, J.W. and Nordstrom, D.K., 1991, User's manual for WATEQ4F, with revised thermodynamic data base and test cases for calculating speciation of major, trace, and redox elements in natural waters: U.S. Geological Survey Open-File Report 91-183, 188 p.
Check the web site http://water.usgs.gov/software/geochemical for more information on WATEQ4F and how to order a manual.
PHREEQC also has a database file derived from MINTEQA2, called minteq.dat, but I don't think that MINTEQA2 documents the sources for these thermodynamic data.
A beta test version of PHREEQC version 2 is available that allows 1D advective/dispersive (or diffusive) transport (http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc.).
A beta test version of PHREEQC version 2 is available that allows general rate expressions for reaction kinetics. (http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc.).
PHREEQE was tested largely by hand calculations. All of the equations are algebraic, so the results can be tested directly. Activity coefficients, ionic strength, mole balance, saturation indices and other quantities can all be tested from the printout.
PHREEQC was tested against PHREEQE results for the PHREEQE test problems. It was tested against WATEQ4F for the wateq4f.dat data base. PHREEQC results were very close to the other programs, with slight differences in the WATEQ4F results attributed to slightly different activity coefficient formulations.
The surface complexation modeling was tested against a couple of test problems in MINTEQA2.
We have currently been working on dispersion and stagnant zones. These parts of the code have been tested against analytical solutions. Kinetics have been tested against test problems developed by Valocchi and more recently Valocchi and Tebes. Solid solutions have been tested by hand calculations and against MBSS, a code for solid solution calculations.
The code has been used extensively, and any bugs have been tracked down and corrected. There have been other efforts, particularly by a company called Intera, to compare PHREEQE results to EQ3/6. I know of two current efforts along these lines as well as with MINTEQA2. One final check is performed within the code to test the mole balance and mineral equilibrium algebraic equations before results are printed. In all, there have been few bugs that resulted in incorrect results. Most program failures are due to nonconvergence in the numerical method.
I haven't had much contact with people that are using it for this purpose other than talking to the authors of the AWA report, I think it was nearly 10 years ago. However, I expect PHREEQC is being used for this purpose. Sorry, I'm not much help here.
To get you started, a simple input file would look like this. Portlandite is in the wateq4f.dat database, which you can set in the Options menu of PHreeqcI.
SOLUTION 1 Pre-treatment water; replace with your analysis units mg/L pH 7.0 Na 15. Ca 60. Mg 40. SO4 10. Alkalinity 250. as CaCO3 Cl 10. END USE solution 1 REACTION 1 # this adds .01 mole of CaO and .005 moles of NaOH to solution 1 # replace with stoichiometry and amount of lime and ash added per liter CaO 1.0 NaOH .5 .01 mole EQUILIBRIUM_PHASES 1 # This allows portlandite and calcite to precipitate if they # become supersaturated Portlandite 0.0 0.0 Calcite 0.0 0.0 SAVE solution 2 END # solution 2 is treated water which could be used for additional # reaction modeling such as pH adjustment?
Brian Marshall of U.S. Geological Survey, Lakewood, CO (firstname.lastname@example.org) has created a Mac version that is available at http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc.
It means the two solutions are essentially the same composition within the given uncertainty limits and no reactions are needed to account for the differences. However, if the uncertainty limit were 1.0 for each constituent of each solution, that is 100 percent uncertainty, then any two solutions would be essentially the same. If uncertainties are small, say less than .05, then it means concentrations between the two solutions differ by less than 5 percent. The key is whether you have used uncertainty limits that are reasonable, if you have, then the solutions are not significantly different.
There is no way with version 1 of PHREEQC to write inverse-modeling information to another file. The beta test version 2.0 has the capability to write the mole transfers to a selected-output file. I'll have to add the maximum fractional error and sum of residuals to this output. (http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc).
The inverse modeling does not do ANY equilibration, it is purely an exercise in accounting for moles of elements. If you do not put in -minimal, the program attempts to find every combination of minerals that can satisfy the mole-balance constraints, subject to changes in analytical data that are within the specified uncertainty limits. The -minimal option limits the models to those sets of minerals for which no model can be found with a subset of that set of minerals.
In general -minimal gives fewer models at the cost of greater "sums of residuals". The superset models that are eliminated with -minimal will have smaller sums of residuals. However, all models satisfy the uncertainty limits, so implicitly even models with greater sums of residuals are consistent with your description of uncertainty.
The problem with your run is with the number of minerals in your list. Though never stated in the documentation, the maximum number of mineral in inverse modeling is 30 to 32.
On the other hand, even with 30 minerals, I expect the execution time will be slow if not infinite and the number of models you get will be very large. You need to simplify your problem.
Consider eliminating some of the trace elements, Se, Cd, Pb, As, U? and related minerals. I think you want to reduce the list to at most 20 minerals, and probably fewer, that you think are reasonable. Some reductions are easy, because polymorphs or phases that differ only in the amount of water in the formula are normally indistinguishable in mole-balance modeling. Thus you should include only gypsum or anhydrite; hematite, goethite, or lepidocrocite; one CdSO4; and probably others. In addition, eliminate any of the minerals forced to dissolve that are absent or present in trace quantities.
Many of the minerals are probably not likely to form, for example, copper sulfate and iron sulfate minerals are very soluble. Anyway, I think if you pare your problem down to a tractable definition, you will have less than 30 minerals and the program will function fine.
The input should run, but I don't think it does what you were trying to do. For transport, the program calculation first does advection, which is simply moving the water from cell 0 to cell 1, cell 1 to cell 2, ... cell n-1 to cell n. Following advection, mixing and equilibration is performed. You have defined no other reactants so only mixing and aqueous equilibration is performed.
Now if you consider your first cell for an advective step: solution 0 is moved into cell 1, then by the MIX definition .98 of solution 0 is mixed with .02 of the new solution in cell 1 (which equals solution 0) and the result is placed in cell 1. Thus, from advective step 1 onwards, cell 1 is always equal to solution 0. At step two, the same logic will apply to cell 2 and so on. Even if you have no mixing, the surface water will propagate through the system in 50 time steps. The mixing fractions in addition to the transport don't make sense to me. I think mixing solution 1 and solution 2, 2 and 3, and so on would make more sense in terms of simulating dispersion.
Note the beta version of 2.0 has a diffusive/dispersive plus advective transport with boundary conditions. The model also includes a temperature retardation factor that allows you to account for the heat capacity of the matrix (http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc).
SPECIES DEFINITIONS: We are using Phreeqc1.6 to model bytownite feldspar dissolution in aqueous gluconate solutions and we are having some difficulty in figuring out how to put the stoichiometry of the Al:gluconate complexes into the SOLUTION_SPECIES database. The complexes are given in Smith and Martell (Vol 6) as:
Al+3 + L- ---> AlL+2 log K = 1.98 AlL+2 ----> AlH-1L+ + H+ log K = -2.87 AlH-1L- ----> AlH-3L- + H+ log K = -9.29
All constants were determined at 25oC and 0.1M KNO3 by Motekaitus and Martell (1984, J. Inorg Chem 23:18-23). The problem arises from the negative subscripts in the latter two species. According to 84MM, these result from a tridentate interaction between gluconate and Al3+ involving the hydroxyl groups of the gluconate rather than the carboxylic group of the ligand. Normally gluconate
H H H OH H | | | | | H-C--C--C--C--C--C=O | | | | | | HO OH OH H OH OH
is treated as a mono-carboxylic acid and therefore there are no defined deprotonated species in solution equivalent to H-1L-2 or H-3L-4.
How can I define these species in PHREEQC for the purpose of modeling their impact on chemical affinity and on the stability of secondary dissolution products? Will PHREEQC be able to handle the negative subscript for H in the complex formulation without otherwise impacting the calculations?
I think you should define the ligand master species as containing 3 hydrogens or actually the ligand "L" as the deprotonated form. PHREEQC won't let you have negative coefficients, but I don't see any reason you can't define the ligand as whatever state of deprotonation you choose. I've roughed in the input below. Not sure about the last one, your equation has only one hydrogen, but a net change of 2 hydrogen in the ligand. So check the details, but I think it should work.
SOLUTION_MASTER_SPECIES #Alkalinity should be defined relative to stable #complex at pH ~4.5 L LH3- -3.0 C6H12O7 ~200.? SOLUTION_SPECIES LH3- = LH3- log_k 0.0 Al+3 + LH3- = AlLH3+2 log_k 1.98 AlLH3+2 = AlLH2+ + H+ log_k -2.87 #Not sure about stoichiometry for this one. AlLH2+ = AlL- + 2H+ log_K = -9.29
INVERSE MODELING: Just wanted to send you a file that results in some curious model results. All the models are somewhat nonsensical from my point of view (although computationally legit) since they all dilute solution 1 to make solution 2. What's computationally interesting is that about five models come out with 0 amount of solution 1 to make solution 2.
Reading your manual, I see in the notes on the inverse modeling section that evaporation/dilution can be modelled by adding the phase H2O to the list of phases considered. However, in my experience PHREEQC also occassionally does evaporation and/or dilution even when the H2O phase is not specified (In addition to the above dilution example, one of my files also resulted in spontaneous evaporation).
It is not really evaporation or dilution, but looks kind of like it. The water-balance equation allows minerals to generate or consume water. This is possible even if there are no waters of hydration; the program simply looks and the coefficient for water in the dissolution equation for the mineral and adds or removes this much water per mole of mineral that reacts. You generally need 10's of moles of mole transfer of minerals to generate all the water in solution 2 (55 moles), so not only is the mixing fraction of solution 1 near zero, but the mole transfers of the minerals are unreasonably large.
I just ignore these models. I did add a switch to ignore the water generated by the minerals in version 2 (-mineral_water false). I am a little concerned that this switch might mask some legitimate water effects in some models, so I usually do not use it.
It is the correct equilibrium calculation, but the confusion is that the natural world does not reach this equilibrium.
As I see it, you must define your reactions as equilibrium or kinetic. You have a choice, does nitrogen react with oxygen to equilibrium or not. You have so far modeled it as equilibrium and do not like the results. Therefore, you are arguing that there is a kinetic reaction. I have modeled the end member kinetic case below in which nitrogen and oxygen simply do not react; nitrogen inert relative to oxygen. The results are as you expected.
To consider the case of kinetic reaction of nitrogen with oxygen with non-zero rate, it would be possible to slowly transfer mass from Nzero (inert relative to oxygen) to N (equilibrium reactions relative to oxygen) through REACTION calculations and the pH would decrease from 5.8 as nitrate was generated by reaction of nitrogen with oxygen.The following example produces the results you expected. As I said before, your concern in your previous emails is that nitrogen gas does not react to equilibrium with oxygen at low temperature and pressure. Thus, we must remove the default equilibrium among the nitrogen species; SOLUTION_MASTER_SPECIES and SOLUTION_SPECIES are used to do that. In the following example, nitrogen gas is assumed to be inert relative to oxygen. It does obtain equilibrium between the gas and aqueous phase. The problem is defined as follows: pure water reacts with a gas volume that is initially 1.0 L, 25C, and pressure 1.0. The gas is a bubble so the pressure remains 1.0 atm, but the volume will vary as the gas reacts with the water. Initially the partial pressures of dry air, CO2, N2, O2 and H2O--10^-3.5, 0.78, .2, and 0 atm.
SOLUTION_MASTER_SPECIES Nzero Nzero2 0.0 Nzero 14.0067 SOLUTION_SPECIES Nzero2 = Nzero2 log_k 0.0 PHASES Nzero2(g) Nzero2 = Nzero2 log_k -3.26 H2O(g) H2O = H2O log_k 1.5 END SOLUTION 1 temp 25. pH 7.0 END GAS_PHASE 1 -pressure 1.0 -volume 1.0 -temp 25. CO2(g) 0.00032 Nzero2(g) 0.78 O2(g) 0.20 H2O(g) 0.0 END USE solution 1 USE gas_phase 1 END
The results follow. The pH after equilibrium is 5.8 under the specified conditions. The log partial pressure of CO2 has decreased to -3.81 due to dissolution of about half the gas into water. The partial pressure of water in the gas has increased from zero to .03 atm, which is saturation. A small amount of N2 and O2 gases have dissolved. No reaction occurs between the N2 and the O2.
The two equations refer to two different things. The equation in SOLUTION_SPECIES refers to an aqueous complex, that is a dissolved ion pair of lead and carbonate. The equation in PHASES refers to a solid mineral (cerrusite). The equilibrium constants are based on the free energy of formation of the aqueous species and the mineral respectively, so they should not be numerically equal. In the simulation, the log k for the aqueous species is used whenever lead and carbon are present in the aqueous solution. The log k for cerrusite is used to calculate the saturation index for cerrusite and whenever cerrusite is included as a mineral in EQUILIBRIUM_PHASES.
I ran your input file and the problem appears to be in the specified alkalinity. I removed the alkalinity input and calculated the total non-carbonate alkalinity (> 1. meq), which is greater than the specified total alkalinity (52 mg/L, ~ 1 meq). The program tries to calculate total carbonate species such that carbonate_alk + non_carbonate_alk = total_alk. In this case carbonate_alk has to be negative, which is not possible and the program fails. I think what you found is that the arsenic species account for a lot of the noncarbonate alkalinity and if you decrease arsenic concentration you decrease the noncarbonate alkalinity to the point where carbonate alkalinity can be nonnegative.
You've got a few choices (1) ignore carbonate species by removing alkalinity, (2) specify a total concentration of C(4) instead of total alkalinity, (3) specify total carbon in some indirect way, like equilibrium with atmosphere (but at this pH, that would calculate a large concentration of carbon) or equilibrium with calcite if that makes sense.
A solution defined with a solution keyword has 1 kilogram of solution. It sounds to me like you are specifying EXCHANGE (or SURFACE for sorption sites?) in equilibrium with a solution with the -equilibrium option of EXCHANGE. This does assume an infinite volume of the solution and provides the exchange composition in a column after a large volume of water has been eluted.
It also sounds like this is not the model that you want, rather you want to take the an amount of solution 1 and equilibrate it with a fixed amount of the exchanger. In that case, you need only remove the -equilibrium identifier from EXCHANGE. In that case however, what is the initial exchange composition when it is added to the water? You must specify the initial exchange composition explicitly. If you have pre-equilibrated the exchanger with an ion, say calcium, you could specify the initial exchanger as CaX2.
The following is an outline of the type of calculation you could make (and I think it is simpler than MINTEQ). I have put some arbitrary concentrations just for discussion. An exchanger with .1 mmol of sites initially filled with sodium ions is brought together with approximately 200 mL (actually a solution with .2 kg of water) of 1 millimolal CaCl2 solution and the exchanger and solution come to equilibrium. The final solution is sodium-calcium-chloride and the exchanger is nearly all calcium filled.
SOLUTION 1 units mmol/kgw pH 7.0 Ca 1. Cl 2. END MIX 1 .2 EXCHANGE 1 NaX .0001 END
COMPILATION: I've been trying to compile the source code of phreeqc using both an old copy of Turbo C and a newish version of Borland C++. Compilation is fine, but no matter which options I try the program fails at run time. Some memory options simply cause a crash, presumably because the program writes/tries to allocate protected memory. Some options are simply too large to load, e.g. program size over 600K with huge memory model and all debugging turned on.
I can get a reasonably-sized executable (around 300 K or less up to about 500K) if I turn off all debugging and use medium or large memory models. When I do this there is a run time error:
Initializing .. ERROR: Null pointer returned for malloc or realloc
Can you advise? What options should be used with Turbo C compiler and linker to ensure a successful result? Should I be using command line rather than the integrated environment? (Just for compilation, I always drop out to DOS before trying to run the program.)
The error message is printed by PHREEQC and means that the program could not get more memory to store data; it ran out of RAM (and swap space if it is available).
Here's what I use with Borland, I would go into the TargetExpert by right clicking on the executable file name in the list of project files. The target type should be "application[.exe]", the platform "Win32", and the Target Model "Console". My checked standard libraries include "Class Library", "Runtime" (disabled), and "BWCC". "Static" makes a portable code that will run on other machines.
The 32-bit compiler does not have any choice of memory models under the options/project menu.
THERMODYNAMIC DATA: I am trying to add some new thermodynamic data I have a table of Dissociation constants for 1:1 metal (Mg+2, Ca+2, Mn+2, Fe+2,Fe +3, Ni+2, Al+2) arsenate complexes (H2AsO4-, HAsO4-2 and AsO4-3) (From Don Langmuir) Do I have to go to the data files and add the species there or can I use the solution species command. If I have to modify the thermodynamic database file where do I add these items at the end of the file and what about the consecutive numbers are they important? this was added to the file as a test
SOLUTION_SPECIES 1 # Do not change this number it is used by the program! MgH2AsO4+ = Mg+2 + H2 AsO4- -log_k 1.52
I get this error
MgH2AsO4+ = Mg+2 + H2 AsO4- log_k 1.52 ERROR: Elements in species have not been tabulated, MgH2AsO4+. ERROR: Reaction for species has not been defined, MgH2AsO4+. ERROR: Calculations terminating due to input errors.
The only thing wrong is that it needs to be an association reaction. In the balanced equation, the species being defined must be the first species to the right of the equal sign. (The program interprets your equation as defining Mg+2.) Sorry it's pretty subtle, but that's the convention I used.
Mg+2 + H2 AsO4- = MgH2AsO4+ -log_k -1.52