Environmental Fluid Dynamics Code: pH Effects User Manual

Sandia National Laboratories · 21 pages

This Sandia National Laboratories manual documents the implementation of pH effects on algae-growth dynamics within the Environmental Fluid Dynamics Code (SNL-EFDC), covering required input file changes and source code modifications needed to enable pH limitation.

Find parts for this model

Frequently Asked Questions

How do I enable pH limitation in SNL-EFDC?

Enable water-quality variable 22 (CO2), setting it to 1 in card C02A of the wq3dwc.inp input file. pH is then calculated within SNL-EFDC using CO2 concentrations.

Can I use measured pH values instead of having SNL-EFDC calculate pH from CO2?

Yes. If measured pH values are available, they can be provided as a 9th column in aser.inp. SNL-EFDC will read these values only when all half-saturation constants for CO2 (KHCO2x) in card C08 of wq3dwc.inp are set to negative values.

What happens if the CO2 half-saturation constants are set positive?

If KHCO2x is positive, SNL-EFDC reads only the standard 8 columns from aser.inp and calculates pH using CO2 concentrations found in the growth medium rather than measured values.

How does SNL-EFDC compute instantaneous pH from measured values in aser.inp?

SNL-EFDC performs a linear interpolation in time between the two closest measured pH values (stored in the PHVAL array) relative to the current time, using the time values stored in the TASER array.

What source code file contains the pH limitation calculations?

The relevant calculations are in WQSKE1.F90, which computes pH limitation values (WQPHDC, WQPHDD, WQPHDG for cyanobacteria, diatoms, and green algae) and the actual production rates (WQPC, WQPD, WQPG).

What happens if water-quality variable 22 is not enabled?

If variable 22 is not enabled (set to 0) in wq3dwc.inp, the pH limitation variables WQPHDC, WQPHDD, and WQPHDG are set to 1.0, meaning pH limitation is not applied.

Manual text content

SANDIA REPORT SAND2012-1620 Unlimited Release Printed February, 2012 Sandia National Laboratories Environmental Fluid Dynamics Code: pH Effects User Manual Vijay Janardhanam and Scott C. James Prepared by Sandia National Laboratories Albuquerque, New Mexico 87185 and Livermore, California 94550 Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-AC04-94AL85000. Approved for public release; further dissemination unlimited. 2 I ssued by Sandia National Laboratories, operated for the United States Department of Energy by Sandia Corporation. NOTICE: This report was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government, nor any agency thereof, nor any of their employees, nor any of their contractors, subcontractors, or their employees, make any warranty, express or implied, or assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represent that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government, any agency thereof, or any of their contractors or subcontractors. The views and opinions expressed herein do not necessarily state or reflect those of the United States Government, any agency thereof, or any of their contractors. Printed in the United States of America. This report has been reproduced directly from the best available copy. Available to DOE and DOE contractors from U.S. Department of Energy Office of Scientific and Technical Information P.O. Box 62 Oak Ridge, TN 37831 Telephone: (865) 576-8401 Facsimile: (865) 576-5728 E-Mail: reports@adonis.osti.gov Online ordering: http://www.osti.gov/bridge Available to the public from U.S. Department of Commerce National Technical Information Service 5285 Port Royal Rd. Springfield, VA 22161 Telephone: (800) 553-6847 Facsimile: (703) 605-6900 E-Mail: orders@ntis.fedworld.gov Online order: http://www.ntis.gov/help/ordermethods.asp?loc=7-4-0#online 3 SAND2012-1620 Unlimited Release Printed February 2012 Sandia National Laboratories Environmental Fluid Dynamics Code: pH Effects User Manual Vijay Janardhanam Department of Physics and Astronomy University of New Mexico Albuquerque, New Mexico 87131 Scott C. James Thermal/Fluids Science and Engineering Department Sandia National Laboratories P.O. Box 969 Livermore, California 94551-0969 Abstract This document describes the implementation level changes in the source code and input files of Sandia National Laboratories Environmental Fluid Dynamics Code (SNL- EFDC) that are necessary for including pH effects into algae-growth dynamics. The document also gives a brief introduction to how pH effects are modeled into the algae- growth model. The document assumes that the reader is aware of the existing algae- growth model in SNL-EFDC. The existing model is described by James, Jarardhanam [1 ] and more theoretical considerations behind modeling pH effects are presented therein. This document should be used in conjunction with the original EFDC manual [ 2 , 3 ] and the original water-quality manual [ 4 ]. 4 ACKNOWLEDGMENTS This work was supported by the Laboratory Directed Research and Development program at Sandia National Laboratories. Sandia National Laboratories is a multi-program laboratory managed and operated by Sandia Corporation, a wholly owned subsidiary of Lockheed Martin Corporation, for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-AC04-94AL85000. 5 CONTENTS 1. Introduction ................................................................................................................................ 7 2. Input file changes ....................................................................................................................... 9 3. Source code changes ................................................................................................................ 13 4. Conclusion ............................................................................................................................... 17 5. References ................................................................................................................................ 19 FIGURES Figure 1. Enable water-quality variable 22 (CO 2 ) in wq3dwc.inp to enable pH limitation. ..... 9 Figure 2. pH values in last column of aser.inp is read by SNL-EFDC when KHCO2 x is set negative in wq3dwc.inp . ........................................................................................................... 10 Figure 3. Set all half-saturation constants for CO 2 , KHCO2 x , to negative values in wq3dwc.inp to read measured pH values provided in aser.inp ................................................................... 11 Figure 4: pH limitation code change in WQSKE1.F90 ................................................................ 13 Figure 5: Calculation of pH as a function of CO2 concentration in WQSKE1.F90 .................... 14 Figure 6: Interpolation of measured pH values to get instantaneous pH values in WQSKE1.F90 ....................................................................................................................................................... 14 Figure 7: In input.for measured pH values are read from 9th column in aser.inp , when all half-saturation constants for CO 2 are negative. If the half-saturation constants are positive, a standard read of aser.inp is done. ........................................................................................... 15 TABLES Table 1. Variable dictionary relevant to source code changes..................................................... 16 6 NOMENCLATURE pH Potential Hydrogen CE-QUAL Water-Quality Code DOE Department of Energy EFDC Environmental Fluid Dynamics Code SNL-EFDC Sandia National Laboratories Environmental Fluid Dynamics Code SNL Sandia National Laboratories 7 1. INTRODUCTION The algae-growth model in SNL-EFDC is described using the governing equation in CE-QUAL [ 4, Eqn. 3.1 ] ( ) ( ) L M R s , B B P B P B w B t z V ¶ ¶ = - - + + ¶ ¶ (1) where B (g/m 3 ) is the biomass, t (days) is time, P (day −1 ) is the production (growth) rate, B M (day −1 ) is the basal metabolic rate, P R (day −1 ) is the predation rate, w s (m/day) is the settling velocity, z (m) is the vertical coordinate, B L (g/day) represent the external loads such as deposition or sources, and V (m 3 ) is the model cell volume. The model already includes decoupled multiplicative effects of nutrient limitation, f (  ), light limitation, g ( I ), and temperature limitation, h ( T ), that limit biomass production rate under non- optimal conditions, as shown in (2), ( ) ( ) ( ) M P P f g I h T n = (2) where 0 ≤ f (  ) ≤ 1, 0 ≤ g ( I ) ≤ 1, 0 ≤ h ( T ) ≤ 1 and P M (day −1 ) is the maximum production rate under optimal conditions. Decoupled effects of non-optimal pH, i (pH), is added to the model through a new multiplicative term in (3) as ( ) ( ) ( ) ( ) M pH i P P f g I h T n = (3) where 0 ≤ i (pH) ≤ 1. More background on the theory behind the addition of pH limitation in SNL-EFDC is available [ 5, Section 2.4 ]. Section 2 describes the various EFDC input files that need to be changed to enable the pH limitation feature and Section 3 describes the relevant source code changes. 8 9 2. INPUT FILE CHANGES pH limitation is enabled when water-quality variable 22, corresponding to CO 2 is enabled (set to 1) in card C02A in wq3dwc.inp input file. Card C02A in wq3dwc.inp file with pH enabled is shown in Figure 1 . pH of the growth media is calculated within SNL-EFDC using CO 2 concentrations following the theory described by [ 5, Section 2.4 ] and hence needs CO 2 water- quality variable enabled in wq3dwc.inp . Figure 1. Enable water-quality variable 22 (CO 2 ) in wq3dwc .inp to enable pH limitation. If pH of the growth medium is available as a measured value, then SNL-EFDC can get those pH values through the atmospheric series input file, aser.inp . In such a case, aser.inp will have 9 columns instead of the usual 8 columns, and the last column contains the measured pH values. A section of aser.inp with pH values added as the 9 th column is shown in Figure 2 . SNL-EFDC reads pH values from aser.inp only when all half-saturation constants for CO 2 , 10 KHCO2 x , in card C08 in wq3dwc.inp are set to negative values, as shown in Figure 3 . For actual use of half-saturation constants of CO 2 in SNL-EFDC, such as in nutrient limitation calculations, the absolute value of KHCO2x is used. If KHCO2 x is set as a positive number, then SNL-EFDC reads only 8 columns from aser.inp and pH would be calculated using CO 2 concentrations found in the growth medium. Figure 2. pH values in last column of aser.inp is read by SNL-EFDC when KHCO2 x is set negative in wq3dwc.inp . 11 Figure 3. Set all half-saturation constants for CO 2 , KHCO2 x , to negative values in wq3dwc.inp to read measured pH values provided in aser.inp . 12 13 3. SOURCE CODE CHANGES The code snippet from WQSKE1.f90 in Figure 4 shows the calculation of pH limitation value and actual production rate. The global variables WQPHDC , WQPHDD , and WQPHDG store the pH limitation value that ranges between 0 and 1, for cyanobacteria, diatoms and green algae respectively. If water-quality variable 22 is not enabled (equal to 0) in wq3dwc.inp , then WQPHDC , WQPHDD , and WQPHDG are set to 1.0 and as a result pH limitation is not enabled. WQPC , WQPD , and WQPG store the actual production rates and they are calculated as the product of maximum production rate under optimal conditions ( WQPM x ), and nutrient limitation ( WQF1N x ), light limitation ( WQF2I x ), temperature limitation ( WQTDG x ) and pH limitation ( WQPHD x ) values. The functional form of pH limitation values WQPHD x depends on hydrogen ion concentration ( WQPHHCONC ), and rate constants ( WQPHKH and WQPHKOH ) and is based on the function form of Mayo [ 6 ] as described elsewhere [ 1, Section 2.4 ]. The rate constants are themselves functions of instantaneous temperature ( TWQ ) in the growth medium. Figure 4: pH limitation code change in WQSKE1.F90 . 14 The variable WQGPH stores the local pH of the growth medium and is computed from the [CO 2 ] concentration in the medium using the relation   10 w 1 h 2 1 pH log [CO ] . 2 k k k    (4) The relation between pH and CO 2 concentration is derived in detail elsewhere [ 5, Section 2.4 ]. In Figure 5 , if water-quality variable 22 corresponding to CO 2 is enabled, then pH ( WQGPH ) is calculated as a function of [CO 2 ] concentrations ( WQV (L, K, 22) ). Figure 5: Calculation of pH as a function of CO2 concentration in WQSKE1.F90 If pH values of the growth medium are measured and available through aser.inp as described in Section 2, then SNL-EFDC reads pH values from the last column of aser.inp . When measured pH values are available, then half-saturation constant of CO 2 should be set to a negative value, and hence variable WQKHCO2G should be negative. If WQKHCO2G would be negative in the code snippet shown in Figure 4 , then hydrogen ion concentration is calculated using CPH , which is in turn computed from measured pH values. Computation of instantaneous pH values ( CPH ) from measured pH values available in aser.inp is done using a simple linear interpolation in time using the code snippet shown in Figure 6 . pH value at current time ( CPH ) is calculated by doing a linear interpolation between the two pH values ( PHVAL(CPOS-1,1 ) and PHVAL(CPOS,1) ) that are closest in time to the current time ( CTIME ). Figure 6: Interpolation of measured pH values to get instantaneous pH values in WQSKE1.F90 15 The measured pH values are read from aser.inp and they are stored in the array PHVAL. The time when pH measurements were measured are read into the array TASER. The two pH values that are closest in time to the current time are obtained by iterating through the time values stored in TASER and stopping when current time becomes smaller than the time values obtained from TASER. The reading of pH values from aser.inp is done in input.for using the code snippet shown in Figure 7 . If the half-saturation constants for CO 2 are positive, then aser.inp has only 8 columns of data and a standard read is done. If the half-saturation constants for CO 2 are negative, then aser.inp has 9 columns of data and pH values are read from the 9 th column. Figure 7: In input.for measured pH values are read from 9th column in aser.inp , when all half-saturation constants for CO 2 are negative. If the half-saturation constants are positive, a standard read of aser.inp is done. 16 Table 1. Variable dictionary relevant to source code changes. Variable Name Description WQPHD x Global variables that store the actual pH limitation value ranging between 0 and 1 ( x = C, D, G refers to Cyanobacteria, Diatoms, and Green algae, respectively). WQP x Actual production rate ranging between 0 and 1. WQPM x Maximum production rate under optimal conditions i.e., when all limitation factors are 1. WQF1N x Nutrient limitation factor ranging between 0 and 1. WQF2I x Light limitation factor ranging between 0 and 1. WQTDG x Temperature limitation factor ranging between 0 and 1. WQPHHCONC Hydrogen ion concentration calculated from local pH. WQPHKH Protonation rate constant. WQPHKOH Deprotonation rate constant. TWQ Local temperature of the medium. WQKHCO2 x Half-saturation constant for CO 2 limited growth. WQGPH Local pH of the medium. WQV Water-quality variable and variable 22 contains the CO 2 concentrations in the medium. CPH pH found at current time, which is calculated by interpolating measured pH values obtained from atmospheric series file. PHVAL pH values read from atmospheric series input file. CPOS Position variable used while iterating through measured pH values, which identifies the two closest measured pH values that should be used in linear interpolation to get pH at current time. CTIME Variables that stores the current time during the simulation period. TASER Time information from atmospheric series input file. 17 4. CONCLUSION The changes in source code ( wqske1.f90 , input.for ) and input files ( wq3dwc.inp , aser.inp ) that are needed to include the effects of pH limitation into the algae-growth model have been described in this document. The reader of this document should incorporate the source code changes and build new binaries for testing pH limitation effects. The input files also should be changed so that pH limitation can be switched on. The reader can check the effects of pH limitations by running the model with and without pH limitations and looking into the difference in output variables of interest, like algae biomass. 18 19 5. REFERENCES 1. James, S.C., V. Jarardhanam, and D.T. Hansen, Simulating pH effects in an algae-growth hydrodynamic model. Journal of Computational Biology, 2012. in preparation . 2. Hamrick, J.M., The Environmental Fluid Dynamics Code: User Manual , I. Tetra Tech, Editor 2007, US EPA: Fairfax, VA. 3. Hamrick, J.M., The Environmental Fluid Dynamics Code: Theory and Computation , I. Tetra Tech, Editor 2007, US EPA: Fairfax, VA. 4. Cerco, C.F. and T. Cole, User’s Guide to the CE-QUAL-ICM Three-Dimensional Eutrophication Model, Release Version 1.0 , 1995, U.S. Army Corps of Engineers. 5. James, S.C., et al., Isotope exchange kinetics in metal hydrides II: Finite element model , 2012, Sandia National Laboratories: Livermore, CA. p. 30. 6. Mayo, A.W., Effects of temperature and pH on the kinetic growth of unialga Chlorella vulgaris cultures containing bacteria. Water Environment Research, 1997. 69 (1): p. 64- 72. 20 DISTRIBUTION 1 MS0899 RIM – Reports Management 9532 (electronic copy) 2 MS0123 D. Chavez, LDRD Office 1011 (electronice copy)