THE THEORETICAL BASIS FOR THE MODELLING OF CHEMICAL REACTIONS IN ROCK—WATER SYSTEMS WITH SPECIFIC REFERENCE TO THE HEAT FLOW, FLUID FLOW AND SOLUTE TRANSPORT LAWS by ERNEST HENRY PERKINS M.Sc, University of British Columbia, 1980 B.Sc, University of British Columbia, 1975 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY in THE FACULTY OF GRADUATE STUDIES Department of Geological Sciences We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA September 1986 ©Ernest Henry Perkins, 1986 In presenting t h i s thesis i n p a r t i a l f u l f i l m e n t of the requirements for an advanced degree at the University of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y available for reference and study. I further agree that permission for extensive copying of t h i s thesis for scholarly purposes may be granted by the head of my department or by h i s or her representatives. I t i s understood that copying or publication of t h i s thesis for f i n a n c i a l gain s h a l l not be allowed without my written permission. Department of Geological Sciences The University of B r i t i s h Columbia 1956 Main Mall Vancouver, Canada V6T 1Y3 " Date Sept 2 6> !986 DE-6 (3/81) ABSTRACT In order to understand the processes involved i n water and steam floods during secondary and enhanced o i l recover, waste disp o s a l , i n - s i t u mining and leaching, or many d i f f e r e n t types of geological phenomenona, the chemical interactions between the f l u i d and the surrounding minerals must be known as a function of pressure, temperature and composition. These systems are generally open systems, thus the changes i n pressure, temperature and bulk composition are coupled to the chemical reactions occurring throughout the entire system and cannot be independently s p e c i f i e d . Based on the equations of mass action and mass balance, fur t h e r equations have been derived which allow chemical reactions between a f l u i d and s o l i d phases to be evaluated. The equations are based on the derivatives of the mass action and mass balance equations with respect to time, and are used i n a serie s expansion to pr e d i c t the composition of the f l u i d and the s o l i d phases at future times. The equations are*coupled to those constraining pressure, temperature and mass f l u x -which have been modified t o allow t h i s coupling. Because of various l i m i t a t i o n s on many of the equations used, only a sing l e f l u i d i n porous media can be modelled. A computer program has been written to t e s t the equations and concepts developed i n t h i s t h e s i s . The r e s u l t s allow the following g e n e r a l i z a t i o n f o r natural flow systems with decreasing pressure and temperature along the flow path to be made. Excluding systems with s u f f i c i e n t mechanical energy to create new flow paths and excluding a l l phases which exhibit decreasing s o l u b i l i t y with increasing temperature or with decreasing pressure, every natural flow system which attempts to maintain equilibrium between the f l u i d and s o l i d phases i n contact with the f l u i d w i l l ;.i ultima t e l y seal i t s e l f . T a b l e o f C o n t e n t s Abstract ii Table of Contents iii List of Tables v List of Figures vi List of Symbols viii Acknowledgements ix 1. Introduction 1 2. Description of the Problem 5 3. Components 8 4. Thermodynamic Basis of the Constraining Equations 10 The Mass Balance Equation 10 The Mass Action Equation 14 Summary 17 5. Model-Dependent Equations 18 Activity Coefficients of Solid Solution Species 18 The Activity Coefficient of Aqueous Species 20 The Ionic Strength equation 24 The Derivative of the Activity of Water 25 Derivative of the Number of Moles of the Reactant Minerals 26 Summary 27 6. Solution of the Mass, Ionic Strength and Activity Derivatives 29 7. The Flow equation 36 The Temporal Terms 36 The Spatial Terms 39 Conclusions 41 8. The Solute Transport Equation 43 9. The Heat Equation 49 10. Notes on the Solution of the Equations 52 11. Model Verification 57 12. Examples of Model Application 60 Overview of the Graphical Technique 61 Model One: Iso-thermal with no Chemical Reactions, Inert Transport 62 Model Two: Thermal Effects, Fixed Pressure Gradient, Inert Transport 69 Model Three: No Chemical Reaction, Inert Transport 73 Model Four: Iso-thermal with no Transport 79 Model Five: Thermal Effects, Fixed Pressure Gradient, No Transport 84 Model Six: No Transport - Pressure and Temperature Gradient 88 Model Seven: Iso-thermal system with flow and mass transport 99 Model Eight: Thermal Effects, Fixed Pressure Gradient 104 Model Nine: No Pressure, Temperature or Mass Flux Constraints 108 Overview of the Modelling 114 13. Future Work 115 14. Summary 117 References 120 Appendix One: Summary of the Thermodynamic Relationships 128 iii Solid Phases . 130 Aqueous Species 133 Water 136 Appendix Two: Program Description 139 Input For Fortran Unit 1—The Physical Constraints 140 Input for Fortran Unit 2—The Thermodynamic Data 143 Input For Fortran Unit 3—The Chemical Constraints 146 Fortran Unit 7 Output—Plotting Pressures and Fluid Velocities 148 Fortran Unit 8 Output—Plotting the Temperatures 148 Fortran Unit 9 Output—-Plotting Porosity and Permeability 149 Fortran Unit 10 Output—Plotting Fluid Compositions 150 Fortran Unit 11 Output—Plotting the Number of Moles of Solid Phases 150 Appendix Three: Sample Unit 1 Data 152 Appendix Four: Sample Unit 2 Data 154 Appendix Five: Sample Unit 3 Data 158 Appendix Six: Sample Unit 6 Output 159 Appendix Seven: Program Listing 166 iv List of Tables Table I: Solvation Parameter for NaCl 21 Table II: Short Range interaction Parameter for NaCl 22 Table III: Expansion of Symbols in Figure 1 31 Table III: Continued, 32 Table IV: Calculated values of Pressure, • • •, at time: 0.0 94 Table V: Calculated values of Pressure, • • , at time: 4000 95 Table VI: Calculated values of Pressure, , at time: 8000 96 Table VII: Calculated values of Pressure, , at time: 12000 97 Table VIII: Calculated values of Pressure, • , at time: 16000 98 Table DC: Coefficients for Equation A-15 135 Table X: Coefficients for Equation A-16 135 Table XI: Coefficients for Equation A-21 138 Table XII: Coefficients for Equations A-20 and A-21 138 v L i s t o f F i g u r e s Figure 1 - Tabular Forms of the Constraining Chemical Equations 30 Figure 2 - Method of Solution 34 Figure 3 - Iteration Scheme Used 56 Figure 4A - Change in Pressure with respect to time and distance 64 Figure 4B - Derivative of the Change in Pressure 64 Figure 4C - Change in Velocity with respect to time and distance 65 Figure 4D - Derivative of the Change in Velocity 65 Figure 4E - Change in Porosity with respect to time and distance 66 Figure 4F - Derivative of the Change in Porosity 66 Figure 4G - Change in Permeability with respect to time and distance 67 Figure 4H - Derivative of the Change in Permeability 67 Figure 41 - Change in Concentration with respect to time and distance 68 Figure 4J - Derivative of the Change in Concentration 68 Figure 5A - Change in Temperature with respect to time and distance 70 Figure 5B - Derivative of the Change in Temperature 70 Figure 5C - Change in Porosity with respect to time and distance 71 Figure 5D - Derivative of the Change in Porosity 71 Figure 5E - Change in Concentration with respect to time and distance 72 Figure 5F - Derivative of the Change in Concentration 72 Figure 6A - Change in Pressure with respect to time and distance 74 Figure 6B - Derivative of the Change in Pressure 74 Figure 6C - Change in Velocity with respect to time and distance 75 Figure 6D - Derivative of the Change in Velocity 75 Figure 6E - Change in Temperature with respect to time and distance 76 Figure 6F - Derivative of the Change in Temperature 76 Figure 6G - Change in Porosity with respect to time and distance 77 Figure 6H - Derivative of the Change in Porosity 77 Figure 61 - Change in Concentration with respect to time and distance 78 Figure 6J - Derivative of the Change in Concentration 78 Figure 7A - Change in Pressure with respect to time and distance 80 Figure 7B - Derivative of the Change in Pressure 80 Figure 7C - Change in Velocity with respect to time and distance 81 Figure 7D - Derivative of the Change in Velocity 81 Figure 7E - Change in Porosity with respect to time and distance 82 Figure 7F - Derivative of the Change in Porosity 82 Figure 7G - Change in Concentration with respect to time and distance 83 Figure 7H - Derivative of the Change in Concentration 83 Figure 8A - Change in Temperature with respect to time and distance 85 Figure 8B - Derivative of the Change in Temperature 85 Figure 8C - Change in Porosity with respect to time and distance 86 Figure 8D - Derivative of the Change in Porosity 86 Figure 8E - Change in Concentration with respect to time and distance 87 Figure 8F - Derivative of the Change in Concentration 87 Figure 9A - Change in Pressure with respect to time and distance 89 Figure 9B - Derivative of the Change in Pressure 89 Figure 9C - Change in Velocity with respect to time and distance 90 v i Figure 9D - Derivative of the Change in Velocity 90 Figure 9E - Change in Temperature with respect to time and distance 91 Figure 9F - Derivative of the Change in Temperature 91 Figure 9G - Change in Porosity with respect to time and distance 92 Figure 9H - Derivative of the Change in Porosity 92 Figure 91 - Change in Concentration with respect to time and distance 93 Figure 9J - Derivative of the Change in Concentration 93 Figure 10A - Change in Pressure with respect to time and distance 100 Figure 10B - Derivative of the Change in Pressure 100 Figure 10C - Change in Velocity with respect to time and distance 101 Figure 10D - Derivative of the Change in Velocity 101 Figure 10E - Change in Porosity with respect to time and distance 102 Figure 10F - Derivative of the Change in Porosity 102 Figure 10G - Change in Concentration with respect to time and distance 103 Figure 10H - Derivative of the Change in Concentration 103 Figure 11A - Change in Temperature with respect to time and distance 105 Figure 11B - Derivative of the Change in Temperature 105 Figure 11C - Change in Porosity with respect to time and distance 106 Figure 11D - Derivative of the Change in Porosity 106 Figure H E - Change in Concentration with respect to time and distance 107 Figure 11F - Derivative of the Change in Concentration 107 Figure 12A - Change in Pressure with respect to time and distance 109 Figure 12B - Derivative of the Change in Pressure 109 Figure 12C - Change in Velocity with respect to time and distance 110 Figure 12D - Derivative of the Change in Velocity 110 Figure 12E - Change in Temperature with respect to time and distance I l l Figure 12F - Derivative of the Change in Temperature I l l Figure 12G - Change in Porosity with respect to time and distance 112 Figure 12H - Derivative of the Change in Porosity 112 Figure 121 - Change in Concentration with respect to time and distance 113 Figure 12J - Derivative of the Change in Concentration 113 Figure 13 - Availablity of Model Parameters 118 vii L i s t o f S y m b o l s A D e b y e - H u c k e l e l e c t r o s t a t i c coe f f i c ien t a A c t i v i t y o f a p h a s e , species o r c o m p o n e n t a Size p a r a m e t e r f o r c a l c u l a t i n g a c t i v i t y coe f f i c ien ts B D e b y e - H u c k e l e l e c t r o s t a t i c coe f f i c ien t f>NaCl S o l v a t i o n p a r a m e t e r f>Nn+ ai- S h o r t r a n g e i n t e r a c t i o n p a r a m e t e r . C C o n c e n t r a t i o n Cp H e a t c a p a c i t y a t c o n s t a n t p ressu re Cv H e a t c a p a c i t y a t c o n s t a n t v o l u m e A , y C o e f f i c i e n t o f d i s p e r s i o n G G i b b s f ree e n e r g y g G r a v i t y H E n t h a l p y I I o n i c s t r e n g t h K E q u i l i b r i u m c o n s t a n t m M o l a l i t y o f a n aqueous species N T o t a l n u m b e r o f mo les o f a species, s o l i d , gas o r c o m p o n e n t n N u m b e r o f mo les o f a s o l i d , aqueous species o r gas P Pressu re Q S o u r c e / s i n k t e r m ? Spec i f i c d i scha rge R G a s c o n s t a n t s E n t r o p y s Sur face a rea T T e m p e r a t u r e V V o l u m e X M o l e f r a c t i o n o f an e n d m e m b e r z C h a r g e o n an i o n a C o e f f i c i e n t o f t h e r m a l e x p a n s i o n C o e f f i c i e n t o f l o n g i t u d e n t a l d i s p e r s i v i t y a T C o e f f i c i e n t o f t r a n s v e r s e d i s p e r s i v i t y P C o e f f i c i e n t o f i s o t h e r m a l c o n t r a c t i o n 1 A c t i v i t y coe f f i c ien t e D i e l e c t i c c o n s t a n t V D y n a m i c v i s c o s i t y 6 P o r o s i t y X R a d i o a c t i v e decay c o n s t a n t V S t o i c h i o m e t r i c coe f f i c ien t o f c o m p o n e n t i n phase i P r o g r e s s v a r i a b l e p D e n s i t y a R a t e o f d e c o m p o s i t i o n T T i m e U) B o r n coe f f i c ien t v i i i A c k n o w l e d g e m e n t s T h i s thes is c o u l d have neve r b e e n w r i t t e n w i t h o u t t h e s u p p o r t , p a t i e n c e a n d e n c o u r a g e m e n t o f m y w i f e , L a u r i e . T h r o u g h t h e yea rs , b o t h D r . T . H . B r o w n a n d D r . H . J . G r e e n w o o d have c o m m e n t e d o n a n d d iscussed i n d e t a i l t o p i c s t h a t I have b e e n i n t e r e s t e d i n . T h e y have c r i t i c i z e d w h e n necessary, a n d h e l p e d w h e n e v e r n e e d e d . I d e e p l y a p p r e c i a t e a l l t h a t t h e y have d o n e . I w o u l d l i ke t o a c k n o w l e d g e t h e - C o m p u t i n g C e n t e r a t t h e U n i v e r s i t y o f B r i t i s h C o l u m b i a , V a n c o u v e r , B C , C a n a d a , - R e c h e n z e n t r u m , E T H , Z u r i c h , S w i t z e r l a n d , - Z e n t r u m f u r i n t e r a k t i v e s R e c h n e n , E T H , Z u r i c h , S w i t e r l a n d , - I n s t i t u t f u r M i n e r a l o g i e u n d P e t r o g r a p h i e , E T H , Z u r i c h , S w i t z e r l a n d , f o r t h e use o f t h e i r c o m p u t i n g f a c i l i t i e s . E x c l u d i n g t h e f i gu res , t h e p r o g r a m a n d t h e d a t a I / O l i s t i n g s , a l l t e x t was p rocessed u s i n g T^ jX , w h i c h r e d u c e d t h e n i g h t m a r e o f typesetting e q u a t i o n s a n d t e x t t o an a l m o s t p l e a s u r a b l e e x p e r i e n c e . ix 1. I n t r o d u c t i o n In any regional or local flow system, the fluid can react with the surrounding media. These re-actions are manifested by the spatial and temporal distribution of phases and by the spatial and temporal variation in the composition of the phases and the fluid. Rock/water interactions can perturb the local temperature and flow fields and are one of the controlling factors in the rate of migration of chemical components. Geological examples are abundant: weathering, hydrothermal alteration, diagensis, metasomatism and ore deposition are familiar results of such processes. There are many examples of mathematical and numerical analysis for heat flow in solid media, fluid flow in porous/fractured media and coupled heat and fluid flow in porous media using various differ-ent boundary conditions. For example, the classic book of Bear (1972) presents and discusses the equations for both fluid flow and coupled heat-fluid flow in porous media. Numerical analysis of coupled flow processes has been applied to regional ground water flow (for example, Domenico and Palciauskas, (1973)), geothermal areas (for example, Straus and Schubert (1977), Sorey (1978)) and porphyry copper environments (for example, Norton and Knight (1977), Norton (1978)). Because of the increasing problem of chemical and nuclear waste disposal and the potential problem of contaminating existing flow systems, considerable attention has been paid to the mi-gration of chemical species in ground water. A few of the many papers discussing the various aspects of the contaminant transport problem include those by Bredehoeft and Pinder (1973), Pin-der (1973), Schwartz and Domenico (1973), Pickens and Lennox (1976), Konikow (1977), Pickens and Grisak (1979), Charbeneau (1981), Chu and Sposito (1981), Rao, Portier and Rao (1981), Smith and Schwartz (1981), Tang, Frind and Sudicky (1981), in addition to the numerous technical reports generated by the various atomic waste disposal groups. With the exceptions of Norton (1978, 1979, 1982, 1984), Norton and Knight (1977) and Lichtner (1985), authors discussing the redistribution of mass generally limit themselves to near-surface iso-thermal conditions where the aqueous species and the solid phases are considered to be inert, or, a retardation factor is used to approximate the chemical reactions between the aqueous species and the surrounding matrix. Norton, and Norton and Knight have discussed the coupling of heat flow, fluid flow and chemical reactions for large systems in the vicinity of intrusive bodies and have assessed the critical factors constraining these 1 processes u n d e r h y d r o t h e r m a l c o n d i t i o n s . L i c h t n e r (1985) has p r e s e n t e d a m a t h e m a t i c a l a n d t h e r -m o d y n a m i c c o n s i s t e n t m o d e l c o u p l i n g a d v e c t i v e t r a n s p o r t , d i f f u s i o n a n d c h e m i c a l r e a c t i o n s . H i s m o d e l is i s o - t h e r m a l a n d i s o - b a r i c b u t c a n be eas i ly m o d i f i e d t o i n c l u d e t h e ef fects o f p ressu re a n d t e m p e r a t u r e ( p e r s o n a l c o m m u n i c a t i o n ) . E q u i l i b r i u m t h e r m o d y n a m i c s has b e e n used b y p e t r o l o g i s t s f o r m a n y years t o c a l c u l a t e e q u i l i b r i a b e t w e e n m i n e r a l s a n d a f l u i d a t e l e v a t e d t e m p e r a t u r e s a n d pressures a n d t o d e l i m i t t h e c o n d i t i o n s o f f o r m a t i o n o f v a r i o u s phases a n d assemblages . I n a d d i t i o n , t h e q u a l i t a t i v e e s t i m a t i o n o f t h e a m o u n t s a n d d i s t r i b u t i o n o f phases i n a r o c k a l l o w p e t r o l o g i s t s t o suggest t h e poss ib le r e a c t i o n s t h a t t h e phases i n t h e r o c k have u n d e r g o n e . I n o p e n s y s t e m s , espec ia l l y those t h a t c o n t a i n s i g n i f i c a n t a m o u n t s o f a fluid, t h e e x t e n t a n d n a t u r e o f t h e r e a c t i o n s are v e r y d i f f i c u l t t o d e l i m i t w i t h a n y degree o f c o n f i d e n c e . B e g i n n i n g i n t h e la te s i x t i es , a n u m b e r o f a u t h o r s b e g a n t o m a t h e m a t i c a l l y m o d e l c h e m i c a l r e a c t i o n s i n i d e a l c losed s y s t e m s i n o r d e r t o p l a c e c o n s t r a i n t s o n n a t u r a l ana log ies . C a l c u l a t e d e x a m p l e s i n c l u d e ; weathering—Helgeson, G a r r e l s a n d M a c k e n z i e (1969), F o u i l l a c et a l . (1976), P f e i f e r (1977, 1981); geothermal areas—Capuano a n d Co le (1982); ore deposition—Helgeson (1970), V i l l a s a n d N o r t o n (1977); reaction of a vault fluid with different several rock types—Wolery (1980); supergene alteration—Kwong, B r o w n a n d G r e e n w o o d , (1982). T h e success o f these s i m u l a t i o n s has s h o w n t h a t m a n y g e o c h e m i c a l processes c a n be m o d e l l e d b y a m a t h e m a t i c a l a p p r o a c h , l e a d i n g t o a b e t t e r u n d e r s t a n d i n g o f n a t u r a l s y s t e m s . T h e r e have b e e n t h r e e d i s t i n c t n u m e r i c a l a p p r o a c h e s t o t h e m o d e l l i n g o f c h e m i c a l r e a c t i o n s i n g e o c h e m i c a l s y s t e m s ; t h e d i s t r i b u t i o n o f species m e t h o d , t h e d e r i v a t i v e m e t h o d , a n d t h e c o n t i n u u m m e t h o d . O f t h e t h r e e m e t h o d s , o n l y t h e c o n t i n u u m m e t h o d was i n i t i a l l y a n d e x p l i c i t l y d e v e l o p e d f o r a n o p e n s y s t e m , n o n e were d e v e l o p e d f o r s y s t e m s u n d e r g o i n g changes i n t e m p e r a t u r e a n d p r e s s u r e . T h e d i s t r i b u t i o n o f species m e t h o d w a s f i r s t used b y G a r r e l s a n d M a c k e n z i e (1967), w h o s i m u -l a t e d t h e e v a p o r i t i c c o n c e n t r a t i o n o f s p r i n g w a t e r . T h e y so l ved t h e mass b a l a n c e a n d mass a c t i o n e q u a t i o n s f o r a series o f b u l k c o m p o s i t i o n s w h e r e each b u l k c o m p o s i t i o n w a s r e l a t e d t o t h e p r e v i o u s -> one b y t h e r e m o v a l o f a s m a l l a m o u n t o f w a t e r . I f t h e fluid was s u p e r s a t u r a t e d w i t h respec t t o a s o l i d p h a s e , a s m a l l a m o u n t o f t h i s phase w o u l d b e p r e c i p i t a t e d , i f t h e fluid was u n d e r - s a t u r a t e d w i t h r e s p e c t t o a s o l i d phase , a s m a l l a m o u n t w o u l d be d i sso l ved i n t o t h e fluid. T h e m e t h o d is n o n - l i n e a r a n d i t e r a t i v e b u t has t h e d i s t i n c t a d v a n t a g e t h a t i t is easy t o u n d e r s t a n d a n d p r o g r a m . I t has b e e n r e - e x a m i n e d i n m o r e d e t a i l s ince t h e w o r k o f G a r r e l s a n d M a c k e n z i e . K a r p o v , K a y ' m i n a n d K a s h i k (1973) p r e s e n t e d i t i n t h e R u s s i a n l i t e r a t u r e , w h i l e P a r k h u r s t , P l u m m e r a n d T h o r s t e n s o n (1978, 2 1980), Wolery (1979) and Read (1982) have developed more general and efficient algorithms. The derivative method was developed by Helgeson who recognized that the changes in the amount and composition of phases during a reaction could be modelled as a expansion in the derivatives taken with respect to reaction progress. In a series of theoretical papers, (Helgeson (1968), Helgeson (1970a,b), Helgeson, Brown, Nigrini and Jones (1970), Helgeson (1971)), Helgeson discusses the equations and implications of this technique, and presents the results of different iso-thermal iso-baric processes that he and his co-workers modelled. Subsequent development of this approach has been limited: Fouillac, Michard and Bocquier (1976) discussed the modifications necessary to model a partially open system while Perkins (1980) corrected some conceptual errors in the equations and presented a more efficient numerical algorithm. The continuum model of Lichtner couples the first derivatives of the molalities of the aqueous species and of the number of moles of solid phases with respect to time directly to the transport equations. This allows a rapid coupled solution of the equations but restricts the step size. It currently has not been extended to systems with thermal or pressure gradients. Kinetic equations for solid phases are very easily included. The distribution of species method and the derivative method are complementary. For large complex unconstrained problems when only limited information about the process is needed, the distribution of species method can be very efficient. The derivative approach analytically solves the reaction coefficients at each time step, thus knowledge of the reaction is more detailed. With the exception of this thesis, neither method has proven to be successful in modelling an open system. The extent to which a phase or assemblage has undergone a reaction is given by the progress variable, initially defined by DeDonder (1920) and formalized by Prigogine and Defay (1954). It was first related to geochemical systems by Helgeson (1968). The progress variable relates the degree of reaction to the forces which cause the reaction—dissolution of phases not in equilibrium with the fluid, changes in temperature and/or pressure, etc. With the exception of Lichtner, none of the authors modelling reactions involving a fluid have related the progress variable to time. This is a direct result of the rather limited kinetic information known at the time these models were developed. There has been considerable work in the last few years relating reaction progress to time. Kinetic equations describing the dissolution rates of silicates with specific reference to the progress variable have been developed by Aagaard and Helgeson (1982), Helgeson and Murphy (1983) and Murphy and Aagaard (1984). Their models are functions of surface area and reaction affinity. Other approaches 3 to the rate at which silicate reactions occur relate directly to functions of time and bypass the progress variable. Lasaga (1984) in a review paper summarizes many of the different models and discusses the effect of grain size on reaction rate. This thesis develops the equations constraining chemical reactions in an open system and couples the partial differential equations constraining heat flow, fluid flow and mass transport to them. Modification of the transport, heat and flow equations was necessary and is discussed in separate chapters. All equations have been specifically developed for porous media, fluid flow in fractured media or multi-phase flow is beyond the scope of this work. Using the equations, a computer program has been written to calculate chemical reactions in a flow system with thermal and compositional gradients. A description of the program, a program listing, sample input data, and a partial listing of the output are given in the appendices. The program has been used to model several rock-water systems and the results are briefly discussed at the end of this thesis. Fluid flow in the program is considered to occur as a direct result of fluid potential and not as a direct result of density, temperature or chemical gradients. However, the spatial and temporal changes in density, temperature and fluid composition will modify the fluid potential, thus indirectly affecting the fluid flow. The numerical method used is based on the derivative method and the driving forces will include temperature, pressure, dissolution of phases not in equilibrium with the system, radioactive decay and addition or removal of mass from the system. 4 2. Description of the P r o b l e m T o m a t h e m a t i c a l l y d e s c r i b e t h e c h e m i c a l processes o c c u r r i n g i n a v o l u m e o f r o c k , t h e i n t e n s i v e a n d e x t e n s i v e p r o p e r t i e s ( t e m p e r a t u r e , p ressure , p o r o s i t y , b u l k c o m p o s i t i o n , . . . ) m u s t be a n average over t h e v o l u m e e l e m e n t . T h i s v o l u m e e l e m e n t m u s t be la rge c o m p a r e d t o t h e d i m e n s i o n o f t h e i n d i v i d u a l p o r e s a n d m i n e r a l g r a i n s . I f t h e s y s t e m is n o t c losed , t h e n each v o l u m e e l e m e n t m u s t b e s m a l l c o m p a r e d t o t h e t o t a l d i m e n s i o n s o f t h e s y s t e m as w e l l as b e i n g s m a l l e r t h a n t h e large-sca le h e t e r o g e n e i t i e s . T h e v o l u m e e l e m e n t c o r r e s p o n d s d i r e c t l y t o t h e r e p r e s e n t a t i v e e l e m e n t a r y v o l u m e ( R E V ) as d e f i n e d b y B e a r ( 1 9 7 2 ) . I n a n y g i v e n v o l u m e o f r o c k , o n l y t w o t y p e s o f phases w i l l b e c o n s i d e r e d — c r y s t a l l i n e phases a n d a fluid p h a s e . T h e c r y s t a l l i n e phases can be s e p a r a t e d i n t o t w o sets : t hose i n e q u i l i b r i u m w i t h t h e fluid a n d t h o s e n o t . T h e s e w i l l be r e f e r r e d t o as e q u i l i b r i u m phases a n d r e a c t a n t phases , r e s p e c t i v e l y . 1 T h e fluid phase is c o m p o s e d p r e d o m i n a t e l y o f w a t e r w i t h d i s s o l v e d m a t e r i a l i n t h e f o r m o f c h a r g e d a n d n e u t r a l aqueous species a n d c o m p l e x e s . T h e fluid phase c a n be a s s u m e d t o be i n i n t e r n a l e q u i l i b r i u m because t h e r e a c t i o n t i m e s b e t w e e n m o s t aqueous species a n d c o m p l e x e s i n s o l u t i o n are o n t h e o r d e r o f m i l l i s e c o n d s . E q u i l i b r i u m phases w i l l d i sso lve i n t o o r p r e c i p i t a t e o u t o f s o l u t i o n as t h e c o m p o s i t i o n o f t h e fluid changes . T h e r a t e s o f these r e a c t i o n s are m u c h s lower t h a n t h e r e a c t i o n r a t e s i n v o l v e d i n t h e i n t e r n a l e q u i l i b r i a o f a fluid, b u t are g e n e r a l l y m u c h f a s t e r t h a n t h e r a t e a t w h i c h r e a c t a n t phases d isso lve . T h u s , i t w i l l be a s s u m e d t h a t t h e fluid phase a n d t h e e q u i l i b r i u m phases rep resen ts a s t a b l e e q u i l i b r i u m assemblage. T h i s i m p l i e s t h a t r e a c t i o n r a t e s f o r t h e e q u i l i b r i u m phases are t h e same as t h o s e f o r t h e a q u e o u s species. I t also i m p l i e s t h a t t h e f l u i d c a n n e v e r be s u p e r s a t u r a t e d w i t h respec t t o a n y m i n e r a l even t h o u g h a s m a l l degree o f s u p e r s a t u r a t i o n is necessary as t h e d r i v i n g fo rce f o r p r e c i p i t a t i o n . R e a c t a n t phases are t h o s e w h i c h t h e fluid is u n d e r s a t u r a t e d w i t h r e s p e c t t o . T h e r a t e at w h i c h t h e r e a c t a n t phases d isso lve i n t o a fluid is a f u n c t i o n o f t h e i r su r face a rea , t h e degree o f u n d e r s a t u r a t i o n o f t h e fluid w i t h respec t t o t h a t p h a s e , t e m p e r a t u r e , a n d t o a lesser e x t e n t , p r e s s u r e . A r e a c t a n t p h a s e w i l l b e c o m e a n e q u i l i b r i u m phase w h e n t h e fluid s a t u r a t e s w i t h r e s p e c t t o i t . 1 E q u i l i b r i u m phases have o f t e n b e e n r e f e r r e d t o as p r o d u c t phases i n t h e l i t e r a t u r e . 5 T h e p e r t u r b a t i o n o f an e q u i l i b r i u m assemblage b y changes i n t e m p e r a t u r e , changes i n p ressu re , d i s s o l u t i o n o f r e a c t a n t phases i n t o t h e fluid, t r a n s p o r t o f m a t e r i a l i n t o / o u t o f t h e v o l u m e e l e m e n t a n d r a d i o a c t i v e decay c a n be expressed t h r o u g h t h e use o f a series e x p a n s i o n i n t h e n u m b e r o f mo les o f each phase a n d species. F o r e x a m p l e , t h e c h a n g e i n t h e n u m b e r o f m o l e s o f a phase o r species ( n ) over a t i m e i n t e r v a l ( A r ) c a n be exp ressed u s i n g a T a y l o r series as: A d n ( A T ) 2 d 2 n (ArP d ' n ^ = ^ + A x - + L _ i - ^ + . . . + ^ - — . (1) d is t h e t o t a l d e r i v a t i v e . O n e s u c h e x p a n s i o n i n t h e n u m b e r o f m o l e s a n d t h e d e r i v a t i v e w i t h respec t t o t i m e c a n be w r i t t e n f o r each phase a n d species i n t h e s y s t e m . E a c h o f t h e d e r i v a t i v e s can be e x p a n d e d as f u n c t i o n s o f t h e i n t e n s i v e a n d e x t e n s i v e p r o p e r t i e s w h i c h a f fec t t h e s y s t e m . Fo r e x a m p l e , a n e x p a n s i o n o f t h e first d e r i v a t i v e c o u l d y i e l d : dn dn dT dn dP dn dNx.c dn 9nr . . d7 ~ d~f ~d7 + ~9P !h + ^ 9NTc 9T + ^ 3 ^ ~ 3 7 ' ^' c=l ' r=l T h e f i r s t a n d t h e s e c o n d t e r m s o n t h e r i g h t h a n d s ide are t h e c h a n g e i n t h e n u m b e r o f mo les as f u n c t i o n s o f t e m p e r a t u r e (T) a n d p r e s s u r e ( P ) , r e s p e c t i v e l y . T h e t h i r d t e r m o n t h e r i g h t h a n d s ide is t h e change i n t h e n u m b e r o f mo les as a r e s u l t o f a c h a n g e i n t h e t o t a l n u m b e r o f mo les o f t h e c ' t h c o m p o n e n t (NT.C)—the r e s u l t o f mass flux a n d p o s s i b l y as a r e s u l t o f r a d i o a c t i v e decay. T h e las t t e r m o n t h e r i g h t - h a n d s ide is t h e c h a n g e i n t h e n u m b e r o f m o l e s as a f u n c t i o n o f t h e i r r e v e r s i b l e d i s s o l u t i o n o f r e a c t a n t phases i n t o t h e fluid.2 I f o t h e r i n t e n s i v e v a r i a b l e s , f o r e x a m p l e t h e m a g n e t i c field, c o u l d p o s s i b l y a f fect t h e s y s t e m , t h e n an a d d i t i o n a l d e r i v a t i v e f o r each o f these n e w i n t e n s i v e v a r i a b l e s s h o u l d be i n c l u d e d i n e q u a t i o n (2). C o n v e r s e l y , i f a n y o f t h e d e r i v a t i v e s i n e q u a t i o n (2) are zero a n d w i l l r e m a i n zero t h r o u g h o u t t h e e n t i r e p rocess , t h e n t h e e n t i r e t e r m c a n be e x c l u d e d , s i m p l i f y i n g t h e m o d e l l i n g . T h e d e r i v a t i v e s o f t h e n u m b e r o f m o l e s w i t h r e s p e c t t o t i m e i n e q u a t i o n (1) can be so lved b y t a k i n g a n d m a n i p u l a t i n g d e r i v a t i v e s o f t h e mass b a l a n c e a n d mass a c t i o n e q u a t i o n s . T h e s e e q u a t i o n s are d e v e l o p e d i n c h a p t e r s 4 a n d 5, a n d a m e t h o d o f s o l u t i o n d i scussed i n c h a p t e r 6. T h r e e n e w t e r m s (dP/dr, dNx.c/dr a n d dT/dr) are i n t r o d u c e d as t h e r e s u l t o f e x p a n s i o n s s i m i l a r t o e q u a t i o n (2). T h e y c a n be so l ved u s i n g t h e r a d i o a c t i v e d e c a y l a w , t h e fluid flow, mass t r a n s p o r t a n d h e a t flow e q u a t i o n s . T h e s e are d iscussed i n c h a p t e r s 4, 7, 8 a n d 9, r e s p e c t i v e l y . 2 M o r e c o r r e c t l y , t h i s las t t e r m c o u l d b e t h o u g h t o f as t h e r e a c t i o n o f s u b s y s t e m s w h i c h m a y o r m a y n o t be i n i n t e r n a l e q u i l i b r i u m at t h e s p e c i f i e d c o n d i t i o n s w i t h a s u b s y s t e m w h i c h is i n i n t e r n a l e q u i l i b r i u m a t t h e spec i f i ed c o n d i t i o n s . Higher order terms in equation 1 can be evaluated and expanded in a similar fashion as was done to obtain equation 2. When more high order terms are evaluated, a larger time step can be taken. Although a Taylor series was used for equation (1), this does not imply that it is the only applicable expansion. A Taylors series is an exact description of any continuous function when sufficient derivatives are used. When only a limited number of derivatives are available, other expansions of the same order may be able to approximate the true function to a greater degree of accuracy. 7 8. Components I n a s t r i c t t h e r m o d y n a m i c sense, a set o f c o m p o n e n t s re fe rs t o t h e set o f i n d e p e n d e n t bas is v e c t o r s t h a t c o m p l e t e l y s p a n t h e c o m p o s i t i o n a l space o f t h e s y s t e m . E a c h c o m p o n e n t has a u n i q u e c o m p o s i -t i o n w h i c h m a y be i d e n t i c a l t o t h e c o m p o s i t i o n o f a phase o r species i n t h e s y s t e m . T h e c o m p o s i t i o n o f a c o m p o n e n t n e e d n o t c o r r e s p o n d t o a r e a l phase or species, a n i m a g i n a r y o r n e g a t i v e c o m p o s i t i o n is p e r f e c t l y v a l i d . I n a d d i t i o n , t h e c o m p o n e n t m a y be ass igned i d e n t i c a l t h e r m o d y n a m i c a n d p h y s i -c a l p r o p e r t i e s as a phase o r species. T h i s does n o t i m p l y t h a t t h e phase o r species is a c o m p o n e n t , r a t h e r t h a t t h e i r p r o p e r t i e s are i d e n t i c a l . A phase or species w i l l a lways have t h e same a c t i v i t y as a c o m p o n e n t w i t h i d e n t i c a l p r o p e r t i e s ; h o w e v e r , t h e n u m b e r o f mo les o f t h a t phase o r species w i l l g e n e r a l l y be d i f f e r e n t t h a n t h e n u m b e r o f mo les o f t h e c o r r e s p o n d i n g c o m p o n e n t . T h e n u m b e r o f m o l e s o f a n y phase or species is a l w a y s ze ro o r p o s i t i v e , t h e n u m b e r o f mo les o f a c o m p o n e n t m a y b e n e g a t i v e , ze ro o r p o s i t i v e . T h e m i n i m u m n u m b e r o f c o m p o n e n t s needed t o d e s c r i b e a n y r e a l s y s t e m is one . T h e m a x i m u m n u m b e r o f c o m p o n e n t s d e p e n d s o n seve ra l f a c t o r s : t h e n u m b e r o f e lemen ts p r e s e n t , i f m u l t i p l e o x i d a t i o n s ta tes o r c h a r g e d species are p r e s e n t , i f c o m p o s i t i o n a l d e p e n d e n c i e s are p r e s e n t a n d i f m o r e t h a n one i s o t o p e ex is ts f o r a n y e l e m e n t . I n a n y f l u i d - r o c k s y s t e m c o m p o s e d of e l e m e n t s w i t h a u n i q u e i s o t o p i c c o m p o s i t i o n , t h e m a x i m u m n u m b e r o f c o m p o n e n t s is t h e n u m b e r o f e l e m e n t s p l u s one . I f o n l y one o x i d a t i o n s t a t e ex is ts f o r each e l e m e n t , t h e m a x i m u m n u m b e r o f c o m p o n e n t s is e q u a l t o t h e n u m b e r o f e l e m e n t s . I f m o r e t h a n one i s o t o p e ex i s t s f o r a g i ven e l e m e n t , a n d t h e i r c h e m i c a l b e h a v i o u r is s i g n i f i c a n t l y d i f f e r e n t , t h e n t h e y m u s t b e t r e a t e d i n d e p e n d e n t l y . Because t h e p resence o f a r a d i o g e n i c o r r a d i o a c t i v e i s o t o p e r e s u l t s i n a n a d d i t i o n a l c o m p o n e n t w h i c h is d e p e n d e n t o n t i m e , t i m e m u s t b e i n c l u d e d as an i n t e n s i v e v a r i a b l e . T o m i n i m i z e t h e numerical roundoff error, s i m p l i f y t h e e q u a t i o n s a n d t h e m e t h o d o f s o l u t i o n , t h e c o m p o n e n t bas is w i l l b e c o m p r i s e d o f c o m p o n e n t s w i t h c o m p o s i t i o n a l a n d t h e r m o d y n a m i c p r o p -e r t i es i d e n t i c a l t o t h e e q u i l i b r i u m phases a n d w a t e r . T h e r e m a i n i n g c o m p o n e n t s w i l l have c o m p o s i -t i o n a l a n d t h e r m o d y n a m i c p r o p e r t i e s i d e n t i c a l t o t h e m o s t a b u n d a n t i n d e p e n d e n t aqueous species. C h a n g i n g f r o m one c o m p o n e n t bas is t o a n o t h e r c a n b e d o n e b y s i m p l e m a t r i x m a n i p u l a t i o n s . W h e n t h e a c t i v i t y o r t h e n u m b e r o f mo les o f each c o m p o n e n t is k n o w n fo r a g i v e n t e m p e r a -8 ture and pressure, then the activities of all species, complexes and phases in the system are fixed. Various authors have taken advantage of this in geochemical modelling, for example: Brown and Skinner (1974) in the prediction of equilibrium phase assemblages, Wolery and Walters (1975) in the Monotone Sequence method of distribution of species, Perkins (1980) in mass transfer theory. The number of independent solute transport equations needed to completely describe the migration of chemical species in a flow system is also equal to the number of components. This is discussed in more detail below. 9 4. T h e r m o d y n a m i c Bas i s o f t h e C o n s t r a i n i n g E q u a t i o n s A t a n y g i v e n t e m p e r a t u r e , p ressure a n d c o m p o s i t i o n , t h e d i s t r i b u t i o n o f mass a m o n g t h e phases a n d species i n a n e q u i l i b r i u m s y s t e m is c o m p l e t e l y d e t e r m i n e d a n d c a n be c a l c u l a t e d u s i n g t h e mass a c t i o n a n d mass b a l a n c e e q u a t i o n s . T h e t e m p e r a t u r e , t h e p ressure a n d t h e c o m p o s i t i o n o f t h e e q u i l i b r i u m s y s t e m m a y c h a n g e as a f u n c t i o n o f t i m e , p o t e n t i a l l y c h a n g i n g t h e d i s t r i b u t i o n o f mass a m o n g t h e phases a n d species. T h i s c h a n g e i n t h e d i s t r i b u t i o n o f mass c a n be so l ved b y t a k i n g t h e d e r i v a t i v e s w i t h r e s p e c t t o t i m e o f t h e c o n s t r a i n i n g e q u a t i o n s , s o l v i n g t h e m , a n d u s i n g these d e r i v a t i v e s i n a series e x p a n s i o n t o p r e d i c t t h e n u m b e r o f mo les at f u t u r e t i m e s . T h e d e r i v a t i v e s o f t h e m a s s b a l a n c e a n d m a s s a c t i o n e q u a t i o n s w i t h r e s p e c t t o t i m e w i l l b e d i scussed s e p a r a t e l y . A s these e q u a t i o n s are d e r i v e d , t e r m s w i l l a p p e a r w h i c h c a n o n l y b e e v a l u a t e d b y t h e use o f e m p i r i c a l a n d s e m i - e m p i r i c a l m o d e l s o r b y t h e a p p l i c a t i o n o f m o d e l - d e p e n d e n t b o u n d a r y c o n d i t i o n s . T h e s e w i l l be d i scussed a n d e v a l u a t e d i n t h e f o l l o w i n g c h a p t e r s . T h e M a s s B a l a n c e E q u a t i o n T h e r e are nc i n d e p e n d e n t mass ba lance e q u a t i o n s , one fo r each o f t h e c o m p o n e n t s . E a c h mass b a l a n c e e q u a t i o n expresses t h e t o t a l n u m b e r o f m o l e s o f t h e c ' t h c o m p o n e n t (NT.C) as a s u m o f t h e n u m b e r o f m o l e s o f t h e c ' t h c o m p o n e n t i n each o f t h e phases , aqueous species a n d c o m p l e x e s i n t h e v o l u m e e l e m e n t . I t c a n be " w r i t t e n as: w h e r e nr, ns, np a n d ei are t h e n u m b e r o f r e a c t a n t phases , n u m b e r o f aqueous species a n d c o m p l e x e s , n u m b e r o f e q u i l i b r i u m phases a n d n u m b e r o f e n d m e m b e r s o f t h e i^th e q u i l i b r i u m phase , r e s p e c t i v e l y . n„, nr, n , j t are t h e n u m b e r o f mo les o f t h e s ' t h a q u e o u s species, o f t h e r ' t h r e a c t a n t m i n e r a l a n d o f t h e k'ih e n d m e m b e r o f t h e i'th. m i n e r a l , r e s p e c t i v e l y . vc.s, v0.T a n d vc.i.k are t h e n u m b e r o f mo les o f t h e c ' t h c o m p o n e n t i n one m o l e o f t h e s ' t h a q u e o u s spec ies , i n one m o l e o f t h e r ' t h r e a c t a n t phase a n d i n one m o l e o f t h e k'th e n d m e m b e r o f t h e i ' t h e q u i l i b r i u m phase , r e s p e c t i v e l y . I n a s t o i c h i o m e t r i c p h a s e , t h e n u m b e r o f e n d m e m b e r s is one . T h u s t h e first t e r m o n t h e r i g h t - h a n d s ide o f t h e mass b a l a n c e e q u a t i o n r e p r e s e n t s t h e aqueous species, t h e s e c o n d a n d t h i r d r e p r e s e n t t h e s o l i d phases i n (3) 10 equilibrium with the fluid (equilibrium phases) and those not in equilibrium with the fluid (reactant phases), respectively. The molality of an aqueous species (m„) is related to the total number of moles of that species (ns) by: ms = 55.51— (4) n„ nw is the number of moles of water and 55.51 the number of moles of water in one thousand grams of water.3 By substituting equation (4) for the number of moles of each aqueous species, the mass balance equation can be written in terms of the molalities of aqueous species and number of moles of solid phases. It is: N T - O = Y "55 51 ' + Y Y yo.i.kni.k + Yl V<-rnr (5) 9 = 1 ' t'=l fc=l r=l Equation (5) is more useful than equation (3) for several reasons. • • The reported analytical results of most waters are given in units relative to a fixed mass or volume of solvent or to a fixed mass or volume of water. It is simple to convert these to molalities. • Because of the standard state conventions used, molality is easily equated to activity. The derivative of the mass balance equation (equation 5) with respect to time is: j »r ns „ . ns ~ np ei « nr 3 -5^ = 2 . - 5 5 1 1 — a T " + Y - ^ i r ^ r + Y Y ^ - j ^ + Y ^ ^ (6) 9 = 2 « = 1 i=l fc=l r=l The derivatives of the molalities of the aqueous species have been written as a logarithmic derivatives through the use of the relationship dx = xd ln x = 2.303 xd log x. For convenience, the convention that water is always the first aqueous species will be followed. The number of moles of water per one thousand grams of water is a constant and its derivative zero. Thus the first term in equation (6), the derivative of the molality of the aqueous species, is summed from s = 2 and not from s = 1. The second term, the derivative of the number of moles of water, is summed from s = 1 to include the change in the total number of moles of water and its effects on all aqueous species, including solvent water. The first three terms on the right-hand side contain derivatives of the molalities of the aqueous species, of the number of moles of water and of the number of moles of each of the equilibrium 3 The actual value is closer to 55.50825 but 55.51 will be used for brevity. 11 phases with respect to time. They will be solved and used to predict the change in the number of moles of each phase and species in the volume element once the remaining constraining equations have been developed. The derivative in the last term on the right-hand side is the change in the number of moles of the reactant minerals with respect to time. This term depends on the composition of the fluid in the volume element, the volume of the reactant minerals and their surface area. It can be solved using semi-empirical models and is discussed in chapter 5. The left-hand side of equation (6) is the change in the number of moles of the c'th component with respect to time. This derivative is a function of only two processes which can be assumed to be additive: • Mass flux into/out of the volume element, • Radioactive decay. Mass flux into/out of the volume element is an applied boundary condition or it can be calculated using the flow, solute transport and diffusion equations. The coupling of the flow and solute transport equations to the chemical reaction equations is discussed in chapters 7 and 8. The rate of decay of an radioactive isotope can be calculated using the decay constant (A) and the decay equation: ]Sr+Ar = NTe~XAT . (7) NT and ^ V T + A R are the number of moles of the isotope at time r and r +AT , respectively. In a closed system with radioactive components present, the left-hand side of equation (6) for a radioactive parent component would reduce to: ^ = -XNT.. (8) UT and for a daughter component, the left-hand side reduces to: d-^ = +XNT.c . (9) or For any non-radiogenic component in a closed system, the left-hand side of equation (6) reduces to: - ^ = 0 . (10) The energy released during the process of radioactive decay is easily included in the energy balance for a REV. Unfortunately, the exact amount of energy depends on the type of particles, the nature of their interaction with the surrounding matrix/fluid, and if their interaction causes any 12 chemical reactions to occur. In general, the amount of energy released during most decay processes in many different matrix materials is known, plus/minus an order of magnitude or two, and can be included. The change in mass of each of the components as a result of radioactive decay is potentially very easily included, see equation (9) for example. The problem is that there is no reasonable way to include the elementary particles released during a decay reaction—many are stable only for micro-seconds and their final form largely depends on the surrounding matrix. By ignoring their presence, changing amount and interaction with the other phases in the system, the mass and energy balance equations have been violated. Except under very unusual circumstances (for example, natural reactors4), the violation is local, affecting the rock matrix and the fluid a maximum of millimeters5 around the point of decay, and thus can be considered trivial. 4 Some fluid inclusions from the Okla natural reactor contain 95 percent hydrogen and 5 percent nitrogen, others contain 80 percent hydrogen and 20 percent oxygen. Clearly the only reasonable source for the hydrogen (and oxygen) was from the breakdown of water—introduced by interaction with the decay particles. This non-equilibrium assemblage is probably the most extreme example of decay affecting the surrounding fluid and minerals. J. Dubessy, personal communication. 5 The average length of the decay path of many particles is on the order of angstroms to 10's of microns. Those with a longer decay paths generally do not cause chemical reactions to occur. 13 T h e M a s s A c t i o n E q u a t i o n The activity of the s'th aqueous species can be related to the activity of the components through the mass action equation. For the s'th species, the mass action equation can be written: nc In K = v„ ln as + i/C9 ln ac (11) 0=1 where ac and a„ are the activities of the c'th component and the s'th species, respectively. i/cs and i/g are the reaction coefficients of the c'th component and the s'th species in the s'th reaction. Ks is the equilibrium constant for the reaction between the s'th aqueous species and the components. ys has been included for completeness but generally is equal to one. The relationship between the activity of a phase and the components is expressed using a mass action equation of identical form to equation (11), the subscript s is replaced by the subscript i to indicate the i'th phase. The relationship between the activity and the molality of an aqueous species is: o, = 7 „ m s (12) where 7 , , as and ms are the activity coefficient, activity and molality of the s'th species, respectively. Equation (11) does not differentiate between components with different types of properties. It can be rewritten such that np components have the same properties as the np equilibrium phases, one has the same properties as water, and the remaining components have the same properties as the most abundant independent aqueous species. Substituting equation (12), the relationship between molality and activity, into the rewritten form yields: l n J T , , , 1 = l n 7 „ + In ms + (13) vw.B In aw + ^2 ln 7 C + ^ i/c,s ln mc + ^ ^ y,j,k In aiA c=2 c=2 i=l k=l np is the number of equilibrium phases in the system, ncsp is the number of aqueous species repre-senting the remaining components. The subscript w indicates water. The molalities of the aqueous species are summed from c = 2 to allow water to be treated separately. Ji water does not represent a component, then the aqueous species terms must be summed from c = 1 and the water term is dropped. If the k'th endmember of the i'th equilibrium mineral does not have the same properties as a component, then iVt.fc (the coefficient of the &'th endmember of the i'th mineral in the s'th reaction) is zero, and a mass action equation similar to equation (11) can be used to calculate its activity. The mass action equation between a component and a phase or species with the same chemical and thermodynamic properties is trivial, the phase or species has the same activity as the component. 14 The activity of the k'th solid solution species (dk) in a ei-component solid solution mineral is given by: O-k — IkXk (14) (15) Y n i 3 = 1 where Xk and 7 ^ are the mole fraction and the activity coefficient of the &'th solid solution endmem-ber, respectively. Substituting equation (15) into equation (14) and the result into equation (13) yields a general form of the mass action equation, which can be written as: In if, , , 1 = kiis + In ms H ,,, ln aw + Y vc.s In 7 c + X ] m m c c-2 c=2 np ei r ei (16) »'=1 k=l L j=i If an equilibrium phase is stoichiometric—it has only one endmember, its activity coefficient is one and the logarithmic terms involving the number of moles of solid phases drops out. Equation (16) can be rewritten to describe the activity of the I'th non-component phase by substituting the subscript i for the subscript s. Differentiating equation (16) with respect to time yields: 1 dhiK <9hi79 3 ln m9 1 v * dr dr dr ua 5 . >^sp ln aw \ ^ vw.s—— V ) ,vc OT c=2 d ln 7 , . v—^ d ln m,. dr ^ np ei 1=1 fc=l 31n7,-,fc 1 drii.k 1 e i it i-^ 9 ra».y dr ' riik dr e i ^ dr Y 3 = 1 J '=I (17) The equilibrium constant can be expanded in terms of the thermodynamic variables of each phase and species in the reaction, yielding: , „ -AC APT - TASr , , h l K = - ^ f - = -RT <18> and taking its derivative with respect to time yields: d\nK AHr dT AV dP dr RT2 dr RT dr 15 (19) R is the gas constant, A C , ASr, AHr, and AV are the Gibbs free energy, the entropy, the enthalpy, and volume of reaction, respectively. As these terms are functions of temperature and pressure, they must be evaluated under the conditions of reaction. The thermodynamic variables and their derivatives are summarized in appendix one. Values for various phases and species can be obtained from standard compilations of thermodynamic data, for example: Robie, Hemingway and Fisher (1978), Helgeson, Delany, Nesbitt and Bird (1978) and Berman, Brown and Greenwood The derivatives of pressure and temperature with respect to time in equation (14) are either known boundary conditions or have been solved using the flow and heat equations presented in chapters 7 and 9. The derivatives of the activity coefficients of aqueous species and of solid phases and the derivative of the activity of water are model-dependent. They will be discussed in chapter 5. It is often necessary to simplify theoretical equations representing real systems, either because essential data may be missing or because the complete forms of the equations are too complex. The right-hand side of equation (17) can be simplified by several assumptions. The fluid phase in many geological systems is believed to be a concentrated brine and the removal/addition of small amounts of mass from/to the fluid will not significantly change the activity coefficients of the aqueous species. Under these conditions, the activity coefficients of aqueous species can be assumed to be constant and their derivatives zero. The activity of water varies from 1.0 in an infinitely dilute solution to approximately 0.95 in a 3 molal sodium chloride solution at 25 C—the magnitude of c hange is similiar at higher pressures and temperatures. For this reason, the activity of water can be assumed to be constant and its derivative zero under many geological situations. If the equilibrium phases can be represented by an ideal solid solution (activity coefficients constant and equal to one), then when combined with the above assumptions, equation (17) reduces to: (1985). (20) 16 Summary The total derivative of the mass balance equation and the mass action equation with respect to time (equations (6), (17) and (19)) introduces a large number of new terms which must be evaluated. These terms are model-dependent and will be discussed in chapters 5, 7, 8 and 9. If a variety of reasonable assumptions are made, the derivatives of both the mass balance and mass action equations can be reduced in complexity, leaving only the boundary conditions (dNx.c/dT/dr, dP/dr) to be specified. These assumptions allow complicated systems to be simplified to a sufficient degree such that they can easily be modelled. 17 5. Model-Dependent Equations T h i s c h a p t e r e v a l u a t e s t h e model-dependent d e r i v a t i v e t e r m s a n d i n t r o d u c e s t w o n e w c o n s t r a i n i n g e q u a t i o n s , b o t h o f w h i c h are t h e r e s u l t o f t h e spec i f i c m o d e l s u s e d . T h e t w o n e w e q u a t i o n s c o u l d b e d i r e c t l y s u b s t i t u t e d i n t o t h e d e r i v a t i v e o f t h e mass a c t i o n a n d t h e mass b a l a n c e e q u a t i o n s , b u t as s h o w n i n c h a p t e r 6, t h e i r i n t r o d u c t i o n as i n d e p e n d e n t e q u a t i o n s a l lows a m o r e e f f ic ient m a t h e m a t i c a l s o l u t i o n t o be u s e d . Act iv i ty Coefficients of Solid Solution Species T h e d e r i v a t i v e o f t h e mass a c t i o n e q u a t i o n ( e q u a t i o n 17) has i n t r o d u c e d t h e d e r i v a t i v e o f t h e a c t i v i t y o f each o f t h e s o l i d s o l u t i o n e n d m e m b e r s . T h e d e r i v a t i v e o f t h e n u m b e r o f mo les o f each o f t h e s o l i d s o l u t i o n e n d m e m b e r s w a s i n t r o d u c e d i n t h e d e r i v a t i v e o f t h e mass b a l a n c e e q u a t i o n . T o r e l a t e t h e d e r i v a t i v e o f m a s s a n d o f a c t i v i t y , a so l i d s o l u t i o n m o d e l f o r e v e r y phase w h i c h p o t e n t i a l l y c a n e x h i b i t s o l i d s o l u t i o n m u s t be assumed o r k n o w n . I f t h e a c t i v i t y o f a so l i d s o l u t i o n e n d m e m b e r is e q u a l t o i t s m o l e f r a c t i o n , t h e n t h e d e r i v a t i v e o f t h e a c t i v i t y is e q u a l t o t h e d e r i v a t i v e o f t h e m o l e f r a c t i o n , w h i c h i n t u r n c a n b e e q u a t e d t o t h e t o t a l n u m b e r o f m o l e s o f each e n d m e m b e r a n d t h e i r d e r i v a t i v e s . Tli YHi «'=1 ( \ ani -Xi i=l k J2n' k V U n f o r t u n a t e l y f e w s o l i d s o l u t i o n phases o b e y s u c h s i m p l e r e l a t i o n s h i p s . T h e r e are m a n y d i f f e r e n t s o l i d s o l u t i o n m o d e l s i n t h e l i t e r a t u r e . F o r each , a n e q u a t i o n c a n be w r i t t e n r e l a t i n g t h e d e r i v a t i v e o f t h e a c t i v i t y , m o l e f r a c t i o n a n d t h e n u m b e r o f m o l e s o f each e n d m e m b e r . F o r p u r p o s e s o f i l l u s t r a t i o n , t h e m o s t g e n e r a l m o d e l w i l l be u s e d . B a s e d o n a p o l y n o m i a l e x p a n s i o n o f t h e excess f ree e n e r g y o f a s o l i d s o l u t i o n , B e r m a n a n d B r o w n (1984) d e v e l o p e d a g e n e r a l e q u a t i o n t o c a l c u l a t e t h e a c t i v i t y 18 coe f f i c ien t o f t h e / ' t h s o l i d s o l u t i o n species i n a fc-component s o l i d s o l u t i o n . W h e n a t h i r d degree p o l y n o m i a l is u s e d t o d e s c r i b e a b i n a r y so l id s o l u t i o n p h a s e , t h e i r e q u a t i o n reduces t o t h e M a r g u l e s f o r m u l a t i o n f o r a b i n a r y a s y m m e t r i c so l id s o l u t i o n ( T h o m p s o n , 1967). T h e g e n e r a l e q u a t i o n f o r t h e a c t i v i t y coe f f i c ien t o f t h e / ' t h species g i v e n b y B e r m a n a n d B r o w n is : l n 7y = aRT (k-1 k k E E - . E ^i' l = l l2=>i *p = *fp — 1 i j > (=1 i ) I I X * 1=1 J) (21) w h e r e : •3) k=l a n d f o r n = 0, 0 r t = 1, f o r n > 0, 0" 0. p is t h e degree o f p o l y n o m i a l used i n t h e f u n c t i o n t o fit t h e d a t a . M^ , . i 3 ip is t h e i n t e r a c t i o n p a r a m e t e r b e t w e e n t h e s u b s c r i p t e d e n d m e m b e r s . T is t h e t e m p e r a t u r e , R t h e i d e a l gas c o n s t a n t a n d a t h e ^ u m b e r o f p o s s i l {<%-mixing s i tes . T h e d e r i v a t i v e <.{ e q u a t i o n (21) w i t h jrespec t^ ;o t i m e is: tRT2 E E - E «P q]l xi-(p--)I[ x^ aRT ( I «i = l i 3 = ii x'p=:'p_1 t ;=1 v V /k-l k k E E ' " ' E ••••«> ii = l is = ii ip = ip-i ( \ 1=1 JJ V < ? E h=l n k=i k^h dr ( p - i ) E h=l J i k=l \k^h J (22) J B y s u b s t i t u t i n g t h e d e f i n i t i o n o f m o l e f r a c t i o n ( e q u a t i o n 15) i n t h e above e q u a t i o n , t h e d e r i v a t i v e o f t h e a c t i v i t y coe f f i c ien t w i t h respec t t o t i m e c a n be w r i t t e n i n t e r m s o f t h e n u m b e r o f mo les o f each s o l i d s o l u t i o n e n d m e m b e r . D a t a ex is ts f o r m a n y so l i d s o l u t i o n m i n e r a l s , b u t g e n e r a l l y o n l y f o r b i n a r y o r p s e u d o - b i n a r y sec t i ons . F o r t h e p u r p o s e s o f c l a r i t y , s i m p l i c i t y a n d because o f t h e r e s t r i c t e d d a t a , e q u a t i o n (22) w i l l be w r i t t e n i n t e r m s o f a t h i r d degree p o l y n o m i a l , b i n a r y s o l i d s o l u t i o n ( a s y m m e t r i c b i n a r y s o l u t i o n u s i n g t h e t e r m i n o l o g y o f T h o m p s o n ) . S u b s t i t u t i n g e q u a t i o n (15) i n t o e q u a t i o n (22) a n d r e s t r i c t i n g t h e r e s u l t t o a t h i r d degree b i n a r y s o l u t i o n , y i e lds : d ln7i 1 dr + aRT2 XjX2 aRT XjX2 aRT W1122XLxl + Wl22X2(X2 - Xx) W1122X2(l - 3XX) - W1222X2{1 - 3Xi.) W1122X2{1 - 3Xi) - Wi222X2{l - 3XX) d l n ni dr d l n n2 (23) 19 The equation for the second endmember in a binary solid solution is identical in form, all subscripts "1" are replaced by "2" and all subscripts "2" are replaced by "1". The derivative of temperature with respect to time in equation (23) is known either as a boundary condition or calculated using the heat equation. The interaction parameters in equation (23) are independent of temperature, pressure and composition. Interaction parameters which vary as a function of temperature and pressure could be included in the above development; the resulting equation is more complex. If the strings " i " and "3 — i" are substituted for the subscripts "1" and "2", and the string k" is appended to all subscripts, then the notation used in equation (23) would be consistent with the notation used throughout the rest this thesis. Equation (23) can be substituted for the derivative of the activity coefficient of solid solution phases in the derivative of the mass action equation, equation (17), thus restricting all solids to be either stoichiometric or binary solid solution phases. This restriction could, of course, be removed by the substitution of equation (22) rather than equation (23) into equation (17) but insufficient data exists to make this a useful substitution. T h e A c t i v i t y C o e f f i c i e n t o f A q u e o u s Spec ies The derivative of the mass action equation (equation 17) has introduced the derivative of the activity coefficient of each aqueous species as another set of unknown variables. By taking the derivative of an equation which relates the activity coefficient to molality of the species, the derivative of the activity coefficient can be removed from equation (17), thus decreasing the number of unknowns. Helgeson et al. (1981) proposed that for a given temperature and pressure, the activity coefficient of the s'th neutral aqueous species could be approximated by: 7* = 1-0 (24) and the activity coefficient of the s'th charged aqueous species could be approximated by the following modification of the Debye-Huckel equation. -AZ2yA log 7 9 = '—-= + r + (ujab9bN<lCi + b N a + c l - - 0.19(abs(Zs) - 1)) I (25) 1 + a9Bvl I is the true ionic strength of the solution and is defined later below. A and B are Debye-Huckel equation electrostatic parameters and are defined below. uiabs is the absolute Born coefficient for the s'th aqueous species and is defined by equation (A-15) in appendix one. Zs is the charge on the s'th aqueous species. <zis the effectiv e electrostatic radius of the ith aqueous species. 6jv«C(and bNa+ci-are the solvation parameter and the short range interaction parameter for NaCl, respectively. They 20 Table I: Solvation Parameter for NaCl N a G l " 2.30ZRT where E is an entry in the table below, R is the gas constant, and T is the temperature in degrees kelvins. The values in the table have been taken from Helgeson et al., (1981). Pressure is in kilobars, the temperature is in degrees C. Sat refers to the pressure at that temperature along the critical curve of water. Parentheses indicate high uncertainty. Values have been multiplied by 103. Units are Kg/mole. Pressure T Sat 1 2 3 4 5 25 2.47 (2.58) (2.66) (2.72) (2.77) (2.82) 50 2.15 (2.28) (2.37) (2.45) (2.51) (2.56) 75 1.79 (1.95) (2.06) (2.15) (2.22) (2.28) 100 1.39 1.58 1.72 1.83 1.91 (1.99) 125 0.93 1.18 1.35 1.48 1.58 (1.67) 150 0.41 0.73 0.95 1.11 1.23 (1.33) 175 -0.18 0.25 0.51 0.72 0.86 (0.98) 200 -0.85 -0.28 0.04 0.29 0.47 (0.60) 225 -1.64 -0.86 -0.46 -0.15 0.05 (0.21) 250 -2.57 -1.50 -1.00 -0.63 -0.38 (-0.20) 275 -3.71 -2.20 -1.57 -1.13 -0.84 (-0.63) 300 -5.21 -2.99 -2.19 -1.67 -1.33 (-1.09) 325 -7.32 -3.88 -2.85 -2.24 -1.85 (-1.58) 350 -4.91 -3.58 -2.86 -2.40 (-2.10) 375 -6.11 -4.38 -3.52 -2.99 (-2.65) 400 -7.56 -5.26 -4.24 -3.63 (-3.25) 425 -9.31 -6.24 -5.03 -4.32 (-3.85) 450 -11.43 -7.34 -5.87 -5.06 (-4.57) 475 -14.01 -8.56 -6.78 -5.84 (-5.28) 500 -17.12 -9.88 -7.73 -6.63 (-6.00) are used as approximations for the solvation and interaction parameters of the s'th aqueous species and are both functions of pressure and temperature. Data for both have been taken from Helgeson et al. (1981) and are given in tables I and II, respectively. T represents the mole fraction to molality conversion factor and is defined by: T = - log ( 1 + 0.0180153 ] T mg 8 = 2 log (l + 0.01801531) (26) As suggested by Helgeson et al. (1981), the ionic strength has been substituted for the sum of the molalities of all the aqueous species to yield equation (26). A, the Debye-Huckel electrostatic 21 T a b l e EE: S h o r t R a n g e i n t e r a c t i o n P a r a m e t e r f o r N a C l Taken from Helgeson et al., (1981). Pressure is given in kilobars, temperature is given in degrees C. Parentheses indicate high uncertainty. All values have been multiplied by 103. Units are Kg/mole2. Pressure T Sat 1 2 3 4 5 25 -9.77 -9.19 -9.12 9.51 -10.44 (-11.76) 50 -5.59 (-5.07) (-5.52) (-5.60) (-5.66) (-5.87) 75 -2.43 (-2.63) (-2.65) (-2.46) (-2.15) (-1.68) 100 0.23 -0.07 -0.10 0.13 0.71 (1.39) 125 2.44 1.71 1.85 2.14 3.05 (4.21) 150 4.51 4.13 4.12 4.28 5.13 (6.26) 175 6.38 5.91 5.88 6.16 7.05 (8.13) 200 8.11 7.48 7.66 8.18 9.05 (10.30) 225 9.73 9.27 9.20 9.59 10.40 (11.58) 250 ' 11.29 10.80 10.73 11.15 11.92 (13.15) 275 12.71 .12.24 12.19 12.62 13.39 (14.54) 300 14.15 13.68 13.66 13.99 14.83 (16.01) 325 15.49 15.16 15.10 15.41 16.23 (17.36) 350 16.48 16.42 16.76 17.52 (18.68) 375 17.80 17.79 18.10 18.81 (19.88) 400 19.12 19.11 19.40 20.13 (21.23) 425 20.33 20.35 20.66 21.38 (22.38) 450 21.55 21.61 21.85 22.56 (23.64) 475 22.86 22.84 23.09 23.74 (24.78) 500 24.03 23.95 24.32 24.94 (25.95) parameter, is defined by: A = 1.824829238 x 106 V ^ - (27) pw and ew represent the density and dielectric constant of pure water. B is the Debye-Huckel electrostatic parameter and is defined by: B = 50.29158649 x 108 Z^JL (28) The development of the above equations have been discussed in detail by Helgeson and Kirkham (1974b), Helgeson and Kirkham (1976) and Helgeson et al. (1981). 22 The derivative of equation (25) with respect to time can be written as: . „ ~o . .-. d log 7.^ dr -0.5Z?A 0.0180153 0 . 1 9 ( | Z , | - 1) ~ n o w > ' „ ^ a n i g o f l + < W < + bNa+c ( l + « 8 J B v f ) 2 v f 2.303(1 +0.01801531] -Z^AVl (dAdP dAdT' ( l + a , f l v f ) \ d P d T + d T d T ab» (dbttaCidP , dbNaCidT\ -fdbNa+Ci-dP i dbNa+Ci-8T ci-dl + K ( - ^ r - — + ^ Y ~ a 7 j s/> a 7 + s r a 7 ' ( 2 9 ) The derivatives of pressure and temperature with respect to time are boundary conditions or are known from the flow and heat laws. The derivative of ionic strength is discussed below. The derivatives of the solvation parameter and the short range interaction parameter of NaCl with respect to time can be evaluated numerically using tables I and II, respectively. The derivative of the Debye-Huckel electrostatic parameter with respect to time is: dA _ (1.824829238 x 10° \ 8pw /3 x 1.824829238 x 10 6\ / dT dew\ dr~ ~ \ 2Pw(ewT)^ ) ~dr~ + { 2(ewT)™ ) \£w^r~ + T~d7) [™ ] and the derivative of the Debye-Huckel electrostatic radius parameter with respect to time is: dB (50.29158649 x 10 s\ dpw ( „ / \ / dT dew\ , , ' * ^ + 50.29158649 x 10 8./ P w e + j — ^ ) (31) r V 2 V ^ ^ T J dr \ ' \J 2{ewT)15 J \ W dr dr The derivative of the density of pure water with respect to time can be expanded to yield: dr V° dr + Vw dr ( ' Vw, aw and are the molar volume, thermal expansion at constant pressure and isothermal contraction at constant temperature for pure water evaluated at the temperature and pressure of interest. The derivative of the dielectric constant of water with respect to time can be obtained by taking the derivative of equation (A-15), appendix one and is: 4 4 > 4 4 t ^ = E E - /I-*-) "I + E E <^f>J£ i=Q j=o «=o 3=0 ei.j are fit coefficients given in table LX in the appendix. An alternative representation can be obtained by taking the derivative of equation (A-16), appendix one, yielding: 23 All fit parameters for the preceeding equations are given in tables IX and X, appendix one. For reasons given in this appendix, equation (33) is preferred over the preceding one. Equations (30), (31), (32) and (33) can be substituted into equation (29) to obtain the total derivative of the activity coefficient with respect to time. The Ionic Strength equation The derivative with respect to time of the activity coefficient of an aqueous species has introduced a new term, the derivative of the true ionic strength. The true ionic strength of an aqueous solution was defined by Helgeson (1969) as: nn I = ; E ^ m « ( 3 4 ) 1 1=1 where Zs and m„ are the charge and the molality of the s'th aqueous species, respectively. The derivative of the ionic strength equation with respect to time is obtained by taking the derivative of this equation. It is: 31 1 -^-y „ 9 d ln ms , „ ^ - = - > £ a m , „ (35) s = l The derivative of ionic strength with respect to time can be replaced in all equations containing it by the right-hand side of equation (35). Although this replacement decreases the number of unknown variables by one, a more efficient numerical algorithm can be used if it is not made. This is discussed in detail below. 24 The Derivative of the Activity of Water In addition to temperature and pressure, the activity of pure water is dependent upon the number of moles of dissolved material. Many different models have been suggested to directly calculate the activity of water as a function of solute concentration (for example: Harvie and Weare, 1980) or indirectly as a function of the osmotic coefficient (for example: Helgeson et al., 1981). An alternative method of calculating the activity of water is through the use of the Gibbs-Duhem equation which relates the derivatives of the intensive variables for a given phase. Writing these derivatives as temporal derivatives yields: T 8T ndP din a, 0= -Vt— + Sf— + RT y V - r - - 36 OT dr L— J or 8=1 The volume (V) and entropy (S) have been subscripted / to indicate that they apply only to the fluid. The last term on the right-hand side can be separated into the activity of water and the activity of all other species in solution, yielding: + R T Y ^ a - ^ + RTnw a-^ + R T Y ^ a - ^ ± (37) ^ 55.51 dr dr ^ 55.51 dr y ' 8 = 2 8=2 Rearranging equation (37) with this in mind yields: d ln a,„ Vt dT Si dP 1 v-* 3 ln m, 1 Sin 7 , - = > ms > ms — (38) 3r RTnw 3r RTnw 3r 55.51 ^ dr 55.51 ^ dr y ' 8=2 9=2 The derivative of the activity coefficient of the aqueous species has been left in this equation only for reasons of clarity as it can "be replaced using equation (29). The derivative of the parameters which are introduced by this replacement are then replaced by equations (30), (31), (32) and (33). The derivative of temperature and pressure with respect to time are known or have been solved using the flow and heat equations. Equation (38) could be substituted into all equations containing the derivative of the activity of water but has not been done in order to allow a more efficient numerical algorithm. 25 Derivative of the Number of Moles of the Reactant Minerals The derivative of the number of moles of reactant minerals taken with respect to time was intro-duced in equation (6), the derivative of the mass balance equation with respect to time. Because reactant minerals are those with which the solution is undersaturated, they will dissolve into the solution, potentially changing the molality of the aqueous species and/or potentially causing the precipation/dissolution of equilibrium phases. This driving force continues until the solution is sat-urated with respect to all of the reactant phases or until all reactant phases have totally dissolved into the solution. Helgeson proposed monitoring the progress of the system towards equilibrium through the use of the progress variable (£), a convention generally followed in the literature. When the derivative of the number of moles of all solid phases and the molality of all aqueous species with respect to the progress variable is zero, then the system is at equilibrium for an isothermal isobaric process. Under these conditions, the derivative of the Helmholtz and Gibbs free energy with respect to the progress variable must be zero. If the derivative of the number of moles of a reactant taken with respect to time is expanded to include the progress variable, then the following expression is obtained. d nr d nr d£ . lh=l>J[~dT~ y39' where nr is the number of moles of the r'th reactant phase. The derivative of the progress variable taken with respect to time is the reaction kinetic term and controls the rate of the dissolution of each of the reaction minerals. With the exception of Aagaard and Helgeson (1982), Helgeson and Murphy (1983) and Helgeson, Murphy and Aagaard (1984), previous papers discussing the derivative approach have considered the derivative of the progress variable with respect to time to be a constant or have ignored it. Aagaard and Helgeson have derived a rate equation which is dependent on the effective surface area and the chemical affinity between the reactant phase and the fluid. This equation allows the derivative of the progress variable with respect to time to be evaluated, it is: dr k is the rate constant, s is the effective surface area, as is the activity of the s'th aqueous species, is the stoichiometric reaction coefficient of the s'th aqueous species corresponding to the formation of the critical activated complex, a is the rate of decomposition of the activated complex and A is 26 the chemical affinity of the mineral reaction. This equation was initially applicable under isothermal isobaric conditions and in the temperature range 25—200 C along the critical curve of water. The parameters in this equation have been re-evaluated by Helgeson and Murphy (1983) and Helgeson, Murphy and Aagaard (1984) and extended to temperatures in the range of 650 C. Equation (40) has been explicitly derived for iso-thermal, iso-baric conditions and is only one term of a more complete expansion, which could have the form: d£_5T dti_dP_ d£ + dT d 7 + dP ~d7 + 57 Although the derivatives of the progress variable with respect to temperature and pressure can be assumed to be zero, the possibility that they exist and are not zero precludes the rigorous use of equation (40) in open systems. If the changes in temperature and pressures are small with respect to time, then it can be used. Summary Substituting equations (8) and (40) into the derivative of the general mass balance equation (equation (6)) yields an equation consistent with assumptions that the component is a radioactive parent, mass flux potentially occurs from/to the neighboring volume elements and the modified model of Aagaard and Helgeson is used to constrain the reaction rate. The left-hand side of this equation includes equation (9) instead of equation (8) if the component is a radiogenic daughter product. This equation is simplified if no mass flux occurs or if the component is not radiogenic or radioactive. Substituting equations (19), (23) and (29) into the derivative of the general mass action equation with respect to time (equation (17)) yields an equation consistent with the model of Helgeson et al. (1981) for activity coefficients of aqueous species, of Berman and Brown (1984) for a third degree binary solid solution phase and the Gibbs-Duhem equation for the activity of water. Two additional equations have been developed in this chapter, the derivative of the activity of water with respect to time (equation (38)) and the derivative of the ionic strength (equation (35)). These equations can be solved using matrix algebra, yielding the first derivatives of molalities of aqueous species, of the activity and number of moles of water and of the number of moles of all solid phases in the system. Equations similar to these allow higher order derivatives to be solved in an analogous fashion. Once all of the derivatives are known, an expansion in molality for aqueous species, in number of moles for water and for solid phases and in activity for water can be used to 27 calculate the distribution of mass among the species and solids at future times. The next chapter discusses in more detail the techniques used to solve these equations. 28 6. Solution of the Mass, Ionic Strength and Act iv i ty Derivatives The derivative of each of the mass balance equations (one for each component), the derivative of each of the mass action equations (one for each non-component phase and species), the derivative of the ionic strength equation and the derivative of the activity of water equation form a set of equations which contain the following derivatives: drip dnw daw dms 31 dP dT dr ' dr ' dr ' dr ' dr ' 9T ' dr Subscripted variables indicate that there is one derivative for each possible value of the subscript—s has been used for aqueous species, p for solid phases and c for components. The derivative of pressure, the derivative of temperature and the derivative of the total number of moles of a component with respect to time for each volume element cannot be solved using the equations presented in the previous chapters, they must be solved using the flow, solute transport and heat equations which are discussed in the following chapters. The flow, heat and solute transport equations are not independent of the variables listed above, as explained in chapter 10, a coupled solution procedure is necessary. Once the pressure, temperature and total number of moles of component derivatives are known, the derivatives of the mass action equation, of the mass balance equation, of the ionic strength equation and of the activity of water equation form a set of equations which are linear with respect to the last six derivatives listed above. These derivatives can be solved using standard matrix techniques. At this point, it is worth rewriting the derivatives of the mass action, mass balance, ionic strength and activity of water equations in order to illustrate a method of solution. All substitutions discussed in chapters 4 and 5 will be made, but rather than write the equations in full, the symbols A, B, C, D, ... will be used to represent various terms. These symbols are expanded in table III. The equations are listed in figure 1, in order they are: • the derivative of the mass balance equations, • the derivative of the ionic strength equation, • derivative of the activity of water equation, • the derivative of the mass action equations. 2 9 F i g u r e 1 - T a b u l a r F o r m s o f t h e C o n s t r a i n i n g C h e m i c a l E q u a t i o n s II K £ £ s to a to to I % 'to|<o 'to I to en* N to |co ' 'to|to °* J5 ^ to o + = 1A|« — + Note 1: Although it was not done in the text, the first three equations have had the sums of the log molalities of the species separated into component and non-component terms. Note 2: The above equations are the general forms of the equations constraining the first derivatives when the symbols A, B, . . . are expanded as given in table III. The expansions given are not totally complete, some substitution from the text is necessary. Note 3: Although it was not done in the text, all logarithm and logarithmic derivatives to the base 10 have been converted to base e. 30 Table HI: Expansion of Symbols in Figure 1 55.51 ^ A 8 = 1 ar ^ ar r=l Zfm, 2 1 55.51 J = 2.303m, - ° - 5 ^ 1 0 . 1 9 ( a b s (X) - l ) - ° - ° 1 8 ° 1 5 3 ( l + a . v f ) Vf 2.303(1 + 0.0180153) + w"''" fc^aCI + #JVa+ Cl-K = M - 2.303 ^ > / m 8 8 = 2 V a r s ' ap M = RTnw dr R.Tn,,, dr Z2aVI fdAdP dAdT\ Z;AVl (dBdP dB dT = (i + a . f l v f | 37 + a7j - ( 1 + f l s j B v f ) l a p a7 + a r a7 •" V 3 P ar dT dr) r(dha+ct- 3P dbNa+cl- dT\ V ap ar a r ar y ^8 31 Table D3: Continued, . . . <2 R S •-T ?_J_ m„ J_ » - a f E E - £ . £ ( ( 1 1 * ) / £ * . . fc-i fc y = i1=l h—H h>=*v-i h=l V fc = l u w X y--z = -X aRT E E • E ^ w „ - ( P - i ) E ( n ) '1 = 1 «2 = »'l *p — »,i — 1 W E t=i ;,.=i \ fc=i k=h. NGej< AHr d T AVr 8P „ ^ + *RT2 ^ k-1 k k E E ••• E w>.<*.-<, ^ i ' i = l t2=*i iv = iv — ± ( , P g n Xi, - (P -1) n Xi, 1=1 dT ~d7 32 These equations can be directly solved using matrix algebra techniques such as direct inversion or gaussian elimination. The computational time needed to solve a set of linear equations by matrix inversion is approximately proportional to the cube of the number of unknowns while the time needed for gaussian elimination increases as a function of the square of the number of unknowns. The time needed these techniques and more many others are well documented in a wide variety of texts. In most aqueous systems, the number of aqueous species is large relative to the number of components, thus there are a large number of derivatives of the mass balance equations. Examination of the equations in figure 1 reveals that if the derivative of number of moles and the derivative of the molalities of the components, the derivative of ionic strength and the derivative of the activity of water are positioned in the first nc + 2 columns, the lower right corner of the matrix bounded by the nc + 2 column and row, is an identity matrix. In iso-thermal iso-baric mass tranfer and Perkins (1980) recognized the presence of this identity matrix and solved the set of equations by a partitioning method. This particular method is outlined in figure 2 and is very efficient when the rank of the identity matrix is a significant portion of the rank of the entire matrix. The identity matrix will exist only when the ionic strength and the activity of water are treated as separate variables. If they are not, the equations containing derivatives of the ionic strength and the activity of water must be substituted into the derivative of the mass action equation. Each mass action equation will contain the derivative of the logarithmic molalities of each of the aqueous species, and no identity matrix would exist in the lower right hand corner of the matrix. The solution of this set of equations would take considerable computer time as the coefficient matrix is not sparse. If computer storage is limited, it may be necessary to reduce the number of equations and unknowns. Because the derivative of each of the non-component species is written only in terms of the derivatives of the components, ionic strength and activity of water, it can be substituted for each occurrence of the derivative of that species in the derivative of ionic strength, the derivative of the activity of water and the derivative of the mass balance equations. This reduces the number of equations to the number of components plus two. The derivatives of the non-component species can be calculated directly from the derivative of the mass action equations once the derivative of the component phases and species, ionic strength and water are known. Alternatively, the molalities of the non-component species can be directly calculated once the molality of the component species, the ionic strength, the activity of water and the number of moles of the component phases are known. If both methods are used, comparison allows a direct assessment of the numerical roundoff error. 33 Figure 2 - M e t h o d of Solution For any linear system of equations which can be written in the form the solution can be obtained by: [B] = [C][A]-1 . [A] is a square non-singular matrix of known coefficients, [B] is the unknown column vector and [C] is a vector containing the constant terms. Direct inversion of matrix [A] is slow but the procedure can be speeded up considerably if [A] is divided into partitions such that the lower right partition is an identity matrix. If [A] is partitioned and contains an identity matrix, the following method can be used to calculate the inverse. If partition d is an identity matrix, then: q — (a — be) 1 w = — bq x = qc y = I — cw and I = the identity matrix This proceedure is correct only when partition d is an identity matrix. The advantage is that the only matrix which must be inverted has the dimensions of partition a. When its rank is small compared to the rank of matrix [A], this method is extremely fast. If only one set of equations is to be solved, elimination is generally much faster. However, if the equations can be written such that matrix [A] is independent of the number of derivatives which will be solved for, only one inversion is needed. This makes this method a very practical alternative to elimination. 34 The solution by partitioning method has one major advantage over a solution by a direct inversion or elimination—speed. All methods have similar numerical roundoff error. The speed of solution for the collapsed set of equations is similiar to the speed of solution of the partitioned matrix but requires slightly more time to set up. The solution of the collapsed equations has the advantage of decreased storage space but the disadvantage of slightly greater numerical roundoff error, ff the matrix is collapsed, the non-component species must be calculated from the component species. With the partitioned matrix method, the derivatives of the non-component species are part of the solution vector and can be directly compared with those calculated from the components, allowing a direct assessment of the numerical error. 35 7. The Flow equation Following Cooper's (1966) development (equation 15, page 4787), the generalized transient flow equation of a compressible fluid in a hetrogeneous porous medium can be written in fixed Cartesian coordinates as: n / >. „ dPf dB „ d vr, . -V(pf9)=04L+Pf~- + Pf01T (41) or or az P/ is the fluid density, q is the specific discharge vector with components in each of the Cartesian coordinates. 9 is the porosity of the medium, vg is the grain velocity. V is the del operator. Equation (41) assumes that any deformation must be in a vertical direction, thus is restricted in applicability. The Temporal Terms Assuming that the grain velocity is negligible, the last term on the right-hand side of equation (41) can be ignored. The remaining terms on the right-hand side of equation (41) can be expanded in terms of the properties of the media and the fluid. Consider first the porosity, which is defined as: ym Vel is the volume of the element, Vm is the volume of the solids ( Vm = ^ n r + n> ^»')- Inherent in the use of equation (42) to define the porosity are the assumptions that only one fluid is present, that all of the grain surfaces are completely wetted, and that all pores are connected. This is most closely approximated in sandstones and other unsolidated sediments. The derivative of the porosity with respect to time is: dd _ vm dvel i dvm _ e dvel _ I dvm 37 ~ (Ve'f ~dr 'V71 dr Vel dr Y71 dr ^ The volume of an element is constant in fixed coordinates, therefore the first term of the right-hand side of equation (43) is zero. The total volume of the matrix is a function of temperature-, pressure and the number of moles of each of the solid phases. The number of moles of each solid phase can change as a result of dissolution, precipitation or by the physical movement of solid material into the volume element. Rewriting equation (43) with these processes in mind, assuming as before that 36 the grain velocity is negligible, yields: dr yd \ Vi gT + ni gp gT 1=1 v d VidT\ jT"dr~) dVrdT + nT (44) Vj and Vr are the molar volume of the i'th equilibrium phase and of the r'th reaction phase, respectively, ra, and nr are the number of moles of the i'th equilibrium phase and of the r'th reactant phase, respectively. In order to simplify the notation, the equilibrium phases have been treated as stoichiometric phases. To include solid solution phases, each summation of the number of phases must be expanded to include an inner summation over the number of endmembers of each phase. The derivative of the number of moles of reactant minerals taken with respect to time is known, is an applied boundary condition or can be calculated. The derivatives of the number of moles of each of the equilibrium phases are solved using the equations presented in the previous chapters. The assumption of constant volume for each element coupled with a grain velocity of zero implies an incompressible media, not incompressible phases. Experimental evidence and field observation indicate that porous media is compressible and that porosity is hysteretic with respect to pressure. The available data describing the compressibility of porous media are for shallow environments, little or no data are available for deep basins or any other geological environment. Undoubtedly, porous media display a similar hysteretic effect with respect to temperature but no evidence or observations exist. The assumption of a constant volume element does not imply the porosity is constant. As is obvious from equation (44), the porosity will change as a function of temperature and pressure through the changes in the molar volume and the number of moles of each of the solid phases. If the assumption of a constant volume and/or a grain velocity of zero is removed, then the shape and/or size of the volume element may change in response to a stress field. The thermodynamic properties of the phases in the volume element will also change in response to the stress field. If new phases form by diffusion of material into existing phases or by a direct solid-solid transformation, it is not clear what the effects of the stress field would be, or indeed, the effects of the stress field on the reaction. In any natural medium, the use of a non-hydrostatic model for the solid phases would necessitate knowledge or assumptions on the average grain orientation and size of each solid phase, on the nature of the porosity and permeability and how a stress field will modify them. As new phases precipitate, they would form in a hydrostatic environment and as the supporting matrix 37 dissolves or the stress field changes, they could be rotated and their thermodynamic properties changed. Although the effects of non-hydrostatic stress on phases could potentially be very important, it is very difficult to evaluate the effects of a changing stress field. Bruton and Helgeson (1983) examined the thermodynamic implications of a static stress field and the consequences when fluid pressure was not equal to rock pressure. They concluded • that the effect of a stress field was small when compared to the absolute magnitude of thermo-dynamic energies under hydrostatic conditions, • that the difference between fluid and rock pressure could significantly affect the interpretation of the pressure temperature depth history of solid assemblages and fluids, • that this effect could be safely ignored when the pressure difference between rock and fluid pressure was less than fifty bars. Contrary to the first conclusion of Bruton and Helgeson, it is clear from a great variety of geological observations that stress related phenomenon do exist and that stress can be a significant modifier of phase relationships under many different geological conditions. The inclusion of the effects of a non-hydrostatic pressure field in a general sense is currently impossible. For very limited and specific cases, it is possible to calculate the order of the effect by setting a rock pressure different than the fluid pressure or by using very specific phenomenological relationships. Density is a function of the molar volume and the number of moles of each species in the fluid. It can be defined as: n3 PI = ^ (45) £ v>n> ! <= i MWS is the molecular weight of the s'th species, n» is the number of moles of the s'th species and V„ is the partial molar volume of the s'th species (including solvent water). Equations defining the molar volume of water and the molar volume of aqueous species are given in appendix one. Equation (45) assumes that the volume of a solution can be represented by a weighted combination of the partial molal volumes of the species present in the fluid. In dilute solutions, this assumption is quite good; in concentrated solutions, it is not very accurate. Rewriting equation (45) in terms of molalities through the use of equation (4), and taking its 38 derivative with respect to time yields: a 9 and /3„ are the coefficients of thermal expansion and isothermal compressibility for the s'th aqueous species, respectively. They can be evaluated through taking the derivative of the volume equations given in appendix one. T h e S p a t i a l T e r m s The spatial derivative of the density and of the specific discharge vector are present in the right-hand side of equation (41). In a similar fashion to the expansion of the derivative of equation (45), the derivative of the density can be expanded, including the effects of each aqueous species on density as a function of position. However, the spatial variation in density is often small compared to its temporal variation, thus in general, it can be ignored. Specific examples when the spatial variation cannot be ignored include the interface between two immiscible fluids such as oil and water or between fluids with vastly different densities like fresh and salt water. The specific discharge is evaluated as a function of the hydraulic head, which can be written as a function of pressure. It is: rj is the dynamic viscosity of the fluid and k the permeability of the medium. The interial term is generally small except in systems with high fluid velocities. For the remainder of this thesis, it will be assumed to be zero. If the gravity term is moved out of the integral on the right hand side, the integral describes the amount of work involved in moving the fluid from one pressure to another. In principle, this integral can only be evaluated if the complete chemical history, pressure and temperature history over the path of integration is known. In practise, this degree of information is never available. The integral can be simplified by two assumptions: 39 • For the purposes of integration, the fluid can be approximated by pure water with no chemical reactions occurring between the fluid and the matrix. • The integral can be evaluated isothermally at the reference temperature. Other more elaborate integration paths could be conceived and evaluated but there is no advantage to this. Evaluating the integral with these assumptions yields: f P dP 1 / 7 ~ = MW~ ( A G - ^ - A G w . T r . F r ) (48) AGW is the Gibbs free energy of pure water, evaluated at the subscripted pressure and temperature. In most hydrology texts and papers, a constant, the ideal gas law or simple exponential/polynomial equations are used to represent the density of water. When integrated, these often provide a poor approximation to the right hand side of equation (48). The free energy of water has been measured and tabulated in detail over a wide range of pressure temperature space (for example: Burnham, Holloway and Davis (1969), Keenan, Kyes, Hill and Moore (1978), Haar, Gallagher and Kell(1984)) and many complex fit equations allow easy computer evaluation of the free energy of water (for example, equations A-19, A-20, A-21 in appendix one). Equation (47) introduced a new variable, the dynamic viscosity. Equations describing the dynamic visosity of pure water and steam are given by Watson, Basu and Sengers (1980). If the solute concentration is low (less than 1 molar), the extended Jones-Dole equation (Jones and Talley, 1933) can be used to calculate the viscosity ratio between the solution and pure water. Data for some of the common univalent species are given by Out and Los (1980) for a pressure of one atmosphere and temperatures less than 100 C. Formore concen trated solutions which are predominately sodium or potassium chloride brines, the equations given by Kestin, Khalifa and Correia (1981a, 1981b, 1981c, 1981d) can be used in the temperature and pressure range of 20-150 C and 0.1-35 MPa. Systems which exceed these limits must model the dynamic viscosity of the fluid by using the dynamic viscosity of pure water. In systems where the composition of the fluid and the temperature does not significantly vary, the dynamic viscosity is approximately a constant and its derivative zero. 40 Conclusions Combining equations (44), (46), (47) and (48) with equation (41), and assuming that the kinetic is negigible, allows the flow equation to be written in terms of spatial, temporal, molar, pressure and temperature derivatives. dm dVidP dVidT E l ,,orii dP dr dT dr V- / „ dnr dVrdP dVr8T £ [VT — + nr — — + nr dP dr dT dr +8 EL yd r=l ( I r) \ n" :»=2 J s=2 sr^ I d m » E KMS V , = 2 ( ns YMW>m<> s=2 E 9 = 2 \s=2 (49) where: AGW = A G w.Tr.P AG w.Tr.Pr In the above equation, the permeability is assumed to vary spatially but not temporally, and canbe considered to be a scalar quantity in each element. Given a model for the relationship between the permeability and the number of moles of solid phases or the porosity, this restriction could be removed. Although various general models for permeability exist, they are, at best, approximations and are not satisfactory for a wide range of conditions or for systems which have significant amounts of precipatation or dissolution of solid phases. Wood and Hewitt (1982) have made a simple observation which allows the precipation and dissolution of solid phases to modify the permeability. Arguing that changes in the permeability will occur relative to changes in the porosity, they proposed the following phenomenological relationship between porosity and permeability in sandstones: LT + A T flr + Ar This observation is very useful, as most modelling processes assume an initial porosity and an initial permeability. The change in porosity as a function of time can be easily calculated as the changes in 41 temperature, pressure and number of moles of solid phases is known, thus the change in permeability can be approximated. Their relationship can be easily extended to include any model which relates permeability to the volume of solid phases. We could write: kT+AT = f(T,P,n„nT,... ,T+ AT) kT }(T,P,ni:nr,... ,T) where / is some function which relates temperature, pressure, moles of equilibrium phases, moles of reactant phases, and time to the permeability. Examples of possible functions would include any emperical relationship relating permeability to grain size and packing, any relationship based on dimensional considerations or any theoretical relationship which has the general form: k = /i(s)f2(n)d', where s is dimensionaless parameters that express the effect of grain shapes, n is a parameter that expresses the effect of porosity and d is the effect diameter of the grains (Bear, 1972). This function will not be used to calculate the permeability, rather it will be used to calculate the change in permeability as a function of various system parmeters. For this reason, it does not need to be very accurate. Equation (49) contains the spatial derivative of the Gibbs free energy. Rather than solve this as a new derivative, the spatial derivative of the Gibbs free energy of water can be expanded in terms of the derivatives of pressure and temperature, yielding: d . n > dAGw,Tr.pdP , dAGw,Tr.pdT V Tr.P ~ &<^w.Tr.Pr) = ^ ~ ~~ 1 ^ "= oxi dP dx{ dT dxi = Vw.Tr.P(l- 7a) ^ (50) VwTrP is the volume of water evaluated at the reference temperature and at the pressure. The free energy of water at the reference temperature and reference pressure is fixed thus its derivative with respect to position is zero. Because of the assumption used in the integration of equation (48), the derivative of temperature with respect to position must be zero, even if the process being modelled is not isothermal in time or space. Equation (50) is substituted into equation (49) to complete the flow equation. If a more elaborate path was used in the integration of equation (47), then the left hand side of the flow equation could potentially include the derivatives of temperature and fluid composition in addition to the derivative of pressure. 42 8. The Solute Transport Equat ion The solute transport equation has been developed and used as a predictive tool by many different authors (for example: Reddell and Sunada (1970), Bear (1972), Bredehoeft and Pinder (1973), Konikow and Grove (1977)). In general, it has the form: when written in Cartesian tensor notation. V{ is the component of the average interstitial velocity of C is the concentration of the chemical species in the fluid and 6 is the porosity. R is the reaction term. Each of the authors previously mentioned imply or explicitly state that this equation describes the behavior of only a single species in the fluid and that there must be an additional equation for each new species considered. In modelling the movement of one or two aqueous species, this is not restrictive. Many geochemical problems involve tens of aqueous species, clearly the computational time needed if a transport equation is used for each species is excessive. In fairness, it should be pointed out that the concentration of one aqueous species for a given element may dominate the concentration of all other aqueous species containing that element by orders of magnitude. Thus in modelling the movement of an element in a flow field, the concentration of the dominant ion will be the effective concentration. Unfortunately, in determining the reactions between the species and complexes in the fluid and the reactions between the fluid and the surrounding media, the effects of all aqueous species and complexes must be considered. As discussed in the chapter on components, the number of independent variables needed to constrain all of the chemical species and phases in the system is the number of components and not the number of species and phases, ff the number of moles of each component, the temperature and the pressure are known, then the number of moles of all species, complexes and phases can be calculated. Knowing this, the solute transport equation can be written in terms of components, thus simplifying the analysis of a chemical system and reducing the number of mass transport equations to the number of components from the number of aqueous species. (51) the fluid in the I'th direction, Z?,-.y is the coefficient of mechanical dispersion (a second order tensor) 43 The change in the number of moles of any component with respect to time is a function of only three processes: • Mass flux of the component into/out of the REV due to advection, diffusion or dispersion, • Radioactive and radiogenic decay creating or destroyiny the component, • Physical removal or addition of the component by a source or sink. Expressing this list as an equation, yields: net flux of component C = rate of accumulation of component C — rate of change due to source/sink terms — change due to radioactive decay (52) The radioactive decay term is negative for a daughter component and positive for the parent. The source term is positive for material being removed (sink) and negative for material being added (source). Equation (52) has no reaction term because chemical reactions do not destroy components, they redistribute them among the phases and species in the system. Consider the mole flux term of the above equation. The flux of the c'th component parallel to the x axis through the center plane of an REV can be defined as: Nf,cv*JAyAz . (53) Nf-C is the number of moles of the c'th component in a unit volume of the fluid, v* is the instantaneous mass velocity of the fluid parallel to the x axis. 6 is the porosity and Ay Az represents the effective cross-sectional area through which flow occurs. The mole flux of the c'th component into the REV parallel to the x axis from the left can then be written: Q A X Nf.cv*xe Ay Ax- — (Nf,cv*xe Ay Az) — (54) OX L and the mole flux out of the REV to the right is: 3 Ax Nj.cvie Ay Ax + — (Nf.cv*xe Ay Az) — (54) ox I 4 r is the distance along the x axis from the edge to the center of the REV. Expressions similar to equations (54) and (55) can be written for flow parallel to the y and z axis. Summing them for flow parallel to all axis yields: 3 3 3 -^-(Nf.cv*xAyAz) Ax - — (Nf.cv* AxAz) Ay - — (Nf.cv*z Ax Ay) Az dx ay y dz 44 or using an implicit summation and assuming that the volume of the REV is constant, ~—(Nf.cv*d) AxAy Az (56) Equation (56) does not take into account the increase of a component by the movement of solid material into the REV. In developing the flow equation, it was assumed that the grain velocity was small (zero) and this process could be ignored. The mole flux term, equation (56), is written in terms of the number of moles of component in the fluid and not the total number of moles of component. Thus, the first term on the right-hand side of equation (52) must also be expressed in terms of the number of moles of the c'th component in a unit volume of the fluid. Considering that an REV contains only a single fluid and solid phases, the total number of moles of the c'th component can be expressed in terms of the number of moles of the fluid species and in the solid phases in the matrix as: NT.C AxAyAz = ~Nf.e AxAyAzd + Nm,c AxAyAz{l - 6) (57) Nf.c and Nm,c are the number of moles of the c'th component in a unit volume of the fluid (/) and of the matrix (m), respectively. Ax Ay Az represents the volume of the REV. Assuming as before that the volume of the REV is constant, the derivative of equation (57) with respect to time is: A x A 2 / A Z ^ = AxAyAz ((Nj.^Nm.c)d/ + + (l - 9 ) 3 - ^ ) (58) dr \ or or ar j The change in the total number of moles of the c'th component is a function not only of the change in the number of moles of the c'th component in the fluid but includes the changes in the number of moles of the c'th component in the solid phases and the change in the porosity. The total number of moles of the c'th component in a unit volume is related to the total number of moles of the c'th component and to the total number of moles of the c'th component in the phases and species comprising the REV by: AxAyAz ^ / ns nr np ei \ = AxAyAz + £ ^ + £ E ^ ^ J ( 5 9 ) * V = l r = i i=l Jc=l / The last expression on the right-hand side of equation (59) is effectively the mass balance equation for the c'th component divided by the volume of the REV. This equation was defined in chapter 4. 45 The total number of moles of the c'th component in a unit volume of fluid is related to the total number of moles of the c'th component in the REV and the total number of moles of the c'th component in the aqueous species present in the fluid in the REV by: Nj.c AxAyAz £ ^ c . 3 « i 8 (60) 55.519AxAyAz ^ The total number of moles of the c'th component in a unit volume of the matrix is related to the total number of moles of the c'th component in the matrix of the REV and the total number of moles of the c'th component in all solid phases comprising the REV by: N.. N3.c = S.C AxAyAz ^ f nr np et (l-9)AxAyAz (E"-»'+ E E (61) Equations (60) and (61) could be substituted into equations (57) and (58) but will not be done in order to simplify the notation. The radioactive term in equation (52) can be written as: AxAyAz ^ (62) which represents the total change of the c'th component in the REV as a function of radioactive decay. This term is discussed in more detail in chapter 4. The source/sink term can be written as: AxAyAz Q{f,NT.c) (63) which represents the change of the c'th component in the REV as a function of time and number of moles of the c'th component in the fluid. Equation (63) is positive when representing a source term and negative when representing a sink term. Through the use of equations (56), (58), (62) and (63), equation (52) can be written in a more rigorous sense, yielding: * = (Nf, - Nm,) d ± + 9 d J ^ + ( l - 9 ) d N m. c + +Q(t,Nt.°) ( 64) x,' v or or dr (d~NT.c [rod) As the volume of the element is constant, it can be moved out of the derivatives, and cancels out. The instantaneous mole flux in equation (64) must be expanded in terms of variables currently used to describe the system. As shown by Bear (1972), it can be written in the form: Nf.cv* = Nf.cv + Nj.cV (65) 46 v is the average interstitial velocity of the fluid and v is the average deviation of the velocity from the average interstitial velocity. The average interstitial velocity is defined by: ^ = £ (66) where q is the specific discharge vector for the fluid. The specific discharge is calculated using equations (47) and (48) in chapter 7. As show by Bear (1972), the average deviation of the velocity from the interstitial velocity can be approximated by: viNf.e = -D,/-^- (67) axj where Dij is the coefficient of mechanical dispersion. This term is defined as a function of the properties of the media and of the fluid velocity by: Di.j = atv&ij + (aL- at)^- (68) a is the dispersivity of the porous medium, subscripted Y to indicate the transversal dispersivity and subscripted 'L' to indicate the longitudinal dispersivity. 6i.}- is the Kronecker delta and v is the velocity of the fluid (with components vxt vy, vz). In cartesian coordinates, equation (68) reduces to: Dxx = (at{vl + v2z) +aLvx)'2/v Dvy = {at{v2x + v2) + aLvy)2/v Dzz = (at(v2x + v2y) + aLvz)2 jv and Dxy = Dyx = (aL - at)vxvy/v Dxz = Dzx = (aL - at)vxvz/v Dyz = Dzy = (aL - at)vyvz/v (69) These equations are limited as they specifically refer to isotropic medium. The coefficients of lon-gitudinal and transversal dispersivity are calculated from field observations or from experimental simulations. In both cases, the composition of the fluid is generally analyzed for the total concen-tration of an element in solution parallel and perpendicular to the direction of flow. If elemental 47 components are used, the coefficients of longitudinal and transversal dispersivity for the component has been measured and not the coefficient for the s'th species in the fluid. Values for these coef-ficients are tabulated in the literature and can be used directly in equation (69). Unfortunately, there is often considerable discrepancy for dispersion coefficients determined from experimental and from field values. This is partly a result of large and small scale hetrogeneities in the medium and the intrinsically anisotropic nature of all geological units. In addition, the field values are generally derived by fitting the flow and solute equations to a given set of field data, using boundary and initial conditions which are presumed to apply. Substituting equations (65), (67) and (69) into (64) yields a general form for the solute transport equation written in terms of components. It is: axi axi \ axi J or or + ( l - e ) ^ ^ + d - ^ + Q(t,Nf.c) (70) or or The temporal derivative of porosity should be replaced using equation (44) from the previous chapter. It has not been done in order to simplify the notation. Equation (70), including equations (60) and (61) can be compared directly with equation (51) as they have an identical form. The primary difference between them is that concentration of a species is used in equation (51) and number of moles of a component is used in equation (70). Equation (70) is directly coupled to the flow equation (chapter 7) through the specific discharge vector of the fluid. It is also coupled to the chemical reaction equations developed in chapter 4 through the derivative of the number of moles of the c'th component. As shown in equations (60), (61) and (62), this derivative can be directly related to the derivative of the number of moles of each solid phase and each aqueous species in the REV. The flow equation is directly coupled to the chemical reaction equations through the derivative of the porosity. Because all of these equations are coupled, they should be solved simultaneously, either directly or by an iterative technique. 48 9. The Heat Equat ion The energy equation, which describes temperature spatially and temporally can be written for porous media in the form: (6Pf Cvf+(1- d)PmCvm) ^ = A - ( ^ K * ^ ) - P f Cvf q f ~ + Q(R) + Q(f) (71) p and Cv are the density and the specific heat at constant volume, respectively, subscripted / to indicate fluid or m to indicate matrix. 6 is the porosity, T the temperature, and r the time. K* is the total thermal dispersion tensor. Q(f) is a heat source/sink term which can be considered to be the result of a point source of fluid of a different temperature than the temperature of the matrix. Q(R) is the heat source/sink term which is a result of the chemical reactions and the radioactive decay occurring in the volume element. Equation (71) assumes that the temperature of the fluid and the temperature of the matrix in a volume element are identical at all times. This implies that the volume element is in total thermal equilibrium and that heat transfer within an REV is instantaneous. Only fluid systems with low fluid velocities and high porosities approach these criteria, yet Mercer and Pinder (1974) and Sorey (1978), among others, successfully modelled geothermal systems using equations essentially identical to equation (71). Q(f) can be defined by: Q(f) = (pfCvf(T- Tf))rate (72) T is the temperature of the volume element, Ty is the temperature of the incoming fluid. Cvj is the heat capacity at constant volume for the incoming fluid and rate is the rate at which the fluid is entering the volume element. An injection well is a typical example of such a source. Q(R) can be defined by: oim - V A H° 9 n s + V A H i d n i + V A H r d n r + V o dNe Q y R ) - l ^ - v * s7 + Z.-^r a7 + 2^ i^ r^ 7 + ^ Q c ~ d 7 ( 7 3 ) 9 = 1 i=l r=l c=l AH is the enthalpy of the phase or species, n is the number of moles. Both are subscripted i for the i'th phase, s for the s'th aqueous species and r for the r'th reactant phase. Qc is the heat produced during the radioactive decay of the c'th component. It is beyond the scope of this presentation to 49 rigorously evaluate this term as it depends on parameters such as the nature of the matrix in which the decay occurs. Fortunately, the energy associated with the radioactive decay of most isotopes can be approximated by a temperature independent constant which is in the order of 103 cal/gram/year (plus or minus one order of magnitude). The thermal dispersion tensor can be expanded in terms of the thermal conductivity tensor of the matrix and the fluid, and of the coefficient of thermal dispersion (superscripted m, / and d, respectively). K* = Km(l-6) + Kf6 + Kl (74) where yei The total thermal conductivity of the matrix can be approximated by: np nr Km = J 2 K i n i + YK'n' (75) i=l r=l K is the thermal conductivity, subscripted i to indicate of the i'th phase and subscripted r to indicate the r'th reactant. The thermal conductivity of most phases is a tensor, but equation (75) tacitly assumes random grain orientation. Thus the thermal conductivity is the bulk thermal conductivity. Equation (75) is only an approximation as it does not consider the physical properties of each grain. For example, Vandersande and Pohl (1982) found that the effects of exsolution and twinning lamellae, inclusions and density gradients within each phase are more significant modifiers of the thermal conductivity of a rock than grain boundary effects between each phase. Because their measurements were at low temperatures, it is reasonable to assume that the same properties will probably not be significant modifiers of the thermal conductivity of the media at geological temperatures. Without direct experimental data, there is no way to predict or evaluate terms arising from these interactions or other effects such as the grain boundaries produce. Because of the absence of experimental data and theoretical models for a wide range of pressure temperature conditions, the thermal conductivity of a water rich fluid must be approximated by the thermal conductivity of pure water. The thermal conductivity of pure water is represented over a large range of pressure-temperature space using the equations discussed by Kestin (1979). By analogy to the dispersion term for solute transport, the coefficient of thermal dispersion has been suggested by many authors (Bear (1972), Mercer and Pinder (1979), Pickens and Grisak 50 (1979), among others) to have the following form: Ki^pjCvjDa (76) Dij is the coefficient of mechanical dispersion for the fluid. It was defined in equation (69) as part of the solute transport equation, an identical form is used for heat transport. When used with the heat flow equation, the coefficients of transverse and longitudinal dispersion (OIL and ax) describe the heat dispersion in the fluid. Many authors consider the dispersion coefficient for heat transport as a scalar which can enhance heat transport. Both the scalar and the tensor dispersion term (76) have been successfully used in modelling heat transport in geothermal systems. 51 10. Notes on the Solution of the Equations All of the partial differential equations which constrain fluid flow, heat transport, and solute trans-port implicitly assume that the parameters in these equations are a statistical average over a rep-resentative elementary volume (REV). The REV must be large enough such that parameter being described is not affected by local fluctuations in the parameter, but small enough that large scale features are in different REV's. The size of a REV for porosity (or for example, permeability) is clearly controlled by the size and homogenetity of the geological unit for which it is being determined. For identical reasons, an REV representing the total number of moles of each of the components is controlled by the homogenetity (grain size, number of moles of minerals, and amount of each component in each mineral) and scale of the geological unit. In general, the volume of the REV for each parameter is different. For a static system, the dimensions of the chemical REV's may be different than the physical parameter REV's, but in adynamic system where they are coupled, the physical and chemical REV's must be the same size. This leads to a philosophical problem. Consider an REV for porosity which has superimposed a number of chemical REV's. The chemical REV's are too small to define the porosity in a meaningful sense while the chemical heterogeneity on the scale of the REV for porosity does not allow large chemical REV's. If a reaction occurs in one of the chemical REV's, reducing local void space to zero, the entire flow process would be be affected, but due to the necessarily larger size of the porosity REV, it would be averaged out and never seen. This is one of the limitations when mapping real systems to a numerical model, and then mapping the results back to the real system. For numerical models, the REV for each parameter are often tactly assumed to be the same for reasons of expediency. The initial volume of the REV is based on the scale of the process being modelled and the degree of information that the modeller thinks necessary. The correct volume of REV will depend on the process occuring—often sufficient detail will not be known until the modelling has been completed. The flow, heat and solute transport equations contain and solve for the following temporal and 52 spatial derivatives: dP_ 9T_ dNf.e dP_ dT_ dNf.c dr ' dr ' dr ' dx/dxi' dxi Subscripted variables indicate that there is one derivative for each possible value of the subscript. These equations are coupled through the derivatives of pressure and temperature, either directly or indirectly through terms such as fluid velocity. In addition, all three of these equations contain the derivative of the number of moles of each of the solid phases and of water, and the derivative of the molality of all aqueous species: drii dnT drrig dnw dr ' dr ' dr ' dr Ideally, the flow, heat and solute transport equations should be solved simultaneously with the derivatives of the mass balance, mass action, ionic strength and activity of water. This is clearly impractical for many systems because of the large number of equations involved. For every volume element, the initial temperature, the initial (fluid) pressure, the initial number of moles of each of the components and the initial distribution of these components among the phases and species must be known before the temporal effects can be calculated. The initial values for the temperature, fluid pressure and number of moles of each component in each volume element can be based on a natural system, on the results of other calculations, or they can be arbitrarily chosen. The initial value of the number of moles of each component in a volume element cannot be based on a steady state calculation as most chemical systems never reach total equilibrium. The problem of obtaining good initial values for the number of moles of each of the phases and species in each volume element can be partially overcome by considering each volume element to be initally closed with respect to the mass of components. The number of moles of each phase and the molality of each aqueous species consistent with the chosen mass of each component is then calculated at the initial pressure and the initial temperature of the volume element. This is easily done by a distribution of species calculation or by a EQULAS type of calculation (Brown and Skinner, 1974). The total volume of solids will not generally be equal to the volume available to solids (total volume of the R E V minus the porosity), nor will the volume of the calculated fluid equal the volume available in the pores. The number of moles of each of the solid phases and the aqueous species must be scaled such that the sum of their volumes total the volume of the R E V . The total number of moles of each component are subsequently calculated. Once the initial conditions and boundary conditions are define, the solution of the equations can preceed. The partial differential equations can be solved using finite difference or finite element 53 techniques. The solut ion of these equations is wel l documented in a wide range of texbooks (Remson, Hornberger and M o l z , 1972, P inder and Gray, 1977, Desai and A b e l , 72 are three of many available). F in i t e element techniques were used for al l of the model l ing w i t h the parameters evaluated as discussed below. The solution of the temporal derivatives of the number of moles of each of the phases and of the mola l i ty of a l l of the aqueous species are discussed in chapter 6. The temporal por t ion of the flow, heat and solute transport equations can be solved using a mult i tude of methods, for a one dimensional stream tube analysis, a finite difference approximation is generally used. P i n d e r and G r a y (1977) concluded that the centered finite difference procedure is generally the most efficient and stable method of solution for one dimensional analysis. In contrast, the present s tudy found the centered finite difference procedure to be very unstable and only yielding an acceptable answer for large t ime steps. A n finite difference procedure w i t h a weighting factor of approximately 0. 9 w i t h a l l parameters evaluated at r + ^AT (described below) was found to give the most stable results except for very smal l t ime steps. Before each time step, the values for all system variables (such as pressure) are guessed for t ime T + AT using one of two different techniques. E i ther an extrapolat ion from the values at r and T — AT is used (for the parameters which vary smoothly, i.e. pressure) and an up-stream weighting based on the values at r for the two preceeding nodes (for the parameters which exhibited sharp changes, 1. e. temperature and composit ion) . Us ing these values, a l l system parameters are then evaluated at T + ^AT. Because the system parameters depend on the system variables at T + AT, they are be updated whenever the system variables are solved. The solution technique for each variable is iterative and can take considerable computer t ime. The amount of time used is a direct funct ion of the test(s) used to terminate the iterations. The test presently used compares the difference between the value calculated for the present i teration and the previous i terat ion, if this is greater then a specified tolerance, the iterations continue. To prevent an excessive number of iterations, a counter specifying the m a x i m u m number of iterations must be used. T h e o p t i m a l size of the time step is of cr i t i ca l importance to the accurate solution of any finite difference procedure. A l t h o u g h it is the most convenient to have a l l t ime steps the same size, this results in a very slow and inaccurate code. W h e n time steps are too smal l , often numerica l drift is greater then the true change in the values being solved for. The correct t ime step is u l t imate ly determined by the process being modelled, its size and rate of response to temporal phenomenon. Thi s is not always obvious from the boundary conditions, thus modeller must expect to try different 54 time steps, based on preceeding results. As will be discussed in the modelling chapter, the pressure at each element quickly reaches a value from which it varies only slowly. The change in temperature is dominated by convection thus very little happens until the front reaches the given element. The maximum step size for the solute transport equation is constrained by convection and by the chemical reactions occurring in each volume element. The size of the time step that can be taken in the chemical reactions equations is dependent totally on the process being modelled and to a lesser extent, on the amount of output desired by the modeller. The size of this time step is generally small, but the absolute size is variable. In most processes, the size of the chemical reaction time step and the solute transport time step should be similar. In the development of the partial differential equations describing the flow, heat transport and solute transport equations, all spatial derivatives of an order greater than two and all temporal derivatives of an order greater than one were discarded. This truncation has resulted in the use of only one derivative to approximate the total change in the number of moles of a phase or the molality of an aqueous species and will introduce significant errors when large time steps are taken. This can be overcome by replacing the derivative of the number of moles or molality in the flow, heat and solute transport equations by a finite difference derivative. The derivative of the number of moles of the i'th phase (for example) would be replaced by: a_ „ T + A T T ani n- — n- , 7 7 = - " " AT-" ( 7 7 ) The number of moles of the i'th phase at time r + Ar would be calculated using as many derivatives as is needed in a series expansion such as equation (1). This effectively reintroduces higher-order derivatives into the temporal portion of the flow, heat and solute transport equation, and improves the accuracy and stability of these equations. Figure 3 illustrates the iteration scheme used, the order of solution and potential relative sizes of the time steps. Each horizontal line indicates the relative size of time step, and the relative position of the time of solution. The predicted values for all parameters (for example, porosity) are updated at the end of each iteration for the solution of flow, heat and solute transport equations. One practical limitation on the step size is the difference in velocity of one REV compared to the next. If this difference, multiplied by the time step, is significantly greater then the length of the REV, the calculated results for the solute transport and for the heat transport will be grossly in error. 55 F i g u r e 3 - I t e r a t i o n S c h e m e U s e d Flow equation H e a t equation S o l u t e transport and c h e m i c a l reaction equations solved alternatively H e a t equation S o l u t e transport and c h e m i c a l reaction equations solved alternatively H e a t equation S o l u t e transport and c h e m i c a l reaction equations solved alternatively T I M E The length of the dashed lines indicates the relative size of time steps—their vertical position indi-cates the relative order in which they occur. For purposes of illustration, all time steps are fixed, the flow equation step size is three times greater than the heat equation step size and nine times greater than the solute transport equation and chemical reaction equation step size. In general, each step can vary and is iterative. 56 11. Model Verification The equations developed and discussed in the previous chapters have been used as the basis for a computer program which is described in the appendices. Before the program can be used as a predictive tool, the results must be confirmed as correct. The theoretical bases of the program can be verified by independently rederiving all equations, but the verification of a large computer code is much more difficult. Programs are verified by comparing their calculated results with existing analytical solutions or with the results of other programs. The program can also be examined by other programmers, but the absence of visible errors does not ensure that there are none. For a given problem, an analytical solution is exact but the range of problems for which an an-alytical solution exists and can be applied to is extremely limited. Comparison with other programs is often the only method of verification, but this depends on the availability of programs which make similar calculations. To the best of the author's knowledge, there are no computer codes (and certainly no analytical solutions) that can be used to calculate geochemical processes in the detail and with the degree of coupling presented here. The code has been verified by checking the results against existing analytical solutions and other computer codes, generally by modelling very simple and restricted cases. For many of these test, the code developed for this thesis had to be modified (simplified) to match the other program. The following comparisons/verifications have been made: 1 Iso-thermal flow processes with no mass transport and no chemical reactions. Constant porosity and permeability as a function of time and space, all nodes equal. All matrix phases considered inert. Fluid is inert and the volumetric properties of the REV are independent of pressure and temperature. Results were directly compared to analytical solutions and simple numerical models which calculated the pressure head and fluid velocity. 2 As per (l), except the volumetric properties of the fluid were modelled using the ideal gas law. Results compared to simple numerical models which calculated the pressure head and fluid velocity. 3 As per (l), except the volumetric properties of the fluid were modelled using the Keenan and Keyes equations of state for water. The initial pressure gradient was kept small, all other 57 properties were scaled accordingly. Results compared to simple numerical models which used the ideal gas law to calculate the pressure head and fluid velocity. 4 As per (2) except porosity varied as a function of node position. Results compared against simple numerical models which calculated the pressure head and fluid velocity. 5 No flow, no chemical reactions, constant porosity and permeability as a function of space and time, heat capacity of matrix and fluid set to a constant, all nodes equal. Results compared to analytical solution which calculated the conductive heat transport. 6 No flow, no chemical reactions, constant porosity and permeability as a function of space and time, all nodes equal, heat capacity of matrix and fluid allowed to vary, results compared to numerical models which calculated conductive heat transport. 7 Flow constant as a function of time and equal in all nodes. No chemical reactions, constant and equal porosity and permeability as a function of space and time, pressure constant and equal at all nodes, heat capacity of matrix and fluid constant. No conductive heat transport.-Results compared to numerical models for advective heat transport. 8 As per 7 except dispersive heat conduction considered as well. Results compared to numerical models. 9 Constant pressure (same at all nodes), constant porosity and permeability (same at all nodes) as a function of space and time, constant temperature (at all nodes), no chemical reactions. Con-stant ionic strength, activity coefficents, volumetric properties of fluid. No flow, only diffusional transport of species allowed. All parameters not specified here were held constant. Species and matrix phases considered inert. Results compared to analytical solution for diffusional mass transport. 10 As per 9, except advection included. Compared to numerical results for advective and diffusional mass transport. 11 Thermodynamic properties of aqueous species compared to results calculated using PATH69 (Perkins, 1980), PATH81 (Perkins, 1980), SUPCRT (Kirkham, et al., 1978) and EQ3D (Wolery, 1979). 12 Thermodynamic properties of solids and water compared to values calculated using a modifi-cation of PT-SYSTEM (Perkins, Brown and Berman, 1985). 13 Mass transfer calculations for isothermal isobaric closed systems compared to results calculated using PATH69 (Perkins, 1980), PATH81 (Perkins, 1980), and EQ3D (Wolery, 1979). 58 14 All routines which calculate the physical properties of phases, aqueous species and water verified against existing tabulations of experimental data. The above comparisons verify most of the subroutines in the program, they do not verify the coupling and subsequent interactions. These can only be verified by detailed examination of the individual run results, plotting them, and examining their implications. The chemical data for any given run can be plotted on activity diagrams; if the calculations are inconsistant with the thermodynamic data, then the calculated equilibrium would disagree with the diagrams. Until such time that equivalent programs are available, complete verification of the program written for this thesis is not possible. The program does contain some internal checks against errors. At any point in time, the total mass in an REV is fixed and the distribution of mass among the phases and species has been calculated. Using the total mass, the distribution of mass among the phases and species can be recalculated using different routines, thus independently verifying the number of moles of the solid phases and the molality of the aqueous species. The final verification that any model can undergo is to sucessfully predict and interpret natural and industrial processes. The most applicable process to which this model can be applied is a steam or hot water flood during secondary oil recovery. Within the limitations of the code (a one dimensional analysis), the agreement is good. 59 12. Examples of Model Application This chapter presents the results of various model calculations which were made with the program de-scribed and listed in the appendices. All of the calculations have the same basic physical geometry—a one dimensional "stream tube" consisting of a quartz matrix with an initial porosity of 20%. At time zero, a pressure and/or thermal event occurs at one end. This event modifies the existing flow field (if one existed), the pressure and temperature. Dependent on the boundary conditions, material may dissolve/precipitate during this process. The results are presented in figures and must be considered preliminary. The models have been kept as simple as possible in order to illustrate the processes—results from complicated runs often hide the underlying process in details. The models are divided into three sets, each set into three subsets. The subsets are the same in each set. The sets were chosen to represent the three most extreme cases possible—they and then-respective subsets are: • Inert component, with transport - Pressure gradient in an isothermal system. - Temperature gradient in a system with fixed pressures at each node. - Pressure and temperature gradients. • Reactive component, with no tranport - Pressure gradient in an isothermal system. - Temperature gradient in a system with fixed pressures at each node. - Pressure and temperature gradients. • Reactive component, with transport - Pressure gradient in an isothermal system. - Temperature gradient in a system with fixed pressures at each node. - Pressure and temperature gradients. Because of the interactions in the system, each of the subsystems will have different ranges for each of the variables. The closest real system to these models would be a wet steam flood—which is used as an enhanced oil recovery technique. The position z, = 0 on the following figures would correspond 60 to a position close to the gravel pack.6 Steam/hot water injected through it quickly dissolves the quartz, often reaching a near saturated silica value before the formation is reached. The producing formation in most oil fields usually contains upwards of 50% quartz. Overview of the Graphical Technique The results have been plotted in a series of three dimensional figures. On each figure, the x axis is the distance along the flow path, and increases from left to right. The y axis is time, and increases with depth into the figure. The variable being plotted (pressure, temperature, porosity, ...) always increases vertically (the z axis). The surface has been generated by a series of lines, one set parallel to the time axis (iso-distance) and the other set parallel to the distance axis (iso-time). The set of surfaces for any given run all have the same x and y dimensions. Regardless of the number of time steps and of volume elements, the results have been displayed such that there is always between 31 and 61 divisions in the x (distance) and y (time) directions. No calculations were made with less then 31 divisions in either direction. If there were more than 40 REV's or more than 61 time steps, then some of the intermediate results were not plotted. This was done to maintain the density of information on the figure at a useable level. On occasion, not plotting the intermediate results yields a bumpy surface. The bumpiness may also be a result of numerical roundoff during plotting, or due to numerical error/roundoff/instability during the calculations. For each variable considered (pressure, temperature, porosity, ...), two surfaces have been plotted. The first is the variable versus distance and time, the second is the derivative of the variable with respect to time versus distance and time. The second plot gives a better sense of the spatial and temporal changes that particular variable undergoes. Although each variable is coupled to all others, one of the variables may change a factor of two or much more than the others. When this occurs, the time scale for that variable on the figures will be different than for the other figures. Because the change in permeability is totally proportional to porosity (see the equation of Wood and Hewitt (1982), at the end of flow chapter), figures containing permeability and the deriviative of permeability have only been plotted for the first model. Figures of the spacial and temporal change in the molality of the aqueous species and the temporal derivatives have not been included. 6 A gravel pack is a cylinderical shell of sieved quartz sand (approximately 1.70 to 0.85 mm in diameter) surrounding the well. It typically has an inter radius of 20-30 centimeters and an outer of 50-70 centimeters. 61 The aqueous species data base used is that of Helgeson et al. (1974a, 1974b, 1976, 1981), and it, unfortunately, is limited as it generally includes only one aqueous species for each element—typically the bare ion. As an aid in interpreting the graphs, several tables are associated with model 6. These list the pressure, temperature, porosity and molality of silica as a functions of distance and time. The units for all figures are: pressure is in MPa, temperature is in degrees kelvins, concentration of aqueous species are in molality. M o d e l O n e : I s o - t h e r m a l w i t h n o C h e m i c a l R e a c t i o n s , I n e r t T r a n s p o r t This model calculates the changes in pressure, fluid velocity, porosity, permeability and concentration of aqueous silica when a quartz sandstone is subjected to a pressure event. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all z8) pressure = 20.0 MPa, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, "fluid composition in equilibrium with quartz, for times greater than 0.0 pressurex=o = 20.5 MPa, solution is inert, and for all times and positions temperature = 500 degrees kelvins. This model is illustrated by figures 4A, 4B, 4C, 4D, 4E, 4F, 4G, 4H, 41 and 4J. Examination of the figures reveals the following: • Each node reacts quickly to the pressure front, reaching a pressure value near the steady state value. • The change in pressure rapidly decays and disperses over a a longer length of the stream tube. • The magnitude of the velocity decays as quickly as the pressure does, in exact proportion to the pressure decay. 62 The permeability and porosity at x = 0 was held constant, giving the graphs the appearance of a ridge. Both the porosity and permeability increase as the pressure increases. Their maximum rate of change correlates to the maximum rate of change of pressure. Because of the model used, the change in permeability is exactly the same as the change in porosity. The silica in solution cannot react with the matrix, and because there is only one aqueous silica species, its concentration is independent of the pressure. As would be expected for any inert component, speed of the silica concentration front is a function of the velocity. This isothermal process illustrates the effects that occur when the rate of reaction between aqueous species and solids is infinitely slow—the effects on the matrix are totally a function of the pressure work term. 63 Figure 4A - Chang, » p r e „ „ , « „ „ , „ , „ „ , t o t l m ( , a n d CO \ Figure - Derivative of the Change in Pressure Figure 4B is the derivative of pressure with in an isothermal system. respect to time plotted as a function of time and distance 64 F i g u r e 4C - C h a n g e i n V e l o c i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 4C illustrates the change in velocity as a function of time and distance in an isothermal system. F i g u r e 4D - D e r i v a t i v e o f t h e C h a n g e i n V e l o c i t y Figure 4D is the derivative of velocity with respect to time plotted as a function of time and distance in an isothermal system. 65 F i g u r e 4 E - C h a n g e i n P o r o s i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 4E illustrates the change in porosity as a function of time and distance in an isothermal system. F i g u r e 4F - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 4F is the derivative of porosity respect to time plotted as a function of time and distance in an isothermal system. 66 Figur. iG - C h M g « m V^bmiy with re,p«, ,„ tta, « „ d i,,„„ system. ai><^,._ ^ Figure 4H - Derivative of the Change b, Permeability Fi8»re 4H is the derivative o t p „ m e i b i l i t y w i t h r „ p e c t ^ ^ ^ ^ ^ ^ ^ ^ distance in an isothermal system. 67 F i g u r e 41 - C h a n g e i n C o n c e n t r a t i o n w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 41 illustrates the change in the concentration of an inert component as a function of time and distance in an isothermal system. F i g u r e 4J - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 4J is the derivative of the concentration of an inert component with respect to time plotted as a function of time and distance in an isothermal system. 68 M o d e l T w o : T h e r m a l E f fec t s , F i x e d P r e s s u r e G r a d i e n t , I n e r t T r a n s p o r t This model calculates the changes in temperature, fluid velocity, porosity, permeability and concen-tration of aqueous silica when a quartz sandstone is subjected to a thermal event. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all z,-) temperature = 500.0 degrees kelvins, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 temperaturex=o = 550.0 degrees kelvins, solution is inert, and for all times and positions Pressure MPa= 20.5 - (.00125i,). The model is illustrated by figures 5A, 5B, 5C, 5D, 5E and 5F. Examination of these figures reveals the following: • The thermal event is a sharp front moving from left to right across the diagram. • Plotting error (too few points for a true 3D view), numerical error (both roundoff and insta-bility) are clearly visible in the derivative of temperature with respect to time and the porosity. • The porosity decreases as a function of temperature. The maximum rate of change correlates to the maximum rate of change of temperature. • As would be expected for any inert component, speed of the silica concentration front is a function of the velocity. • Because the silica front is not reactive, it quickly moves ahead of the temperature front. The rate of change of temperature is constrained by the velocity of the fluid and by the heat capacity of the matrix. This process illustrates the effects that occur when the rate of reaction between aqueous species and solids is infinitely slow—the effects on the matrix are totally a function of the temperature. It also illustrates that under these conditions, the temperature field migrates considerably slower than the solute front. 69 Figure 5 A - Change in Temperature with respect to time and distance Figure 5A illustrates the change in temperature as a function of time and distance in a system with fixed pressures. Figure 5B - Derivative of the Change in Temperature Figure 5B is the derivative of temperature with respect to time plotted as a function of time and distance in a system with fixed pressures. 70 F i g u r e 5C - C h a n g e i n P o r o s i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 5C illustrates the change in porosity as a function of time and distance in a system with fixed F i g u r e 5 D - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 5D is the derivative of porosity respect to time plotted as a function of time and distance in a system with fixed pressures. 71 Figure 5E - Change in Concentration with respect to time and distance Figure 5E illustrates the change in the concentration of and distance in a system with fixed pressures. an inert component as a function of time F '"o, F- °°„ °S 0 • 0-F i g u r e 5F - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 5F is the derivative of the concentration of an inert component respect to time plotted function of time and distance in a system with fixed pressures. as a 72 M o d e l T h r e e : N o C h e m i c a l R e a c t i o n , I n e r t T r a n s p o r t This model calculates the changes in temperature, fluid velocity, porosity, permeability and con-centration of aqueous silica when a quartz sandstone at equilibrium with a fluid, is subjected to a thermal and pressure event. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all xt) temperature = 500.0 degrees kelvins, pressure = 20.0 MPa, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 pressureI=o = 20.50 MPa, temperature x = 0 — 550.0 degrees kelvins. solution is inert, This process is illustrated by figures 6A, 6B, 6C, 6D, 6E, 6F, 6G, 6H, 61 and 6J. Note that the pressure and velocity figures have a different time scale than the other figures. The most significant points shown on these figures are: • The pressure quickly rises to a near steady state case. • The velocity instantaneously reaches a maximum value from which it decays rapidly to near the steady state value. • The maximum change in porosity correlates directly with the maximum change in temperature. • The thermal effect on porosity (and permeability) is far greater than that of the mechanical (pressure) effect. The pressure effect can be seen—although only for the initial nodes after a longer time when the porosity surface curves upward. • Because the velocity changes significantly—from zero to a positive, approximately constant value—the inert component shock front only travels about 15 percent faster then the tempera-ture shock front does. This process illustrates the effects when the reaction rates between the aqueous species and the solids are infinitely slow—the effects on the matrix are totally a func-tion of the pressure and temperature. It also illustrates that in a evolving system, the solute shock front does not outdistance the temperature shock front to the same degree as it would in an established flow system. 73 F i g u r e 6A - C h a n g e i n P r e s s u r e w i t h respec t t o t i m e a n d d i s t a n c e Figure 6A illustrates the cha lange m pressure as a function of time and dist thermal and pressure gradients. ance m a system with F i g u r e 6 B - D e r i v a t i v e o f t h e C h a n g e i n P r e s s u r e Figure 6B is the d e r i v e of pressure with respect to time plotted as a function of tune and distance in a system with thermal and pressure gradients. . 74 Figure 6C - Change in Velocity with respect to time and distance Figure 6C illustrates the change in fluid velocity as a fun, thermal and pressure gradients. ction of time and distance in a system with Figure 6D - Derivative of the Change in Velocity Figure 6D is the derivative of velocity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 75 F i g u r e 6E - C h a n g e i n T e m p e r a t u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 6E illustrates the change in temperature as a function of time and distance in a system with thermal and pressure gradients. F i g u r e 6F - D e r i v a t i v e o f t h e C h a n g e i n T e m p e r a t u r e Figure 6F is the derivative of temperature with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 76 F i g u r e 6 G - C h a n g e i n P o r o s i t y w i t h respec t t o t i m e a n d d i s t a n c e Figure 6G illustrates the change in porosity as a function of time and distance in a system with thermal and pressure gradients. F i g u r e 6 H - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 6H is the derivative of porosity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 77 F i g u r e 61 - C h a n g e i n C o n c e n t r a t i o n w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 61 illustrates the concentraion of an inert component as a function of time and distance in a system with thermal and pressure gradients. F i g u r e 6J - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 6J is the derivative of the concentration of an inert component with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 78 M o d e l Four: Iso-thermal w i th no Transport . This model calculates the changes in pressure, fluid velocity, porosity, permeability and concentration of aqueous silica when a quartz sandstone at constant temperature remains in equilibrium with the fluid during a pressure event. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all z,) pressure = 20.0 MPa, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 pressure x = 0 = 20.50 MPa, solution is inert, and for all times and positions temperature = 500.0 degrees kelvins, there is no solute transport, the fluid remains at all times in equilibrium with quartz. This process is illustrated by figures 7A, 7B, 7C, 7D, 7E, 7F, 7G and 7H which can be compared with those of model one. • As in model one, the pressure and velocity quickly reach a near steady state values. • The porosity increases with respect to time and distance as it does in model one, but the increase is a factor of 1.5 more due to the dissolution of quartz. • There is no solute front as no transport has occurred. Thus the molality and the derivative of the molality of silica in solution is a direct function of the pressure and the derivative of fluid pressure. This model illustrate the effects on a system in which the rates of reaction between the solution and the solid phases are infinitely fast but no solute transport occurs. Under these conditions, the general effect is to increase the porosity and permeability. 79 F i g u r e 7A - C h a n g e i n P r e s s u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 7A illustrates the change in pressure as a function of time and distance in an isothermal F i g u r e 7 B - D e r i v a t i v e o f t h e C h a n g e i n P r e s s u r e Figure 7B is the derivative of pressure with respect to time plotted as a function of time and distance in an isothermal system. 80 F i g u r e 7C - C h a n g e i n V e l o c i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 7C illustrates the change in velocity as a function of time and distance in an isothermal F i g u r e 7D - D e r i v a t i v e o f t h e C h a n g e i n V e l o c i t y Figure 7D is the derivative of velocity with respect to time plotted as a function of time and distance in an isothermal system. 81 Figure 7E - Change in Porosity with respect to time and distance Figure 7E illustrates the change in porosity as a function of time and distance in an isothermal system. Figure 7F - Derivative of the Change in Porosity Figure 7F is the derivative of porosity respect to time plotted as a function of time and distance in an isothermal system. 82 F i g u r e 7 6 - C h a n g e i n C o n c e n t r a t i o n w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 7G illustrates the change in the concentration of a component as a function of time and distance in an isothermal system with no transport of that component. F i g u r e 7 H - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 7H is the derivative of the concentration of a component with respect to time plotted as a function of time and distance in an isothermal system with no transport of that component. 83 Model Five: Thermal Effects, Fixed Pressure Gradient, No Transport This model calculates the changes in temperature, fluid velocity, porosity, permeability and concen-tration of aqueous silica when a quartz sandstone is subjected to a thermal event. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all x,) temperature = 500.0 degrees kelvins, porosity = 20.0 percent, log permeability = —8.00, fluid composition in equilibrium with quartz, for times greater than 0.0 temperature I =o = 550.0 degrees kelvins, solution is inert, and for all times and positions Pressure MPa= 20.5 — (.00125X;), velocity determined by pressure gradient, there is no solute transport, the fluid remains at all times in equilibrium with quartz. This process is illustrated by figures 8A, 8B, 8C, 8D, 8E and 8F. The most important points illustrated by these set of figures are: • The position of the temperature front is exactly mirrored by the changes in porosity and by the molality of silica in solution. • The fronts broaden and slow with respect to time and distance due to the heat capacity of the solid phases and due to dispersion. • In contrast to model 3, the porosity has increased by approximately 20 percent (and although not shown, the permeability as well). This model illustrates the effects on a steady state flow field when a thermal event occurs, the rate of reaction between aqueous species and solid phases is infinitely fast, but no solute tranport occurs. The general effect is to increase the porosity and permeability significantly. 84 Figure 8A - Change in Temperature with respect to time and distance Figure 8A illustrates the change in temperature as a function of time and distance in a system with fixed pressures. Figure 8B - Derivative of the Change in Temperature Figure 8B is the derivative of temperature with respect to time plotted as a function of time and distance in a system with fixed pressures. 85 F i g u r e 8C - C h a n g e i n P o r o s i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 8C illustrates the change in porosity as a function of time and distance in a system with fixed pressures. • ' /x F i g u r e 8D - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 8D is the derivative of porosity respect to time plotted as a function of time and distance in a system with fixed pressures. 86 F i g u r e 8E - C h a n g e i n C o n c e n t r a t i o n w i t h respec t t o t i m e a n d d i s t a n c e Figure 8E illustrates the change in the concentration of a component as a function of time and distance in a system with a fixed pressure head and fixed fluid velocity, but in a system with no tranport of that component. F i g u r e 8 F - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 8F is the derivative of the concentration of a component respect to time plotted as a function of time and distance in a system with a fixed pressure head and fixed fluid velocity, but in a system with no transport of that component. 87. Model Six: No Transport - Pressure and Temperature Gradient This model can be considered the "no solute transport" analogy to model 2 or the sum of models 4 , and 5. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all x,) temperature = 500.0 degrees kelvins, pressure = 20.5 MPa, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 temperaturex=$ '= 550.0 degrees kelvins, pressureI=o = 20.5 MPa, and for all times and positions there is no solute transport, the fluid remains at all times in equilibrium with quartz. Figures 9A through 9J illustrate this model. All points mentioned for models 4 and 5 apply to this one as well, but a few more need to be mentioned. • The effects of numerical instability can be clearly seen in figures 9E, 9G and 91—and are, of course, present in the figures showing the derivatives of these properties. • The effects of pressure on the porosity or on the molality of silica in solution is small compared to the effects of temperature and is difficult to see in these diagrams. It can be most easily seen in the derivative of porosity by comparing the height of the surface in front of and behind the "ridge" indicating the effects of the temperature shock front. • Because the thermal front broadens with respect to time and distance, all of the shock fronts appear to be curved in time. Because the front broadens, the time taken by the front to tranverse a given point inceases. This model indicates what could happen in a static system when it is disturbed by an injection of hot fluid, but no solute transport occurs. The general conclusion is that the porosity, permeability and amount of dissolved material in solution would increase. The position of maximum change in any of these variables would be at the thermal shock front. F i g u r e 9 A - C h a n g e i n P r e s s u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 9A illustrates the change in pressure as a function of time and distance in a system with thermal and pressure gradients. F i g u r e 9 B - D e r i v a t i v e o f t h e C h a n g e i n P r e s s u r e Figure 9B is the derivative of pressure with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 89 Figure 9C - Change in Velocity with respect to time and distance Figure 9C illustrates the change in fluid velocity as a function of time and distance in a system with thermal and pressure gradients. Figure 9D - Derivative of the Change in Velocity Figure 9D is the derivative of velocity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 90 F i g u r e 9 E - C h a n g e i n T e m p e r a t u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 9E illustrates the change in temperature as a function of time and distance in a system with thermal and pressure gradients. F i g u r e 9F - D e r i v a t i v e o f t h e C h a n g e i n T e m p e r a t u r e Figure 9F is the derivative of temperature with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 91 F i g u r e 9G - C h a n g e i n P o r o s i t y w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 9G illustrates the change in porosity as a function of time and distance in a system with thermal and pressure gradients. i — i cn o ex o F i g u r e 9 H - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 9H is the derivative of porosity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 92 F i g u r e 91 - C h a n g e i n C o n c e n t r a t i o n w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 91 illustrates the concentration of a component as a function of time and distance in a system with thermal and pressure gradients, but with no transport of that component. F i g u r e 9J - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 9J is the derivative of the concentration of a component with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients, but with no transport of that component. 93 Table TV: Calculated values of Pressure, , at time: 0.0 The following values for pressure, temperature, molality of silica in solution and porosity were calculated for time: 0.0 Position Pressure Temperature Molality Porosity .00000E+00 .21000E+02 .55000E+03 .85929E-02 .20000000 .10000E+02 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .20000E+02 .2OO00E+02 .50000E+03 .53346E-02 .20000000 .30000E+02 .20O00E+02 .50000E+03 .53346E-02 .20000000 .40000E+02 .20O00E+02 .50000E+03 .53346E-02 .20000000 .50000E+02 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .60000E+02 .20000E+02 .50000E+03 .53346E-02 .20000000 .70000E+02 .20000E+02 .50000E+03 .53346E-02 .20000000 .80000E+02 .20000E+02 .50000E+03 .53346E-02 .20000000 .90000E+02 .20000E+02 .50000E+03 .53346E-02 .20000000 .10000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .11000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .12000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .13000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .14000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .15000E+03 .20O0OE+O2 .50000E+03 .53346E-02 .20000000 .16000E+03 .2OO00E+02 .50000E+03 .53346E-02 .20000000 .17000E+03 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .18000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .19000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .20000E+03 .20O00E+02 .50000E+03 .53346E-02 .20000000 .21000E+03 .20O00E+02 .50000E+03 .53346E-02 .20000000 .22000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .23000E+03 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .24000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .25000E+03 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .26000E+03 .20O0OE+02 .5000OE+03 .53346E-02 .20000000 .27000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .28000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .29000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .30000E+03 .20O0OE+02 .50000E+03 .53346E-02 .20000000 .31000E+03 .20000E+02 .50000E+03 .53346E-02 2^0000000 .32000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .33000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .34000E+03 .20000E+02 '.50000E+03 .53346E-02 .20000000 .35000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .36000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .37000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 .38000E+03 .20O0OE+O2 .50000E+03 .53346E-02 .20000000 .39000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 94 Table V: Calculated values of Pressure, • • •, at time: 4000 The following values for pressure, temperature, molality of silica in solution and porosity were calculated for time: 4000. Position Pressure Temperature Molality Porosity .OO000E+0O .21000E+02 .55000E+03 .85929E-02 .20000000 .10000E+02 .20784E+02 .54994E+03 .85798E-02 .23733399 .20000E+02 .20598E+02 .55000E+03 .85763E-02 .23724984 .30000E+02 .20436E+02 .54993E+03 .85646E-02 .23708875 .40000E+02 .20305E+02 .55000E+03 .85642E-02 .23704466 .50000E+02 .20203E+02 .54990E+03 .85529E-02 .23690701 .60000E+02 .20130E+02 .55000E+03 .85570E-02 .23692623 .70000E+02 .20080E+02 .54982E+03 .85419E-02 .23675795 .80000E+02 .20048E+02 .55000E+03 .85536E-02 .23687128 .90000E+02 .20027E+02 .54950E+03 .85168E-02 .23647653 .10000E+03 .20015E+02 .55000E+03 .85524E-02 .23685253 .11000E+03 .20008E+02 .54795E+03 .84068E-02 .23512364 .12000E+03 .20005E+02 .55000E+03 .85519E-02 .23684497 .13000E+03 .20002E+02 .53387E+03 .74313E-02 .21841017 .14000E+03 .20001E+02 .50280E+03 .54934E-02 .20045878 .15000E+03 .20001E+02 .50000E+03 .53343E-02 .20014559 .16000E+03 .200O0E+O2 .50016E+03 .53434E-02 .20003666 .17000E+03 .20000E+02 .50000E+03 .53343E-02 .20000148 .18000E+03 .20000E+02 .50001E+03 .53349E-02 .19999859 .19000E+03 .20000E+02 .50000E+03 .53343E-02 .19999596 .20000E+03 .20000E+02 .50000E+03 .53343E-02 .19999582 .21000E+03 .20000E+02 .50000E+03 .53343E-02 .19999563 .22000E+03 .20000E+02 .50000E+03 .53343E-02 .19999562 .23000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .24000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .25000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .26000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .27000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .28000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .29000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .30000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .31000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .32000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .33000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .34000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .35000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .36000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .37000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .38000E+03 .20000E+02 .50000E+03 .53343E-02 .19999560 .39000E+03 .20000E+02 .50000E+03 .53343E-02 .20000000 95 Table VI: Calculated values of Pressure, at time: 8000 The following values for pressure, temperature, molality of silica in solution and porosity were calculated for time: 8000.0 Position Pressure Temperature Molality Porosity .00000E+00 .21000E+02 .55000E+03 .85929E-02 .20000000 .10000E+02 .20847E+02 .55000E+03 .85866E-02 .23742872 .20000E+02 .20711E+02 .55000E+03 .85807E-02 .23732949 .30000E+02 .20584E+02 .55000E+03 .85756E-02 .23724384 .40000E+02 .20468E+02 .54999E+03 .85704E-02 .23715473 .50000E+02 .20367E+02 .55000E+03 .85668E-02 .23709310 .60000E+02 .20281E+02 .54998E+03 .85619E-02 .23701555 .70000E+02 .20210E+02 .55000E+03 .85604E-02 .23698534 .80000E+02 .20154E+02 .54996E+03 .85549E-02 .23690921 .90000E+02 .20110E+02 .55O0OE+O3 .85562E-02 .23691782 .10000E+03 .20077E+02 .54991E+03 .85482E-02 .23681413 .11000E+03 .20053E+02 .55000E+03 .85539E-02 .23687643 .120O0E+O3 .20035E+02 .54977E+03 .85365E-02 .23669783 .13000E+03 .20023E+02 .55000E+03 .85527E-02 .23685708 .14000E+03 .20015E+02 .54933E+03 .85039E-02 .23633432 .15000E+03 .20009E+02 .55000E+03 .85521E-02 .23684830 .16000E+03 .20006E+02 .54746E+03 .83714E-02 .23466565 .17000E+03 .20004E+02 .55000E+03 .85519E-02 .23684528 .18000E+03 .20002E+02 .53547E+03 .75391E-02 .22142581 .19000E+03 .20001E+02 .50453E+03 .55925E-02 .20153386 .20000E+03 .20001E+02 .50000E+03 .53346E-02 .19999858 .21000E+03 .20000E+02 .50022E+03 .53471E-02 .20009008 .22000E+03 .20000E+02 .50000E+03 .53346E-02 .19999835 .23000E+03 .20000E+02 .50001E+03 .53354E-02 .20000469 .24000E+03 .20000E+02 .50000E+03 .53346E-02 .19999828 .25000E+03 .20000E+02 .50000E+03 .53347E-02 .19999871 .26000E+03 .20000E+02 .50000E+03 .53346E-02 .19999826 .27000E+03 .20000E+02 .50000E+03 .53346E-02 .19999828 .28000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .29000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .30000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .31000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .32000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .33000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .34000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .35000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .36000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .37000E+03 .20000E+02 \50000E+03 .53346E-02 .19999825 .38000E+03 .20000E+02 .50000E+03 .53346E-02 .19999825 .39000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 96 Table V U : Calculated values of Pressure, at time: 12000 The following values for pressure, temperature, molality of silica in solution and porosity were calculated for time: 12000. Position Pressure Temperature Molality Porosity .OOO00E+0O .21000E+02 .55000E+03 .85929E-02 .20000000 .10000E+02 .20875E+02 .55000E+03 .85877E-02 .23744910 .20000E+02 .20763E+02 ' .55000E+03 .85830E-02 .23736843 .30000E+02 .20655E+02 .55000E+03 .85786E-02 .23729545 .40000E+02 .20554E+02 .55000E+03 .85742E-02 .23722170 .50000E+02 .20462E+02 .55000E+03 .85707E-02 .23716094 .60000E+02 .20379E+02 .54999E+03 .85667E-02 .23709776 .70000E+02 .20306E+02 .55000E+03 .85642E-02 .23705295 .80000E+02 .20243E+02 .54999E+03 .85607E-02 .23700059 .90000E+02 .20190E+02 .55000E+03 .85595E-02 .23697346 .10000E+03 .20146E+02 .54998E+03 .85560E-02 .23692811 .11000E+03 .20111E+02 .55000E+03 .85562E-02 .23691991 .12000E+03 .20083E+02 .54996E+03 .85519E-02 .23687184 .13000E+03 .20061E+02 .55000E+03 .85542E-02 .23688731 .14000E+03 .20044E+02 .54990E+03 .85467E-02 .23681214 .15000E+03 .20031E+02 .55000E+03 .85539E-02 .23687317 .16000E+03 .20022E+02 .54976E+03 .85354E-02 .23671157 .17000E+03 .20015E+02 .55000E+03 .85523E-02 .23685659 .18000E+03 .20010E+02 .54925E+03 .84987E-02 .23632221 .19000E+03 .20007E+02 .55000E+03 .85520E-02 .23684650 .20000E+03 .20005E+02 .54697E+03 .83363E-02 .23437098 .21000E+03 .20003E+02 .55000E+03 .85519E-02 .23684442 .22000E+03 .20002E+02 .53321E+03 .73870E-02 .22041296 .23000E+03 .20001E+02 .50396E+03 .55596E-02 .20150192 .24000E+03 .20001E+02 .50000E+03 .53343E-02 .19999772 .25000E+03 .20001E+02 .50019E+03 .53455E-02 .20009339 .26000E+03 .20000E+02 .50000E+03 .53343E-02 .19999748 .27000E+03 .20000E+02 .50001E+03 .53350E-02 .20000343 .28000E+03 .20000E+02 .50000E+03 .53343E-02 .19999739 .29000E+03 .20000E+02 .50000E+03 .53343E-02 .19999778 .30000E+03 .20000E+02 .50000E+03 .53343E-02 .19999736 .31000E+03 .2O0O0E+O2 .50000E+03 .53343E-02 .19999738 .32000E+03 .20000E+02 .50000E+03 .53343E-02 .19999735 .33000E+03 .20000E+02 .50000E+03 .53343E-02 .19999735 .34000E+03 .20000E+02 .50000E+03 .53343E-02 .19999734 .35000E+03 .20000E+02 .50000E+03 .53343E-02 .19999734 .36000E+03 .20000E+02 .50000E+03 .53343E-02 .19999734 .37000E+03 .20000E+02 .50000E+03 .53343E-02 .19999734 .38000E+03 .20000E+02 .50000E+03 .53343E-02 .19999734 .39000E+03 .20000E+02 .50000E+03 .53343E-02 .20000000 97 Table VIII: Calculated values of Pressure, , at time: 16000 The following values for pressure, temperature, molality of silica in solution and porosity were calculated for time: 16000. Position Pressure Temperature Molality Porosity .0O00OE+OO .21000E+02 .55000E+03 .85929E-02 .20000000 .10000E+02 .20892E+02 .54999E+03 .85873E-02 .23744944 .20000E+02 .20794E+02 .55000E+03 .85844E-02 .23739144 .30000E+02 .20699E+02 .54998E+03 .85794E-02 .23731471 .40000E+02 .20609E+02 .55000E+03 .85767E-02 .23726241 .50000E+02 .20524E+02 .54998E+03 .85721E-02 .23719208 .60000E+02 .20446E+02 .55000E+03 .85700E-02 .23714918 .70000E+02 .20375E+02 .54998E+03 .85658E-02 .23708694 .80000E+02 .20312E+02 .55000E+03 .85645E-02 .23705596 .90000E+02 .20256E+02 .54998E+03 .85606E-02 .23700140 .10000E+03 .20208E+02 .55000E+03 .85602E-02 .23698394 .11000E+03 .20166E+02 .54997E+03 .85564E-02 .23693395 .12000E+03 .20132E+02 .55000E+03 .85571E-02 .23693166 .13000E+03 .20103E+02 .54995E+03 .85527E-02 .23687922 .14000E+03 .20080E+02 .55000E+03 .85553E-02 .23689888 .15000E+03 .20061E+02 .54992E+03 .85482E-02 .23682624 .16000E+03 .20046E+02 .55000E+03 .85536E-02 .23687302 .17000E+03 .20034E+02 .54985E+03 .85423E-02 .23675067 .18000E+03 .20025E+02 .55000E+03 .85527E-02 .23685910 .19000E+03 .20018E+02 .54966E+03 .85280E-02 .23658484 .20000E+03 .20013E+02 .55000E+03 .85523E-02 .23685113 .21000E+03 .20010E+02 .54911E+03 .84883E-02 .23610066 .22000E+03 .20007E+02 .55000E+03 .85521E-02 .23684755 .23000E+03 .20005E+02 .54741E+03 .83680E-02 .23446726 .24000E+03 .20003E+02 .54946E+03 .85123E-02 .23671410 .25000E+03 .20002E+02 .54322E+03 .80725E-02 .22907370 .26000E+03 .20002E+02 .51135E+03 .59947E-02 .20578904 .27000E+03 .20001E+02 .50000E+03 .53346E-02 .20000013 .28000E+03 .20001E+02 .50030E+03 .53512E-02 .20018104 .29000E+03 .20000E+02 .50O0OE+O3 .53348E-02 .19999976 .30000E+03 .20000E+02 .50001E+03 .53354E-02 .20000917 .31000E+03 .20000E+02 .50000E+03 .53346E-02 .19999973 .32000E+03 .20000E+02 .50000E+03 .53346E-02 .20000025 .33000E+03 .20000E+02 .50000E+03 .53346E-02 .19999968 .34000E+03 .20000E+02 .50000E+03 .53346E-02 .19999970 .35000E+03 .20000E+02 .50000E+03 .53346E-02 .19999965 .36000E+03 .20000E+02 .50000E+03 .53346E-02 .19999965 .37000E+03 .20000E+02 .50000E+03 .53346E-02 .19999965 .38000E+03 .20000E+02 .50000E+03 .53346E-02 .19999964 .39000E+03 .20000E+02 .50000E+03 .53346E-02 .20000000 98 Model Seven: Iso-thermal system with flow and mass transport This model is the open system analog to model four and the reactive analog to model one. It evaluates what could happen to an isothermal system when the fluid remains in equilibrium with the minerals. The process was calculated under the following conditions— Initial conditions (time = 0.0, for all x;) pressure = 20.0 MPa, porosity = 20.0 percent, log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 pressure I = 0 = 20.5 MPa, and for all times and positions temperature = 500.0 degrees kelvins, at all times, the fluid remains in equilibrium with quartz. The results of this model are illustrated by figures 10A through 10H. In, addition to the points made by these figures, there are several significant differences between these results and the previous ones. • The amount of silica in solution is totally a function of the fluid pressure. • There is no shock front as the solution is always in equilibrium with quartz. • Considerable numerical error has occurred and can be easily seen in figures 10E, 10F and 10J. • In contrast to models one and two, the porosity has decreased by approximately 10 percent— due to the precipation of silica. This model illustrates what could happen in an isothermal open system. Although the amount of silica in solution at a given point increase as the pressure increases, quartz is precipitated out of solution because of the material transported from the preceeding REV's. This model also leads to the inference that the the steeper the pressure gradient, the more flow, the more quartz precipitated, the faster the system seals itself. 9 9 F i g u r e 1 0 A - C h a n g e i n P r e s s u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 10A illustrates the change in pressure as a function of time and distance in an isothermal F i g u r e 1 0 B - D e r i v a t i v e o f t h e C h a n g e i n P r e s s u r e Figure 10B is the derivative of pressure with respect to time plotted as a function of time and distance in an isothermal system. 100 Figure IOC - Change in Velocity with respect to time and distance Figure IOC illustrates the change in velocity as a function of time and distance in an isothermal Figure 10D - Derivative of the Change in Velocity Figure 10D is the derivative of velocity with respect to time plotted as a function of time and distance in an isothermal system. 101 Figure 10E - Change in Porosity with respect to time and distance Figure 10E illustrates the change in porosity as a function of time and distance in an isothermal Figure 10F - Derivative of the Change in Porosity Figure 10F is the derivative of porosity respect to time plotted as a function of time and distance in an isothermal system. 102 F i g u r e 1 0 G - C h a n g e i n C o n c e n t r a t i o n w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 10G illustrates the change in the concentration of a component as a function of time and distance in an isothermal system with transport of that component. F i g u r e 1 0 H - D e r i v a t i v e o f t h e C h a n g e i n C o n c e n t r a t i o n Figure 10H is the derivative of the concentration of a component with respect to time plotted as a function of time and distance in an isothermal system with transport of that component. 103 Model Eight: Thermal Effects, Fixed Pressure Gradient. This model is the open system analog to model five or the reactive analog to model two. It was calculated under the following conditions— Initial conditions (time = 0.0, for all z,-) temperature = 500.0 degrees kelvins, porosity = 20.0 percent, log permeability = —8.00, fluid composition in equilibrium with quartz, for times greater than 0.0 temperature x = 0 = 550.0 degrees kelvins, and for all times and positions Pressure MPa= 20.5 - (.00125a;,-u), Velocity defined by the pressures, the fluid remains in equilibrium with quartz. This process is illustrated in figures 11A through 11F. The most obvious thing about these figures is that everything occurs in a very short distance—and extremely quickly. It is clear that the composition of the solution follows the temperature front, and that the maximum change in porosity and permeability occur at this front as well. Because the solute shock front attempts to outdistance the thermal front and because the solution is constrained to be in equilibrium with quartz, the system very quickly clogs itself with precipitated quartz. Flow is reduced to a minimum, porosity to near zero. These figures clearly illustrate that equilibrium phases cannot exist in a flow field with a signif-icant temperature gradient—the system just shuts itself down. 104 F i g u r e 1 1 A - C h a n g e i n T e m p e r a t u r e w i t h r e s p e c t t o t i m e a n d d i s t a n c e Figure 11A illustrates the change in temperature as a function of time and distance in a system with fixed pressure head and fluid velocity. F i g u r e 1 1 B - D e r i v a t i v e o f t h e C h a n g e i n T e m p e r a t u r e Figure 11B is the derivative of temperature with respect to time plotted as a function of time and distance in a system with a fixed pressure gradient. 105 F i g u r e 11C - C h a n g e i n P o r o s i t y w i t h respec t t o t i m e a n d d i s t a n c e Figure 11C illustrates the change in porosity as a function of time and distance in a system with a F i g u r e 1 1 D - D e r i v a t i v e o f t h e C h a n g e i n P o r o s i t y Figure 11D is the derivative of porosity respect to time plotted as a function of time and distance in a system with a fixed pressure gradient. 106 F i g u r e 1 1 E - C h a n g e i n C o n c e n t r a t i o n w i t h respec t t o t i m e a n d d i s t a n c e Figure HE illustrates the change in the concentration of a component as a function of time and distance in a system with a fixed pressure gradient. Mass transport of the component occurs. Sr, Figure 11F - Derivative of the Change in Concentration Figure HF is the derivative of the concentration of a component respect to time plotted as a function of time and distance in a system with a fixed pressure gradient. 107 Model Nine: No Pressure, Temperature or Mass Flux Constraints This model is analogous to the previous one, the primary difference being that the pressure is not invarient as a function of time. It was calculated under the following conditions— Initial conditions (time = 0.0, for all x,) temperature = 500.0 degrees kelvins, porosity = 20.0 percent, pressure = 20.0 MPa log permeability = —8.00, initial velocity = 0.0 m/sec, fluid composition in equilibrium with quartz, for times greater than 0.0 temperature I =o = 550.0 degrees kelvins, pressure I =o = 20.5 MPa, and for all times and positions the fluid remains in equilibrium with quartz. This model, illustrated by figures 12A to 12J yields identical information to the previous one. Equilibrium phases cannot exist in a flow field with a temperature gradient. These figures show that everything happens in the first nodes, and that the only change would be due to heat conduction. The extremely small space and short time in which this model occurs contributes significantly to the numerical error, which can be easily seen on most of the figures. If the REVs are made smaller in an attempt to correct this, the process will still occur only in the first REVs. 108 Figure 12A - Change in Pressure with respect to time and distance Figure 12A illustrates the change in pressure as a function of time and distance in a system with thermal and pressure gradients. Figure 12B - Derivative of the Change in Pressure Figure 12B is the derivative of pressure with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 109 Figure 12C - Change in Velocity with respect to time and distance Figure 12C illustrates the change in fluid velocity as a function of time and distance in a system with thermal and pressure gradients. Figure 12D - Derivative of the Change in Velocity Figure 12D is the derivative of velocity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 110 Figure 12E - Change in Temperature with respect to time and distance Figure 12E illustrates the cha ige in temperature as a function of time and dist thermal and pressure gradients. ance in a system with CO \ f"0 Figure 12F - Derivative of the Change in Temperature Figure 12F is the derivative of temperature with respect to time plotted a, a function of time and distance in a system with thermal and pressure gradients. I l l Figure 12G - Change in Porosity with respect to time and distance Figure 12G illustrates the change in porosity as a function of time and distance in a system with thermal and pressure gradients. Figure 12H - Derivative of the Change in Porosity Figure 12H is the derivative of porosity with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients. 112 Figure 121 - Change in Concentration with respect to time and distance Figure 121 illustrates the concentration of a component as a function of time and distance in a system with thermal and pressure gradients, with transport of that component. Figure 12J - Derivative of the Change in Concentration Figure 12J is the derivative of the concentration of a component with respect to time plotted as a function of time and distance in a system with thermal and pressure gradients, with transport of that component. 113 Overview of the Modelling The three different sets of models presented in this thesis: • Non-reactive aqueous species, which can be transported (models one, two and three), • Reactive aqueous species, which cannot be transported (models four, five and six), • Reactive aqueous species, which can be tranported (models seven, eight and nine), correspond to three of the four combinations of the following pairs of limiting conditions: • infinitely slow kinetics of reaction or infinitely fast kinetics of reaction, • no mass transport of the aqueous species or mass transport of the aqueous species. The fourth model, infinitely slow kinetics and no mass transport, is not of interest. All systems modelled are open to heat energy and work, but only the first and third sets of models are open to mass. Because of intermediate reaction kinetics, most natural systems fall between the first and third sets. Although there are a number of general conclusions which have been observed/inferred from the figures, the most important is a result of the third set of models. This conclusion can be stated as: In open systems where the temperature and pressure gradient coincide, the solute shock front will attempt to outdistance the temperature shock front. If the reaction rates of the solid phases with the aqueous species are rapid when compared to the rate of solute transport, the material which attempts to outdistance the temperature shock front will precipitate. This will reduce the porosity and permeability. Under extreme conditions, the effective porosity and permeability will be reduced to a point where conduction becomes the effective means of heat transport. This leads to the observation that equilibrium phases, although useful as limiting constraints in modelling and useful to clarify the numerical algorithm, probably do not exist in open systems with coincident pressure and temperature gradients. 114 13 . F u t u r e W o r k The most obvious place for future work is the evaluation of more complicated models—the possibil-ities are endless. However, based on experience gained in the development of this thesis, there are three areas in which further work should be done before detailed modelling is attempted. These are: • Removal of the equilibrium mineral constraint. "Real systems" are often supersaturated or undersaturated with respect to phases. If a general kinetic equation was available for preci-patation and dissolution of phases,7 all phases would be treated in the same fashion as the reactant phases are currently treated. This would more closely approximate real systems. It would ensure that small changes in fluid composition, temperature or pressure would not cause massive or instantaneous changes in the matrix. • Use of more powerful finite element techniques. One of the problems is that a significant amount of time is spent calculating chemical reactions in the REVs where very little happens—or the change is totally a result of numerical instability. A finer mesh improves the numerical error (at the expense of increased computational time) but results in many more REVs where nothing is happening. A better solution would be to use a moving mesh technique. With this method, the mesh will be very fine at the front and coarser away from it. As the front evolves, the mesh expands and contracts proportionally to the distance from the front. • Improvement of the numerical algorithm for the calculation of the properties of water and the aqueous species. In the current program, the Keenan and Keys equation of state for water has been used because of its high precision in calculating the thermodynamic and physical properties of water. Unfortunately, it is very slow. If this routine could be speeded up or a faster algorithm used, the CPU time used to run the program would decrease significantly. After the computer program was written, the Haar (Haar, et al., 1984) equation of state was available. It is faster and more accurate than the Keenan and Keys equation. It should be used in preference. • Better definition of the characteristic volume for REVs of the various system parameters and improve the numerical methods which uses these definitions. 7 See equation (40) for an example of an equation for the kinetic rate of dissolution of a solid phase. 115 The primary reasons for these improvements are: improved representation of natural systems, speed and numerical accuracy. It is critical that the equilibrium mineral constraint be removed, otherwise any system with a decreasing thermal gradient in the direction of flow will try and seal itself as fast as the reaction kinetics will allow. 116 14. Summary The preceding chapters have presented an internally consistent set of equations which describe the chemical reactions occurring within a given volume element and the interaction of these reactions between each of the surrounding volume elements. The chemical reactions equations are primarily based on expansions in the derivatives of the mass action and mass balance equations. Additional functions used include the derivatives of equations constraining the activity of water and the activity coefficients of solid solution endmembers and of aqueous species. The coupling of the equations for each volume element is through modified forms of the flow, heat transport and solute transport equations. These yield changes in temperature, pressure and composition in each volume element with respect to time and distance. A wide range of situations can be modelled using these equations, for example: • geological processes in porous media, • industrial processes such as nuclear waste disposal, secondary oil recovery and in-situ leaching and mining. A list of all processes which could be modelled is limited only by the user's imagination and by the available data. The necessary model parameters and their availability are listed in figure 13. Given all of parameters for the appropriate conditions and suitable kinetic relationships for the phases and species in the system, any process could be modelled. The models presented in this thesis illustrate the limiting conditions when heat transport/solute transport/fluid flow are all in the same direction in porous media. The most important conclusion is that the speed of the solute front is controlled by the rate at which a solid containing the solute can react with the solution. If the reaction rate is infinitely fast (an equilibrium phase) and if the solubility of the solid decreases with respect to temperature, then the system will always attempt to seal itself. However, most systems with a thermal gradient have enough work energy to hydrologically re-fracture the matrix and create new porosity and permeability. The model presented in this thesis can not model this type of process. It must be emphasized that the equations and parameters used in these models cannot begin to represent the complexity and detail which occurs in natural and industrial processes. The principal 117 Figure IS - Availablity of Model Parameters Parameter Availability Boundary/Initial conditions (temperature, pressure, compositon) Thermodynamic data Kinetic data for solid phases Physical Properties Physical properties of the medium Model-dependent, can be easily changed or modified. Good—stoichiometric phases Poor—solid solution phases Limited—aqueous species Excellent—water Needs to be better Limited but adequate for stoichiometric phases and solid solution phases. Most fluid properties must be modelled using properties of pure water. Water properties are very well known. Adequate at near surface conditions for moderate to high porosity medium. Poor to non-existent for most other conditions External processes (eg: injection wells) Model-dependent, can be easily changed or modified. 118 goal of this modelling is not to simulate an existing situation, but to allow a clearer understanding of how processes evolve and to help evaluate which parameters are significant and potentially the controlling factors. 119 References Aagaard, P. and Helgeson, H.C . 1982. Thermodynamic and Kinetic Constraints on Reaction Rates among Minerals and Aqueous Solutions. I. Theoretical Considerations. American Journal of Science, 282, pp. 237-285. Bear, J. 1972. Dynamics of fluids in porous media. 764 pages. Berman, R .G. and Brown, T . H . (1983) A revised equation for representation and high temperature extrapolation of the heat capacity of minerals. Trans. Amer. Geophys. Union 64, 875. Berman, R .G. and Brown, T . H . (1984) A thermodynamic model for multicomponent melts, with application to the system CaO — A I 2 O 3 — Si02. Geochimica et Cosmochimica Acta, 48, pp. 661-678 Berman, R .G . and Brown, T . H . (1985) Heat capacity of minerals in the system Na20 — K20— CaO - MgO - FeO- Fe203 - Al203- Si02- Ti02- H20- C02: representation, estimation, and high temperature extrapolation. Contributions to Mineralogy and Petrologie, 89, pages 168-183. Berman, R.G. , Brown, T . H . and Greenwood, H.J. (1985) An internally-consistent thermodynamic data base for minerals in the system Na2O — K20 — CaO — MgO — FeO — Fe203 — A^ 03 — Si02 — Ti02 — H20 — G02. Atomic Energy of Canada Technical Report (in press). Bredehoeft, J.D and Pinder, G.F. 1973. Mass Transport in Flowing Groundwater. Water Resources Research, 9, pp. 194-210. Brown, T . H . and Skinner, B.J. 1974. Theoretical Prediction of equilibrium Phase Assemblages in Multicomponent Systems. American Journal of Science, 274, pp. 961-986. Burnham, C .W. , Holloway, J.R. and Davis, N.F. 1969. Thermodynamic properties of water to 1,000 C and 10,000 bars: Geol. Soc. America Spec. P aper 132, 72p. Bruton, C.J. and Helgeson, H.C. 1983. Calculation of the chemical and thermodynamic conse-quences of differences between fluid and geostatic pressure in hydrothermal systems. American Journal of Science, 283-A, pp. 540-588. Capuano, R . M . and Cole, D.R. 1982. Fluid-mineral Equilibria in a Hydrothermal System, Roosevelt Hot Springs, Utah. Geochimica et Cosmochimica Acta, 46, pp. 1353-1364. 120 Charbeneau, R.J. 1981. Groundwater Contaminant Transport With Adsorption and Ion Exchange Chemistry: Method of Characteristics for the Case without Dispersion. Water Resources Re-search, 17, pp. 705-713. Chu, S. and Sposito, G. 1981. A Derivation of the Macroscopic Solute Transport Equation for Homogeneous, Saturated, Porous Media 2. Reactive Solutes at Low Concentration. Water Resources Research, 17, pp. 333-336. Cooper, H.H. 1966. The Equation of Groundwater Flow in Fixed and Deforming Coordinates. Journal of Geophysical Research, 71, pp. 4785-4790. DeDonder, Th. 1920. Lecons de Thermodynamique et de Chimie-Physique. Gauthier-Villars. Desai, CS. and Abel, J.F. 1972. Introduction^ the finite element Method. Van Nostrand Reinhold Company. .477 pages. Domenico, P.A. and Palciauskas, V.V. 1973. Theoretical Analysis of Forced Convective Heat Trans-fer in Regional Ground-Water Flow. Geological Society of America Bulletin, 84. pp. 3803-3814. Flowers, G.C. 1979. Correction of Holloway's (1977) adaptation of the modified Redlich-Kwong equation of state for calculation of the fugacities of molecular species in supercritical fluids of geologic interest. Contributions to Mineralogy and Petrology, 69, pp. 315-318. Fouillac, C, Michard, G. and Bocquier, G. 1977. Une methodee simulation de revolution des profiles d'alteration. Geochimica et Cosmochimica Acta, 41, pp. 207-213. Garrels, R.M. and Mackenzie, F.T. 1967. Origin of the Chemical Compositions of Some Springs and Lakes. In Advances in Chemistry Series, 67, pp. 222-242. Haar, C, Gallagher, J.S., and Kell, G.S. 1984. NBS/NRC Steam Tables. Thermodynamic and Transport Properties and Computer Programs for Vapour and Liquid States of Water in SI units. Hemisphere Publishing Co. Haas, J.L. Jr. and Fisher, J.R. 1976. Simultaneous evaluation and correlation of thermodynamic data. American Journal of Science, 276, pages 525-545. Harvie, C.E. and Weare, J.H. 1980. The prediction of mineral solubilities in natural waters: the Na — K — Mg — Ca — Gl — S O4 — H2 O system from zero to high concentration at 25 C. Geochimica et Cosmochimica Acta, 44, pp. 981-998. Hazen, R.M. and Finger, L.W. 1981. Crystal Structure of Diopside at High Temperature and Pressure. Annual Report of the Director, Geophysical Laboratory, 1980-1981, pp. 373-375. Helgeson, H.C. 1968. Evaluation of irreversible reactions in geochemical processes involving minerals 121 and aqueous solutions-I. Thermodynamic relations. Geochimica et Cosmochimica Acta, 32, pp. 853-877. Helgeson, H.C. 1969. Thermodynamics of hydrothermal systems at elevated temperatures and pressures. American Journal of Science, 267, pp. 729-804. Helgeson, H.C. 1970a. Descriptions and interpretation of phase relations in geochemical processes involving aqueous solutions. American Journal of Science, 268, pp. 415-438. Helgeson, H.C. 1970b. A Chemical and Thermodynamic Model of Ore Deposition in Hydrothermal Systems. Mineralogical Society of America Special Paper 3, pp. 155-186. Helgeson, H.C. 1971. Kinetics of mass transfer among silicates and aqueous solutions. Geochimica et Cosmochimica Acta, 35, pp. 421-469. Helgeson, H.C, Brown, T.H., Nigrini, A. and Jones, T.A. 1970. Calculation of Mass transfer in Geochemical Processes involving Aqueous Solutions. Geochimica et Cosmochimica Acta, 34, pp. 569-592. Helgeson, H.C, Delany, J.M., Nesbitt, H.W. and Bird, D.K. 1978. Summary and Critique of the Thermodynamic properties of Rock-forming Minerals. American Journal of Science, 278-A, pp. 1-220. Helgeson, H.C, Garrels, R.M. and Mackenzie, F. 1969. Evaluation of irreversible reactions in geochemical processes involving minerals and aqueous solutions-II. Applications. Geochimica et Cosmochimica Acta, 33, pp. 455-481. Helgeson, H.C. and Kirkham, D.H. 1974a. Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: I. Summary of the Thermodynam-ics/Electrostatic Properties of the Solvent. American Journal of Science, 274, pp. 1089-1198. Helgeson, H.C. and Kirkham, D.H. 1974b. Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: II. Debye-Huckel parameters for activity coefficients and relative partial molal properties. American Journal of Science, 274, pp. 1199-1261. Helgeson, H.C. and Kirkham, D.H. 1976. Theoretical Prediction of the Thermodynamic Behavior of Aqueous Electrolytes at High Pressures and Temperatures: III. Equation of state for aqueous species at infinite dilution. American Journal of Science, 276, pp. 97-240. Helgeson, H.C, Kirkham, D.H. and Flowers, G.C 1981. Theoretical prediction of the thermody-namic behavior of aqueous electrolytes at high pressures and temperatures: IV. Calculation of 122 activity coefficients, osmotic coefficients, and apparent molal and standard and relative partial molal properties to 600 C and 5 kb. American Journal of Science, 281, pp. 1249-1516. Helgeson, H.C. and Murphy, W.M. 1983. Calculation of Mass Transfer Among Minerals and Aqueous Solutions as a Function of Time and Surface Area in Geochemical Processes. I. Computational Approach. Mathematical Geology, 15, pp. 109-130. Helgeson, H.C, Murphy, W.M. and Aagaard, P. 1984. Thermodynamic and kinetic constraints on reaction rates among minerals and aqueous solutions. II. Rate constants, effective surface area, and the hydrolysis of feldspar. Geochimica et Cosmochimica Acta, 48, pp. 2405-2432. Hill, P.G. 1982. Personal communication. Holloway, J.R. 1977. Fugacity and activity of molecular species in supercritical fluids, in Thermo-dynamics in geology, Fraser, D.G., editor. D. Reidel Publishing Co., pp. 161-181. Jones, G. and Talley, S.K. 1933. The Viscosity of Aqueous Solutions of Strong Electrolytes with Special Reference to Barium Chloride. Journal of the American Chemical Society, 55, pp. 4124. Karpov, I.K., Kaz'min, L.A. and Kashik, S.A. 1973. Optimal Programming for Computer Calcu-lations of Irreversible Evolution in Geochemical Systems. Geochemistry International, 10, pp. 464-470. Keenan, J.H., Keys, F.G., Hill, P.G. and Moore, J.G. 1978. Steam Tables, Thermodynamic Proper-ties of Water Including Vapor, Liquid, and Solid Phases (International System of Units-S.L). 156 pages. Kerrick, D.M. and Jacobs, G.K. 1981. A modified Redlich-Kwong equation for H20, C02 and H20-C02 mixtures at elevated pressures and temperatures. American Journal of Science, 281, pp. 735-767. Kestin, J. 1979. The Transport Properties of Water Substance in Water and Steam, Their Properties and Current Industrial Applications, edited by J. Straub and K. Schemer, pp. 283-302. Kestin, J., Khalifa, H.E. and Correia, R.J. 1981a. Tables of the Dynamic and Kinematic Viscosity of Aqueous KC1 Solutions in the Temperature Range 25-150 C and the Pressure Range 0.1-35 MPa. Journal of Physical and Chemical Reference Data, 10, pp. 57-70. Kestin, J., Khalifa, H.E. and Correia, R.J. 1981b. Erratum: Tables of the Dynamic and Kinematic Viscosity of Aqueous KC1 Solutions in the Temperature Range 25-150 C and the Pressure Range 0.1-35 MPa. Journal of Physical and Chemical Reference Data, 10, pp. 1203. Kestin, J., Khalifa, H.E. and Correia, R.J. 1981c. Tables of the Dynamic and Kinematic Viscosity of 123 Aqueous NaCl Solutions in the Temperature Range 20-150 C and the Pressure Range 0.1-35 MPa. Journal of Physical and Chemical Reference Data, 10, pp. 71-88. Kestin, J., Khalifa, H.E. and Correia, R.J. 1981c. Erratum: Tables of the Dynamic and Kinematic Viscosity of Aqueous NaCl Solutions in the Temperature Range 20-150 C and the Pressure Range 0.1-35 MPa. Journal of Physical and Chemical Reference Data, 10, pp. 1203. Kirkham, D.H., Walther, J., Delany, J., and Flowers, G. 1978. SUPCRT (Internal Memo), Computer Program Library, Prediction Central, Department of Geology and Geophysics, University of California, Berkeley. 20 pages. Konikow, L.F. 1977. Chloride Movement in the Alluvial Aquifer at the Rocky Mountain Arsenal, Colorado. U.S. Geological Survey Water Supply Paper, 2044. 43 pages. Konikow, L.F. and Grove, D.B. 1977. Derivation of Equations describing Solute Transport in Ground Water. U.S. Geological Survey Water-Resources Investigations 77-19. 30 pages. Kwong, Y.T.J., Brown, T.H. and Greenwood, J.H. 1982. A thermodynamic approach to the under-standing of the supergene alteration at the Afton copper mine, south-central British Columbia. Canadian Journal of Earth Sciences, 19, pp. 2378-2386. Lasaga, A.C. 1984. Chemical Kinetics of Water-Rock Interactions. Journal of Geophysical Research, - 89, B6, pp. 4009-4025. Lichtner, P.C. 1985. Continuum model for simultaneous chemical reactions and mass transport in hydrothermal systems. Geochimica et Cosmochimica Acta, 49, pp. 779-800. Mercer, J.W. and Pinder, G.F. 1979. Finite Element Analysis of Hydrothermal Systems in Finite Element Methods in Flow Problems, pp. 401-414. Norton, D. 1978. Sourcelines, Sourceregions, and Pathlines for Fluids in Hydrothermal Systems Related to Cooling Fluids. Economic Geology, 73, pp. 21-28. Norton, D. 1979. Transport phenomena in hydrothermal systems: the redistribution of chemical components around cooling magmas. Bulletin Mineralogy, 102, pp. 471-486. Norton, D. 1982. Fluids and heat transport phenomena typical of copper-bearing pluton envi-ronments, southeastern Arizona. In Advances in Geology of the Phorphyry Copper deposits, Southwestern North America, ed: S.R. Titley, pp. 59-72. Norton, D. 1984. Theory of Hydrothermal Systems. Ann. Rev. Earth Planet. Science, 12, pp. 155-177. Norton, D. and Knight, J. 1977. Transport phenomena in hydrothermal systems: Cooling plutons. 124 American Journal of Science, 277, pp. 937-981. Out, D.J.P. and Los, J.M. 1980. Viscosity of Aqueous Solutions of Univalent Electrolytes from 5 to 95 C. Journal of Solution Chemistry, 9, pp. 19-35. Parkhurst, D.L., Plummer, L.N., and Thorstenson, D.C. 1978. Chemical Models in Ground-Water Systems. Geological Society of America Abstracts, 7, pp. 468. Parkhurst, D.L., Plummer, L.N. and Thorstenson, D.C. 1980. PHREEQE—A computer program for geochemical calculations. U.S. Geological Survey, Water-Resources Investigations 80-96. 216 pages. Perkins, E.H. 1980. A Reinvestigation of the Theoretical Basis for the Calculation of Mass Transfer in Geochemical Processes involving Aqueous Solutions. MSc Thesis, Department of Geological Sciences, University of British Columbia, Vancouver, B.C., Canada. 149 pages. Perkins, E.H., Brown, T.H. and Berman, R. 1985. PT-SYSTEM, TX-SYSTEM, PX-SYSTEM— Three programs which calculate Pressure-Temperature-Composition Phase Diagrams. Cur-rently submitted to Computers and Geology. Pfeifer, H.R. 1977. A Model for Fluids in Metamorphosed Ultramafic Rocks. Observations at Surface and Subsurface Conditions (High pH Spring Waters). Schweizerische Mineralogische und Petrographische Mitteilungen 57, pp. 361-396. Pfeifer, H.R. 1981. A Model for Fluids in Metamorphosed Ultramafic Rocks. III. Mass transfer under amphibolite facies conditions in olivine-enstatite rocks of the Central Alps, Switzerland. Bulletin Mineralogy, 104, pp. 834-847. Pickens, J.F. and Grisak, G.E. 1979. Finite-Element Analysis of Liquid Flow, Heat Transport and Solute Transport in a Ground-Water System: 1. Governing Equations and Model Formulation. Report by Contaminant Hydrogeology Section, Hydrology Research Division, Inland Waters Directorate, Environment Canada. 39 pages. Pickens, J.F. and Lennox, W.C. 1976. Numerical Simulation of Waste Movement in Steady Ground-water Flow Systems. Water Resources Research, 12, pp. 171-180. Pinder, G.F. 1973. A Galerkin-Finite Element Simulation of Groundwater Contamination on Long Island, New York. Water Resources Research, 9, pp. 1657-1669. Pinder, G.F. and Gray, W.G. 1977. Finite Element Simulation in Surface and Subsurface Hydrology. 295 pages. Prigogine, I. and Defay, R. 1954. Chemical Thermodynamics, translated by D.H. Everett. Longmans 125 Green. 543 pages. Ralph, R.L. , Hazen, R.M. and Finger, L.W. 1981. Cell parameters of Orthoenstatite at High Temperature and Pressure. Annual Report of the Director, Geophysical Laboratory, 1980-1981, pp. 376-379. Rao, P.V., Fortier, K.M. and Rao, P.S.C. 1981. A Stochastic Approach for Describing Convective-Dispersive Solute Transport in Saturated Porous Media. Water Resources Research, 17, pp. 963-968. Raz, U. 1983. Thermal and Volumetric measurements on quartz and other substances at pressures up to 6 kbars and temperatures up to 700 C. PhD Thesis Diss. nr. 7386, Swiss Federal Institute of Technology (ETH), Zurich. 91 pages plus tables. Read, M.H. 1982. Calculation of Multicomponent Chemical Equilibria and Reaction processes in systems involving Minerals, Gases and an Aqueous phase. Geochimica et Cosmochimica Acta, 46, pp. 513-528. Reddell, D.L. and Sunada, D.K. 1970. Numerical Simulation of Dispersion in Groundwater Aquifers. Hydrology Papers, Colorado State University, Number 41. 79 pages. Redlich, O. and Kwong, J.N.S. 1949. An equation of state. Fugacitites of gaseous solutions. Chem-ical Review, 44, pp. 233-244. Remson, I., Hornberger, G.M., and Molz. 1971. Numerical Methods in Subsurface Hydrology with an introduction to the finite element method. Wiley-Interscience. 389 pages. Robie, R.A., Hemingway, B.S. and Fisher, J.R. 1978. Thermodynamic Properties of Minerals and Related Substances at 298.15 K and 1 Bar (105 Pascals) Pressure and at Higher Temperatures. Geological Survey Bulletin 1452. 456 pages. Schwartz, F.W. and Domenico, P.A. 1973. Simulation of Hydrochemical Patterns in Regional Groundwater Flow. Water Resources Research, 9, pp. 707-720. Smith, L. and Schwartz. F.W. 1981. Mass Transport 3. Role of Hydraulic Conductivity Data in Prediction. Water Resources Research, 17, pp. 1463-1479. Sorey, M.L. 1978. Geohydrology of Geothermal Systems. United States Geological Survey Profes-sional Paper 1044-D. 25 pages. Straus, J.M. and Schubert, G. 1977. Thermal Convection of Water in a Porous Medium: Effects of Temperature and Pressure Dependent Thermodynamic and Transport Properties. Journal of Geophysical Research, 82, pp. 325-333. 126 Tang, D.H., Frind, E.O. and Sudicky, E.A. 1981. Contaminant Transport in Fractured Porous Media: Analytical Solution for a Single Fracture. Water Resources Research, 17, pp. 555-564. Thompson, J.B. 1967. Thermodynamic Properties of Simple Solutions. In Researches in Geochem-istry, edited by P.H. Abelson, volume II, pp. 340-361. Uematsu and Franck. 1980. Static Dielectric Constant of Water and Steam, Jour. Physical. Chem-ical Reference Data, 9, pp. 1291. Vandersande, J.W. and Pohl, R.O. 1982. Negligible Effect of Grain Boundaries on the Thermal Conductivity of Rocks. EOS, 63, pp. 814. Villas, R.N. and Norton, D. 1977. Irreversible Mass Transfer Between Circulating Hydrothermal Fluids and the Mayflower Stock. Economic Geology, 72, pp. 1471-1504. Watson, J.T.R., Basu, R.S. and Sengers, J.V. 1980. An Improved Representative Equation for the Dynamic Viscosity of Water Substance. Journal of Physical Chemical Reference Data, 9, pp. 1254-1290. Wolery, T.J. 1979. Calculation of chemical equilibrium between aqueous solutions and minerals: the EQ3/EQ6 software package, UCRL-52658, University of California, Lawrence Livermore Laboratory, Livermore, California. 44 pages. Wolery, T.J. 1980. Chemical modelling of geological disposal of nuclear waste: progress report and a perspective. UCRL-52748, University of California, Lawrence Livermore Laboratory, Livermore, California. 66 pages. Wolery, T.J. and Walters, L.J. 1975. Calculation of Equilibrium Distribution of Chemical Species in Aqueous Solutions by Means of Monotone Sequences. Journal of Mathematical Geology, 7, pp. 99-115. Wood, J.R. and Hewett, T.A. (1982) Fluid convection and mass transfer in porous sandstones: a theoretical model. Geochimica et Cosmochimica Acta 46, pp. 1707-1713. 127 Appendix One: Summary of the Thermodynamic Relationships The equilibrium constant is related to the thermodynamic properties of each phase, species and component in an equilibria by: -RTki K = AG' = AGprod — AG r e a c i O - l ) ln K is the logarithm of the equilibrium constant. T is the temperature in kelvins, R is the gas constant. AG is the Gibbs free energy, superscripted "r" to indicate of reaction, "prod" to indicate the sum of the free energy of the products and "read? to indicate the sum of the free energy of the reactants. The Gibbs free energy of formation of any phase or species can be related to its enthalpy and entropy of formation by: AG;.T.P = AH/.T.P - TASf.T.p {A - 2a) AGf.T.p, AH/.T.P and ASf.j.p are the standard molal Gibbs free energy of formation, the standard molal enthalpy of formation and the standard molal entropy of formation at the subscripted tem-perature and pressure from a reference set of components8 at the same temperature and pressure. Equation (A-2a) is awkward to evaluate as the properties of the components must also be evaluated at the temperature and pressure interest. In any balanced reaction, the properties of the components must cancel. Taking advantage of this, the free energy of a phases or species can be defined in a variety of other ways. For example, it is often denned as a function of the enthalpy of formation and the third law entropy, yielding: AGT.P = AH/.Tr.Pr + (HTP - HTr Pr) - TSTr Pr - T(STP - STr Pr) (A - 2b) H° is the standard molal enthalpy at the subscripted conditions and S° is the third law entropy at the subscripted conditions. Another very common definition used to define the apparent molal 8 Generally the reference set of components are the the stable form of the elements or the stable form of the oxides. 128 Gibbs free energy (AGT.P), which has been used extensively by Helgeson is: A G T.P = AG' 'f.T.P G% Tr.Pr = AGf.Tr.Pr + (H°T,P - H°Tr!Pr) ~ S°T,P(T- Tr) - T(S^P - 5°r.Pr) - AHfTP + (E°r P - H^r.pr) - Sj.T Pr(T - Tr) - TrSfTTpT T ( S T P S ^ R P R ) [A-2c) Equation (A-2b) will be used throughout this thesis. The enthalpy and the third law entropy of any phase or species at any temperature and pressure can be related to the enthalpy and third law entropy of that phase or species at the reference temperature and pressure by: In equations (A-3) and (A-4), V° is the molar volume and Cp is the molar heat capacity at constant pressure. Evaluation of the integrals in equations (A-3) and (A-4) depends on the equations used to represent the molar volume and the heat capacity. The equations used for solid phases are different than those for aqueous species, both of which are different than those for gases. The equations used for solid phases, aqueous species and water will be discussed in separate sections. and (A-4) 129 Solid Phases The coefficient of thermal expansion (a) is defined as: (A-5) and the coefficient of compressibility (fi) as: -1 fdV°\ With the notable exceptions of quartz (Raz, 1983), diopside (Hazen and Finger, 1981), enstatite (Ralph, Hazen and Finger, 1981) and a limited number of other phases which have measured at low temperatures in the diamond anvil cell, the isothermal compressibility is known only at room temper-ature and the coefficient of thermal expansion is only known at one atmosphere. The data generally indicate that in the absence of phase transitions, the isothermal compressibility of most silicates can be assumed to be independent of pressure. Integrating equation (A-6) with this assumption, the volume as function of pressure at constant temperature is: yo _ yo -0[P-Pr) c VlPr(l-0(P-Pr)) (A -7) Equation (A-7) is only an approximation and does not represent the volume of most phases accu-rately. However, within the limits of the low pressure experimental data, the linear approximation of equation (A-7) is equally valid to an exponential approximation. The heat capacity of most solid phases can be accurately represented within the range of the experimental data using the Maier-Kelly expression, which is: Cp= a + b T + cT~ 2 This equation does not yield a constant heat capacity at high temperatures and it cannot represent the heat capacity of a phase undergoing a phase transition. However, a wealth of data in this form exists. Other heat capacity equations are used (for example, Haas and Fisher (1976)) but the most satisfactory form is that of Berman and Brown (1983, 1985). Although it does not fit the experimental data as well as some of the other forms, it does fit the data within the experimental 130 error, extrapolates well and agrees with the limiting values for heat capacity at high temperatures. Their equation is: Cp = k0 + h T~ 0- 5 + k2 T~ 2 + k3 T~ 3 (A - 8) where fci and k2 are less then or equal to zero. Equations (A-5), (A-7) and (A-8) can be substituted into equations (A-3) and (A-4), and the result into equation (A-2b) to obtain the apparent molal Gibbs free energy of a solid phase as a function of temperature and pressure. It is: AG$,, = Aflfry.p, - TAS°Tr.r, (T - Tr) + fc ( T - TrTh / f-2 _ Tr-2 T-3_ Tr-3\ + H -2-0 + 3.0 J + VT.pr ((P - Pr)(l + pPr) - P-{P 2 - Pr 2)) (A - 9) This equation does not make any provision for the possibility of any phase transitions. If a lambda, second or higher order phase transition exist in the temperature range of interest, then the above equation must be modified to include a term expressing the additional energy. Equations for lambda type transitions and for disorder transformations are given by Berman and Brown (1985). An alternative method used by Helgeson et al. (1978), is to use coefficients for the heat capacity and, if necessary for volume, which are only applicable to a given temperature range. 'Different coefficients must be used for the other temperature ranges. Typically, these temperature ranges correspond to the temperature space between transitions for the given phase but may also correspond to the range between transitions in the reference material. As noted in Helgeson et al. (1978), this method will not yield correct results at pressure unless the temperature of transition is independent of pressure. The change in volume of most solid phases is relatively small at low to moderate pressures and temperatures. If the region of pressure-temperature space is limited to region where the data for aqueous species from Helgeson, Kirkham and Flowers (1981) is defined (less then 5 kilobars and 600 C), it is reasonable to assume that the isothermal con traction term in equation (A-9) is negligible and that the volume of a solid phase is a constant. The Gibbs free energy of a solid solution mineral can be calculated from the properties of the endmembers and from an equation which describes the excess free energy of mixing. For a given 131 composition, the Gibbs free energy of a ^ -component solid solution can be written: fc k AG isol Y X{AG° + TX,RT ln X; + AG' (A -10) «'=! »'=1 AG is the Gibbs free energy, superscripted "soP to indicate solution, "°" to indicate the apparent molar Gibbs free energy and "ex" to indicate the excess Gibbs free energy, a is the number of equivalent sites and X, is the mole fraction of the i'th endmember. The Gibbs free energy of the endmembers is calculated using the equations presented previously in this appendix. The excess Gibbs free energy is dependent on composition, temperature and pressure. Berman and Brown (1984) have developed a general equation describing the excess free energy of a solid solution using an p'th degree polynomial. It is: where k is the number of components. .,-3 ,• is the interaction term between the subscripted endmembers and is obtained by fitting to experimental data sets. Under the appropriate conditions, this model reduces to the Margules model presented by Thompson (1967). There are various sources of thermodynamic data which can be used to evaluate these expres-sions, for example: Robie, Hemingway and Fisher (1978), Helgeson, Delany, Nesbitt and Bird (1978), Berman, Brown and Greenwood (1985). (A.- 11) 132 Aqueous Species The various thermodynamic and physical properties of aqueous species vary significantly throughout pressure and temperature space. The experimental data is limited. In fact, the properties of most aqueous species are only known at one bar and temperatures below 100 C. Data not on the boiling curve is almost non-existant. However, as these thesis is concerned with developing the equations to "model geological process", most of which do not occur on the boiling curve, only the equations applicable under high temperature and pressures conditions will be discussed. In a series of four papers, Helgeson and co-workers (Helgeson and Kirkham (1974a, 1974b, 1976), and Helgeson, Kirkham and Flowers (1981)) analyzed the existing high pressure and temperature data pertaining to aqueous species. Fitting the available (limited) data and extrapolating it under various practical and theoretical constraints, they developed equations which describe the partial molal properties of aqueous species at pressures up to 5 kilobars and temperatures to 600 C. They proposed that the partial molal volume of an aqueous species can be accurately represented as a function of pressure and temperature using the following expression: V„ is the volume of the s'th aqueous species. a l 8, a2,9, a3 a^^ and d„ represent temperature and pressure independent coefficients for the s'th aqueous species, given by Helgeson et al. (1981). They also proposed that the heat capacity at constant pressure for the s'th aqueous species could be represented by: Op, = C L , + c2.« T T-ds a 2a3.s (P - Pr) + a4,2 {P 2 - Pr 2) (T-8,)3 (A - 13) Ci.„ and C2.s are temperature and pressure independent constants for the s'th. aqueous species, also given by Helgeson et al. (1981). ws is defined by: abs and abs = VZ> (A-14) rj is a constant (6.94657 * 105 A Joules/mole). Zs and rs are the charge and the effective electrostatic radius of the s'th ion, respectively. The subscript "H +" indicates hydrogen ion. 133 ew is the dielectric constant of pure water and was fit to a fourth degree power function of temperature and density by Helgeson and Kirkham (1974a). It is defined by: 4 i-i ^ = £ X ^ M 7 V . (A-15) ,'=0 J=0 €jj are fit coefficients and are given in table LX. Uematsu and Franck (1980) have reviewed all existing experimental data and numerical repre-sentations of the dielectric constant of water. They concluded that equation (A-15) represented the data within experimental error but suffered from two flaws. • It can only be used for temperatures below 550 C and for densities greater than 0.4 g /cm 3. It could not be used for extrapolation. • It exhibits a undulatory pattern through the experimental data, thus derivatives calculated with this equation should not be used. They proposed instead that the dielectric constant of water be represented by: ew = 1 + -£p* + (|L + ffl3 + a4 r ) ( p*) 2 + (|L + ^ T* + a7 (T*)2) (p*)3 where pw is the density of pure water and T the temperature. The constants used in equation (A-16) are defined in table X. The enthalpy and entropy of the s'th aqueous species at any given temperature and pressure can then be expressed using equations (A-3), (A-4), (A-12) and (A-16). This leads to the following expression for the apparent molal Gibbs free energy of the s'th aqueous species: AG,,T.P = AH3,f.Tr.Pr - TS^Pr + cUs (j-Tr- Tin (jr^) + C a . . ( r - T r - ( T - ^ ) l n ( ^ 7 ) ) 2 (fll., (T - 8.) q3., T) (P - Pr) + (a2.8 (T - 6,) + a4.s T) (P2 - Pr2) 2{T-6.) 1 T-Tr\(dUem.T.P\ { A _ i 7 ) + ^W.TT.PT £W.T.P ZW.TT.PT J \ dT This equation is consistent with equation (A-2b). The Gibbs free energy of any aqueous solution can be calculated at any given temperature and pressure by: ns AG"R0,F = v-" n» (AG° + RTlna9) . (A - 18) 134 Table TX: Coefficients for Equation A-15 Coefficients for equation (A-15) as taken from Helgeson and Kirkham (1974). ti.i =&ylO*-'' fi.J i j 0 i 2 5 4 0 4.39109592 -2.33277456 4.61662109 -4.03643333 1.31604037 1 -2.18995148 1.00498361 -1.35650709 5.94046919 2 1.82898246 -2.08896146 1.60491325 3 1.54886800 -6.13941874 4 -6.13542375 > ki.j i k 0 1 2 5 0 2 0 -3 -6 -9 1 2 0 -3 -7 2 1 -1 -4 3 2 -2 4 1 Table X: Coefficients for Equation A-16 Coefficients for equation (A-16) as taken from Uematsu and Franck (1980). * p = p/Po T = T/T0 Po 1000.0Kg/M3 T0 298.15degK A(l) = 7.62571 A{2) = 244.003 A{3) = -140.569 A{4) = 27.7841 A(5) = -96.2805 A(6) 41.7909 A(7) = -10.2099 A(8) -45.2059 A{9) = 84.6395 A(10) = -35.8644 135 AG is the Gibbs free energy and is subscripted "soP to indicate of solution or "°" to indicate the apparent molar Gibbs free energy. a„ and ra8 are the activity and number of moles of the s'th aqueous species (including water), respectively. Helgeson and Kirkham (1974b, 1976) and Helgeson et al. (1981) discuss in detail the derivation of these equations, their limitations and the calculation of the various constants. The above section is only a brief summary. W a t e r Some phases, especially gases, have properties that vary widely throughout pressure and temperature space. Certainly, the best known is water. Many different equations with various functional forms have been proposed to be used in describing its physical and thermodynamic properties, thus allowing the integrations in equations (A-3) and (A-4). Most equations which can accurately calculate the properties of water, are high-order polynomials (often with logarithmic and exponential terms) representing the Gibbs free energy (for example, Burnham, Holloway and Davis, 1969), or the Helmholtz free energy (for example, Keenan, Keys, Hill and Moore, 1978, Haar, Gallagher and Kell, 1984). These equations are typically functions of temperature and density or of temperature and pressure. A variety of corresponding state equations have also been suggested, the most accurate of which generally use adjustable fit parameters. The most common are variations on the Redlich-Kwong equation (Redlich and Kwong (1949), Holloway (1977), Flowers (1979), Kerrick and Jacobs (1981), among many others). By taking derivatives or integrating these equations and combining them with various ther-modynamic equations of state, all thermodynamic properties can be calculated. Although the corresponding state equations are often accurate over a restricted pressure-temperature range in describing the primary fit property (either the Gibbs free energy or the volume), thermodynamic properties obtained from the derivatives of these equations are typically highly inaccurate. One of the most accurate equations of state is the Keenan and Keys equation, which is limited to pressures below one kilobar. P.G. Hill (1982) has proposed a modification of the fit parameters for the Keenan and Keys equation of state for water which allows the calculation of the properties of water to temperatures greater than 1300 C and pressures greater than 10 kilobars, including the low pressure region. The fundamental form of the Keenan and Keys equation expresses the Helmholtz free energy (F) as a continuous function of the temperature and of the density of water in both the liquid and 136 gas regions. It is of the form: FT.P = F°( T) + RT (In p + pQ(p, T)) (A- 19) where: 6 C T F ° { T ) ^ Y . j ^ l + G ^ h i T + G ^ Y (A-20) and: 7 / 8 10 \ Q(p, T) = (T- Te) £ (T - T. y) J- 2 £ A,-,; (p - p*)''"1 + <T4-8p £ ^P*'~ 9 M - 21) i=l Vi=l 1=9 / T, T, p, i2 and Tc are the temperature in kelvins, 1000 / T, density in g/cm3, the gas constant (4.6151 bar cm3/g K) and a constant, 1.544912. The remaining coefficien ts are givenin tables XI and XII. As these equations apply only to water, the parameters have not been subscripted 'w'. Values for the Gibbs free energy of water can be directly calculated from: G=F + PV (A-22) Expressions relating each of the different thermodynamic variables to the Helmholtz free energy are given in Keenan et al. (1978), Helgeson and Kirkham (1974) or in most thermodynamic texts. An alternative to the Keenan and Keyes equation of state for is the Haar equation of state for water. It is more accurate and faster. It is similiar to the Keenan and Keys equations in that it calculates the Helmholz free energy as a function of density and temperature and that all other parameters are derived from the Helmholz free energy. It should be used in preference to the Keenan and Keys equation. Throughout this thesis, the activity of all pure substances has been assumed to be one at all temperatures and pressures. In addition, the third law entropy of all substances is assumed to be zero at absolute zero. The Keenan and Keys equation, along with most compilations of steam properties, assumes that the third law entropy of water is zero at the triple point of water. This must be taken into account when using this equation. 137 Table X I : Coefficients for Equat ion A-21 Coefficients for equation (A-21) as given by Hill (1982). Ai.j j i 1 2 8 4 1 15.08935547 -1.126399040 6.248408318 -0.7511532307 2 -72.10865784 -8.325212479 -25.87362671 -2.641253471 3 152.4410858 17.59562683 50.28768921 4.8491477997 4 -200.0392914 -16.59400940 -64.65473938 3.395516396 5 193.2660826 5.603165627 0.0 0.0 6 -142.1213989 -127.4073334 0.0 0.0 7 78.26339722 93.21633911 0.0 0.0 8 -.2260081482 76.98554993 0.0 0.0 9 -229.34576423 49.11743464 -155.2604218 -4.012123108 10 -224.9741058 -408.3481445 -653.3615723 -80.93405151 i 5 6 7 1 -2.360856056 -1.041758537 -.108-222130 2 9.403068542 -4.143721581 7.4030921459 3 -18.87019348 -7.860260963 -.4694258571 4 -22.99574280 5.793392181 0.01748328283 5 0.0 0.0 0.0 6 0.0 0.0 0.0 7 0.0 0.0 0.0 8 0.0 0.0 0.0 9 55.59095764 18.63822937 0.6496112347 10 229.297058 108.8137970 122.8528786 Table X I I : Coefficients for Equations A-20 and A-21 Coefficients for Equations (A-20) and (A-21) as given by from Hill (1982). i Ci Paj 1~aj 1 1857.065 .634 1.545 2 3229.12 1.0 2.5 3 -419.465 1.0 2.5 4 36.6649 1.0 2.5 5 -20.5516 1.0 2.5 6 4.85233 1.0 2.5 7 46.0 1.0 0.0 8 -1011.249 — — 138 Appendix Two: Program Description A computer program has been written to apply the theory developed in this thesis. The program is written in FTN 5, a Control Data Corporation (CDC) implementation of ANSI standard FORTRAN 77 and has been run on a Cyber 825 computer under the NOS 4.1 operating system. No FTN5 extensions of ANSI standard FORTRAN 77 have been used, thus conversion to other operating systems is relatively easy. The program models the chemical, thermal and mechanical effects as the result of one dimen-sional flow through porous media. The flow is the result of a pressure gradient and will redistribute thermal energy by convection and by conduction. Mass is redistributed by the flow process and by dispersion. These processes cause the spatial and temporal dissolution/precipitation of solid phases and a spatial and temporal change in the composition of the fluid. This version of the program uses the pressure, temperature and composition at nodes 1 and n (in a system of n nodes) as the boundary conditions—these values can be invariant or functions of time. The program is listed in appendix seven. The input for the program has been divided into three files. The first contains information about the physical problem, the second contains the thermodynamic properties of all phases, species and gases, the last contains the initial chemical composition of the nodes. These files are read by fortran units 1, 2 and 3, respectively. The output is written on six different units, fortran units 6, 7, 8, 9, 10 and 11. Fortran unit 6 output is a complete record of the run data, including input verification and error messages. A partial listing of typical output is given in appendix six. Fortran unit 7 output is a condensed listing of the pressures and fluid velocities at the nodes for each time step. Fortran unit 8 output is a condensed listing of the temperatures at the nodes for each time step. The information written to fortran unit 9 is a condensed listing of the composition at each node (both fluid and matrix), porosity and permeability for each time step. Fortran unit 10 output is a condensed listing of the log molalities and log activities of the aqueous species for each time step. Fortran unit 11 output is a condensed listing of the number of moles and the change in the number of moles of the solid phases for each time step. The output written to units 7 to 11 are intended as input for plot programs. They are described in more detail below. 139 It must be emphasized that this program needs relatively large amounts of central memory (CM) and takes a minimum of thousands of seconds of central processor time (CPU seconds) for all but the most trivial of runs. The accuracy of the program is totally dependent on the quality of the thermodynamic data, the medium data (porosity, permeability, etc), the user specified error limits and, most important, the size of the time step and the number of nodes. The speed of the program is directly proportional to a power of the number of nodes and to the size of the time step. I n p u t F o r F o r t r a n U n i t 1 — T h e P h y s i c a l C o n s t r a i n t s This file contains the temperature, pressure, porosity, permeability, and all other parameters for each node at the initial time. These define the initial state of the media, the initial chemical conditions, several switches and error limits. The initial lines in this file are the: T I T L E cards, which can be up to 100 characters long. There can be as many title cards as need be, including blank lines. The last title line contains the word S T A R T , beginning in column one. If the S T A R T title line is omitted, then the entire file will be read as a title. The next card contains a character string which defines the type of following data. The possible strings are: A L P H a , C H E M i c a l , C O M P o s i t i o n , D I S T a n c e , E N D , E R R O r , N O D E , P E R M e a b i l i t y , P O R O s i t y , P R E S s u r e , S T E P , S T O P , T E M P e r a t u r e , T H I C k n e s s , T I M E , W E I G h t . Only the first four characters are necessary. Each string can be specified more than once, although for some, there is no advantage in doing so. ff the string reads: A 1 P H — t h e n a minimum of 2 lines follows. The first following line contains an integer value which indicates how many lines follow (format: 15). These lines contain the names of the components used for flow calculations and their associated longitudinal dispersivity (format: 2A4,8X,Fl0.5). Only these components will be transported and they must correspond to an aqueous chemical species in the data base attached to fortran unit 2 (see the description of unit 2 below). If the system is described by nc chemical components, then only nc — 1 components can be specified. These components, water and if necessary, other components chosen automatically by the program will be the reference compositional basis. All dispersivities are positive, non-zero, real numbers (units: meters/sec). Water will always have a dispersivity of zero and can never be specified by the user. The transport equation will be solved only if component-dispersivity pairs are present. 140 CHEM—then chemical reactions will be calculated during this run. The default is that NO reactions will be calculated. COMP—then the next line contains a formula which indicates which chemical elements will be considered during this run. The formula is a character string and has the form: CA(1)MG(1)AL(1)SI(1)0(1)H(1). No chemical elements can be referenced which are not defined in the thermodynamic data base (see description of fortran unit 2 below). The coefficients assigned to each of the chemical elements must be non-zero but their value is not important. DIST—then a minimum of 2 lines follows. The first line contains the number of distances which will be assigned (NUM) and the index of the first node to which they will be applied (ISTART) (format: 215). The next line(s) contains the distance between nodes ISTART and ISTART + 1, nodes ISTART + 1 and ISTART + 2, up to and including the distance between nodes ISTART + NUM - 1 and ISTART + NUM (units: meters, format: 8F10.5). END—then no more data is read from this file. If this string is not present, the program reads to the end of file (EOF) or to the string STOP. ERRO—then two lines follows. The line contains three error limit/test values (format: 3E12.5). The first value is used in the pressure, the second in the temperature, and the last in the flow calculations. Their values must be between zero and one. If out of this range, a default of one is used. They are applied to the test: ABS(( •Sn.+i %n)/%n) ^ error limit value where x„ + i and x„, are the values of the parameters at iteration n+1 and iteration n, respectively. The iterations continue until the test is pasted. The second Une contains three counters which indicates the maximum number of iterations for each time step (format: 315). The default value is five. MAXP—then one line follows containing the maximum pressure for node 1, the length of time used to raise to this pressure, and the time at which the increase begins (format: 3F10.3). MAXT—then one line follows containing the maximum temperature for node 1, the length of time used to raise to this temperature, and the time at which the increase begins (format: 3F10.3). NODE—then one line follows containing the number of nodes in the system (format: 15). PERM—then a minimum of 2 lines describing the initial permeabilities follows. The first contains the number of nodes which will be assigned and the index of the first node (NUM, ISTART, 141 format: 215). The next line(s) contains the logarithm (base 10) of the permeability (units: square meters, format: 8F10.5). The first value corresponds to node with the index ISTART, the next to the node with the index ISTART + 1. The last corresponds to the node with the index ISTART + NUM - 1. PORO—then a minimum of 2 lines describing the initial porosities follows. The first contains the number of nodes which will be assigned and the index of the first node (NUM, ISTART, format: 215). The next line(s) contains the porosities (format: 8F10.5). The first value corresponds to the node with the index, ISTART, the next to the node with the index ISTART + 1. The last corresponds to the node with the index ISTART + NUM - 1. PRES—then a minimum of 2 lines describing the initial pressures follows. The first contains the number of nodes and the index of the first, node (NUM, ISTART, format: 215). The next line(s) contains ABS(NUM) initial pressures in MPa (format: 8F10.5). The first value corresponds to the node with the index, ISTART, the next to the node with the index ISTART + 1. The last corresponds to the node with the index ISTART + NUM - 1. If NUM is negative, then the pressures will be held constant through all of the calculations. STEP—then the next line contains four integers (NSTEP, ITERT,- ITERC, ITERM, format: 415). NSTEPS is the maximum number of steps to be taken this run. For the first attempt, a step size of zero (the default) should be used to verify the initial conditions and the data. ITERT is the number of temperature steps for each pressure step and ITERC is the number of transport steps taken for each temperature step. STOP—then no more data is read from this file. If this string is not present, the program reads to the end of file (EOF) or to the string END. TEMP—then a minimum of 2 lines defining the initial temperatures follows. The first contains the number of nodes (NUM) and the index of the first node (NUM, ISTART, format: 215). The next line(s) contains ABS(NUM) initial temperatures in degrees kelvins (format: 8F10.5). The first value corresponds to the node with the index, ISTART, the next to the node with the index ISTART + 1. The last corresponds to the node with the index ISTART + NUM - 1. If NUM is negative, then these temperatures will be held constant through all of the calculations. THIC—then the next line contains the Y dimension in meters. By default, this value is equal to one meter (format: F10.4). The Z dimension is equal to the Y dimension. The X direction is the direction along which flow occurs and is set by the DIST command. 142 TIME—then the next line contains the size of the initial time step and the initial time in seconds (default is zero seconds) (format: 2F10.5). WEIG—then the next line contains the value of the weighting parameter for the finite-difference time step used in solving the pressure, temperature and transport equations (format: F10.5). If an input value is less than zero or greater than one, a one is used. Zero corresponds to an explicit temporal approximation, one-half to a Crank-Nicolson implicit scheme and one to a fully implicit method. If the initial values for any variable is not specified for a given node, then the value from the preceeding node is used. If the first node does not have a value, then the program prints out an error message and stops. If a value for a node is specified more than once, then the last value is used. Appendix three contains a simple example of the input for fortran unit 1. Input for Fortran Unit 2—The Thermodynamic Data The initial portion of this file defines the atomic symbols and the atomic weights. The second portion identifies the phases, species and gases, with their accompanying thermodynamic, compositional, and physical data. An example of an input file for fortran unit 2 is listed in appendix four. The first line in the file is the number of elements (format: 15). This is followed by the atomic symbols of the elements, left justified in their field (format: 7(A4,4X)). In general, only two characters are needed to define the atomic symbols, but four positions are provided so that unique strings can be given for each of the isotopes. These lines are followed by the atomic weights of each of the elements/isotopes (format: 7(F10.5)). Immediately after these fines of input, is a character string identifying the following information. The only valid character strings are: AQUEOUS DATA, DECAY, GAS DATA, MINERAL DATA, REFERENCES, SOLID SOLUTION DATA, END and STOP. Each of these character strings must be followed by at least three asterisks and (starting in column one) preceeded by at least three asterisks. There are no spaces between the asterisks and the character string. If the character string is: ****AQUEOUS DATA****—then the following lines contain the names, compositions and thermo-dynamic data of aqueous species. The data for each species occurring as a set of three lines. The first line contains the name of the species (only the first 8 characters are used, but it can be of any length), 4 blanks (or more), the formula (in the form: AL(1)0(2)H(2)—decimal numbers 143 can be used as coefficients). This is followed by at least 4 blanks and then any information can be included. The next line contains: the apparent Gibbs free energy of formation from the elements at 298.15 C and 0.1 MP a (J/mole), the enthalpy of formation from the elements (J/mole), the third law entropy (J/mole/deg), two terms (Cl and C2) of the of the heat ca-pacity equation (J/mol/deg, J/mol/deg), and the first two terms of the volume expansion, A l and A2 (J/mol/bar, J/mol/bar2, respectively). The next line contains the remaining two terms of the volume expansion, A3 and A4 (J/mol/bar, J/mol/bar2, respectively), theta (deg), the conventional Born parameter and the charge of the species. The last two lines are read with the format: (5X,6F12.3). In the data base, A2 and A4 have been multiplied by 105, A3 has been multiplied by 102 and the conventional Born parameter by 10 - 5. Values for these parameters are given in calories by Helgeson et al (1981). Water must be the first aqueous species in the data base and only its enthalpy and entropy are needed. If an aqueous species has a charge of zero or a charge greater than nine, then an activity coefficient of one is used. The activity of water is calculated using equations given previously in the text. *DECAY****—then information about the natural radioactive decay of isotopes follows. Each decay reaction has two lines. The first line contains one space, then the name of the decay reaction (for example: Ra226 => Rn222 + He4), at least four spaces and an equation giving the decay reaction. The name of the decay reaction can be of any length, but only the first 20 characters are used. The decay reaction is written in the form: RA26(-l)RN22(l)HE(l) which would imply that one atom of Radium, mass 226, decays to one atom of Radon gas, mass 222 and one atom of Helium, mass 4. Note that these symbols and their masses must have been identified in the first section of this file. The next line contains the half life constant of the reaction (units: seconds) and the energy released as heat per second of decay for one mole of the substance (units: J/sec mole) (format: 5X, 2E12.5). *END****—then the program stops reading this data base immediately. If this string is not present, the program reads until the end of the file or to the character string ***SJOP***. This string is not necessary on most systems. *GAS DATA****—then the following lines contains the names, compositions and thermody-namic data of various gases. The data for each gas occurs in a set of two lines. The first line contains one space, the name of the gas (only the first twenty characters are used, but the name can be of any length), four spaces (at least), the formula, (in the form: H(2)S(1)—decimal 144 numbers can be used). At least four blanks follows and then any information. The next line contains: the Gibbs free energy of formation from the elements (J/mole), the enthalpy of forma-tion from the elements (J/mole) and the third law entropy (J/mole deg), all at at the reference temperature and pressure. The next line contains the terms of the capacity equations: a, b, c, d, e, f and g (J/mole/deg, J/mole/deg2, J deg/mole, J/deg5, J/m/deg3, J/m, J deg2/mol, respectively). No two gases should have identical thermodynamic and compositional properties. As the above terms only allow the gas properties to be calculated at one bar, a Redlich-Kwong routine is used to calculate the pressure integral in the programs. *MTNERAL DATA****—then the following lines contain the names, compositions and thermo-dynamic data of stoichiometric minerals. The data for each phase occurs in a set of three lines. The first line contains one space, the name of the phase (only the first 20 characters are used, but it can be of any length), 4 spaces (or more), the formula (in the form: CA(3)AL(2)SI(3)0(12)— decimal numbers can be used). At least 4 blanks follows and then any information. The next line contains: the Gibbs free energy of formation from the elements (J/mole), the enthalpy of formation from the elements (J/mole), the third law entropy (J/mole deg), and the molar volume (cubic cm.), all evaluated at the reference conditions. The next line contains the terms of the heat capacity equation: a, b, c, d, e, f and g ((J/mole/deg, J/mole/deg2, J deg/mole, J/deg5, J/m/deg3, J/m, J deg2/mol, respectively). The next line contains the coefficient of iso-baric expansion (l/deg), the coefficient of iso-thermal contraction (l/MPa) and the thermal conductivity (watt/m deg). These lines are read using the format: (5X,6F12.3). No two phases should have an identical composition and thermodynamic properties. •REFERENCES****—then the following information is ignored by the program unless the first non-blank characters are another key word character string. *SOIID SOLUTION DATA***—Then the next lines contain the properties of various solid solution minerals. These occur in sets, in which the first line contains one space, the number of endmembers, four spaces, the name of the solid solution, four spaces and a representative formula for the phase (format: 1X,I2,2X,20A4). The name of the solid solution can be of any length, but only the first twenty characters are used. The formula must contain all of the elements in the solid solution. Any analysis can be used as the formula is used to determine if the solid solution phase is in the compositional space of the system being modelled. Thus it is only used when the data base is being read. For a pyrope-grossular garnet, the formula could 145 be any of the following: CA(0.1)MG(2.9)AL(2)SI(3)O(8), CA(1)MG(2)AL(2)SI(3)0(8), CA(l.l)MG(1.0)AL(2)SI(3)O(8), CA(2)MG(l)AL(2)SI(3)0(8), CA(2.9)MG(0.l)AL(2)SI(3)O(8). All of the elements must be included in the formula using real or integer coefficients. The next line(s) contains 10 blanks and the name of one of the solid solution endmembers. (format: 10X,30A4). This is repeated until all of the endmembers have been defined. The name of the endmember can be of any length, but must be identical to the name of a stoichiometric phase in the mineral data section. The next lines contain the interaction parameters for this solid solution. All parameters must be included, even if they are zero, (format: 5X,6E12.5). At present, only binary solid solution phases are allowed. ****gjQp****—then the program stops reading this data base immediately. If this string is not present, the program reads until the end of the file (EOF) or to the character string ***END***. This string is not necessary on most systems. Input For For t ran Un i t S — T h e Chemical Constraints This file contains the chemical constrains for each of the nodes, an example is given in appendix five. The first lines in the file are title cards. As many as desired, including blank lines, can be used. They are terminated by a line with the word S T A R T in the first five columns. The next line in the file is one of five character strings which describes the nature of the data following it. The five possible strings are C O M P o s i t i o n , E N D , I N E R t , R E A C t a n t s and S T O P . Only the first four characters of the string are used to identify the string. Each string (and its associated data) can be repeated as many times as needed. If the string is: C O M P — t h e n the following lines define the composition at the specified nodes. The first line which follows contains the number of compositional constraints, the number of nodes (NUM) and the index of the first node to which these constraints apply (ISTART, format: 315). The next lines contain the compositional constraints. The first three characters (AQU=aqueous species, MTN=stoichiometric mineral, SSS=solid solution mineral, GAS=gas) specifies the physical state of the constraint and the portion of the data base in which it will be found. This is followed by one blank and then one character specifying molality ( M ) , number of moles ( M ) , log activity ( A ) , balancing ion (B) or grams (G) . Balancing ion indicates molality and that ini-tial molality can be modified by the program for charge balance. For an aqueous species, only 146 the molality, balancing ion and log activity options can be used. For a solid solution or stoichio-metric mineral, only the moles and grams options can be used. For a gas, only the log activity option can be used. This is followed by one blank and then a. field (F10.5) for the molality/log activity/number of moles/number of grams of the mineral/aqueous species/gas. This is followed by a field for the name of the phase/species/gas exactly as it appears in the data base (format: A1,1X,A1,1X,F10.5,10A4). Water is automatically added as a constraint, thus the user specified constraints must be independent of water. In a five component system, only four constraints are needed, if one of the constraints was brucite, periclase could not be another. If the composition of a node is not specified, then the value of the previous node is used. These constraints are applied to nodes whose indexes are IS TART, IS TART + 1,... , IS TART + NUM- 1. END—signals the end of this file. If not present, the program reads until the end of file (EOF) or until the character string STOP. TNER—then a minimum of two lines follows. The first contains the number of nodes (NUM) and a pointer to the first node (ISTART) to which the values on the following line(s) apply. The next line(s) contain the fraction of the solid portion which will be inert (format: 8F10.5). The first value applies the node with index ISTART, the next to the node ISTART + 1. The last applies to the node with the index ISTART + NUM - 1. The default value for any unspecified node is zero. If no solid phases are present at a node, the inert portion defaults to 1.0 minus the porosity. REAC—then the following lines defines the reactant minerals at each node. The first line specifies the number of reactants (K), the number of nodes (NUM), and a. pointer to the first node to which these reactants will apply (ISTART). The next K lines contain the reactant(s). Each line contains one character which indicates if the amount is in grams (G) or moles (M), followed by one space, the amount (F10.5), 3 spaces and the reactant mineral name. The reactants apply to all nodes with indexes IST ART, IS TART +1,... , ISTART + NUM - 1. default value is that there are no reactants at a given node. STOP—signals the end of this file. If not present, the program reads until the end of file (EOF) or to the character string END. When the composition of the fluid has been calculated, the volume of the fluid is determined based on one thousand grams of water. The total number of moles of water in the system is then calculated based on this value, the porosity and the total volume of the element. The total volume available 147 for solid phases is (the total volume of the element) minus (the total volume times the porosity) minus (the total volume times the inert fraction of the volume). The sum of the volumes of solid constraints and reactant minerals is normalized to this amount. Thus the values given for the number of grams (or moles) of minerals and reactants only provide a ratio for the final calculated amount. For example, if the user would like solid phases A, B, and C to be present in a weight ratio of 1:2:4, then their amounts could be specified as 1, 2 and 4 grams, or 1000, 2000 and 4000 grams, respectively. Both would result in the same number of moles of each phase as an initial condition. Fort ran Un i t 7 O u t p u t — P l o t t i n g Pressures and F lu id Velocities The output directed to fortran unit 7 is pressure and velocity information and is designed to be read by a plot program. The first line is the number of nodes (format: 15). The second line contains two integers in a 215 format. They are the maximum number of pressure steps and a switch. The following line(s) contain the position of each of the nodes, 10 per line in 10(1X,E12.5) format (units: meters). The next set of lines are printed for each time step unless the switch is negative when they are only printed at the initial time. The first line of the set contains the time and the time step, (format: 2(lX,El2.5). The next line(s) of the set contains the pressures (units: MPa) for nodes 1 to n (format: 10(1X,E12.5)). These are followed by the velocities between each node (format: 10(1X,E12.5)). Fort ran Un i t 8 O u t p u t — P l o t t i n g the Temperatures The output directed to fortran unit 8 contains the temperatures at each node point and is designed to be read by a plot program. The first line contains two integer in a 215 format. They are the number of nodes and a switch. The next line also contains two integers—the number of pressure steps and the number of temperature steps per pressure step (format: 215). The following line(s) contain the position of each of the nodes (format: 10(1X,E12.5); units: meters). The next set of lines is printed for each time step. The first line contains the time and the time step (format: 2(lX,E12.5). The next line(s) contains the temperatures (units: deg K) for nodes 1 to TI (format: 10(lX,E12.5)). If the switch is negative, then the temperatures are only printed for the initial conditions. 148 Fort ran Un i t 9 O u t p u t — P l o t t i n g Porosity and Permeabil i ty The output directed to fortran unit 9 is bulk composition of the fluid and matrix, porosity and permeability data and is designed to be read by a plot program. The first line contains three integers in 315 format. These are the number of nodes, the number of components and a switch. The second line contains 3 integers (format: 315)-—the number of pressure steps which will be attempted, the number of temperature steps per pressure step and the number of flow steps per temperature step. The following line(s) contain the position of each of the nodes (format: 10(1X,E12.5); units: meters). This is followed by the names of the components, using a 15A8 format. The lines described in this paragraph are printed only at the beginning of the file. The next set of lines is printed for each time step. The molality of the first component in the fluid for each node, followed by the second, , until the molality of all components are printed (format: 10(1X,E12.5)). If the switch is negative, then they are printed only for the initial conditions. The next set of lines contains the total number of moles of each of the components in the solid phases for the each node, printed for the first component, followed by the second, ... (format: 10(1X,E12.5)). If the switch is negative, then they are only printed for the initial conditions. The next set of lines contain the porosity for each node (format: 10(1X,E12.5)) followed by the permeability for each node (format: 10(lX,El2.5)). The permeability and porosity are printed for all time steps, regardless of the switch setting. 149 Fortran Unit 10 Output—Plotting Fluid Compositions The output directed to fortran unit 10 contains the molalities and activity coefficient of each species in the fluid at each node and is designed to be used by a plot program. The first line contains the number of nodes (format: 15). The next line(s) contains the positions of each of the nodes (format: 10(lX,El2.5), units: meters). The next line contains the number of aqueous species, written as an integer in 15 format. The next line(s) contains the names of all the aqueous species in the system (format: 10(5X,A8)). These lines are printed only at the beginning of the file. The next set of lines are printed for each time step. The first line contains the time and the time step (format: 2(1X,E12.5)). The next line(s) contains the log molality of the first, second, third, aqueous species, followed by the log activity for these species, in the same order as they were listed at the start of the file. The next line(s) contains the log molalities and log activities for the second node, followed by the third, etc. For water, the total number of moles is written instead of molality (format: 10(lX,El2.5)). Fortran Unit 11 Output—Plotting the Number of Moles of Solid Phases The output directed to fortran unit 11 contains the total number of moles of each of the solid phases at each node and is designed to be read by a plot program. The first line contains the number of nodes (format: 15). The next line(s) contains the positions of each of the nodes (format: 10(lX,El2.5), units: meters). The next line contains the number of possible solid phases in the system (format: 15). The next line(s) contains the names of all of the solid'phases with twenty spaces for each phase name, six names per line (format: 6A20). These lines are only at the start of the file. The next set of lines is printed for each time step. The first line contains the time and the time step (format: 2(1X,E12.5)). The next line contains three integers, the first is the number of the node, the second the number of product (equilibrium) phases present at that node, the third the number of reactant phases present at that node (format: 315). If the number of product phases is greater than zero, then the next line(s) contains the index number of a product phase at that node, the number of moles and the change in the number of moles of that phase since the last time step. This is repeated for each product phase. If the number of reactant phases at that node is non-zero, then the identical information is written for each reactant phase on a separate line (format: 150 I5,2(1X,E12.5)). 151 Appendix Three: Sample Unit 1 Data The following is a listing of typical data for unit 1. TEST: THIS RUN MORE OR LESS MODELS WHAT WILL HAPPEN WHEN A FLUID GOES THROUGH A PURE QUARTZ ROCK UNDER A PRESSURE AND TEMPERATURE GRADIENT START NODES 40 COMPOSITION H(1.0)O(1.0)SI(l)CL(l)NA(l) PERM 1 1 -8.0 POROUSITY 1 1 0.2 PRESSURE 2 1 21.00000 20.0 TEMPERATURE 2 1 650.00 600. TIME 1500.0 STEPS 60 4 1 THICK 1.0 DIST 1 1 10. WEIGHT 0.9 ALPHA 3 NA+ 0.10 CL- .001 SI02(AQ) 0.01 CHEMICAL REACTIONS ERROR 0.05 5 5 5 5 152 S T O P 1 5 3 Append ix Four: Sample Un i t 2 Data The following pages are portion of a typical data set which would normally be assigned to fortran unit 2. The data for the aqueous species was taken from Helgeson et al., 1981. The data for the solid phases was taken from a prerelease copy of the Berman et al. data base (1985). This database has now been formally released—some of the data shown here is not current. Please contact R. Berman for a current version. 154 0 H NA CA MG FE MN AG AU PB ZN CU HG SI AS S C CL AL K F MO N P NI CO W BA SN U V SR N I BR CS LI TI 15 .99940 1.00797 22 . 98981 40 . 08000 24 31200 55 84700 54.938 107 .87000 196.96700 207.19000 65 . 37000 63 53999 200 59 28.086 74 .92160 32.06400 12.01115 35. 45300 26 98151 39 10201 18.9984 95 .94 14.0067 30.9738 58 . 71 58 9332 183 85 208.980 118 . 69 238.03 50.942 87 . 62 14 0067 126 9044 79.909 132 .905 6.939 47 .90 * * * * AQUEOUS SPECIES*** WATER H ( 2 ) 0 ( l ) H20 REF . - SEE BELOW -285830. 69.915 0.0000 0.0000 0 0000 0.0000 0.0000 0.0000 0.0000 0 0000 ••••REFERENCES*** WATER MUST BE THE FIRST SPECIES IN THE AQUEOUS SPECIES SECTION!!!!!! ****AQUEOUS SPECIES*** H + H( 1) REF . 1 0.0000 0.0000 0 0000 0 0000 0 . 0 0 0 0 0.0000 0.0000 0.0000 0 0000 0 0000 1 . 0 0 0 0 4.0000 N A + NA( 1) REF. 1 - 240299.6719 58.5760 149 4328 -26 2990 0 8 . 0 0 8 -2002.13 -235.484 1529.67 215 1700 I 383 2 1 . 0 0 0 0 4.0000 K( 1) REF . 1 - 252169.6875 101.2528 77 2710 -12 2445 13.000 311.79 -81.421 606.85 234 1900 0 8063 1.0000 4.0000 MG+ + MG ( 1) REF . 1 - 466779.5937 138.0720 163 2835 - 11 1566 - 17.447 5894.29 -00.264 029.46 270 5600 6 4316 2 . 0 0 0 0 4.0000 CA+ + CA( 1) REF . 1 - 543099.9375 -56.4840 150 1219 - 13 8490 - 14.949 4771.18 -05.238 073.97 266 1400 5 1739 2.0000 4.0000 AL+ + + A L ( 1 ) REF 1 - 531401.5000 -307.9424 273 0897 -33 0118 -29.414 -376.56 -133.888 907.93 229 6000 12 0127 3.0000 4.0000 CL- C L ( 1 ) REF 1 - 167079.6719 56.9024 -20 2439 -8 5395 24.104 -2911.65 -44.760 433.67 246 0200 6 0919 - 1.0000 4.0000 OH- 0 ( 1 ) H ( 1 ) REF . 1 - 230023.7656 - 10.8784 103 4318 -25 97 18 02.155 -041.59 -83.031 453.21 253 5200 7 2157 -1.0000 4.0000 HC03- H( 1 ) C ( 1 ) 0 ( 3 ) REF . 1 -689933.2500 98.3240 64 4336 - 12 5520 32.999 -3733.17 -112.077 600.40 236 8700 5 5618 -1 .0000 4.0000 195.723 0.OOOO OO.895 0.OOOO 111837.35 4.OOOO 2064.43 4.OOOO PP 1249 1516 NACL(AQ) N A ( l ) C L ( l ) REF. 1 -417868.6250 62.7600 266.2317 -4.1840 -1970.777 -101880.77 265.2500 4.9413 SI02(AQ) S I ( 1 ) 0 ( 2 ) REF. 1 -881677.5625 61.9232 202.9947 -66.0616 285.596 124.64 233.0000 0.5402 •••REFERENCES*** REF. 1 - DATA IS FROM HELGESON ET AL ( 1 9 8 1 ) , AJS 281, DATA IS IN ORDER H, S, C l , C2, A l , A3, A4, THETA, W, A2 HAS BEEN MULTIPLIED BY 10**5, A3 HAS BEEN MULTIPLIED BY 10**2 A4 HAS BEEN MULTIPLIED BY 10**5, W HAS BEEN MULTIPLIED BY 10**-5 UNITS ARE IN ORDER: J/M, J/(MK), J / ( M K ) , J/(MK), J/(M BAR), J/(M BAR BAR) J/(M BAR), J/(M BAR BAR), K, J/M, E-, ANGSTOMS WHERE J IS JOULES, M IS MOLES, K IS DEG KELVIN, AND B IS BARS ORIGINAL REFERENCE IS IN CALORIES, THEY WERE MULTIPLIED BY 4.184 TO CONVERT NOTE THAT WATER MUST BE THE FIRST AQUEOUS SPECIES AND DOES NOT HAVE ANYTHING OTHER THAN AN DELTA H OF FORMATION AND A SZERO. A2 , Z, AZERO • * * *REF ERENCES* * * * * * SOLID PHASES - F I T USING HAAR EQUATION OF STATE PRELIMINARY RELEASE OF BERMAN ET AL FORMAT: H, S, V A, B, C, D, E, F, G DV/DT, DV/DP, K (THERMAL COND) DV/DT AND DV/DP FROM MEMOIR 97 -K (THERMAL COND.) FROM MEMOIR 97 WHEN NO DATA DEFAULT VALUES OF 0.001 AND -0.002 USED. - DEFAULT VALUE OF 100 USED WHEN NO DATA. ALPHA-QUARTZ USED FOR BETA-QUARTZ CAL C I T E VALUE USED FOR ALL CARBONATES •••••MINERAL DATA***** A L B I T E NA( 1 ) A L ( 1 ) S I ( 3 ) 0 ( 8 ) ALB I -3934963.50 208.09999 99.9800 393.63568 0.000000 -7892826. -2415.4976 0.00100000 -0.00200000 100. ANDALUSITE A L ( 2 ) S I ( 1 ) 0 ( 5 ) ANDA -2590415.75 91.53000 51.5877 236.47818 0.000000 -7526810. -1102.9413 0.00082000 -0.00200000 110. ANORTHITE A L ( 2 ) C A ( 1 ) S I ( 2 ) 0 ( 8 ) ANOR -4230350.50 199.59999 100.7500 439.36926 0.000000 0. -3734.1487 0.00120000 -0.00200000 100. CALC C A ( 1 ) C ( 1 ) 0 ( 3 ) CALC -1207438.00 91.72376 36.9190 193.23828 0.000000 0. -2040.8756 0.00100000 -0.00050000 38. CORUNDUM A L ( 2 ) 0 ( 3 ) CORU -1675700.00 51.02000 25.5680 155.01888 0.000000 -3861363. -828.3870 0.00100000 -0.00008000 250. 0.OOOO 0.OOOO 0.OOOO 0 . O O O O 0 . O O O O 0.0 1070635968 0.0 936442432 0.0 -317023264 0.0 199455888 0.0 409083520 DIOPSIDE M G ( 1 ) C A ( 1 ) S I ( 2 ) 0 ( 6 ) DI -3200898.50 142.50000 66.1527 305.41321 0.000000 -7165973. 1604 9314 0.00057600 -0.00070000 100 . FORSTERIT E M G ( 2 ) S I ( 1 ) 0 ( 4 ) FO -2176500.00 94.20061 43.8030 238.64136 0.000000 0 . 2001 2606 0.00105000 -0.00043000 100 . GROSSULAR C A ( 3 ) A L ( 2 ) S I ( 3 ) 0 ( 1 2 ) GROS -6634023.50 255.00000 125.3920 573.43042 0.000000 - 18887174. 2039 4049 0.00225000 -0.00075000 100. PYRO M G ( 3 ) A L ( 2 ) S I ( 3 ) 0 ( 12) PYRO -6283743.50 272.79999 113.1100 581.51300 0.000000 -9039100. 2790 7576 0.00100000 -0.00200000 100 . ALPHA-QUARTZ S I ( 1 ) 0 ( 2 ) A-QTZ -910700.00 41.45252 22.6880 80.01199 0.000000 -3546684. -240 2755 0.00077100 -0.006100 8 . 4 BETA-QUARTZ S I ( 1 ) 0 ( 2 ) B-QTZ -908624.06 44.20796 23.7180 80.01199 0.000000 -3546684. -240 2755 0.00075000 -0.00200000 8 . 4 SILLIMANITE A L ( 2 ) S I ( 1 ) O ( 5 ) S I L L -2586855.50 95.64000 49.8481 233.15654 0.000000 -7726210. 1052 7800 0.00049800 -0.00042000 100 . SPINEL M G ( 1 ) A L ( 2 ) 0 ( 4 ) SP -2304398.50 83.66499 39.7400 235.89992 0.000000 -1710415. 1766 5780 0.00100000 -0.00016000 138 . 0.0000 0.0 0.0000 0.0 0.0000 0.0 0.0000 0.0 0.0000 0.0 0.0000 0.0 0.0000 0.0 0.0000 0.0 921837504 -116243280 2319311872 143163008 491568416 491568416 997865792 40616924 Append ix Five: Sample Un i t S Data The following is a typical set of data assigned to unit 3. The example is perhaps the simplest possible, with all REV having the same composition. THIS FILE DESCRIBES THE CHEMICAL COMPOSITION OF EACH NODE HERE IT IS A QUARTZ ROCK, CONTAINING A SODIUM CHLORIDE BRINE BALANCING ION IS SODIUM START COMPOSITION 4 1 MIN M 1.0 ALPHA-QUARTZ AQU A -6.0 H+ AQU B 1.0 NA+ AQU M 1.0 CL-STOP 158 Append ix Six: Sample Un i t 6 Output The following listing is an edited version of the output written to the file attached to fortran unit 6. Typically this output file is very large—100000 lines is not unusual. On most computer systems, only files on magnetic tape can be big enough to contain the entire output. For hardcopy, micro-fiche is recommended. This output was generated using the data given earlier. Only the inital conditions and portions of the first step are shown for brevity. When material has been removed, it has been flagged using the following construction: *************************************************************** **************************************************************** ************* M A T E R I A L H A g B E E N REMOVED HERE************ **************************************************************** In addition to removing material, the length of the output lines was truncated to 90 characters in order to fit the thesis format. The following material was extracted from a output listing about 3 inches thick. 159 1 TITLE INFORMATION READ FROM DATA ATTACHED TO UNIT 1 TEST NUMBER OF NODES - 40 SIZE OF ELEMENTS (METERS) ie.eee 10 .000 10 .000 10.eee 10.eee 10 .000 10 .000 10 .000 10.000 10 .000 10 .000 10.eee 10.000 ie.eee 10 .000 10.000 POSITION OF EACH OF THE NODES (METERS) .eee 10 .000 2 0 . 0 0 0 3 0 . 0 0 0 100.000 ne.eee 120.000 130.000 200.eee 210.eee 2 2 0 . 0 0 0 2 3 0 . 0 0 0 3 0 0 . 0 0 0 3ie.eee 3 2 0 . 0 0 0 3 3 0 . 0 0 0 THICKNESS OF GRID IN METERS - .10000E+01 SYSTEM IS COMPOSED OF THE FOLLOWING ELEMENTS: H INITIAL PERMEABILITY IN EACH NODE (METERS»»2) .100O0E-O7 .10000E-07 .ieeeeE-07 .ieoeoE-e7 .10000E-07 .ieO00E-07 .1O000E-07 .i0oeeE-e7 .ioeeeE-e7 .1OO00E-07 .ieoeoE-07 .10000E-07 .ieeoeE-07 .ieeeeE-07 .ieeeeE-07 .ioeeeE-07 INITIAL POROUSITY IN EACH NODE .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 .200 INITIAL PRESSURES IN EACH NODE (MPA) 21.0 20.0 20.B 20.0 20.0 20.0 20.0 20.e 20.e 20.e 20.0 20.0 20.0 20.0 20.e 20.0 INITIAL TEMPERATURES IN EACH NODE (DEG K) 550.0 500.0 500.0 500.0 500.e 500.0 500.0 500.0 500.0 500.0 500.0 500.0 10.000 10.000 10.000 10.000 10.000 10.000 10.000 10.000 10.ee 1 0 . 0 0 1e.ee 1 0 . 0 0 40.000 140.000 240.000 340.000 50.000 150.000 250.000 350.000 60.00 160.00 260.00 360.00 SI CL NA 10000E-07 1O000E-O7 10O0OE-07 1O000E-07 .100OOE-O7 .10000E-O7 . 10000E-O7 . 1O00OE-07 . 10000E-0 .10000E-O .10000E-0 .10000E-0 .200 .200 .20 .200 .200 .20 .200 .200 .20 .200 .200 .20 20.0 20.0 20. 20.0 20.0 20. 20.0 20.0 20. 20.0 20.0 20. 500.0 500.0 500. 500.0 500.0 500. 500.0 500.0 500. 500.0 500.0 500 .0 500.0 500 .0 THE FOLLOWING AQUEOUS SPECIES HAVE BEEN CHOSEN AS MOBILE COMPONENTS NAME LONG. DISPERSIVITY SI02(AQ) .01000 5 0 0 . 0 500. WEIGHTING FACTOR FOR THE FINITE DIFFERENCE TIME STEP IS: .90000 MAX. NUMBER OF TIME (PRESSURE) STEPS IS FOR EACH PRESSURE STEP. THERE IS FOR EACH TEMPERATURE STEP, THERE IS FOR EACH SOLUTE TRANSPORT STEP. THERE IS THE INITAL TIME IS: .00000E+00 SECONDS THE INITAL PRESSURE TIME STEP IS THE INITAL TEMPERATURE TIME STEP IS THE INITAL COMPONENT TRANSPORT TIME STEP IS THE INITAL CHEMICAL REACTION TIME STEP IS 4 TEMPERATURE STEPS 1 SOLUTE TRANSPORT STEPS 1 CHEMICAL REACTION STEPS. .20000E+01 SECONDS .50000E+00 SECONDS .50000E+00 SECONDS .50000E+00 SECONDS. PRESSURE TEMPERATURE TRANSPORT PERCENT MAXIMUM ERROR .50000E+01 .10000E+03 .10000E+03 MAX. NUMBER ITERATIONS 5 5 5 1 THE FOLLOWING PHASE/THERMODYNAMIC INFORMATION WAS READ FROM THE FILE ASSIGNED TO UNIT THE FOLLOWING AQUEOUS SPECIES WERE USED AS THE COMPOSITIONAL BASIS FOR ALL PHASES AND SP WATER SI02(AQ) H+ C L - NA+ THE FOLLOWING AQUEOUS SPECIES WILL BE CONSIDERED IN THE CALCULATIONS NAME WATER (G/MOLE) 18.01534 1.00797 H (F) (J/MOLE) -285830 .0 .0 S (ZERO) (J/MOLE/DEG) 69.92 .00 C l J/MOL/DEG .0000 .0000 •••••••••••••MATERIAL HAS BEEN REMOVED HERE*»»»»»»**»*»«»«»»»»*« • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • a * * * * * * * * * * * * TITLE INFORMATON READ FROM DATA ON UNIT 3 THIS FILE DESCRIBES THE CHEMICAL COMPOSITION OF EACH NODE 0 CHEMICAL CONSTRAINTS FOR NODE: ALPHA-QUARTZ H+ NA+ C L -WATER (MINERAL) (AQ SPECIES) (AQ SPECIES) (AQ SPECIES) (AQ SPECIES) 1 (MOLES) (LOG ACT . ) (MOLALITY) (MOLALITY) (LOG ACT.) CHEMICAL CONSTRAINTS FO .100O0E+01 -.600O0E+01 .10000E+01 .10000E+31 .00000E+00 ALPHA-QUARTZ H+ NA+ C L -WATER .MATERIAL HAS BEEN REMOVED HERE* 0 NODE: TOTAL VOLUME INERT POROSITY AVAILABLE VOLUME PHASES PRESENT (M*«3) FRACTION (M**3) .10000E+02 .10000E+02 .000000 .000000 .200000 .200000 .80000E+01 .B0000E+01 ALPHA-QUARTZ ALPHA-QUARTZ .MATERIAL HAS BEEN REMOVED HERE* (M (AQ (AQ (AQ (AO AMOUN (MOLE .35158 .35208 DISTRIBUTION OF SPECIES CALLED AT TIME 0 FOR NODE: 1 WITH A TEMPERATURE OF 550.000 (OEG.K) AND A PRESSURE OF 0 SPECIES WATER H+ NA+ C L -OH-NACL(AQ SI02(AQ 0 IONIC MOLALITY .55508E+02 .99863E-05 .99103E+00 .99091E+00 . 1 3 U 1 E - 0 3 .90916E-02 .85929E-02 STRENGTH: ELECTRICAL BALANCE: LOG MOL. 1.74436 -5 .00060 - .00391 - . 0 0 3 9 7 -3 .88136 -2 .04136 -2 .06586 .99104 .49687E-10 ACTIVITY .96461E+00 .10000E-05 .89374E-01 .88015E-01 .10721E-04 .90916E-02 .85929E-02 LOG ACT. - . 0 1 5 6 5 - 6 . 0 0 0 0 0 - 1 . 0 4 8 7 9 -1 .05545 -4 .96978 -2 .04136 -2 .06586 21.000 (MPA) ACTIVITY COEF LOG ACT COEF .01738 .10014 .09018 .08882 .08158 .00000 1.00000 -1 .76000 - . 9 9 9 4 0 - 1 . 0 4 4 8 8 -1 .05148 - 1 . 0 8 8 4 2 .00000 .00000 0 ION/COMPONENT USED FOR ELECTRICAL BALANCE: NA+ PHASE ALPHA-QUARTZ BETA-OUARTZ LOG ACTIVITY .00000E+00 - .55346E-01 LOG K .0000 - . 0 5 5 3 LOG Q .0000 .0000 .MATERIAL HAS BEEN REMOVED HERE* 1 COMPOSITION. POROSITY AND PERIMIABILTY AT: PRESSURE STEP NUMBER: 0 TEMPERATURE STEP NUMBER: COMPONENT FLOW STEP NUMBER: 0 o TIME OF OUTPUT (SEC) : .0O0OOE+OO TEMPERATURE TIME STEP ( S E C ) : .50000E+0O MAX. ERROR (PERCENT): 100.00000000 MAX. NUMBER OF ITERATIONS IS: 5 FLOW COMP SI02(AQ) PERCENT ERROR .00000000 ITERATIONS NUMBER OF MOLES OF EACH OF THE FLUID COMPONENTS PER LITER FOR THE AQUEOUS SPECIES ARE: NODE: 1 2 WATER .55508E+02 .55508E+02 SI02(AQ) .85929E-02 .53346E-02 - .12143E-03 - .63112E-04 •MATERIAL HAS BEEN REMOVED HERE* C L -. 10000E+01 . 10000E+01 NA+ .10001E+01 .10001E+01 NUMBER OF MOLES OF EACH OF THE FLUID COMPONENTS IN THE SOLID PHASES ARE NODE: 1 2 WATER .00000E+00 .00000E+00 SI02(AQ) .35158E+06 .35208E+06 H+ . 00000E+00 .00000E+00 C L -.00000E+OO .00000E+00 NA+ .O0000E+OO .00000E+00 POROUSITIES AT THE NODES FOR TIME .00000E+00 SEC. ARE: .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .20000 .2000 .2000 .2000 .2000 PERMIABILITIES AT THE NODES FOR TIME .00000E+00 SEC. ARE: .10000E-07 .10000E-O7 .10000E-07 .10000E-07 .10000E-07 .10000E-07 .10000E-07 .10000E-07 .10000E-07 .10000E-07 .10000E-07 •10000E-07 .10000E-07 . 10000E-07 . 10000E-07 . 1000OE-07 . 10000E-07 10000E-07 10000E-07 10000E-07 .10000E-07 .10000E-07 . 10000E-07 10000E-07 .10000E-0 . 10000E-0 10000E-O 10000E-0 1 TEMPERATURE OUTPUT AT: PRESSURE STEP NUMBER: TEMPERATURE STEP NUMBER: 0 TIME OF OUTPUT (SEC) : .00000E+00 TEMPERATURE TIME STEP (SEC) : .50000E+00 PERCENT ERROR LIMIT: 100.00060000 MAX. NUMBER ITERATIONS: 5 PERCENT ERROR USED : .00000000 TOTAL NUMBER ITERATIONS: 0 TEMPERATURES (K) AT THE NODES ARE 550.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500.00 500 .00 500 .00 500 .00 500 .00 500 .0 500 .0 500 .0 500 .0 1 PRESSURE OUTPUT AT PRESSURE STEP NUMBER: TIME OF CALCULATION (SEC) : .00000E+00 PRESSURE TIME STEP (SEC) : .20000E+01 PERCENT ERROR LIMIT: 5.00000000 PERCENT ERROR USED : .00000000 0 MAX. NUMBER ITERATIONS: TOTAL NUMBER ITERATIONS: PRESSURES (MPA) AT THE NODES ARE : 21 .00 20 .00 20 .00 20.00 20 .00 2 0 . 0 0 2 0 . 0 20.00 20 .00 20 .00 20.00 20 .00 2 0 . 0 0 2 0 . 0 20.00 20.00 20.00 20.00 20 .00 20 .00 2 0 . 0 20 .00 20.00 20.00 20 .00 20 .00 2 0 . 0 0 2 0 . 0 VELOCITIES (M/SEC) BETWEEN EACH NODE ARE: .91162E+01 .00000E+00 .0000OE+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .000O0E+O0 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+00 .00000E+0 .00000E+0 .00000E+0 .00000E+0 1 AT TIME - .5 FOR NODE: 1 PRESSURE ITERATION - 1 TEMPERATURE ITERATION - 1 FLOW ITERATION - 1 REACTION ITERATION - 1 PRESSURE - 21 .00 MPA TEMPERATURE - 550.00 DEG K 0 SPECIES MOLALITY LOG MOL. WATER .55508E+02 1.74436 H+ .99862E-05 -5 .00060 ACTIVITY LOG ACT. ACTIVITY COEF LOG ACT COEF .96461E+00 - . 0 1 5 6 5 .01738 - 1 . 7 6 0 0 0 .10000E-05 - 6 . 0 0 0 0 0 .10014 - . 9 9 9 4 0 NA+ C L -OH— NACL(AQ) SI02(AQ) .99103E+0O .99091E+00 . 12676E-03 .90916E-02 .85929E-02 - . 0 0 3 9 2 - . 0 0 3 9 7 -3.89701 -2.04136 -2.06586 .89374E-01 .88015E-01 .10341E-04 .90916E-02 .85929E-02 IONIC STRENGTH: .99104 ELECTRICAL BALANCE: - . 31934E-09 ION/COMPONENT USED FOR ELECTRICAL BALANCE: NA+ PHASE ALPHA-QUARTZ BETA-QUARTZ PHASE ALPHA-QUARTZ LOG ACTIVITY .00000E+00 - .55346E-01 - 1 . 0 4 8 7 9 - 1 . 0 5 5 4 4 - 4 . 9 8 5 4 3 -2 .04136 -2 .06586 LOG K .0000 - . 0 5 5 3 D M/ DT TOTAL NUMBER OF MOLES .00000000E+00 .35157593E+06 'MATERIAL HAS BEEN REMOVED HERE .09018 .08882 .08158 1.00000 1.00000 - 1 . 0 4 4 8 7 - 1 . 0 5 1 4 8 - 1 . 0 8 8 4 2 .00000 .00000 LOG Q .0000 .0000 Appendix Seven: Program listing The following program has been written in FTN 5, a Control Data Corporation (CDC) implemen-tation of ANSI standard FORTRAN 77 and has been run on Cyber 825 and Cyber 855 computers under NOS 4.1 and NOS 4.2 operating systems. It has also been compiled under the DEC (Digital Equipment Corporation) implementation of ANSI standard FORTRAN 77. The only non-ANSI standard statement used is a CDC extension to the PROGRAM statement. This statement is the first in the program, and in addition is giving a name to the main program blocks, identifies the various I/O units. 166 PROGRAM PHD(TAPE1, TAPE2, TAPE3, TAPE6, TAPE7, TAPE8, TAPE9, TAPE 10, TAPE 11) C C ***************************************************************** c C THIS PROGRAM IS DESIGNED TO CALCULATE MASS TRANSPORT AND C TRANSFER IN A 1 DIM SECTION OF ROCK RANGING FROM THIN SECTION TO C CRUSTAL DIMENSIONS. THE AREA IS DIVIDED INTO A LINEAR C GRID AND THE INITIAL TEMPERATURE AND PRESSURE VALUES ARE USED C TO CALCULATE THE MASS DISTRIBUTION IN EACH CELL. C C C WRITTEN BY E.H. PERKINS, STARTING JAN 17, 1983 C ************************************************** c C UNIT 1 - READS THE RUN SPECIFIC DATA SUCH AS POROUSITY C UNIT 2 - READS THE THERMODYNAMIC DATA FILE C H-* C UNIT 3 - READS THE COMPOSITION OF EACH NODE ^ C UNIT 6 - WRITES A USER VERSION OF ALL OF THE THE DATA, C CALCULATIONS AND ERROR MESSAGES C UNIT 7 - WRITES A SUMMARY TO BE USED PLOTTING THE PRESSURES C AND VELOCITIES C UNIT 8 - WRITES A SUMMARY TO BE USED PLOTTING THE TEMPERATURES C C UNIT 9 - WRITES A SUMMARY TO BE USED PLOTTING THE TOTAL COMPOSTION C OF THE FLUID AND SOLID PHASES, POROUSITY AND C PERMIMIABILITY C UNIT 10 - WRITES A SUMMARY TO BE USED PLOTTING THE MOLALITY AND C ACTIVITY OF ALL AQUEOUS SPECIES C C UNIT 11 - WRITES A SUMMARY TO BE USED PLOTTING THE NUMBER OF MOLES C OF EACH PHASE AND THE POROSITY. C IPSWIT, ITSWIT, ICSWIT, IMSWIT ARE SWITCHES FOR PRESSURE, C TEMPERATURE, COMPONENT TRANSPORT AND MASS TRANSFER C RESPECTIVELY. IF 0, SOLVE, IF -1, THESE TERMS ARE C CONSTANT AND ARE NOT SOLVED FOR, IF 1, THEY HAVE C CONVERGED FOR THIS ITERATION. C C NSTEPS IS THE TOTAL NUMBER OF STEPS TO BE MADE C ITSTEP CONTAINS THE NUMBER OF LOOPS-FOP? TEMPERATURE ( 1 ) , C THE NUMBER OF LOOPS FOR COMPONENTS FLOW (2) C AND THE NUMBER OF LOOPS FOR MASS TRANSFER (3) COMMON /SWIT/ ITSTEP(3), IPSWIT, ITSWIT, ICSWIT, IMSWIT, NSTEPS C IF IUPDT EQUAL TO ZERO, THEN PRINT OUT PREDICTIONS, C NOT EQUAL TO ZERO, THEN DO NOT IUPDT = 1 C C READ IN SIZE, POROSITY AND PERMEABILITY OF EACH NODE AND THE COMPOSITION C OF THE ENTIRE SYSTEM FROM UNIT 1 C CALL SETUP 1 C READ IN PHASE DATA FROM UNIT 2 CALL SETUP2 C C READ IN COMPOSITION OF EACH NODE FROM UNIT 3 C CALL SETUP3 C C SETUP WATER ROUTINE - CALCULATE FREE ENERGY AND DENSITY FOR C VELOCITY CALCULATIONS C CALL SETUP4 C C CALCULATE AND OUTPUT INITIAL DISTRIBUTION OF SPECIES AT C EACH NODE. C CALL SETUP5 C C CALCULATE INITIAL VELOCITY CALL VEL CALL SETUP6 C C OUTPUT INITIAL PRESSURE, VELOCITY, TEMPERATURE, COMPOSITION, POROSITY C AND PERMIABILTY CALL 0UTC(O,O,O,ICSWIT,IMSWIT, IUPDT) CALL 0UTT(O.O,ITSWIT, IUPDT) CALL OUTP(0,IPSWIT, IUPDT) C C THIS IS THE TIME STEP LOOP C C SOLVE PRESSURE, TEMPERATURE, COMPONENT FLOW AND MASS TRANSFER C NOTE THAT ROUTINES ARE ONLY CALLED AS NEEDED IF (NSTEPS .GT. 0) THEN DO 100 ITERP = 1, NSTEPS IF (IPSWIT.NE.-1) THEN CALL SOLVEP(IMSWIT) CALL VEL END IF DO 90 ITERT = 1, ITSTEP(1) IF (ITSWIT.NE.-1) CALL SOLVET(IMSWIT) DO 80 ITERC = 1, ITSTEP(2) IF (ICSWIT.NE.-1) CALL SOLVEC(IMSWIT) C IF (IMSWIT.NE.-1 ) THEN DO 70 ITERM = 1, ITSTEP(3) CALL SOLVEM(ITERP,ITERT, ITERC,ITERM) 70 CONTINUE END IF CALL OUTC(ITERP,ITERT,ITERC,ICSWIT, IMSWIT, IUPDT) 80 CONTINUE IF (ITSWIT.NE.-1) CALL OUTT(ITERP, ITERT, ITSWIT, IUPDT) 90 CONTINUE CALL OUTP(ITERP, IPSWIT, IUPDT) ^ 100 CONTINUE CTN • END IF C STOP END SUBROUTINE SOLVEC(IMSWIT) C THIS ROUTINE SETS UP THE FINITE ELEMENT MATRIX'S FOR C THE SOLUTION OF THE NEW COMPOSITIONS C COMMON BLOCKS PREVIOUSLY DEFINED COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMSS/ COMPSS(10,20), THERSS(8,20), NUMSS COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(51), WATER(51), INDEX1(10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /TRANS/ VEL0C(51,2), A0CO(10.51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC C LOCAL VARIABLES C A - CONTAINS A BANDED REPRESENTATION OF THE FINITE C ELEMENT COEFFICIENT ARRAY. INITIALLY C CONTAINS THE [A] TERMS FOR THE EQUATIONS C [A] P + [B] DP/DT = F C B - CONTAINS A BANDED REPRESENTATION OF THE [B] AREA C IN THE ABOVE EQUATION. C C C - CONTAINS THE COMPOSITIONS AT TIME INOW C C D - WORKING ARRAY C F - ON CALLING IMSL ROUTINE, CONTAINS THE RIGHT HAND SIDE C OF THE EQUATIONS, ON EXIT, IT CONTAINS THE C SOLUTION VECTOR. SEE ABOVE EQUATION. C C PORE - POROUSITY FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME C VOLUME- VOLUME OF ELEMENT C X - SIZE OF ELEMENT, ALSO USED FOR TEMPERARY STORAGE C C XL - WORK ARRAY FOR THE IMSL ROUTINE LEQT1B DIMENSION A(102,3), B(102,3), C(102), D(102), F(102), XL(204) C ZERO = 1.OE-06 ^ C THIS LOOP IS DONE ONCE FOR EACH MOBILE COMPONENT. IT ENDS AT O C THE LABEL 900 -- A COMMENT CARD WITH *** FOLLOWS THIS C LINE DO 900 IK = 1, NCONST IF (ABS(ALPHA(IK)).LT.ZERO) GO TO 900 C DO 800 LOOP = 1, LIML0P(3) I = 2 + IK LOPTOT(I) = LOOP C CALL MINIT(C, 102, 1, O.OEOO) CALL MINIT(D, 102, 1, O.OEOO) CALL MINIT(F, 102, 1, O.OEOO) DO 50 I = 1, NUMX C ( I ) = AQCO(IK,I,INOWC) 50 CONTINUE C C SET UP ELEMENT STIFFNESS MATRIX EVALUATED AT TIME T + DELTA (T/2) C EACH TERM IS EVALUATED FOR THE ELEMENT CALL MINIT(A, 102, 3, O.OEOO) CALL MINIT(B, 102, 3, O.OEOO) CALL MINIT(XL, 204, 1, O.OEOO) K = NUMX - 1 DO 100 I = 1, K J = I + 1 C C THE VELOCITY CALCULATION DOES NOT ASSUME THAT THE C TIME AT INOWP IS THE SAME AS THE TIME AT INOWC C S = (VELOC(I,IFUTP) - VELOC(I,INOWP)) / DTAUP V = VELOC(I,INOWP) + (W1 * S * DTAUC) V = V + (S * ((TAUC - DTAUC) - (TAUC - DTAUC))) C C THE PORE CALCULATION C PORE = (CELLPO(I,INOWC) + CELLPO(0,INOWC)) S = (CELLPO(I,IFUTC) + CELLPO(J,IFUTC)) - PORE PORE = PORE / 2.0 S = S / (2.0 * DTAUC) PORE = PORE + (W1 * S * DTAUC) DISP = ALPHA(IK) * ABS(PORE) C X S I Z E X O ) A(I,2) = ( 1 . 0 * DISP / X) - (V / 2. 0) + A(I,2) A(I,3) = (-1.0 * DISP / X) + (V / 2. 0) A(d,1) = (-1.0 * DISP / X) - (V / 2. 0) A(J,2) = ( 1.0* DISP / X) + (V / 2. 0) B(I,2) =((X / (3. .0 * DTAUC)) * PORE) + B(I,2) B(I,3) = (X / (6 .0 * DTAUC)) * PORE B(J,1) = (X / (6. .0 * DTAUC)) * PORE B(J,2) = (X / (3. .0 * DTAUC)) * PORE c 100 CONTINUE C C FINISH SETTING UP RIGHT HAND SIDE CALL BMMULT(B,102,NUMX,C,F) CALL BMMULT(A,102,NUMX,C,D) DO 160 1 = 1 , NUMX F ( I ) = F ( I ) + ((W1 - 1.0) * D ( I ) ) 160 CONTINUE C FINISH SETTING UP ELEMENT STIFFNESS MATRIX C DO 180 J = 1,3 DO 170 I = 1, NUMX A ( I , J ) = (W1 * A ( I , J ) ) + B ( I , J ) 170 CONTINUE 180 CONTINUE C C SET UP BOUNDARY CONDITIONS -C F(1) = AQCO(IK,1,INOWC) F(NUMX) = AQCO(IK,NUMX,INOWC) DO 200 1 = 1 , 3 A( 1 , I ) =0.0 A(NUMX,I) =0.0 200 CONTINUE A(1,2) =1.0 A(NUMX,2) = 1.0 C SOLVE THE SYSTEM OF EQUATIONS USING IMSL ROUTINE LEQT1B C THIS ROUTINE USES IMSL ROUTINES UERTST AND UGETIO C FOR ERROR OUTPUT. CALL LEQT1B(A,NUMX,1,1,102,F,1,102,0,XL,204,IER) C C CHECK FOR LARGEST ERROR, COPY NEW VALUES TO COMPOSITION ARRAY C <J = 2 + IK ERROR(J) = 0.0 DO 500 1 = 1 , NUMX X = ABS((AQCO(IK,I,IFUTC) - F ( I ) ) / F ( I ) ) IF (X.GT.ERROR(J)) ERROR(J) = X AQCO(IK,I,IFUTC) = F ( I ) 500 CONTINUE IF (ERROR(J).LE.ERRMAX(3)) GO TO 900 800 CONTINUE C 900 CONTINUE C C ************************************* END OF LOOP FOR EACH C MOBILE COMPONENT C RETURN END SUBROUTINE SETUP 1 C C THIS ROUTINE READS IN SIZE, COMPOSITION, POROSITY, PERMEABILITY C OF EACH NODE, AND A FEW OTHER THINGS. C C NEW COMMON BLOCKS COMMON /UPPER / PMIN, PMAX, PTIME, PSTART, TMIN, TMAX, TTIME, TSTART COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CELLS/ CELLPO(51,2 ) , CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /CHEMEL/ WGHT(10), NUMEL CHARACTER*20 PHNAME(25), SSNAME(20), GNAME(10), DNAME(3) CHARACTER*8 F LNAME(10), AQNAME(25) CHARACTER*4 ELNAME(10) COMMON /CHNAME/ PHNAME, SSNAME, GNAME, DNAME, AQNAME, FLNAME, ELNAME COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC PHNAME CONTAINS THE NAME OF ALL OF THE SOLID PHASES CONSIDERED AQNAME CONTAINS THE NAME OF ALL OF THE AQUEOUS SPECIES CONSIDERED SSNAME CONTAINS THE NAME OF ALL OF THE SOLID SOLUTION ENDMEMBERS CONSIDERED. CONTAINS THE NAME OF ALL OF THE GASES CONSIDERED GNAME DNAME FLNAME CONTAINS THE DECAY REACTIONS CONTAINS THE NAMES OF THE SPECIES/COMPONENTS USED FOR THE FLOW CALCULATIONS CELLPO CONTAINS THE POROUSITY AT EACH OF THE NODES CELLPO(I.INOWC) AND CELLPO(I,IFUTC) CONTAINS THE POROUSITY AT TIMES TAUC-DTAUC AND TAUC CELLPE CONTAINS THE PERMIABILITY AT EACH OF THE NODES UNITS ARE METERS**2 CELLPE(I,INOWC) AND CELLPE(I,IFUTC ) CONTAINS THE PERMEABILITY AT TIMES TAUC-DTAUC AND TAUC CELLP CONTAINS THE PRESSURE AT EACH OF THE NODES UNITS ARE MPA (1 BAR = 0.1 MPA) CELLP(I,INOWP) AND CELLP(I,IFUTP) CONTAINS THE PRESSURE AT TIMES TAUP-DTAUP AND TAUP CELLT CONTAINS THE TEMPERATURE AT EACH OF THE NODE UNITS ARE DEG K CELLT(I,INOWT) AND CELLT(I,IFUTT) CONTAINS THE TEMPERATURES AT TIMES TAUT-DTAUT AND TAUT DENSF CONTAINS THE DENSITY OF THE FLUID AT TIMES AT EACH OF THE NODES AT TIMES TAUC-DTAUC AND TAUC SIZEX SIZE (IN METERS) OF EACH OF THE ELEMENTS THICK Y AND Z DIMENSIONS (EQUAL) FOR THE STREAM TUBE NUMX NUMBER OF NODES INOW? INDEX POINTING TO THE PRESENT TIME LEVEL FOR-? = P - PRESSURE C ? = T - TEMPERATURE C ? = C - COMPONENTS C C IFUT? INDEX POINTING TO THE NEXT TIME LEVEL FOR-C ? = P - PRESSURE C ? = T - TEMPERATURE C ? = C - COMPONENTS C C ELNAME NAME OF THE ELEMENTS THAT DEFINE THE COMPOSITIONAL C SPACE OF THE SYSTEM. C C WGHT ATOMIC WEIGHT OF THE ELEMENTS THAT DEFINE THE COMPOSITIONAL C SPACE OF THE SYSTEM. C C NUMEL NUMBER OF ELEMENTS THAT DEFINE THE COMPOSITIONAL SPACE C OF THE SYSTEM. C C DTAUP CONTAINS THE DELTA TIME STEP FOR PRESSURE C DTAUT CONTAINS THE DELTA TIME STEP FOR TEMPERATURE C C DTAUM CONTAINS THE DELTA TIME STEP FOR THE CHEMICAL REACTIONS C DTAUC CONTAINS THE DELTA TIME STEP FOR MASS TRANSPORT C C TAUP CONTAINS THE TIME AT IFUTP (THE TIME AT THE COMPLETION C OF THE TIME STEP (DTAUP) (PRESSURE STEP) C C TAUT CONTAINS THE TIME AT IFUTT (THE TIME AT THE COMPLETION C OF THE TIME STEP (DTAUT) (TEMPERATURE STEP) C C TAUC CONTAINS THE TIME AT IFUTC (THE TIME AT THE COMPLETION C OF THE TIME STEP (DTAUC) (COMPONENT TRANSPORT STEP) C C TAUM CONTAINS THE TIME AT THE TIME OF COMPLETION OF THE TIME STEP C FOR THE CHEMICAL REACTION STEPS C C W1 - WEIGHTING FACTOR FOR FINITE DIFFERENCE TIME APPROX. C 0 <= W1 <= 1 W1 = 1 IMPLICIT, W1 = .5 -C CRANK-NICOLSON IMPLICIT, W1 = 0 EXPLICIT C ERRMAX- MAXIMUM ERROR ALLOWED IN PRESSURE (POSN 1), TEMPERATURE C (POSN 2 ) . COMPONENT MOVEMENT (POSN 3) (POSN 4 NOT C USED) C ERROR - CALCULATED ERROR - SAME ORDER AS ABOVE - FORMULA USED IS C ABS((NEW VALUE - OLD VALUE) / NEW VALUE) C LIMLOP - MAXIMUM NUMBER OF LOOPS TO BE USED IN CALCULATING THE ERROR C (1) - PRESSURE, (2) - TEMPERATURE, (3) - COMPONENT MOVEMENT C PMIN, PMAX, PTIME - PRESSURES - INITIAL P AT NODE 1, P AT NODE 1 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c PSTART AT TIMES PTIME AND GREATER. PSTART - TIME TO START INCREASING P TMIN, TMAX, TTIME - TEMPERATURES- INITIAL T AT NODE 1, T AT NODE 1 TSTART AT TIMES TTIME AND GREATER. TSTART - TIME TO START INCREASING T COMMON BLOCK VARIABLES PREVIOUSLY DEFINED COMMON /SWIT/ ITSTEP(3), IPSWIT, ITSWIT, ICSWIT, IMSWIT, NSTEPS LOCAL VARIABLES COMP - TEMPERARY STORAGE FOR THE COMPOSITION OF A NODE LDUMMY - TEMPERARY LOGICAL ARRAY USED TO READ THE SYSTEM COMPOSITION ID POSN USED TO READ CHARACTERS FROM THE DATA FILE AND TO DECIDE WHAT TYPE OF DATA IS BEING READ. ALPH - READ IN THE ALPHA FACTORS FOR FLOW AND THE SPECIES/COMPONENTS FOR FLOW COMP - COMPOSITION OF EACH NODE CHEM - MASS TRANSFER CALCULATIONS WILL BE MADE DIST - DISTANCE FROM ONE NODE TO ANOTHER END - END OF DATA ERRO - VALUES FOR ERROR SWITCHES - BETWEEN 0 AND 1 MAXP - VALUE OF MAX P AS A FUNCTION OF TIME MAXT - VALUE OF MAX T AS A FUNCTION OF TIME NODE - NUMBER OF NODES DURING THIS RUN PERM - PERMEABILITY OF EACH NODE PORO - POROUSITY OF EACH NODE PRES - INITIAL PRESSURES FOR EACH NODE STEP - NUMBER OF STEPS STOP - END OF DATA TEMP - INITIAL TEMPERATURES FOR EACH NODE THIC - THICKNESS OF THE CELL (IN Y AND Z DIM) TIME - SIZE (IN TIME) OF THE STEPS WEIG - WEIGHTING FACTOR FOR FD TIME STEP HOLDS THE CALCULATED POSITION OF THE NODES TITLE READS THE TITLE CARDS FOR PRINTING REAL COMP(10), P0SNO02) CHARACTER*1 LDUMMY(IOO) CHARACTER*4 ID(4) CHARACTER*100 TITLE ZERO OUT SOME OF THE ARRAYS (-1.0E-50 INDICATES NO DATA) NUMX = 40 NXDIM = 51 CALL MINIT(XINERT, 51, 1, O.OEOO) CALL MINIT(CELLPE, 51, CALL MINIT(CELLPO. 51 , CALL MINIT(CELLP, 51. CALL MlNIT(CELLT, 51 , CALL MINIT(SIZEX, 51 , CALL MINIT(COMP, 10, CALL MINIT(ALPHA, 10, CALL MINIT(ERRMAX, 4, CALL MINIT(ERROR, 55, CALL IMINIT(ITSTEP, 3, CALL IMINIT(LIMLOP, 5, CALL IMINIT(L0PT0T,55, DO 1 I = 1 , 25 PHNAME(I ) AQNAME(I ) CONTINUE DO 2 I = 1 , 20 SSNAME(I ) CONTINUE DO 3 I = 1 , 10 GNAME(I) FLNAME(I ) ELNAME(I ) CONTINUE DO 4 I = 1 , 3 DNAME(I) CONTINUE NCHEM = 10 TTIME = 0.000001 PTIME = 0.000001 PMIN 0.0 TMIN 0.0 PMAX -1 .0 TMAX -1 .0 PSTART = 0.0 TSTART = 0.0 TAUP 0.OEOO TAUT 0.OEOO TAUC O.OEOO TAUM O.OEOO DTAUP = 1.OEOO DTAUT = O.OEOO DTAUC = 0.OEOO DTAUM = O.OEOO ICSWIT = -2 2, -1.OE-50) 2, -1.OE-50) 2, -1 OE-50) 2, -1.OE-50) 1 , - 1.OE-50) 1 , O.OEOO) 1 , O.OEOO) 1 , 1.OEOO) 1 - O.OEOO) i , 1) 1 , 5) 1 , 0) IPSWIT = - 2 I T S W I T = - 2 IMSWIT = - 2 INOWP = 1 INOWT = 1 INOWC = 1 IFUTP = 2 IFUTT = 2 IFUTC = 2 NUMEL = 0 THICK = 1.OEOO W1 = 1.OEOO NSTEPS = 0 W R I T E ( 6 , 1 9 3 0 ) C READ AND PRINT I N THE T I T L E CARD(S) - STOP WHEN THE F I R S T FOUR C CHARACTERS ARE STAR (SHORT FOR START) I = O W R I T E ( 6 , 2 1 4 0 ) 10 READ( 1 , 1 1 2 0 ) T I T L E I D ( 1 ) = T I T L E d I F ( I D ( 1 ) . E O . ' S T A R ' ) GO TO 4 0 W R I T E ( 6 , 1 9 4 0 ) T I T L E GO TO 10 C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C THE FOLLOWING LOOP I S THE MASTER LOOP WHICH CONTROLS C THE READING I N OF THE DATA. I T ENDS AT THE COMMENT L I N E C WITH THE ROW OF * * * * * * C READ I N S P E C I F I C COMAND I N D I C A T I N G WHAT KIND OF DATA FOLLOWS C AND GO TO THE SECTION OF THAT PROGRAM WHICH READS I T I N . 4 0 R E A D ( 1 , 1 1 2 5 , E N D = 6 5 0 ) ( I D ( I ) , I = 1 , 4 ) I F ( I D ( 1 ) . E O . ' A L P H ' ) THEN C READ I N THE NAMES OF THE FLOW COMPONENTS AND THEIR ALPHA' C I F NONE ARE READ I N , THEN THERE I S NO MASS TRANSPORT READ ( 1 , 1 1 0 0 ) ICSWIT ICSWIT = ICSWIT + 1 DO 100 J = 2 , ICSWIT R E A D ( 1 , 1 1 5 0 ) F L N A M E ( J ) , ALPHA(U) 100 CONTINUE FLNAME(1) = 'WATER A L P H A ( 1 ) = - 1 . 0 E 0 0 C ELSE I F ( I D ( 1 ) .EO- ' C H E M ' ) THEN C C MASS TRANSFER - YES ! ! IMSWIT = 1 ELSE IF (ID(1) .EO. 'COMP') THEN READ IN COMPOSITIONAL DATA FOR THE ENTIRE GRID. LDUMMY(1) = 'H' LDUMMY(2) = ' ( ' LDUMMY(3) = ' 1 ' LDUMMY(4) = ' ) ' LDUMMY(5) = '0' LDUMMY(6) = ' ( ' LDUMMY(7) = '2' LDUMMY(8) = ' ) ' READ(1,1140) (LDUMMY(I),I=9,100) CALL ELSORT(COMP,LDUMMY,ELNAME,NCHEM,NUMEL,100,6,1) ELSE IF (ID(1) .EQ. 'DIST') THEN READ IN THE DIMENSION OF EACH ELEMENT IN X DIRECTION. READ(1.1100) NUM, ISTART IFIN = ISTART - 1 + NUM READ( 1 ,1110) (SIZEX(I),1 = 1 START,IFIN) ELSE IF (ID(1) .EO. 'END ') THEN END OF DATA GO TO 650 ELSE IF (ID(1) .EQ. 'ERRO') THEN READ IN ERROR LIMIT AND LIMIT SWITCHS READ(1,1110) (ERRMAX(I), 1=1,3) READ(1,1100) (LIMLOP(I),1=1,3) DO 120 I = 1, 3 IF(ERRMAX(I).GT.1.OEOO.OR.ERRMAX(I).LE.O.OEOO) ERRMAX(I) = 1.0E00 IF(LIMLOP(I).GT.100.OR.LIMLOP(I).LE.0) LIMLOP(I) = 1 CONTINUE READ IN VALUES FOR NODE 1 PRESSURE AS A FUNCTION OF TIME ELSE IF (ID(1) .EO. 'MAXP') THEN READ(1,1110) PMAX, PTIME, PSTART READ IN VALUES FOR NODE 1 TEMPERATURE AS A FUNCTION OF TIME ELSE IF (ID(1) .EO. 'MAXT') THEN READ(1,1110) TMAX, TTIME, TSTART ELSE IF (ID( 1 ) .EQ. 'NODE') THEN READ IN THE NUMBER OF NODES IN X DIRECTION READ(1,1100) NUMX IF(NUMX.GT.NXDIM) THEN WRITE(6,1900) 1, NUMX.NXDIM STOP END IF ELSE IF (ID(1) .EO. 'PERM') THEN READ IN PERMEABILITY DATA FOR EACH GRID POINT. FIRST READ PERMEABILITY, THEN THE NUMBER OF NODES AND THE NODE NUMBERS. READ IN AS L0G(1O) PERMEABILITY BUT STORED IN NORMALLY UNITS (METERS **2) READ(1,1100) NUM, ISTART IFIN = ISTART - 1 + NUM READ(1, 1110) (CELLPE(I, 1 ) ,I = ISTART,IFIN) DO 140 I = ISTART, IFIN CELLPE(I,1) = (10.OEOO)**CELLPE(I,1) CONTINUE ELSE IF (ID(1) .EO. 'PORO') THEN READ IN POROSITY DATA FOR EACH GRID POINT. FIRST READ THE POROSITY THEN THE NUMBER OF NODES AND THEN THE NODE NUMBERS. READ(1,1100) NUM, ISTART IFIN = ISTART - 1 + NUM READ( 1 , 1110) (CELLPO(I, 1 ) ,I = ISTART,IFIN) ELSE IF (ID(1) .EO. 'PRES') THEN READ IN INITIAL PRESSURE DATA FOR EACH GRID POINT. FIRST READ IN THE PRESSURE, THEN THE NUMBER OF NODES AND THEN THEN THE NODE NUMBER. IF NUM IS NEGATIVE, THEN THESE INITIAL PRESSURE WILL BE HELD CONSTANT FOR THE REST OF THE RUN READ(1,1100) NUM, ISTART IF (IPSWIT.EQ.-2.OR.IPSWIT.GT.O) IPSWIT = ISIGN(1,NUM) NUM = IABS(NUM) IFIN = ISTART - 1 + NUM READ( 1 , 1110) (CELLP(1,1),I = ISTART,IFIN) ELSE IF (ID(1) .EQ. 'STEP') THEN READ IN THE MAX. NUMBER OF STEPS - AND NUMBER OF LOOPS FOR TEMPERATURE, COMPONENTS AND MASS TRANSFER READ (1, 1100) NSTEPS, (ITSTEP(I ) ,I = 1,3) IF (NSTEPS.LT.0) NSTEPS = 0 DO 160 I = 1, 3 IF (ITSTEP(I).LT.1) ITSTEP(I) = 1 CONTINUE ELSE IF (ID(1) .EO. 'STOP') THEN END OF DATA GO TO 650 ELSE IF (ID(1) .EO. 'TEMP') THEN READ IN INITIAL TEMPERATURE FOR EACH GRID POINT. FIRST READ TEMPERATURE, THEN NUMBER OF NODES THEN THE NODE NUMBERS. IF NUM IS NEGATIVE, THEN THE TEMPERATURE IN EACH CELL WILL BE HELD CONSTAINT THROUGH OUT THE RUN READ(1,1100) NUM, ISTART IF(ITSWIT.EO.-2.OR.ITSWIT.GT.0) ITSWIT = ISIGN(1,NUM) NUM = IABS(NUM) IFIN = ISTART - 1 + NUM READ(1,1110) (CELLT(1,1),1 = 1 START,IFIN) ELSE IF (ID(1) .EO. 'THIC') THEN READ IN THICKNESS OF GRID (METERS) READ(1,1110) THICK IF(THICK.LT.1.OE-05) THICK = 1.0E-05 IF(THICK.GT.1.OE+04) THICK = 1.0E+04 ELSE IF (ID(1) .EO. 'TIME') THEN READ THE SIZE OF THE TIME (PRESSURE) STEP AND INITIAL TIME READ (1, 1110) DTAUP, TAUP ELSE IF (ID(1) .EO. 'WEIG') THEN READ IN THE WEIGHTING PARAMETER FOR THE FD TIME STEP READ (1, 1110) W1 ELSE IF (ID(1) .NE. ' ') THEN IGNORE BLANK LINES. WHAT IS IT? WRITE OUTPUT ERROR MESSAGE WRITE(6,1920) 1, (ID(I),I=1,4) STOP END IF READ MORE DATA - ONLY WAY OUT IS VIA STOP OR END COMMANDS IN DATA OR BY AN END OF FILE IN DATA GO TO 40 ***************************************************** 650 700 CHECK FOR DATA AT THE FIRST ELEMENT AND THE FIRST NODE IF (IPSWIT.EO " 2) IPSWIT = -1 IF (ITSWIT. EQ. -2) ITSWIT = -1 IF (ICSWIT.EQ.- 2) ICSWIT = -1 IF (IMSWIT.EQ.- 2) IMSWIT = -1 IF (IPSWIT.EQ.- 1) ITSTEP(1) = 1 IF (ITSWIT.EQ.- 1) ITSTEP(2) = 1 IF (ICSWIT.EQ.- 1) ITSTEP(3) = 1 IF (CELLPE( 1,1) . EQ . -1.OE-50) WRITE(6,1910) IF (CELLPO( 1,1) .EQ . -1.OE-50) WRITE(6,1911) IF (CELLT( 1,1) . EQ . -1.OE-50) WRITE(6,1912) IF (CELLP(1,1) .EQ . -1.OE-50) WRITE(6, 1913) IF (SIZEX(1) .EQ . -1.OE-50) WRITE(6,1914) IF (CELLPE( 1,1) .EQ . -1.OE-50) STOP IF (CELLPO(1,1) . EQ . -1.OE-50) STOP IF (CELLT(1,1) . EQ . -1.OE-50) STOP IF (CELLP(1,1) • EQ . -1.OE-50) STOP IF (SIZEX(1) . EQ . -1.OE-50) STOP SET UP SOME DEFAULTS TAUT = TAUP TAUC = TAUP TAUM = TAUP PTIME = TAUP + PTIME TTIME = TAUP + TTIME DTAUT = DTAUP / FLOAT(ITSTEP(1)) DTAUC = DTAUP / FLOAT((ITSTEP(1) DTAUM = DTAUP / FLOAT((ITSTEP( 1 ) IF ANY DATA IS MISSING, USE DATA CALCULATE P0SN(1) = THE POSITION O.OEOO * ITSTEP(2))) * ITSTEP(2) * ITSTEP(3))) FROM PRECEEDING NODE/ELEMENT OF EACH NODE DO 700 IF IF IF IF IF POSN(I) = CONTINUE PMIN = CELLP(1 1 = 2 , NUMX (SIZEX(I) (CELLPE(I,1). (CELLPO( I , 1 ) . (CELLP(1,1) . (CELLT(I,1) . POSN(I ,1) EQ. EQ. EQ. EQ. EQ. -1) .OE-50) .OE-50) OE-50) OE-50) OE-50) SIZEX(I SIZEX(I ) CELLPE(I CELLPO(I CELLP(I, CELLT(I, -1) = S I Z E X ( I - I ) , 1 ) = CELLPE( 1-1 , 1 ) , 1) = CELLPO(1-1,1) 1) = CELLP(1-1 , 1 ) 1) = CELLT(I-1, 1) TMIN = CELLT(1,1) IF (PMAX .LE. 0.0) PMAX = CELLP(1,1) IF (TMAX .LE. 0.0) TMAX = CELLT(1,1) SET UP INITIAL GUESSES FOR THE FUTURE DO 750 1 = 1 , NUMX CELLPE(I,IFUTC) CELLP(I,IFUTP) CELLPO(I,IFUTC) CELLT(I,IFUTT) CONTINUE OUTPUT - VARIFICIATION OF INPUT MUST BE SAME AS PRESENT CELLPE(I,INOWC) CELLP(I,INOWP) CELLPO(I,INOWC) CELLT(I,INOWT) 1=1,2) (SIZEX(I),I=1,(NUMX-1)) 6,1950) NUMX 7,1100) NUMX, IPSWIT 8,1100) NUMX, ITSWIT 9,1100) NUMX, NUMEL, ICSWIT 10,1100) NUMX 11,1100) NUMX 7,1100) NSTEPS 8,1100) NSTEPS, ITSTEP(1 ) 9,1100) NSTEPS, (IT S T E P ( I ) , 6,1960) 6,1970) 6,1975) 6,1970) (POSN(I) 7,1130) (POSN(I) 8,1130) (POSN(I) 9,1130) (POSN(I) 10,1130) (POSN(I) 11,1130) (POSN(I) 6,1980) THICK 6,1990) (ELNAME(I ) 6,2000) 6, 1971) 6,2010) 6,1970) 6,2020) 6,1972) 6,2030) 6,1972) ( C E L L T ( I , 1 ) , I=1,NUMX) IF(IPSWIT.EO.-I) WRITE( 6,2040) IF(ITSWIT.EQ.-I) WRITE( 6,2050) IF(IMSWIT.EQ.-I) WRITE( 6,2070) IF (ICSWIT.GT.O) THEN WRITE(6, 2110) =1,NUMX) =1.NUMX) =1,NUMX) =1,NUMX) =1,NUMX) =1,NUMX) , 1=1, NUMEL) (CELLPE(1,1), 1=1,NUMX) (CELLP0(I,1), 1=1,NUMX) ( C E L L P d . O , 1 = 1,NUMX) CO CO 770 780 790 1100 1 1 10 1 120 1 125 1 130 1 140 1 150 1900 1910 191 1 1912 19 13 1914 1920 1930 ELSE DO 770 1 = 1 , ICSWIT IF (ALPHA(I).LT.O.OEOO) GO TO 770 WRITE(6,2120) FLNAME(I), ALPHA(I ) CONTINUE WRITE( 6,2060) ENDIF WRITE( WRITE( WRITE( DO 780 6,2090) W1 6,2080) NSTEPS, (ITSTEP(I),I=1,3) 6,2100) TAUP, DTAUP, DTAUT, DTAUC, DTAUM 1 = 1,3 ERRMAX(I ) = ERRMAX(I) * 100.0 CONTINUE WRITE( 6,2130) (ERRMAX(I),LIMLOP(I),I=1,3) DO 790 1 = 1 , 3 ERRMAX(I) = ERRMAX(I) / 100.0-CONTINUE IF (PMAX .NE. PMIN) WRITE(6, 2160) PMIN, PMAX, PTIME, PSTART IF (TMAX .NE. TMIN) WRITE(6, 2180) TMIN, TMAX, TTIME, TSTART RETURN FORMATS F0RMAT(2615) FORMAT(8F10.3) FORMAT(A 100) FORMAT(30A4) FORMAT(10(1X.E12.5)) FORMAT(100A1) F0RMAT(A8,8X,F8.5) FORMAT(' FROM DATA READ FROM FORTRAN UNIT ',12, ', THE NUMBER OF ',/, ' NODES IN THE X DIRECTIONS IS ',15,/, ' IT MUST BE LESS THAN ',14,'.') FORMAT(' FROM DATA READ FROM FORTRAN UNIT ',12, '. THE PERMEABILITY OF THE FIRST NODE IS MISSING.') FORMATC FROM DATA READ FROM FORTRAN UNIT ',12, ', THE POROUSITY OF THE FIRST NODE IS MISSING.') FORMATC FROM DATA READ FROM FORTRAN UNIT ',12, ', THE TEMPERATURE OF THE FIRST NODE IS MISSING.') FORMAT(' FROM DATA READ FROM FORTRAN UNIT ',12, ', THE PRESSURE OF THE FIRST NODE IS MISSING.') FORMAT(' FROM DATA READ FROM FORTRAN UNIT '.12, '. THE SIZE OF THE FIRST ELEMENT IS MISSING.') FORMAT(' FROM DATA READ FROM FORTRAN UNIT ',12, '. THE DATA COMMAND',/, 'GIVEN :" ',4A4,' " IS INVALID. CORRECT AND RERUN.') FORMAT(':',/,' 1 ' ) CO 1940 1950 1960 1970 1971 1972 1975 1980 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 2100 21 10 2120 2130 F0RMAT( F0RMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( FORMAT( ' ',A100) 'O','NUMBER OF NODES = ',15) '0','SIZE OF ELEMENTS (METERS)',/) 10(3X,F10.3)) 10(1X,E12.5)) 10(3X,F10.1)) '0','POSITION OF EACH OF THE NODES (METERS) ',/) 'O','THICKNESS OF GRID IN METERS = '.E12.5,/) ' SYSTEM IS COMPOSED OF THE FOLLOWING ELEMENTS:', 10(' ',10(A4.1X),/)) 'OINITIAL PERMEABILITY IN EACH NODE (METERS**2 ) ',/) 'OINITIAL POROUSITY IN EACH NODE ',/) 'OINITIAL PRESSURES IN EACH NODE (MPA)',/) 'OINITIAL TEMPERATURES IN EACH NODE (DEG K)',/) 'OALL NODE PRESSURES ARE FIXED THROUGH THE ENTIRE', ' RUN.') 'OALL NODE TEMPERATURES ARE FIXED THROUGH THE ', 'ENTIRE RUN. ') 'ONO MASS FLUX BETWEEN THE NODES WILL BE ALLOWED ', 'THIS RUN.') 'ONO CHEMICAL REACTIONS WILL BE CALCULATED THIS RUN.') '0 MAX. NUMBER OF TIME (PRESSURE) STEPS IS ',18,//, FOR EACH PRESSURE STEP, THERE IS ',15, ' TEMPERATURE STEPS',/, FOR EACH TEMPERATURE STEP, THERE IS ',15, ' SOLUTE TRANSPORT STEPS',/, ' FOR EACH SOLUTE TRANSPORT STEP, THERE IS ',15, ' CHEMICAL REACTION STEPS.') 'OWEIGHTING FACTOR FOR THE FINITE DIFFERENCE TIME STEP' ' IS: '.F10.5) 'OTHE INITAL TIME IS: '.E12.5,' SECONDS',//, THE INITAL PRESSURE TIME STEP IS: '.E12.5, ' SECONDS',/, THE INITAL TEMPERATURE TIME STEP IS: '.E12.5, ' SECONDS',/, ' THE INITAL COMPONENT TRANSPORT TIME STEP IS: '.E12.5, ' SECONDS',/, THE INITAL CHEMICAL REACTION TIME STEP IS: '.E12.5, ' SECONDS.') 'OTHE FOLLOWING AQUEOUS SPECIES HAVE BEEN CHOSEN ', 'AS MOBILE COMPONENTS',//, 14X,'NAME',15X,'LONG. DISPERSIVITY',/) ' ',11X,A8,20X,F8.5) // ,24X,'PERCENT MAXIMUM ERROR',5X, 'MAX. NUMBER ITERATIONS', /,6X, ' PRESSURE',14X,E12.5,16X,15,/, oo 2140 2160 2180 6X 6X FORMAT(' TITLE ///) FORMAT(///.' THE / / / FORMAT(/// ' TEMPERATURE',11X,E12.5,16X,I5,/, ' TRANSPORT',13X,E12.5,16X,15,/) INFORMATION READ FROM DATA ATTACHED TO UNIT 1 ,27X, ' ,36X, ,30X, , ' THE F10.4 /,30X,' /,36X , /,30X, END SUBROUTINE SETUP2 PRESSURE AT NODE AND RAISED TO: ' OVER ' STARTING AT TEMPERATURE AT 1 WILL INITIALLY BE: ',F10.4, '.F10.4,' SECONDS', '.F10.4,' SECONDS') NODE 1 WILL INITIALLY BE: ,F10.4, AND RAISED TO: ' OVER STARTING AT , F 10. ,F10. ,F10. SECONDS', SECONDS' ) NEW COMMON BLOCKS COMMON /CHEMPH/ COMPPH(10,25), COMMON /CHEMAQ/ COMPAQ(10,25), COMMON /CHEMSS/ COMPSS(10,20), COMMON /CHEMG / COMPG(10,10), THERPH(14,25), NUMPH THERAQ(13,25), NUMAQ THERSS(8,20), NUMSS THERG(6,10), NUMG COMPPH, COMPAQ, COMPSS, COMPG - CONTAINS THE COMPOSITION OF THE MINERALS, AQUEOUS SPECIES, SOLID SOLUTION ENDMEMBERS AND GASSES IN THE ORDER OF THE ELEMENTS IN ELNAME. THERPH, THERAQ, THERSS, THERG - CONTAINS THE THERMODYNAMIC PROPERTIES OF THE MINERALS, AQUEOUS SPECIES, SOLID SOLUTION ENDMEMBERS AND GASSES. ORDER IS GIVEN IN THE APPROPRIATE SECTION BELOW. NUMPH, NUMAQ, NUMSS, NUMG - NUMBER OF MINERALS, AQUEOUS SPECIES SOLID SOLUTION ENDMEMBERS AND GASSES PREVIOUSLY DEFINED COMMON BLOCKS COMMON /SWIT/ ITSTEP(3), IPSWIT, ITSWIT, ICSWIT COMMON /CHEMEL/ WGHT(10), NUMEL COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2) ALPHA(10), INOWC, IFUTC CHARACTER*20 PHNAME(25), SSNAME(20), GNAME(10), DNAME(3) CHARACTER*8 FLNAME(10), AQNAME(25) CHARACTER*4 ELNAME(10) COMMON /CHNAME/ PHNAME ELNAME REAL DATA(14 ) , WEIGHT(40), PHCMP(40) INTEGER NSYC0(4O), IPOINT(10) CHARACTER*20 DUM IMSWIT, NSTEPS SSNAME, GNAME, DNAME, AQNAME, FLNAME, C0MP(1O,25), A(10.10) CHARACTER*8 ABV CHARACTERM CONAME (40) , LTYPE (8 ) CHARACTER*1 LDUMMY(101) DATA LTYPE/ 'MINE' 'REFE' ' AQUE', 'DECA' , 'SOLI ' 'STOP' 'GASE', 'END '/ CALL MINIT(COMPG, 10, 10, O.OEOO) CALL MINIT(COMPSS, 10, 20, O.OEOO) CALL MINIT(COMPPH, 10, 25, O.OEOO) CALL MINIT(COMPAO, 10, 25, O.OEOO) CALL MINIT(WEIGHT, 40, 1, O.OEOO) 00 CALL IMINIT(IPOINT, 10, 1, 0) CALL IMINIT(NSYCO, 40, 1, O) DO 12 I = 1, 40 CONAME(I) = ' 12 CONTINUE NUMPH = O NUMG = 0 NUMAO = 0 NUMSS = 0 NUMD = 0 READ NUMBER OF ELEMENTS IN DATA FILE READ(2,1001) NCTZ READ IN THE ELEMENTAL SYMBOLS READ(2,1002) (CONAME(I),I=1,NCTZ) READ THE WEIGHT'S OF EACH OF THE ELEMENTS READ(2, 1003) (WE IGHT(I),1 = 1,NCTZ) CORRELATE SYSTEM ELEMENTS WITH ELEMENTS IN DATA FILE DO 30 J = 1, NUMEL DO 20 I = 1,NCTZ IF (ELNAME(J).EQ.CONAME(I)) THEN WGHT(J) = WEIGHT(I) NSYCO(I) = d GO TO 30 ENDIF 20 CONTINUE WRITE(6,1004) ELNAME(d), 1, 2, 1 STOP 30 CONTINUE READ IN NEXT LINE . THIS SHOULD BE A COMMAND LINE AND C WILL TELL WHICH SECTION OF THE DATA FILE IS BEING READ. C ALL LINES WITH A BLANK FIRST CHARACTER ARE IGNORED. C THE ONLY ACCEPTABLE FIRST CHARACTER IS A * TO INDICATE C A COMMAND 40 READ(2,1021,ERR=700,END=700) (LDUMMY(I),1=1,101) IF (LDUMMY(1) .EQ. ' ') GO TO 40 45 IF (LDUMMY(1) .NE. '*') THEN WRITE(6,1007) 2, LDUMMY STOP ENDIF K = 1 IFIN = 101 CALL IGNORE(LDUMMY, 101, '*', 1, K, IFIN, IFOUND) IF (IFOUND.EQ.O) GO TO 40 IFOUND = IFOUND - 1 DO 70 K = 1 , 8 DO GO J = 1,4 I = I FOUND + J IF (LDUMMY(I).NE.LTYPE(K)(d:d)) GO TO 70 60 CONTINUE GO TO (100, 200, 300, 400, 500, 600, 700. 700), K 70 CONTINUE WRITE(6,1005) LDUMMY, 2 STOP C THIS SECTION IS FOR SOLID PHASES. C READ IN: NAME, FORMULA, ABREVIATION C H, S. V, C A, B, C, D, E, F, G C DV/DT, DV/DP, CONDUCTIVITY C VALUES ARE AT TR AND PR (298.15 DEG. K. AND 0.1 MPA) C C IF H > 999999, IGNORE PHASE, IF PHASE CONTAINS ELEMENTS NOT IN C ELNAME, IGNORE. STORE PROPERTIES IN ARRAY THERPH IN ORDER: C MW (GRAMS/MOLE), H (d/MOLE), S (d/MOLE/DEG), V (CM**3/M0LE), C A (d/MOLE/DEG), B(d/MOLE/DEG**2), C(d DEG/MOLE), D(d/MOLE/DEG**.5) C E (d/MDLE/DEG**3), F(J/MOLE), G(dDEG**3/M0LE), DV/DT (CM**3/DEG/M0LE ) C DV/DP (CM**3/MPA/M0LE), CONDUCTIVITY (d/(M SEC DEG MOLE) C 100 READ(2,1021,ERR=700,END=700) (LDUMMY(I),I=1,101) IF (LDUMMY(1) .EQ. '*') GO TO 45 READ(2,1006) (DATA(I), 1= 1, 3) READ(2,1006) (DATA(I), 1= 4, 10) READ(2,1006) (DATA(I). 1= 11, 13) IF (DATA(1).GT.999999.EOO) GO TO 100 CALL DECODE(PHCMP,DUM,NCTZ,CONAME,LDUMMY,ABV,101,40,0) DO 110 K = 1,NCTZ IF (NSYCO(K).EQ.O.AND.PHCMP(K).NE.O.OEOO) GO TO 100 110 CONTINUE NUMPH = NUMPH + 1 PHNAME(NUMPH) = DUM GMW = O.OEOO DO 130 I = 1,NCTZ K = NSYCO(I) IF(K.EQ.O) GO TO 130 COMPPH(K,NUMPH) = PHCMP(I) GMW = GMW + (PHCMP(I) * WEIGHT(I)) 130 CONTINUE THERPH(1,NUMPH) = GMW DO 140 I = 1, 13 II = I + 1 THERPH(II,NUMPH) = DATA(I) 140 CONTINUE GO TO 100 C C THIS SECTION IS FOR AQUEOUS SPECIES C READ IN NAME, FORMULA, ABREVIATION C H, S, C1, C2, A1, A2, £ C A3, A4, THETA, W, Z Oo C ALL VALUES ARE AT TR AND PR (298.15 DEG. K AND 0.1 MPA) C C IF H > 999999, IGNORE SPECIES. IF SPECIES CONTAINS ELEMENTS NOT IN C ELNAME, IGNORE. STORE PROPERTIES IN ARRAY THERAQ IN ORDER: C MW, H, S, C1, C2, A1, A2, A3, A4, THETA, W, Z, AZERO 200 READ(2,1021,ERR=700,END=700) (LDUMMY(I),1=1,101) IF (LDUMMY(1 ) .EQ. '*') GO TO 45 READ(2,1006) (DATA(I),I=1, 6) READ(2,1006) (DATA(I),I=7,11) IF (DATA(1).GT.999999.EOO) GO TO 200 CALL DECODE(PHCMP,DUM,NCTZ.CONAME,LDUMMY,ABV,101,4O,0) DO 210 K = 1,NCTZ IF (NSYCO(K).EQ.O.AND.PHCMP(K).NE.O.OEOO) GO TO 200 210 CONTINUE NUMAQ = NUMAQ + 1 AQNAME(NUMAQ) = DUM GMW = O.OEOO DO 230 I = 1,NCTZ K = NSYCO(I) IF(K.EQ.O) GO TO 230 COMPAQ(K,NUMAQ) = PHCMP(I) GMW = GMW + (PHCMP(I) * WEIGHT(I)) 230 CONTINUE THERAQ(1,NUMAQ) = GMW DATA(6 ) = DATA(6 ) * 1.0E-05 DATA(7) = DATA(7 ) * 1.0E-02 DATA(8 ) = DATA(8 ) * 1.0E-05 DATA(10) = DATA(10) * 1.0E+05 DO 240 1=1, 11 II = I + 1 THERAQ(11,NUMAQ) = DATA(I) 240 CONTINUE IF (AQNAME(NUMAQ) .EQ. 'WATER ') THEN THERAQ(13,NUMAQ) = 0.0 ELSE WABS = DATA(10) + (O.5387E05*4.184E00 * DATA(11)) IF (DATA( 1 1 ) .GE. 0.0) THEN AZERO = 1.81E00 ELSE AZERO = 1 .91E00 ENDIF AZERO = (1.66027E05*4.184E00*(DATA(11)**2) / WABS) + (ABS(DATA( 11)) * AZERO) AZERO = AZERO * 2.0E-08 / (ABS(DATA(11)) + 1.0E00) THERAQ(13,NUMAQ) = AZERO ENDIF GO TO 200 C THIS SECTION IS FOR SOLID SOLUTION PHASE DATA 300 READ(2,1021,ERR=700,END=700) (LDUMMY(I),I=1,101) IF (LDUMMY(1) .EQ. '*') GO TO 45 GO TO 300 C C THIS SECTION IS FOR GASES. C READ IN NAME, FORMULA, ABREVIATION C H, S, V C A, B, C, D, E, F, G C IF H > 999999, IGNORE PHASE, IF PHASE CONTAINS ELEMENTS NOT IN C ELNAME, IGNORE. STORE PROPERTIES IN ARRAY THERG IN ORDER: C M W , H , S , V , A , B , C , D , E , F , G 400 READ(2,1021,ERR=700,END=700) (LDUMMY(I),I=1,101) IF (LDUMMY(1) .EQ. '*') GO TO 45 READ(2,1006) (DATA(I).I = 1, 3) READ(2,1006) (DATA(I).I = 4, 10) IF (DATA(1).GT.999999.EOO) GO TO 400 CALL DECODE(PHCMP.DUM,NCTZ,CONAME,LDUMMY,ABV,101,40,0) DO 410 K = 1.NCTZ IF (NSYCO(K).EQ.O.AND.PHCMP(K).NE.O.OEOO) GO TO 400 410 CONTINUE NUMG = NUMG + 1 GNAME(NUMG) = DUM GMW = O.OEOO DO 430 I = 1 ,NCTZ K = NSYCO(I) IF(K.EQ.O) GO TO 430 COMPG(K.NUMG) = PHCMP(I) GMW = GMW + (PHCMP(I) * WEIGHT(I)) 430 CONTINUE THERG(1,NUMG) = GMW DO 440 1=1,5 II = I + 1 THERG(II,NUMG) = DATA(I) 440 CONTINUE GO TO 400 C END OF GAS DATA C C REFERENCE DATA - THIS IS IGNORED BY THE PROGRAM C 500 READ(2,1021,ERR=700,END=700) (LDUMMY(I),1=1,101) IF (LDUMMY(1) .EO. '*') GO TO 45 GO TO 500 C????? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 7 ? ? ? ? ? ? ? ? ? ? ? ? C C DECAY DATA - THIS IS USED TO CALCULATE THE DECAY FROM C ONE ELEMENT TO ANOTHER. C C FORMAT - NAME, DECAY REACTION C 1/2 LIFE, ENERGY C C NAME IS USED FOR REFERENCE PURPOSES C DECAY REACTION IS THE REACTION WRITTEN IN A FORMULA CODE. C SUPPOSE CALCIUM DECAYED TO TWO OXYGENS AND ONE HYDROGEN, C THE DECAY REACTION WOULD READ: CA(1)0(-1.0)H(- 1.0) 600 READ(2,1021,ERR=700,END=700) (LDUMMY(I),I=1,101) IF (LDUMMY(1) .EO. '*') GO TO 45 NUMD = NUMD + 1 GO TO 600 C CHANGE THE COMPONENT BASIS TO ONE COMPOSED OF AQUEOUS SPECIES C NOTE THAT THE AQUEOUS SPECIES FIRST CHOSEN WILL BE THE C SPECIES USED FOR TRANSPORT. C FIRST MAKE A COPY OF THE ARRAY, AND THEN USE THE FIRST C SPECIES FOUND IN EACH ROW AS THE NEW COMPONENT C 700 K = NUMEL + 1 DO 710 I = 1, NUMAQ COMPAQ(K.I) = THERAQ(12,1) * (-1.0) 710 CONTINUE CALL MCOPY(COMP,COMPAQ,1,1,K,NUMAQ,10,25,10,25) C C FIND A AQ. SPECIES, IF ONE NOT FOUND, PUT IN IDENTIFIER C FOR AN IDENTITY COLUMN AND DON'T PROCESS ANY C MORE C ISTART = 0 DO 715 I = 1 , K IF.(ALPHA(I).NE.0.0) THEN DO 712 J = 1, NUMAQ IF (FLNAME(I).NE.AQNAME(d ) ) GO TO 712 IF (ALPHA(I).LT.0.0) ALPHA(I) = 0.0 IPOINT(I) = d ISTART = I GO TO 715 712 CONTINUE WRITE(6,1019) FLNAME(I) STOP ENDIF 715 CONTINUE ISTART = ISTART + 1 DO 716 I = ISTART, K, 1 IPOINT(I) = (I - ISTART + 1) * (-1) 7 16 CONTINUE 717 DO 720 I = 1, K IF (IPOINT(I) .GT. 0) THEN DO 718 d = 1, K A(d,I) = COMPAQCd, IPOINT(I)) 718 CONTINUE ELSE DO 719 d = 1, K A(d,I) = 0.0 719 CONTINUE d = IABS(IPOINT(I)) A(d,I) = 1.0 ENDIF 720 CONTINUE C INVERT TEMP. BASIS C MULTIPLY THROUGH IF NOT SINGULAR C ELSE TRY FOR A NEW ONE C CALL INVRT(A,K, 10, I ER) IF (IER .EQ. 0) THEN CALL MMULT(C0MP, A, COMPAQ, K, K, NUMAQ, 10, 25, 10, 10, 10, 25) ELSE IPOINT(K) = IPOINT(K) - 1 IF (IPOINT(K) .GE. ( ( - 1 ) * K)) THEN GO TO 717 ELSE 11 = K - 1 721 I P O I N T ( H ) = IPOINT(H) - 1 DO 730 I = (11 + 1), K IPOINT(I) = IPOINT(I-I) - 1 730 CONTINUE IF (IPOINT(K) .GE. ( ( - 1 ) * K)) THEN GO TO 717 ELSE 11 = 11 - 1 IF (11 .LT. ISTART) THEN WRITE(6 , 1015) STOP ENDIF GO TO 721 ENDIF M ENDIF C NOW BUILD THE REMAINING COMPONENTS USING REMAINING C AQUEOUS SPECIES C DO 750 I = ISTART, K DO 735 J = 1, NUMAQ IF (ABS(COMP(I,J)) .GT.0.01) THEN IPOINT(I) = J ALPHA(I ) = 0.0 FLNAME(I) = AQNAME(J) GO TO 740 ENDIF 735 CONTINUE 740 DO 745 J<J = 1 , K IF (IPOINT(JU) .GT. 0) THEN DO 741 d = 1 , K A(d,J J ) = COMPAQ(d, IPOINT(JJ)) 741 CONTINUE ELSE DO 742 J = 1, K A(J,UO) = 0.0 742 CONTINUE J = IABS(IPOINT(JJ)) A(d , J J ) = 1.0 ENDIF 745 CONTINUE INVERT NEW BASIS AND MULTIPLY THROUGH CALL INVRT(A,K,10,IER) IF (IER .NE. 0) THEN WRITE(6,1015) STOP ENDIF CALL MMULT( COMP, A, COMPAQ, K, K, NUMAQ, 10, 25, 10, 10, 10, 25) 750 CONTINUE CALCULATE NEW COMPOSITION ARRAYS BASED DN LAST COMPONENT ARRAY AQUEOUS SPECIES CALL MC0PY(COMPAQ,C0MP,1,1,K,NUMAQ,10,25, 10,25) SOLID PHASES IF (NUMPH.GT.O) THEN CALL MMULT(COMP,A,COMPPH,K,K,NUMPH,10,25,10,10,10,25) CALL MCOPY(COMPPH,COMP,1,1,K,NUMPH,10,25,10,25) ENDIF GASSES NUMG,10,25,10,10,10,10) NUMG,10,10,10,25) NUMSS,10,25,10,10,10,20) NUMSS,10,25,10,20) IF (NUMG.GT.O) THEN CALL MMULT(COMP,A,COMPG,K,K CALL MCOPY(COMPG,COMP,1,1,K ENDIF SOLID SOLUTION PHASES IF (NUMSS.LE.O) THEN CALL MMULT(COMP,A,COMPSS,K,K, CALL MCOPY(COMPSS,COMP,1,1,K, ENDIF COLLAPSE MATRIX'S AND LOOK FOR THE NUMBER OF COMPONENTS TAKE OUT PHASES (ETC) WITH WRONG COMPONENTS NUMEL = O DO 800 I = 1 , K IP = IPOINT(I) UJ = NUMEL + 1 IF (IP .GT. 0) THEN NUMEL = NUMEL + 1 ELSE IF (JJ.NE.K) THEN COLLAPSE AQUEOUS SPECIES CALL MROW(COMPAQ,JJ,K,NUMAQ,10,25) COLLAPSE SOLID PHASES - FIRST CHECK IF ANY PHASES 775 776 4> 785 786 795 796 800 GO TO 775 10, 25) 25) 25) 14, 1 , MUST BE THROWN OUT IF (NUMPH.GT.0) THEN 12 = NUMPH DO 775 J = 1, 12 IF (J.GT.NUMPH) GO TO 776 IF (ABS(COMPPH(I,d)).LE.0.001) CALL MCOL(COMPPH, J , K, NUMPH, CALL MCOL(THERPH, d,14, NUMPH, CALL MCOL(PHNAME, J, 1, NUMPH, NUMPH = NUMPH - 1 CONTINUE CALL MROW(COMPPH,dd,K,NUMPH,10,25) ENDIF COLLAPSE GASSES - FIRST CHECK IF ANY MUST BE THROWN OUT IF (NUMG.GT.O) THEN 12 = NUMG DO 785 d = 1, 12 IF (d.GT.NUMG) GO TO 786 IF (ABS(COMPG(I,d)).LE.0.001) GO TO 785 CALL MCOL(COMPG,d,K,NUMG,10,10) CALL MCOL(THERG,d,6,NUMG,6,10) CALL MCOL(GNAME,d,1,NUMPH,1,10) NUMG = NUMG - 1 CONTINUE CALL MROW(COMPG,dd,K,NUMG,10,10) ENDIF COLLAPSE SOLID SOLUTION SPECIES - FIRST CHECK IF ANY MUST BE THROWN OUT IF (NUMSS.GT.O) THEN 12 = NUMSS DO 795 d = 1, 12 IF (d.GT.NUMSS) GO TO 796 IF (ABS(COMPSS(I,d)).LE.0.001) GO TO 795 CALL MCOL(COMPSS,d,K,NUMSS,10,20) CALL MC0L(THERSS.d,8,NUMSS,8,2O) CALL MCOL(SSNAME,d,1,NUMSS,1,10) NUMSS = NUMSS - 1 CONTINUE CALL MROW(COMPSS,dd,K,NUMSS,10.20) ENDIF ENDIF CONTINUE FINISHED - ECHO ONLY NAMES OF PHASES, AQUEOUS SPECIES, SOLID SOLUTION ENDMEMBERS AND GASSES CONSIDERED. vo Ln WRITE WRITE WRITE WRITE WRITE IF (6, 1027) (6, 1016) (6, 1011) (FLNAME(I),1=1.NUMEL) (9, 1018) (FLNAME(I),1=1,NUMEL) (10, 1017) NUMAQ (THERAQ(d,I),d=1,5) (THERAQ(J,I),J=6,9) (THERAQ(d,I),d=10,13) (NUMAQ.GT.O) THEN WRITE (6, 1010) DO 810 I = 1, NUMAQ WRITE (6, 1028) AQNAME(I) 810 CONTINUE WRITE (6, 1029) DO 815 I = 1, NUMAQ WRITE (6, 1031) AQNAME(I) 815 CONTINUE WRITE (6, 1030) DO 820 1 = 1 , NUMAQ WRITE (6, 1032) AQNAME(I ) 820 CONTINUE WRITE (10, 1011) (AQNAME(I),I=1,NUMAQ) ENDIF WRITE (11, 1017) NUMPH IF (NUMPH.GT.O) THEN WRITE (6, 1008) DO 830 1 = 1 , NUMPH WRITE (6, 1022) PHNAME(I), (THERPH(d.I) 830 CONTINUE WRITE (6, 1023) DO 840 1 = 1 , NUMPH WRITE (6, 1024) PHNAME(I), 840 CONTINUE WRITE (6, 1025) DO 850 1 = 1 , NUMPH WRITE (6, 1026) PHNAME(I), 850 CONTINUE WRITE (11 ENDIF IF (NUMSS.GT.O) THEN WRITE (6, 1012) WRITE (6, 1009) (SSNAME(I),I : ENDIF IF (NUMG .GT.O) THEN WRITE (6, 1013) WRITE (6, 1009) (GNAME(I),I=1,NUMG) d=1,4) (THERPH(d,I),d=5,11) (THERPH(J,I),d=12,14) 1020) (PHNAME(I),I=1,NUMPH) =1,NUMSS) ENDIF IF (NUMD .GT.O) THEN WRITE (6, 1014) WRITE (6, 1009) (DNAME(I),I=1,NUMD) ENDIF RETURN vo 1001 FORMAT*1X,2613) 1002 F0RMAT(7(A4,4X)) 1003 FORMAT(7F10.5) 1004 FORMATC ELEMENT SYMBOL ' ,A4. ' READ IN AS A FORMULA ',/, ' ON UNIT ',12,' DOES NOT MATCH WITH ANY ELEMENT',/, ' SYMBOL READ IN OFF OF UNIT ',12,'. CORRECT UNIT',/, 12,' DATA AND RERUN. ') 1005 FORMAT(1X.101A1,//,' THE PRECEDING LINE WAS READ OFF OF ',/, ' FORTRAN UNIT ',12,' AND DOES NOT MATCH INPUT',/, ' FORMATS. CORRECT AND RERUN.') 1006 FORMAT( 5X, 7F12.3) 1007 FORMATC ILLEGAL CHARACTER IN COLUMN ONE OF THE ',/, ' DATA FILE READ OFF OF UNIT ',12,' CORRECT', ' AND RERUN. ',/,' LINE IN QUESTION IS:',/, 110A1) 1008 FORMAT(//,' THE FOLLOWING PHASES WILL BE CONSIDERED IN THE ', 'CALCULATIONS --',//, 4X,'NAME ' ,23X, 'MW',15X, 'H (F)',9X,'S (ZERO)', 10X,'VOLUME',/,30X,'(G/MOLE)',9X,'(J/MOLE)',6X, '(J/MOLE/DEG) ',8X, '(CM**3)') 1009 F0RMAT(5(5X,A2O)) 1010 FORMAT(//,' THE FOLLOWING AQUEOUS SPECIES WILL BE CONSIDERED ' 'IN THE CALCULATIONS --',//. 4X,'NAME ' , 2 1X, 'MW', 13X, 'H (F)',9X,'S (ZERO)', 10X,'C1 ',10X.'C2',/, 28X,'(G/MOLE)',7X,'(J/MOLE)',6X,'(J/MOLE/DEG)', 6X,'J/MOL/DEG',6X,'J/MOL/DEG') 1011 FORMAT(10(5X,A8)) 1012 FORMAT(//,' THE FOLLOWING SOLID SOLUTION ENDMEMBERS WILL BE ', ' CONSIDERED IN THE CALCULATIONS --') 1013 FORMAT(//,' THE FOLLOWING GASES WILL BE CONSIDERED IN THE ', 'CALCULATIONS --') 1014 FORMAT(//,' THE FOLLOWING DECAY REACTIONS WILL BE CONSIDERED ' ' IN THE CALCULATIONS --') 1015 F0RMAT('O ERROR IN BASIS CHANGE IN ROUTINE SETUP2' ) 1016 F0RMAT('O THE FOLLOWING AQUEOUS SPECIES WERE USED AS THE', ' COMPOSITIONAL BASIS FOR ALL PHASES AND SPECIES --') 1017 FORMAT(15) 1018 FORMAT(15A8) 1019 F0RMAT('0',A8,' WAS USED AS A MOBILE COMPONENT BUT COULD',/, ' NOT BE FOUND IN THE AQUEOUS SPECIES',/, ' PORTION OF THE DATA BASE. CORRECT AND RERUN. ') 1020 F0RMAT(6A2O) 1021 FORMAT(101A 1 ) 1022 FORMAT( 1X , A20,5X,F12.4,5X,F12.2,5X,F12.5,5X,F12.4 ) 1023 FORMAT(//, 3X,'NAME ',40X,'(CP)',/, 29X,'A',6X,'+',6X, 'B T,5X, '+ C / T**2 + D / T**1.5 + E T**2', + F / T + G / T**3') 1024 FORMAT(1X,A20,3X,F12.5,3X,F12.1,3X,F12.0,3X,F12.4,3X,F12.1, 3X.F12.1.3X.F12.0) 1025 FORMAT(//, 3X,'NAME',20X,'DV/DT',11X,'DV/DP',11X,'K',/,2GX, '(CM**3/T)',6X,'(CM**3/MPA) (J/M/SEC/DEG)') 1026 FORMAT(1X,A20,3X,F12.8,3X,F12.8,3X,F12.3) 1027 FORMAT('1 THE FOLLOWING PHASE/THERMODYNAMIC INFORMATION ', ' WAS READ FROM THE FILE ASSIGNED TO UNIT 2',///) 1028 FORMAT(1X,A8,15X,F12.5,3X,F12.1,3X,F12.2,3X,F12.4,3X,F12.4) 1029 FORMAT(//,1X, ' NAME',26X, 'A 1' , 11X, 'A2' , 12X, 'A3',13X, 'A4',/, 29X, 'J/M/MPA',5X, 'd/M/MPA**2' ,6X, 'd/M/MPA' ,9X , £ • 'd/M/MPA') 1030 F0RMAT(//,3X,'NAME',24X,'THETA',11X,'W',12X,'CHARGE',9X, 'AZERO' ,/,31X, 'DEG K',9X, 'd/MOLE' , 10X, '(-E ) ' , 1 1X , 'CM') 1031 FORMAT(1X,A8,15X,F12.3,3X,F12.7,3X,F12.5,3X,F12.7) 1032 FORMAT(1X , A8 , 15X , F 12 . 2 , 3X , F 12 . 1 , 3X , F 12 . 1 , 3X , F 12 . 9 ) END SUBROUTINE SETUP3 C THIS ROUTINE READS IN THE COMPOSITIONAL AND ACTIVITY C CONSTRAINS FOR EACH OF THE ELEMENTS C C NEW COMMON BLOCKS C COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(51 ) , WATER(51), INDEX1(10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST C COMMON /REACT/ REACTA(5,51), IREACT(5,51), NUMREA(51) C COMMON /CELLCO/ CHEMO(10,51) C C CHEM CONTAINS THE NUMBER OF MOLES/MOLALITY/GRAMS/ACTIVITY C OF EACH OF THE COMPONENTS AT EACH NODE. C WATER IS ALWAYS STORED AS AN ACTIVITY. C CHEMO CONTAINS THE NUMBER OF MOLES/MOLALITY/GRAMS/ACTIVITY C OF EACH OF THE COMPONENTS AT EACH NODE AT C A TIME DTAUM LESS THAN THE TIME THAT THESE C VALUES WERE STORED IN CHEM C C IBAL CONTAINS THE INDEX OF THE ION TO BALANCE ON C C TOTALM CONTAINS THE TOTAL NUMBER OF MOLES OF EACH COMPONENT C WATER CONTAINS THE NUMBER OF MOLES OF WATER AT EACH NODE C C AQCO CONTAINS THE TOTAL NUMBER OF MOLES OF EACH COMPONENT C IN THE FLUID. THE COMPONENT HERE IS THE C COMPONENT USED TO DESCRIBE THE AQUEOUS SPECIES C IN THE ARRAY COMPAQ C INDEX 1 CONTAINS A POINTER TO WHICH PHASE/AQUEOUS SPECIES/ C SOLID SOLUTION ENDMEMBER/GAS CORRESPONDS TO C THE DATA IN CHEM. C INDEX2 CONTAINS A SWITCH WHICH INDICATES WHETHER THE POINTER C IN INDEX 1 IS A SOLID PHASE ( 1 ) , AQUEOUS C SPECIES ( 2 ) , SOLID SOLUTION ENDMEMBER ( 3 ) , OR C A GAS ( 4 ) . C S C INDEX3 CONTAINS A SWITCH WHICH INDICATES WHETHER DATA IN CO C CHEM IS MOLALITY ( 1 ) , LOG ACTIVITY ( 2 ) , C GRAMS (3) OR MOLES ( 4 ) . C NUMCHM A COUNTER WHICH IS EQUAL TO THE NUMBER OF NODES. THIS C NUMBER MUST BE EQUAL TO NUMX WHICH IS IN THE C COMMON BLOCK CELLS C NCONST NUMBER OF CHEMICAL CONSTRAINS ON EACH CELL. THIS MUST BE C THE SAME FOR EACH CELL. C REACTA CONTAINS THE NUMBER OF MOLES OF EACH OF THE REACTANTS C IREACT CONTAINS A POINTER TO THE POSITION OF THE REACTANT IN THE C MINERAL ARRAYS C NUMREA CONTAINS THE NUMBER OF REACTANTS AT EACH NODE (NOTE THAT THE C MAXIMUM IS DETERMINED BY THE I DIMENSION OF THE ARRAYS C IREACT AND REACTA C PREVIOUSLY DEFINED COMMON BLOCKS COMMON /CELLS/ CELLPO(51,2). CELLPE(51,2), C E L L P ( 5 1 , 2 ) , C E L L T ( 5 1 , 2 ) , DENSF(51,2), S I Z E X ( 5 1 ) , X I N E R T ( 5 1 ) , THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMEL/ WGHT(10), NUMEL COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMSS/ COMPSS(10,20), THERSS(8,20), NUMSS COMMON /TIME / DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /TRANS / VEL0C(51,2), AQCO(10,51,2), SOCO(10.51,2), A L P H A ( 1 0 ) , I N O W C , I F U T C C H A R A C T E R * 2 0 P H N A M E ( 2 5 ) , S S N A M E ( 2 0 ) , G N A M E ( 1 0 ) , D N A M E ( 3 ) C H A R A C T E R * 8 F L N A M E ( 1 0 ) , A Q N A M E ( 2 5 ) C H A R A C T E R * 4 E L N A M E ( 1 0 ) C O M M O N / C H N A M E / P H N A M E , S S N A M E , G N A M E , D N A M E , A Q N A M E , F L N A M E , E L N A M E L O C A L V A R I A B L E S R E A L A ( 1 0 , 1 0 ) I N T E G E R I P 0 I N T ( 1 O ) C H A R A C T E R * 1 0 0 T I T L E C H A R A C T E R * 2 0 C O N S T C H A R A C T E R * 1 2 P R 1 ( 4 ) . P R 2 ( 4 ) C H A R A C T E R * 4 S T R I N C H A R A C T E R * 3 W H A T 1 ( 4 ) , A N S I C H A R A C T E R * 1 W H A T 2 ( 4 ) , A N S 2 D A T A W H A T 1 / ' M I N ' , ' A Q U ' , ' S S S ' , ' G A S ' / D A T A W H A T 2 / ' M ' , ' A ' , ' G ' , ' B ' / D A T A P R 1 / ' ( M I N E R A L ) ' , ' ( A Q S P E C I E S ) ' , ' ( S S E N D M E M ) ' , ( G A S ) V D A T A P R 2 / ' ( M O L A L I T Y ) ' , ' ( L O G A C T . ) ' , ' ( G R A M S ) ' ( M O L E S ) ' / N U M C H M = N U M X N C O N S T = 0 I E R = 0 Z E R O O U T N E W A R R A Y S C A L L M I N I T ( C H E M , 1 0 , 5 1 , O . O E O O ) C A L L I M I N I T ( I N D E X 1 , 1 0 , 5 1 , 0 ) C A L L I M I N I T ( I N D E X 2 , 1 0 , 5 1 , 0 ) C A L L I M I N I T ( I N D E X 3 , 1 0 , 5 1 , 0 ) C A L L I M I N I T ( I B A L , 5 1 , 1 , 0 ) R E A D A N D W R I T E T I T L E I N F O R M A T I O N U N T I L S T A R ( S H O R T F O R S T A R T ) I S F O U N D I = 0 W R I T E ( 6 , 1 0 3 5 ) R E A D ( 3 , 1 0 3 6 ) T I T L E S T R I N = T I T L E I F ( S T R I N . E Q . ' S T A R ' ) T H E N G O T O 1 0 E L S E WRITE(6, 1037) TITLE ENDIF GO TO 1 THE PROGRAM LOOPS BACK TO THIS POINT AND KEEPS ON READING UNTIL AN END OF FILE (EOF) OR EITHER OF THE CHARACTER STRINGS "END " OR "STOP" IS FOUND. READ (3, 1026, END=700) STRIN IF (STRIN .EQ. ' ') THEN SKIP. BLANK LINES GO CHECK DATA GO CHECK DATA GO TO 10 ELSE IF (STRIN .EO. 'STOP') THEN GO TO 700 ELSE IF (STRIN .EQ. 'END ') THEN GO TO 700 ELSE IF (STRIN .EO. 'INER') THEN READ INERT PORTION OF NODE(S) READ (3, 1001) NUM, ISTART IFIN = ISTART - 1 + NUM READ (3, 1022) (XINERT(d),d = I START, IFIN) ELSE IF (STRIN .EO. 'REAC' ) THEN READ REACTANTS FOR EACH NODE READ(3,1001) K, NUM, ISTART NUMREA(ISTART) = K DO 60 I = 1, K READ(3,1031) ANS2, AMOUNT, CONST IF (ANS2.NE.'G'.AND.ANS2.NE.'M') THEN WRITE(6,1032) ANS2, AMOUNT, CONST STOP ENDIF DO 50 d1 = 1, NUMPH IF (CONST.NE.PHNAME(d 1 ) ) GO TO 50 IREACT(I,ISTART) = d1 GO TO 55 CONTINUE WRITE(6,1033) ANS2, AMOUNT, CONST STOP IF (ANS2.E0.'G') THEN AMOUNT = AMOUNT / THERPH(1,d1) ENDIF IF (NUM.NE.1) THEN DO 57 d1 = 2, NUM d2 = d1 - 1 REACTA(I,d1 ) = REACTA(I,d2) IREACT(I.dl) = IREACT(I,d2) CONTINUE ENDIF CONTINUE DO 65 J1 = 2, NUM d2 = d1 - 1 NUMREA(J1) = NUMREA(J2) CONTINUE SE IF (STRIN .EO. 'COMP') THEN READ CHEMICAL CONSTRAINTS ON EACH NODE READ (3, 1001) NUMCOM, ISTART IF (NCONST.EQ.O) NCONST = NUMCOM IF (NCONST.NE.NUMCOM) THEN WRITE(6,1014) NCONST, NUMCOM I ER = IER + 1 ENDIF I = NUMEL - 1 J = I - NUMCOM IF (NUMCOM.NE.I) THEN WRITE(6,1020) NUMEL, 2, NUMCOM, 3, J IER = IER + 1 ENDIF IB = 0 DO 560 1 = 1 , NUMCOM READ (3, 1003) ANSI, ANS2, AMOUNT, CONST DO 80 J = 1, 4 K3 = d IF(ANS2.EQ.WHAT2(J) ) GO TO 100 CONTINUE WRITE(6, 1004) ANSI, ANS2, AMOUNT, CONST STOP IF (ANSI .EQ. 'MIN') THEN READ A MINERAL CONSTRAINT K2 = 1 IF (K3.EQ.1) K3 = 4 IF (NUMPH.LE.0) THEN WRITE(6, 1005) STOP ENDIF DO 150 d1 = 1, NUMPH IF (PHNAME(d1) .EO. CONST) THEN K1 = d1 GO TO 500 ENDIF 150 CONTINUE WRITE(6, 1006) CONST STOP ELSE IF (ANSI .EO. 'AOU') THEN C READ AN AQUEOUS SPECIES C CONSTRAINT K2 = 2 IF (NUMAQ.LE.O) THEN WRITE(6, 1007) STOP ENDIF DO 250 0 1 = 1 . NUMAQ IF (AQNAME(J1) .EQ. CONST) THEN K1 = J1 IF (K3.EQ.4) THEN IB = I K3 = 1 ENDIF GO TO 500 ENDIF 250 CONTINUE WRITE(6, 1006) CONST K> STOP g ELSE IF (ANSI .EQ. 'SSS') THEN C READ SOLID SOLUTION ENDMEMBER K2 = 3 IF (K3.EQ.1) K3 = 4 IF (NUMSS.LE.O) THEN WRITE(6, 1008) STOP ENDIF DO 330 01 = 1, NUMSS IF (SSNAME(U1) .EQ. CONST) THEN K1 = J1 GO TO 500 ENDIF 330 CONTINUE WRITE(6, 1006) CONST STOP ELSE IF (ANSI .EQ. 'GAS') THEN C READ GASS CONSTRAINT K2 = 4 IF (NUMG.LE.O) THEN WRITE(6. 1009) STOP ENDIF 440 DO 440 J1 = 1, NUMG IF ( GNAME ( d 1 ) .EO. K1 = d1 GO TO 500 ENDIF CONTINUE WRITE(6, 100G) CONST STOP CONST) THEN ELSE WRITE(6, STOP 1010) ANSI, ANS2, WHAT IS IT? AMOUNT, CONST ENDIF 500 N J O L O 560 NOW STORE THE INFO IN THE APPROPRIATE CHEM(I,ISTART) = AMOUNT INDEX1(I,ISTART) = K1 INDEX2(I,ISTART) = K2 INDEX3(I,ISTART) = K3 CONTINUE IBAL(ISTART) = IB ARRAYS . ADD WATER TO BASIS. REMEMBER ONE IN THE AQUEOUS PORTION. L = NCONST + 1 CHEM(L,ISTART) =0.0 INDEX1(L,ISTART) = 1 INDEX2(L,ISTART) = 2 INDEX3(L,ISTART) = 2 CHECK THAT THE CONSTRAINS ARE LEGAL BY BASIS WAS TO BE FORMED IF (IER.NE.O) THEN WRITE(6,1013) IER STOP ENDIF DO 650 I = 1 , L K1 = INDEX1(I,ISTART) K2 = INDEX2(I,ISTART) DO 640 d = 1, NUMEL IF (K2.EQ.1) THEN THAT WATER IS ALWAY POSITION NUMBER INVERTING AS IF A NEW A(d,I) = C0MPPH(d,K1) ELSE IF (K2.EQ.2) THEN A(d,I) = C0MPAQ(d,K1) SOLIDS AQUEOUS SPECIES ELSE IF (K2.EQ.3) THEN SOLID SOLUTION SPECIES A(d,I) = COMPSS(J,K1) ELSE IF (K2.E0.4) THEN GASSES A(d, I) = COMPG(d,K1) ENDIF CONTINUE CONTINUE INVERT AND SEE IF IT IS A VALID BASIS - GO BACK AND READ MORE NODES EITHER WAY CALL INVRT(A,NUMEL,10,J) IF (J.NE.O) THEN WRITE(6,1021) ISTART DO 675 d = 1 , L K1 = INDEX1(d,ISTART) K2 = INDEX2(d,ISTART) K3 = INDEX3(d,ISTART) IF (K2.EQ.1) THEN WRITE(6, 1016) PHNAME(K1), PR1(K2), PR2(K3), CHEM(d,ISTART) ELSE IF (K2.EQ.2) THEN ANS2 = ' ' IF (IB.EQ.d) ANS2 = '*' WRITE(6, 1017) AQNAME(K1), ANS2, PR1(K2), PR2(K3). CHEM(d,I START) ELSE IF (K2.EQ.3) THEN WRITE(6, 1016) SSNAME(K1), PR1(K2), PR2(K3), CHEM(d,I START) ELSE IF (K2.EQ.4) THEN WRITE(6, 1016) GNAME(K1), PR1(K2), PR2(K3), CHEM(d,I START) ENDIF CONTINUE ENDIF ELSE WRITE(6,1027) 3, STRIN STOP ENDIF GO TO 10 WHEN ALL HAS BEEN READ, COME HERE AND CHECK THAT ALL NODES HAVE CONSTRAINTS. IF THE NODE IS EMPTY, COPY THE DATA FROM THE PRECEEDING NODE. NCONST = NCONST + 1 DO 740 J = 1. NUMCHM J2 = 0 DO 710 I = 1, NCONST IF (INDEX 1(I,d) .NE. 0) d2 = d2 + 1 CONTINUE COPY DATA FROM PRECEEDING CELL IF (J2.EQ.0) THEN IF (d.EQ.1) WRITE(6,1012) IF (d.EQ.1) STOP K = d - 1 DO 730 1 = 1 , NCONST CHEM(I.d) = CHEM(I,K) INDEX 1(I,d) = INDEX1(I,K) INDEX2(I,d) = INDEX2(I,K) INDEX3(I,d) = INDEX3(I,K) CONTINUE IBAL(J) = IBAL(K) ELSE IF (d2.NE.NCONST.AND.d2.NE.O) THEN WRITE(6, 1011) d IER = IER + 1 ENDIF CONTINUE IF (IER.NE.O) THEN WRITE(6,1013) IER STOP ENDIF DO 780 1 = 1 , NUMCHM, 2 K = I + 1 WRITE(6, 1015) I, K DO 770 d = 1, NCONST DO 760 d1 = I, K IF (d1.LE.NUMCHM) THEN IB = IBAL(d 1 ) K1 = INDEX1(d,dl) K2 = INDEX2(d.dl) K3 = INDEX3(d,Jl) ASSIGN 1016 TO II IF (M0D(d1,2).EQ.O) ASSIGN 1018 TO II IF (K2.EQ.1) THEN WRITE(6, I I ) PHNAME(K1), PR1(K2), PR2(K3), CHEM(d,J1) C ELSE IF (K2.EQ.2) THEN ANS2 = ' ' IF (IB.EQ.d) ANS2 = '*' ASSIGN 1017 TO II IF (M0D(d1,2).EQ.O) ASSIGN 1019 TO II WRITE(6, I I ) AQNAME(K1), ANS2. PR1(K2), PR2(K3), CHEM(d,J1) ELSE IF (K2.EQ.3) THEN WRITE(6, I I ) SSNAME(K1), PR1(K2), PR2(K3), CHEM(d , d 1 ) ELSE IF (K2.EQ.4) THEN WRITE(6, I I ) GNAME(K1), PR1(K2). PR2(K3), CHEM(d,d1) ENDIF ENDIF 760 CONTINUE 770 CONTINUE 780 CONTINUE ° WRITE( 6.1025) WRITE(11,1038) TAUM, DTAUM C NOW ALTER ALL INPUT OF SOLID PHASES IN GRAMS TO MOLES, C AND NORMALIZE ALL AMOUNTS WITH THE POROUSITY C TO THE APPROPIATE AMOUNT IN THE NODE. WRITE(6,1023) DO 890 1 = 1 , NUMCHM AMOUNT =0.0 L = 0 DO 800 d = 1, NCONST IF (INDEX2(d,I).EQ.1) THEN K1 = INDEX 1(d,I) K3 = INDEX3(d,I) L = L + 1 IPOINT(L) = d IF (K3.EQ.3) THEN C CONVERT GRAMS TO MOLES C CHEM(d.I) = CHEM(d.I) / THERPH(1,K1 ) INDEX3(d,I) = 4 ENDIF SUM VOLUMES CALL VMIN (X, THERPH(4,K1), THERPH(12,K1 ) , THERPH(13 , K1 ) , CELLT(I,INOWT ) , CELLP(I,INOWP) ) AMOUNT = AMOUNT + (CHEM(d.I) * X) ENDIF CONTINUE SUM IN VOLUMES OF REACTANTS IF (NUMREA(I).GT.0) THEN DO 810 J = 1, NUMREA(I) K1 = IREACT(d.I) CALL VMIN (X, THERPH(4,K1), THERPH(12,K1), THERPH(13,K1), CELLT(I,INOWT), CELLP(I,INOWP) ) AMOUNT = AMOUNT + (REACTA(J,I) * X) CONTINUE ENDIF CONVERT TO METERS AND FIND FACTOR - NORMALIZE J = I K = J - 1 IF (K.LT.1) K = d IF (J.GE.NUMCHM) d = K AMOUNT = AMOUNT * 1.0E-06 IF (AMOUNT.EO.0.0) THEN XINERT(I) = 1.0 - CELLPO(I,INOWC) ENDIF VOLUME = THICK * THICK * ((SIZEX(d) + SIZEX(K))/2.0) X = VOLUME * (1.0 - CELLPO(I,INOWC) - XINERT(I)) WRITE(6,1024) I, VOLUME, XINERT(I), CELLPO(I,INOWC), X ANS2 = ' ' ASSIGN 1028 TO II DO 830 d = 1, NCONST IF (INDEX2(d,I).EO. 1 ) THEN K1 = INDEX1(d,I) CALL VMIN (VOLUME, THERPH(4,K1), THERPH(12,K1), THERPH(13,K1), CELLT(I,INOWT), CELLP(I,INOWP)) CHEM(d.I) = CHEM(d.I) * X / AMOUNT CHEMO(d.I) = CHEM(d.I) VOLUME = CHEM(d.I) * VOLUME * 1.0E-06 WRITE(6, I I ) ANS2, PHNAME(K1), CHEM(d.I), VOLUME ASSIGN 1034 TO II ENDIF 830 T0TALM(d,I) = CHEM(d,I) CONTINUE IF (NUMREA(I).GT.O) THEN ANS2 = '*' DO 840 d = 1, NUMREA(I) K1 = IREACT(d.I) REACTA(d.I) = REACTA(d.I) * X / AMOUNT CALL VMIN (VOLUME, THERPH(4,K1), THERPH(12,K1), THERPH(13,K1), CELLT(I,INOWT), CELLP(I,INOWP)) VOLUME = REACTA(d, WRITE(6, I I ) ANS2, I ) * VOLUME * 1.OE-06 PHNAME(K1), REACTA(d.I), VOLUME 840 O 00 860 870 890 1001 1003 1004 1006 1007 ASSIGN 1034 TO II CONTINUE ENDIF WRITE( 6,1029) WRITE(11,1001) I, L, NUMREA(I) IF (L.GT.O) THEN DO 860 d = 1, L K1 = INDEX1(IPOINT(d) , I ) WRITE(11,1039) K1, CHEM(IPOINT(d),I), 0.0 CONTINUE ENDIF IF (NUMREA(I) .GT. 0) THEN DO 870 d = 1, NUMREA(I) K1 = IREACT(d.I) WRITE(11,1039) K1, REACTA(d,I), 0.0 CONTINUE ENDIF CONTINUE WRITE(6, RETURN FORMAT(: FORMAT( FORMAT( 1030) [2015) A3,1X.A1,4X,E12.5,3X,A20) ' THE SECOND PARAMETER READ A LINE IN THE FILE', ' ASSIGNED TO UNIT 3 COULD NOT BE RECOGNIZED ',/, ' THIS PARAMETER SHOULD BE ACTIVITY, MOLALITY,', ' MOLES, OR GRAMS. THE LINE IN QUESTION IS:',/, A3,1X.A1,4X,E12.5,3X,A20) 1005 F0RMAT('O YOU CAN NOT HAVE SOLID PHASE CONSTRAINTS WHEN ' ' NO SOLID PHASES HAVE BEEN READ (OR KEPT BECAUSE OF COMPOSITION) FROM THE THERMODYNAMIC DATA BANK') '0 PHASE ',A20,' WAS NOT FOUND IN THE THERMODYNAMIC, DATA BANK. ',/,' CORRECT AND RERUN. ') 'O YOU CAN NOT HAVE AQUEOUS SPECIES CONSTRAINTS WHEN ./, /, FORMAT( FORMAT( ' NO AQUEOUS SPECIES HAVE BEEN READ (OR KEPT BECAUSE',/, ' OF COMPOSITION) FROM THE THERMODYNAMIC DATA BANK') 1008 FORMATCO YOU CAN NOT HAVE SOLID SOLUTIONS CONSTRAINTS WHEN ',/, ' NO SOLID SOLUTIONS HAVE BEEN READ (OR KEPT BECAUSE',/, ' OF COMPOSITION) FROM THE THERMODYNAMIC DATA BANK') 1009 F0RMAT('O YOU CAN NOT HAVE GAS CONSTRAINTS WHEN ',/, ' NO GASES HAVE BEEN READ (OR KEPT BECAUSE',/, ' OF COMPOSITION) FROM THE THERMODYNAMIC DATA BANK') 1010 FORMATC THE FIRST PARAMETER (MINERAL, AQUEOUS SPECIES, ',/, ' SOLID SOLUTION SPECIES OR GAS COULD NOT BE RECOGNIZED' ,/,' LINE IN QUESTION IS:',/, A3,1X.A1,4X,E12.5,3X,A20) 1011 FORMATCO NODE ',13,' DOES NOT HAVE ENOUGH OR HAS TOO MANY ', 'CONSTRAINTS.') 1012 FORMATCO NODE 1 MUST HAVE THE COMPOSITION DEFINED.') 1013 FORMATCO THERE WERE ',13,' ERRORS FOUND IN THE DATA BASE', ' ASSIGNED TO UNIT 3.',/,' END OF RUN.') 1014 FORMATC THE PREVIOUS NODE HAD ',13,' CHEMICAL CONSTRAINS', /,' YET THE ONE JUST READ IN HAD ',13,'. CORRECT ',/, ' AND RERUN. ') 1015 FORMATCO CHEMICAL CONSTRAINTS FOR NODE: ',I5,28X, ' CHEMICAL CONSTRAINTS FOR NODE: ',15) 1016 FORMATC ',A20,1X.2A12,1X.E12.5) 1017 FORMATC ' ,A8, 1 1X , A 1 , 1X,2A12, ' ',E12.5) 1018 FORMAT('+',65X,A20,1X,2A12,1X,E12.5) 1019 FORMAT('+',65X,A8,11X,A1,1X,2A12,1X,E12.5) 1020 FORMATCO THERE ARE ',15,' COMPONENTS (INCLUDING', ' ISOTOPES AND DIFFERENT OXIDATION STATES)', ' USED TO DESCRIBE THE PHASES TAKEN FROM THE',/, ' DATA FILE ASSIGNED TO UNIT',12, ' YET YOU HAVE ENTERED ',15,' CONSTRAINTS', ' IN THE DATA FILE ASSIGNED TO UNIT' , 12 , ' . ' ,/, ' YOU MUST ENTER ',12,' MORE COMPONENTS TO', ' COMPLETELY DETERMINE THE SYSTEM (REMEMBER THAT', ' WATER IS AUTOMATICALLY A COMPONENT).',/) 1021 FORMATCO THE CONSTRAINS LISTED BELOW, DO NOT FORM A', ' INDEPENDENT BASIS FOR THE NODE: ',15) 1022 F0RMAT(8X,F12.3) 1023 FORMATCO NODE: TOTAL VOLUME INERT POROSITY ', ' AVAILABLE VOLUME PHASES PRESENT',10X,'AMOUNT', 8X,'VOLUME',/,12X,'(M**3)',4X,'FRACTION',17X, '(M**3)',32X,'(MOLES)',7X,'(M**3)',/) 1024 FORMATC ',13,4X,E 12 . 5,2X,F8.6,2X,F8.6,4X,E12.5) 1025 FORMATCO', 18X, ' * = ION/COMPONENT CHOSEN BY USER AS', ' ELECTRICAL BALANCING COMPONENT.',/) 1026 F0RMAT(A4) o 1027 FORMATC ON FORTRAN UNIT NUMBER ',12,', THE COMMAND ',A4, ' WAS READ. IT DOES NOT MATCH ANY OF THE POSSIBLE',/, ' KEYWORD STRINGS. CORRECT AND RERUN.') +',59X,A1,A20,1X,E12.5,2X,E12.5) ' ) 58X,'* = REACTANTS') A1,3X,F10.5,1X.A20) '0 LINE IN ERROR IN DATA BANK ASSIGNED TO UNIT 3.', LINE FOR REACTANTS READS: ',/,' ',A 1,3X,F10.5,1X,A20, ERROR IS IN THE SYMBOL FOR GRAMS (G) OR MOLES (M) ') LINE IN ERROR IN DATA BANK ASSIGNED TO UNIT 3.', ',A1,3X,F10.5,1X,A20, 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 FORMAT(' FORMAT(' FORMAT(! FORMAT(t FORMAT( / , FORMAT(' , / , ,//) ' LINE FOR REACTANTS READS: /,' ERROR IS THAT THE REACTANT CAN NOT BE FOUND') FORMAT(' ',59X,A1,A20,1X,E12.5,2X,E12.5) FORMATC1',//,' TITLE INFORMATON READ FROM DATA ON UNIT 3' FORMAT(A 100) FORMATC '.A100) F0RMAT(2(1X.E12.5)) F0RMAT(I5,2(1X,E12.5)) END SUBROUTINE SETUP4 ROUTINE TO SETUP THE WATER ROUTINE. LOCAL DOUBLE PRECISION VARIABLES - LAST CHARACTER IS ALWAYS D CPD - HEAT CAPACITY AT CONSTANT PRESSURE OF WATER CVD - HEAT CAPACITY AT CONSTANT VOLUME OF WATER FD - HELMHOLZ FREE ENERGY OF WATER HD - ENTHALPHY OF WATER DPTVD - DERIVATIVE OF P WRT. DPRTD - DERIVATIVE OF P WRT. DPVTD - DERIVATIVE OF P WRT. PD - PRESSURE (MPA) OF WATER SD - ENTROPY OF WATER TD - TEMPERATURE (DEG K) OF WATER TJD - JOULE THOMPSON COEF. OF WATER UD - INTERNAL ENERGY OF WATER VD - VOLUME (KG/M**3) OF WATER T AT CONSTANT V RHO AT CONSTANT V AT CONSTANT T COMMON /CELLS/ CELLPO(51,2), CELLPE(5 1 , 2 ) , CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51). THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TRANS/ VELOC( 51 ,2) , AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC DOUBLE PRECISION PD, TD, VD, HD, UD, SD, CPD, CVD, TJD, FD DOUBLE PRECISION DPTVD, DPRTD, DPVTD INITIALIZE THE WATER ROUTINE CALL STEAM(PD, TD, VD, HD, UD, SD, CPD, CVD, TdD, FD, 1, NE, DPTVD, DPRTD, DPVTD) NOW CALL H20 WITH THE REFERENCE VALUES - THEY WILL BE STORED IN POSITION 1 OF EACH OF THE ARRAYS IN THE COMMON BLOCK PREF =0.1 TREF = 298 . 15 CALL H20(PREF, TREF, VOL, GIBBS, HTP, STP, EOCON, CV, DVDT, DVDP, D2VDT2, 1) GET INITIAL DENSITIES AT EACH OF THE NODES DO 100 1 = 1 , NUMX PRES = CELLP(I,INOWP) TK = CELLT(I,INOWT) CALL H20(PRES, TK, VOL, GIBBS, HTP, STP, EOCON, CV, DVDT, DVDP, D2VDT2, 0) DENSF(I,INOWC) = 1.0E00 / VOL DENSF(I,IFUTC) = 1.0E00 / VOL CONTINUE RETURN END SUBROUTINE SETUP6 THIS ROUTINE COPIES THE VELOCITY ARRAY FROM IFUTP TO INOWP POSITIONS IN THE ARRAY. IT IS USED ONLY IN THE SETUP COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2), CELLP(51,2), . CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TRANS/ VEL0C(51,2), AOCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC II = NUMX - 1 DO 10 I = 1, II VELOC(I,INOWP) = VELOC(I,IFUTP) CONTINUE RETURN END SUBROUTINE SOLVET(IMSWIT) THIS ROUTINE SETS UP THE FINITE ELEMENT MATRIX'S FOR THE SOLUTION OF THE NEW TEMPERATURES COMMON BLOCKS PREVIOUSLY DEFINED COMMON /CELLCO/ CHEM0(10,51) COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAO/ COMPAQ(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMSS/ COMPSS(10,20), THERSS(8,20), NUMSS COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(51), WATER(51), INDEX1(10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /REACT/ REACTA(5,51), IREACT(5,51), NUMREA(51) COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,5 1 ,2), ALPHA(10), INOWC, IFUTC LOCAL VARIABLES A - CONTAINS A BANDED REPRESENTATION OF THE FINITE ELEMENT COEFFICIENT ARRAY. INITIALLY CONTAINS THE [A] TERMS FOR THE EQUATIONS [A] P + [B] DP/DT = F B - CONTAINS A BANDED REPRESENTATION OF THE [B] AREA IN THE ABOVE EQUATION. C - CONTAINS THE TEMPERATURES AT TIME INOW D - WORKING ARRAY DENS - DENSITY OF WATER, KG/M**3 F ON CALLING IMSL ROUTINE, CONTAINS THE RIGHT HAND SIDE OF THE EQUATIONS, ON EXIT, IT CONTAINS THE SOLUTION VECTOR. SEE ABOVE EQUATION. PERM - PERMIABILITY FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME PORE - POROUSITY FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME PRES - PRESSURE FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME TK - TEMPERATURE FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME VOLUME- VOLUME OF ELEMENT X - SIZE OF ELEMENT, ALSO USED FOR TEMPERARY STORAGE XL - WORK ARRAY FOR THE IMSL ROUTINE LEQT1B REAL A(102,3), B(102,3), C(102), D(102), F(102), XL(204) CALL MINIT(C, 102, 1, O.OEOO) CALL MINIT(D, 102, 1, O.OEOO) CALL MINIT(F, 102, 1, O.OEOO) ro i—1 Co 50 DO 50 I = 1, NUMX C( I ) = CELLT(I,INOWT) CONTINUE SET UP ELEMENT STIFFNESS MATRIX EVALUATED AT TIME T + DELTA (T/2) EACH TERM IS EVALUATED FOR THE ELEMENT DO 900 LOOP = 1, LIML0P(2) L0PT0T(2) = LOOP CALL MINIT(A, 102, CALL MINIT(B, 102, CALL MINIT(XL, 204, DO 100 1 = 1 , (NUMX II = I + 1 O.OEOO) O.OEOO) O.OEOO) 1) THE PRESSURE AND TIME AT INOWP IS PRES = THE PORE SAME S PRES S PRES PRES S V V V XINT PRES DTAUP))) VELOCITY CALCULATION DOES NOT ASSUME THAT THE THE SAME AS THE TIME AT INOWT (CELLP(I,INOWP) + CELLP(II,INOWP)) (CELLP(I,IFUTP) + CELLP(II,IFUTP)) -PRES / 2.0 S / (2.0 * DTAUP) PRES + (S * ((TAUT - DTAUT) - (TAUP PRES + (W1 * S * DTAUT) (VEL0C(I,IFUTP) - VELOC(I,INOWP)) / DTAUP VELOC(I,INOWP) V + (S * ((TAUT - DTAUT) - (TAUP - DTAUP))) V + (W1 * S * DTAUT) (XINERT(I) + XINERT(II) ) / 2.0 CALCULATION ASSUMES THAT THE CELLPO AT INOWC IS AT THE TIME AS CELLT IS WHEN IT IS AT INOWT PORE = (CELLPO(I,INOWC) + CELLPO(11,INOWC)) S = (CELLPO(I,IFUTC) + CELLPO(11,IFUTC)) PORE = PORE / 2.0 S = S / (2.0 * DTAUC) PORE = PORE + (W1 * S * DTAUT) PORE TK X VOLUME ((CELLT(I,INOWT) + CELLT(11,INOWT)) (CELLT(I,IFUTT) + C E L L T ( I I , I F U T T ) ) ) / 4.0 = SIZEX(I) = THICK * THICK * X CALL H20(PRES, TK, DENS, GIBBS, HTP, STP, EOCON, CV, DVDT, DVDP, D2VDT2, 0) DENS = 1 . 0 / DENS CALL C0ND(XK,TK,DENS) CALCULATE CHEMICAL BASED TERMS FOR A, B AND F MATRIX'S TOTCV = 0.0 TOTK = 0.0 TOTW =0.0 TOTM =0.0 TOTV =0.0 DO 80 d = 1 , NCONST K1 = INDEX1(d,I) K2 = INDEX2(d,I) IF (K2.E0.1) THEN SOLID PHASES TOTM = TOTM + CHEM(d,I) TOTW = TOTW + (CHEM(d.I) * THERPH(1,K 1 ) ) CALL VMIN(VTP, THERPH(4, K1), THERPH(12,K 1 ), THERPH(13,K1), TK, PRES) TOTV = TOTV + (CHEM(J.I) * VTP) CALL CVMIN(CVM, TK, THERPH(5,K1), THERPH(6,K1 ) , THERPH( 7,K1), THERPH( 8.K1), THERPH( 9,K1) THERPH(10,K1), THERPH(11,K1), THERPH(12,K1 ) THERPH(13,K1 ) ) TOTCV = TOTCV + (CHEM(d.I) * CVM) TOTK = TOTK + (CHEM(d.I) * THERPH(14,K1) ) ELSE IF (K2.EQ.2) THEN AQUEOUS SPECIES ELSE IF (K2.EQ.3) THEN SOLID SOLUTION ELSE IF (K2.EQ.4) THEN GASES ENDIF CONTINUE IF (NUMREA(I) .GT. 0) THEN DO 90 d = 1, NUMREA(I) K1 = IREACT(d.I) TOTM = TOTM + CHEM(J,I) TOTW = TOTW + (CHEM(J.I) * THERPH(1,K1 ) ) CALL VMIN(VTP, THERPH(4, K1), THERPH(12,K 1 ) , THERPH(13,K1), TK, PRES) TOTV = TOTV + (CHEM(d.I) * VTP) CALL CVMIN(CVM, TK, THERPH(5,K1), THERPH(6,K 1 ) , THERPH( 7,K1), THERPH( 8,K1), THERPH( 9,K1) THERPH(10,K1), THERPH(11,K1), THERPH(12,K1 ) , THERPH(13,K1) ) TOTCV = TOTCV + (CHEM(d,I) * CVM) TOTK = TOTK + (CHEM(d.I) * THERPH(14,K1)) CONTINUE ENDIF A K i d OF 5 TIMES STATIC VALUE OF K IS USED TOTK = TOTK * 6.0 ATEMP = (1.0 - PORE - XINT) * TOTK / TOTM ATEMP = (ATEMP + (PORE * XK)) / X NOTE - E-03 TERM IS TO CONVERT CV FROM d/G TO d/KG A( 1,2) = ( ATEMP) - (DENS * CV * V / 2.0E-03) + A(I,2) A( 1,3) = (-ATEMP) + (DENS * CV * V / 2.0E-03) A ( I I , 1 ) = (-ATEMP) - (DENS * CV * V / 2.0E-03) A( I I , 2 ) = ( ATEMP) + (DENS * CV * V / 2.0E-03) BTEMP = (1.0 - PORE - XINT) * TOTCV * 1.0E06 / TOTV BTEMP = BTEMP + (PORE * DENS * CV * 1.0E03) BTEMP = BTEMP * X / (6.0 * DTAUT) B( 1,2) = (BTEMP * 2.0) + B(I,2) B( 1,3) = BTEMP B ( I I , 1 ) = BTEMP B ( I I , 2 ) = BTEMP * 2.0 CONTINUE FINISH SETTING UP RIGHT HAND SIDE CALL BMMULT(B,102,NUMX,C,D) DO 150 I = 1, NUMX F ( I ) = F ( I ) + D(I) CONTINUE CALL BMMULT(A,102,NUMX,C,D) DO 160 I = 1, NUMX F ( I ) = F ( I ) + ((W1 - 1.0) * D ( I ) ) CONTINUE FINISH SETTING UP ELEMENT STIFFNESS MATRIX DO 180 J = 1,3 DO 170 I = 1, NUMX A(I,d) = (W1 * A ( I . d ) ) + B ( I , J ) CONTINUE CONTINUE SET UP BOUNDARY CONDITIONS F(1) = CELLT( 1.IFUTT) F(NUMX) = CELLT(NUMX,IFUTT) DO 200 1 = 1 , 3 A(1,I ) = 0.0 A(NUMX,I) =0.0 CONTINUE A( 1 ,2) =1.0 A(NUMX,2) = 1.0 SOLVE THE SYSTEM OF EQUATIONS USING IMSL ROUTINE LEQT1B THIS ROUTINE USES IMSL ROUTINES UERTST AND UGETIO FOR ERROR OUTPUT. CALL LEQT1B(A,NUMX,1,1,102,F,1,102,O,XL,204,IER) CHECK FOR LARGEST ERROR, COPY NEW VALUES TO TEMPERATURE ARRAY ERROR(2 ) = 0.0 DO 500 1 = 1 , NUMX X = ABS((CELLT(I,IFUTT) - F ( I ) ) / F ( I ) ) IF (X.GT.ERR0R(2) ) ERR0R(2) = X IF ( F ( I ) .LT. CELLT(NUMX,IFUTT)) F(I)=CELLT(NUMX,IFUTT) IF ( F ( I ) GT. CELLT( 1,IFUTT)) F(I)=CELLT( 1,IFUTT) CELLT(I,IFUTT) = F ( I ) F ( I ) = 0.0 CONTINUE UPDATE PARAMETERS CALL UPDATE(IMSWIT) RETURN IF ERROR TEST PASTED IF (ERR0R(2).LE.ERRMAX(2)) RETURN CONTINUE RETURN END SUBROUTINE SOLVEP(IMSWIT) THIS ROUTINE SETS UP THE FINITE ELEMENT MATRIXaS FOR THE SOLUTION OF THE NEW PRESSURES COMMON BLOCKS PREVIOUSLY DEFINED COMMON /CELLCO/ CHEMO(10,51) COMMON /CELLS/ CELLPO(51,2 ) , CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CHEMPH/ COMPPH(10,25) COMMON /CHEMAQ/ COMPAQ(10,25) COMMON /CHEMSS/ COMPSS(10,20) COMMON /CHEMG / COMPG(10,10), COMMON /CELLCH/ CHEM(10,51), , THERPH(14,25) , THERAQ(13,25) , THERSS(8,20), THERG(6,10), T0TALM(1O,51), , NUMPH , NUMAQ NUMSS NUMG STRNGH(51), WATER(51), INDEX1(10,51) , INDEX2(10,51) , INDEX3(10,51 ) , IBAL(51), NUMCHM, NCONST COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC COMMON /REACT/ REACTA(5,51 ) , I REACT(5,5 1 ) , NUMREA(5 1 ) LOCAL VARIABLES CONTAINS A BANDED REPRESENTATION OF THE FINITE ELEMENT COEFFICIENT ARRAY. INITIALLY CONTAINS THE [A] TERMS FOR THE EQUATIONS [A] P + [B] DP/DT = F CONTAINS A BANDED REPRESENTATION OF THE [B] AREA IN THE ABOVE EQUATION. C CV CONTAINS THE PRESSURES AT TIME INOWP HEAT CAPACITY AT CONSTANT VOLUME FOR WATER D DENS DVDP WORKING ARRAY DENSITY OF WATER, KG/M**3 DV/DP AT CONSTANT T FOR WATER DVDT - DV/DT AT CONSTANT P FOR WATER F - ON CALLING IMSL ROUTINE, CONTAINS THE RIGHT HAND SIDE OF THE EQUATIONS, ON EXIT, IT CONTAINS THE SOLUTION VECTOR. SEE ABOVE EQUATION. GIBBS - GIBBS FREE ENERGY AT T AND P FOR WATER GDREF - DERIVATIVE OF GIBBS FREE ENERGY WITH RESPECT TO P AT REFERENCE TEMPERATURE (USED FOR VELOCITY TERM) PERM - PERMIABILITY FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME PORE - POROUSITY FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME PRES - PRESSURE FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME TK TEMPERATURE FOR AN ELEMENT - WEIGHTED WITH W1 IN TIME VISCOS- DYNAMIC VISCOSITY OF WATER VOLUME- VOLUME OF ELEMENT X - SIZE OF ELEMENT, ALSO USED FOR TEMPERARY STORAGE XL - WORK ARRAY FOR THE IMSL ROUTINE LEQT1B DIMENSION A(102,3), B(102,3), C(102), D(102), F(102), XL(204) CALL MINIT(D, 102, 1, O.OEOO) CALL MINIT(F, 102, 1, O.OEOO) DO 50 I = 1, NUMX C ( I ) = CELLP(I,INOWP) * 1.0E06 CONTINUE SET UP ELEMENT STIFFNESS MATRIX EVALUATED AT TIME T + DELTA (T/2) EACH TERM IS EVALUATED FOR THE ELEMENT DO 900 LOOP = 1, LIMLOP(1) LOPTOT(1 ) = LOOP CALL MINIT(A, 102, 3, O.OEOO) CALL MINIT(B, 102, 3, O.OEOO) CALL MINIT(XL, 204, 1, O.OEOO) DO 100 1 = 1 , (NUMX - 1) II = I + 1 PRES = (((CELLP(I,INOWP) + CELLP(11,INOWP) ) * (1 - W1)) + ((CELLP(I,IFUTP) + CELLP(II,IFUTP) ) * W1)) / 2.0 THE CALCULATIONS IMMEDIATELY BELOW (FOR T, PORE AND PERM) ASSUMES (CORRECTLY) THAT IN THIS ROUTINE, ALL ARRAYS ARE AT THE SAME TIME FOR THEIR INOW? TIME. TK = (CELLT(I,INOWT) + CELLT(11,INOWT)) S = (CELLT(I.IFUTT) + CELLT(II,IFUTT) ) - TK TK = TK / 2.0 S = S / (2.0 * DTAUT) TK = TK + (W1 * S * DTAUP) CALL NEW( TAUP, VALUE, 2) IF (TK .GT. VALUE) TK = VALUE PORE = (CELLP0(I,INOWC) + CELLP0(11,INOWC) ) S = (CELLPO(I,IFUTC) + CELLPO(11,IFUTC ) ) - PORE PORE = PORE / 2.0 S = S / (2.0 * DTAUC) PORE = PORE + (W1 * S * DTAUP) PERM = (CELLPE(I,INOWC) + CELLPE(II,INOWC)) S = (CELLPE(I,IFUTC) + CELLPE(11,IFUTC ) ) - PERM PERM = PERM / 2.0 S = S / (2.0 * DTAUC) PERM = PERM + (W1 * S * DTAUP) X = SIZEX(I) VOLUME = THICK * THICK * X GET DENSITY AND CONVERT TO VOLUME IN THE RIGHT UNITS CALL H20(PRES, TK, DENS, GTP, HTP, STP, EOCON, CV, DVDT, DVDP, D2VDT2, 0) DENS = 1.0 / DENS CALL VISC(VISCOS,TK,DENS) CALCULATE CHEMICAL BASED TERMS FOR B AND F MATRIXaS S STORES TERMS WITH RESPECT TO DP 51 STORES TERMS WITH RESPECT TO DT 52 STORES TERMS WITH RESPECT TO DN S = O.OEOO 51 = O.OEOO 52 = O.OEOO DO 70 J = 1, NCONST K1 = INDEX1(d,I) K2 = INDEX2(d,I) IF (K2.E0.1) THEN SOLID PHASES CALL VMIN(VTP, THERPH( 4,K1), THERPH(12,K1), THERPH(13.K1), TK, PRES) S = S + (CHEM(d.I) * 1.0E-06 * THERPH(13,K1)) 51 = S1 + (CHEM(d.I) * 1.0E-06 * THERPH(12,K1) ) 52 = S2 + (1.OE-06 * VTP * (CHEM(d.I) - CHEMO(d.I)) / DTAUM) ELSE IF (K2.E0.2) AQUEOUS SPECIES ELSE IF (K2.EQ.3) SOLID SOLUTION ELSE IF (K2.EQ.4) GASES ENDIF CONTINUE IF (NUMREA(I) .GT. 0) THEN DO 90 d = 1, NUMREA(I) K1 = IREACT(d.I) S = S + (REACTA(d,I) * 1.OE-06 * THERPH(13,K1) ) S 1 = S 1 + (REACTA(d.I) * 1.OE-06 * THERPH(12,K1 ) ) S2 = S2 + ??????????? CONTINUE ENDIF S = S * (-1.0) * DENS / VOLUME S1 = S1 * (-1.0) * DENS / VOLUME S2 = S2 * (-1.0) * DENS / VOLUME C INCLUDE WATER TERMS (NO S2 WATER TERM AS WATER IS PURE HERE) C S = S - (PORE * (DENS**2) * DVDP) S1 = S1 - (PORE * (DENS**2) * DVDT) S1 = S1 * (CELLT(I,IFUTT) - CELLT(I,INOWT) ) / DTAUT PERM = PERM * DENS / (VISCOS * X) A( 1,2) = PERM + A(I,2) A( 1,3) = PERM * (-1.0) A ( I I , 1) = PERM * (-1.0) A( I I , 2 ) = PERM S = S * X / (DTAUP * 6.0) B( 1,2) = (S * 2.0) + B(I,2) B( I,3) = S B ( I I , 1 ) = S B ( I I , 2 ) = S * 2.0 C F ( I ) = S1 + S2 100 CONTINUE C FINISH SETTING UP RIGHT HAND SIDE CALL BMMULT(B,102,NUMX,C,D) O DO 150 I = 1, NUMX F ( I ) = F ( I ) + D(I) 150 CONTINUE IF (W1 .NE. 1.0) THEN CALL BMMULT(A,102,NUMX,C,D) DO 160 I = 1, NUMX F ( I ) = F ( I ) + ((W1 - 1.0) * D ( I ) ) 160 CONTINUE ENDIF C FINISH SETTING UP ELEMENT STIFFNESS MATRIX C DO 180 J = 1,3 DO 170 I = 1, NUMX A ( I , J ) = (W1 * A ( I , d ) ) +'B(I.J) 170 CONTINUE 180 CONTINUE C C SET UP BOUNDARY CONDITIONS C F(1) = CELLP( 1,IFUTP) * 1.0E06 F(NUMX) = CELLP(NUMX,IFUTP) * 1.0E06 DO 200 I = 1, 3, 2 A( 1 , I ) =0.0 A(NUMX,I) = 0.0 CONTINUE A(1,2) = 1.0 A(NUMX,2) = 1.0 SOLVE THE SYSTEM OF EQUATIONS USING IMSL ROUTINE LEQT1B THIS ROUTINE USES IMSL ROUTINES UERTST AND UGETIO FOR ERROR OUTPUT. I ER = 0 CALL LEQT1B(A,NUMX,1,1,102,F,1,102,0,XL,204,IER) IF (IER .NE. 0) THEN WRITE(6, 1001) STOP ENDIF CHECK FOR LARGEST ERROR, COPY NEW VALUES TO PRESSURE ARRAY ERROR(1) = 0.0 DO 500 1 = 2 , NUMX X = ABS ( ((1.0E06 * CELLP(I,IFUTP)) - F ( I ) ) / F ( I ) ) IF (X.GT.ERROR(1)) ERROR(1) = X IF ( F ( I ) .GT. (1.0E06 * CELLP( 1 ,IFUTP )) ) F ( I ) = CELLP(1,IFUTP) * 1.0E06 CELLP(I,IFUTP) = F ( I ) / 1.0E06 CONTINUE UPDATE PARAMETERS CALL UPDATE(IMSWIT) RETURN IF ERROR TEST PASTED IF (ERROR(1).LE.ERRMAX(1)) RETURN CONTINUE RETURN FORMATC1 ERROR IN CALL TO ROUTINE LEQT1B IN ROUTINE', ' PSOLVE ' ) END SUBROUTINE OUTC(ISTEPP, ISTEPT, ISTEPC, ICSWIT, IMSWIT, IUPDT) THIS ROUTINE PRINTS THE COMPOSITION OF EACH OF THE NODES COMMON BLOCKS PREVIOUSLY DEFINED CHARACTER*20 PHNAME(25), SSNAME(20), GNAME(10), DNAME(3 ) CHARACTER*8 FLNAME(10), AQNAME(25) CHARACTER*4 ELNAME(10) COMMON /CHNAME/ PHNAME, SSNAME, GNAME, DNAME, AQNAME, FLNAME, ELNAME COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(51), WATER(51), INDEX1(10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /TRANS/ VEL0C(51,2), AOCO(10,51,2). SOCO(10,51,2), ALPHA(10), INOWC, IFUTC COMMON /REACT/ REACTA(5,51), IREACT(5,51), NUMREA(51) COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAO/ COMPAO(10,25), THERAQ(13,25), NUMAO WRITE(6,1000) ISTEPP, ISTEPT, ISTEPC, TAUC, DTAUC WRITE(9,1001) TAUC, DTAUC DON'T PRINT COMPOSITIONS UNLESS NECESSARY IF (ICSWIT.EQ.-1 .AND. IMSWIT.EQ.-1 .AND. ISTEPC.NE.O) GO TO 60 X = ERRMAX(3) * 100.0 WRITE(6, 1013) X, LIML0P(3) WRITE(G, 1014) DO 5 I = 1, NCONST IF (ABS(ALPHA(I)) .GT. 0.0) THEN X = ERR0R(I+2) * 100.0 WRITE(6, 1015) FLNAME(I), X, L0PT0T(I+2) ENDIF CONTINUE ISTART = 1 IFIN = ISTART + 7 IF (IFIN.GT.NCONST) IFIN = NCONST WRITE(6,1002) WRITE(6,1003) (FLNAME(I),I=ISTART,IFIN) DO 20 U = 1, NUMX WRITE(6,1004) J , (AQC0(I, J,IFUTC),1=1START,IFIN) CONTINUE ISTART = IFIN + 1 IF (ISTART.LE.NCONST) GO TO 10 DO 30 I = 1, NCONST WRITEO, 1001 ) (AQCO( I , J, IFUTC) , J=1 ,NUMX) CONTINUE ISTART = 1 IFIN = ISTART + 7 IF (I FIN.GT.NCONST) IFIN = NCONST WRITE(6,1006) 50 55 WRITE(6,1003) (FLNAME(I),I=ISTART,IFIN) DO 50 d = 1, NUMX WRITE(6,1004) J , (SOCO(I,J,IFUTC),I=ISTART,IFIN) CONTINUE ISTART = IFIN + 1 IF (ISTART.LE.NCONST) GO TO 40 DO 55 I = 1, NCONST WRITE(9,1001) ( SOCO( I , d,IFUTC),d=1,NUMX ) CONTINUE 60 ro ro 80 WRITE(6,1009) TAUC WRITE(6,1008) (CELLP0(I,IFUTC) , 1 = 1, NUMX) WRITE(9,1016) (CELLP0(I,IFUTC), I = 1, NUMX) WRITE(6,1010) TAUC WRITE(6,1001) (CELLPE(I,IFUTC), I = 1, NUMX) WRITE(9,1016) ((ALOG10(CELLPE(I.IFUTC))), I = 1, NUMX) UPDATE TIME AND POINTERS I = IFUTC IFUTC = INOWC INOWC = I TAUC = TAUC + DTAUC NOW PREDICT THE NEW COMPOSITIONS, BUT ONLY IF NECESSARY IF (ICSWIT.E0.-1 .AND DO 80 I = 1, NCONST IF (ALPHA(I) .GT. 0.0) THEN 1,IFUTC) = AQCO(I 1 ,IFUTC) = SOCO(I IMSWIT.E0.-1) GO TO 120 AQCO(I SOCO(I AQCO(I,NUMX,IFUTC) SOCO(I,NUMX,IFUTC) ENDIF CONTINUE DO 100 1 = 2 , (NUMX - 1) DO 90 J = 1, NCONST IF (ALPHA(J) .GT II = I - 1 AQCO(J,I,IFUTC) INOWC) INOWC) AQCO(I,NUMX,INOWC) SOCO(I,NUMX,INOWC) 0.0) THEN = AOCO(J,I,INOWC) AQCO(d,I, + INOWC)) 90 ((AOCO(d,II,INOWC) (S I Z E X ( I - I ) / ( ( S I Z E X ( I - I ) + S I Z E X ( I ) ) * 2.0))) SOCO(d,I,IFUTC) = SOCO(d,I,INOWC) + ((SOCO(d,II,INOWC) - SOCO(d,I,INOWC) ) * (S I Z E X ( I - I ) / ( ( S I Z E X ( I - I ) + SIZEX(I) * 2 . 0 ) ) ) ) ENDIF CONTINUE 100 120 210 220 CONTINUE CALL UPDATE(IMSWIT) NOW PRINT PREDICTIONS - PRINT COMPOSITIONAL DATA ONLY IF NECESSARY IF ((ICSWIT .NE.-1 .OR. IMSWIT.NE.-1) .AND. IUPDT .EO, 0) THEN ISTART = 1 IFIN = ISTART + 7 IF (IFIN.GT.NCONST) IFIN = NCONST WRITE(6,1005) TAUC WRITE(6,1003) (FLNAME(I),1 = 1 START,IFIN) DO 220 J = 1, NUMX WRITE(6, 1004) J, (AQCOd.d,IFUTC),I = ISTART,IFIN) CONTINUE ISTART = IFIN + 1 IF (ISTART.LE.NCONST) GO TO 210 ho 230 240 ISTART = 1 IFIN = ISTART + 7 IF (IFIN.GT.NCONST) IFIN = NCONST WRITE(6,1007) TAUC WRITE(6,1003) (FLNAME(I),I=ISTART,IFIN) DO 240 J = 1, NUMX WRITE(6,1004) J , (SOCO(I,d,IFUTC),I=ISTART,IFIN) CONTINUE ISTART = IFIN + 1 IF (ISTART.LE.NCONST) GO TO 230 ENDIF 300 IF (IUPDT .EQ. 0) THEN WRITE(6,1011) TAUC WRITE(6,1008) (CELLPO(I,IFUTC), 1 = 1 , NUMX) WRITE(6,1012) TAUC WRITE(6,1001) (CELLPE(I,IFUTC), I = 1, NUMX) ENDIF RETURN 1000 FORMATC1 COMPOSITION, POROSITY AND PERIMIABILTY AT: 8X,'PRESSURE STEP NUMBER: ',18,/, 52X,'TEMPERATURE STEP NUMBER: ',18,/, 49X,'COMPONENT FLOW STEP NUMBER: ',18,//. TIME OF OUTPUT (SEC): '.E12.5,/, ' TEMPERATURE TIME STEP (SEC): '.E12.5) N3 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 101 1 1012 1013 1014 1015 1016 FORMAT(10(1X.E12.5)) FORMATC//,' NUMBER OF MOLES OF EACH OF THE FLUID COMPONENTS' ' PER LITER FOR THE AQUEOUS SPECIES ARE: ',/) F0RMAT(3X, 'NODE: ' ,2X,8(3X,A8,4X)) FORMATC1X,I5,1X,8(3X,E12.5)) FORMATC//,' PREDICTED NUMBER OF MOLES OF EACH OF THE FLUID', ' COMPONENTS PER LITER OF FLUID', ' FOR TIME: '.E12.5,' SEC. ARE: ',/) FORMATC//,' NUMBER OF MOLES OF EACH OF THE FLUID COMPONENTS' ' IN THE SOLID PHASES ARE : ',/) FORMATC//,' PREDICTED NUMBER OF MOLES OF EACH OF THE FLUID', ' COMPONENTS IN THE SOLID PHASES', ' FOR TIME: '.E12.5,' SEC. ARE: ',/) FORMATC10(3X,F10.5)) FORMATCO POROUSITIES AT THE NODES FOR TIME ',E12.5, ' SEC. ARE:',/) FORMATCO PERM I ABILITIES AT THE NODES FOR TIME ',E12.5, ' SEC. ARE:',/) FORMATC'O PREDICTED POROUSITIES AT THE NODES FOR TIME ', E12.5,' SEC. ARE:',/) FORMATC'0 PREDICTED PERMIABILITIES AT THE NODES FOR TIME ', E12.5, ' SEC. ARE: ',/) FORMATC' MAX. ERROR (PERCENT): ' MAX. NUMBER OF ITERATIONS IS: FORMAT(I/, 1 FLOW COMP',6X,'PERCENT ERROR' FORMATC ',A8,8X,F12.8,5X.14) FORMATC10(1X,F12.8)) END SUBROUTINE OUTP(ISTEPP,IPSWIT, IUPDT) THIS ROUTINE PRINTS THE PRESSURES AT EACH NODE AND THE VELOCITIES IN EACH CELL. IT PREDICTS THE VALUES FOR THE NEXT TIME STEP COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2 ) , CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TRANS/ VEL0C(51,2), AQCOC10,51,2), SOCO(10,51,2 ) , ALPHAC10), INOWC, IFUTC COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 .F12.8,/, ,15) ,7X,'ITERATIONS') K = NUMX - 1 IF (ISTEPP.EQ.O .OR. IPSWIT.NE. X = ERRMAX(1) * 100.0 Y = ERROR( 1 ) * 100.0 •1) THEN WRITE(6,1000) ISTEPP, TAUP, DTAUP, X, LIML0P(1), Y, L0PT0T(1 ) WRITE(7,1003) TAUP, DTAUP t o r o 100 1 10 WRITE(6,1001) WRITE(6,1002) (CELLP(I,IFUTP), 1=1,NUMX) WRITE(7,1003) (CELLP(I,IFUTP), 1=1,NUMX) WRITE(6,1004) WRITE(6,1003) (VELOC(I,IFUTP),1=1,K) WRITE(7,1003) (VELOC(I,IFUTP),1=1,K) ENDIF PREDICTION FOR THE NEXT TIME STEP. I = IFUTP IFUTP = INOWP INOWP = I TAUP = TAUP + DTAUP IF (IPSWIT.NE.-1) THEN CALL NEW(TAUP, VALUE, 1) CELLP(1.IFUTP) = VALUE CELLP(NUMX, IFUTP) = CELLP(NUMX, INOWP) DO 100 I = 2, K CELLP(I, IFUTP) = CELLP(I, INOWP) CELLP(I, IFUTP) = CELLP(I, INOWP) + ( ( C E L L P ( I - 1, IFUTP) - CELLP(I+1, INOWP)) * ( S I Z E X ( I - I ) / ( S I Z E X ( I - I ) + S I Z E X ( I ) ) ) ) CONTINUE ELSE IF (ISTEPP .EQ. 0) THEN DO 110 I = 2, NUMX CELLP(I, IFUTP) = CELLP(I, INOWP) CONTINUE ENDIF OUTPUT PREDICTIONS IF (IUPDT .EQ. 0) THEN WRITE(6,1005) TAUP WRITE(6,1002) (CELLP(I,IFUTP) , ENDIF 1=1,NUMX) RETURN 1000 FORMATC1 PRESSURE OUTPUT AT PRESSURE STEP NUMBER: TIME OF CALCULATION (SEC): ',E12.5,/, PRESSURE TIME STEP (SEC): '.E12.5,//, 12X,' PERCENT ERROR LIMIT: '.F12.8, 4X,'MAX. NUMBER ITERATIONS: ',15,/, 18,//, 12X,' PERCENT ERROR USED : '.F12.8, 3X,'TOTAL NUMBER ITERATIONS: ',15) 1001 FORMAT(//,' PRESSURES (MPA) AT THE NODES ARE : ',/) 1002 FORMAT(10(3X,F10.2)) 1003 FORMAT(10(1X,E12.5)) 1004 FORMAT(//' VELOCITIES (M/SEC) BETWEEN EACH NODE ARE: ',/) 1005 FORMAT(//,' PREDICTED PRESSURES (MPA) AT THE NODES', ' FOR TIME: '.E12.5,' SEC. ARE:',/) END SUBROUTINE OUTT(ISTEPP,ISTEPT,ITSWIT, IUPDT) : THIS ROUTINE PRINTS THE TEMPERATURES AT EACH NODE AND : PREDICTS THE TEMPERATURE FOR THE NEXT STEPS COMMON /DIVINE/ ERR0R(55), ERRMAX(3) , L0PT0T(55), LIML0P(3) N> — I INOWP, DTAUC, IFUTP, DTAUM, COMMON /CELLS/ CELLP0(51,2) CELLT(51,2), THICK, NUMX, COMMON /TIME/ DTAUP, DTAUT, TAUM, W1 IF (ITSWIT.NE.-1 .OR. ISTEPT.EQ.O) THEN X = ERRMAX(2) * 100.0 Y = ERROR(2) * 1O0.0 WRITE( 6,1000) ISTEPP, ISTEPT LIML0P(2), Y, L0PT0T(2) WRITE( 8.1003) TAUT, DTAUT CELLPE(51 ,2), CELLP(51,2), DENSF(51,2), SIZEX(51), XINERT(51), INOWT, IFUTT TAUP, TAUT, TAUC, TAUT, DTAUT, X, WRITE( 6,1001) WRITE( 6,1002) (CELLT(I,IFUTT) , I = 1,NUMX) WRITE( 8,1003) (CELLT(I,IFUTT), 1=1,NUMX) ENDIF NOW PREDICT THE NEW TEMPERATURES I = IFUTT IFUTT = INOWT INOWT = I TAUT = TAUT + DTAUT CALL NEW( TAUT, CELLT(1, IFUTT), 2) CELLT(NUMX, IFUTT) = CELLT(NUMX, INOWT) IF (ITSWIT .NE. -1) THEN DO 100 1 = 2 , (NUMX - 1) CELLT(I, IFUTT) = CELLT(I C E L L T O , IFUTT) = CELLT( I - CELLT(I IF (CELLT(I,IFUTT) .GT IFUTT) = IF (I, CELLT(I, (CELLT(I, CELLT( I , IFUTT) IFUTT) . LT . INOWT) INOWT) + ((CELLT(I-INOWT)) / 1.5) CELLT(1.IFUTT) ) CELLT(1,IFUTT) CELLT(NUMX,IFUTT)) CELLT(NUMX,IFUTT) 1, INOWT) ho CO 100 1 10 1000 1001 1002 1003 1004 CONTINUE ELSE DO 110 I = CELLT(I, CONTINUE ENDIF 2, (NUMX IFUTT) = - D CELLT(I, INOWT) NOW PRINT PREDICTIONS IF (IUPDT WRITE( WRITE( ENDIF RETURN FORMAT('1 26x! .EQ. 0) THEN 6.1004) TAUT 6.1002) (CELLT(I,IFUTT). 1=1,NUMX) TEMPERATURE OUTPUT AT: ' PRESSURE STEP NUMBER: ',18,/, TEMPERATURE STEP NUMBER: ',18,//, TIME OF OUTPUT (SEC): '.E12.5,/, TEMPERATURE TIME STEP (SEC): '.E12.5,//, 12X 4X 12X 3X FORMAT(//, FORMAT(10( FORMAT(10( FORMAT(//, END SUBROUTINE PERCENT ERROR LIMIT: '.F12.8, MAX. NUMBER ITERATIONS: ',15,/, PERCENT ERROR USED : '.F12.8, TOTAL NUMBER ITERATIONS: ',15) ' TEMPERATURES (K) AT THE NODES ARE : ',/) 3X.F10.2)) 1X.E12.5)) ' PREDICTED TEMPERATURES (K) AT THE NODES FOR' ' TIME ' .E12.5,' SEC. ARE : ',/) PATCAL(ITERP, ITERT, ITERC, ITERM, INODE) THIS ROUTINE IS RESPONSIBLE FOR THE MASS TRANSFER CALCULATIONS IT LOADS THE ARRAYS AND CALLS THE STEPING AND PRINTING ROUTINES COMMON BLOCKS PREVIOUSLY DEFINED COMMON /PATH/ C(25), CMOLE(IO), XMNOW(10), XMFUT(10), REAMT(5), TKNOW, TKFUT, TAUNOW, TAUFUT, PNOW, PFUT, EMAX, STRONG, AMWAT, DTAU, DTK, DPRES, IP0INT(25), INDREA(5), NUM, IPRINT, NUMREC COMMON /NEWCOM/ CNEWAO(10,25), CNEWPH(10,25), CNEWSS(10,20), CNEWG(10,10), INDX1(10), INDX2(10), INDX3(10), NUMELE LOCAL ARRAYS DERIV CONTAINS THE FIRST FOUR DERIVATIVES OF THE LOG MOLALITY OF THE COMPONENTS AND AQUEOUS SPECIES, OF THE IONIC STRENGTH, OF THE ACTIVITY OF WATER, AND OF THE NUMBER OF MOLES OF THE SOLID PHASES WHICH ARE PART OF THE COMPONENT BASIS. GRAND - CONTAINS THE INVERSE OF THE GRAND MATRIX. THIS MATRIX IS THE SAME FOR ALL LEVELS OF DERIVATIVES DIMENSION GRAND(40,40), DERIV(40,4), DXM(10) CALL MINIT(DERIV, 40, 4, O.OEOO) CALL MINIT(DXM, 10, 1, O.OEOO) DTAU = TAUFUT - TAUNOW DTK = TKFUT - TKNOW DPRES = PFUT - PNOW DO 10 I = 1, NUMELE DXM(I) = XMFUT(I) - XMNOW(I) CONTINUE THIS ROUTINE LOOPS BACK TO THIS STATEMENT UNTIL THE COMPLETE STEP IS TAKEN LOOP = 0 SET UP GRAND MATRIX AND INVERT (USE PARTIONING METHOD DESCRIBED IN THESIS CALL LEFT(GRAND, 40) IF THE STEP IS TOO LARGE, COME BACK TO HERE SET UP RIGHT HAND SIDE FOR DERIVATIVES AND SOLVE CALL DER(GRAND, DERIV, NDIR, 40, 4) TAKE STEP - IF NOT OK, REDUCE SIZE AND TRY AGAIN LOOP = LOOP + 1 CALL STEP(DERIV, 40, 4, NDIR, IOK) IF (IOK .NE. 0 .AND. LOOP .LT. 100) THEN DTAU = DTAU / 2.0E00 DTK = DTK / 2.0E00 DPRES = DPRES / 2.0E00 DO 180 1 = 1 , NUMELE DXM(I) = DXM(I) / 2.0E00 CONTINUE GO TO 150 ELSE IF (IOK .NE. 0 .AND. LOOP .GE. 100) THEN WRITE (6, 1001) LOOP STOP ENDIF CHECK FOR SUPERSATURATION - IF NOT SUPERSATURATED, PRINT - IF SUPERSATURATED, FIND PHASE BOUNDARY ADD PHASE TO MATRIX, PRINT CALL SATCHK(ISAT) IF (ISAT.NE.O) CALL SETSAT CALL PATOUT(ITERP, ITERT, ITERC, ITERM) TAUNOW = TAUNOW + DTAU TKNOW = TKNOW + DTK PNOW = PNOW + DPRES DO 210 J = 1, NUMELE XMNOW(d) = XMNOW(J) + DXM(d) CONTINUE IF ((TAUNOW+DTAU) .LT. TAUFUT .AND. TAUNOW+(2.0*DTAU) .LT. TAUFUT) THEN DTAU = TAUFUT - TAUNOW DTK = TKFUT - TKNOW DPRES = PFUT - PNOW DO 220 d = 1, NUMELE DXM(d) = XMFUT(d) - XMNOW(d) CONTINUE ENDIF IF (TAUNOW .LT. TAUFUT) GO TO 100 RETURN FORMAT(' *************** ',//, ' ',15,' ITERATIONS MADE REDUCING THE STEP SIZE ',/, ' RUN TERMINATED AS STEP SIZE IS NOW TOO SMALL ',//) END SUBROUTINE SAQU( STP, SZERO, C1, C2, THETA, A3, A4, W, YPT, YPRTR, TK, P) THIS ROUTINE CALCULATES THE THIRD LAW ENTROPY OF AN AQUEOUS SPECIES USING EQUATION 274 FROM HELGESON, KIRKHAM AND FLOWERS, AdS 281, P. 1412 (1981). RETURNED: STP - CALCULATED ENTROPY AT T AND P PASSED: C1, C2, A3, A4, THETA, W, YPT, YPRTR - PARAMETERS IN EQUATION. SEE TEXT FOR DETAILS. SZERO - THIRD LAW ENTROPY AT TR, PR P - PRESSURE IN MEGA-PASCALS TK - TEMPERATURE IN DEG K. NOTE: UNITS USED ARE dOULES AND MEGA-PASCALS, NOT CALORIES AND BARS AS IN HELG. ET. AL. REAL STP, SZERO, C1, C2, THETA, A3, A4, W, YPT, YPRTR REAL TR, TK, P, PR PR = 0.1E00 TR = 298.15E00 STP = SZERO + ( C l * ALOG((TK/TR))) + (C2 * ALOG(( (TK - THETA)/(TR - THETA)))) + (THETA * ((2.0 * A3 * (P - PR)) + (A4 * ( p * * 2 - PR**2))) / (2.0E00 * ((TK - THETA)**2)) ) + (W * (YPT - YPRTR)) RETURN END SUBROUTINE SATEMP(P,TM) INTERVAL HALF TO CALCULATE SATURATION TEMPERATURE FOR A GIVEN PRESSURE. DOUBLE PRECISION TA, TB, TM, PC, PSATD ro to 200 PC= 21.66D0 IF (P .GT. PC) IF (P .GT. PC) TA= 0.0 TB= 370.74 DO 200 d=1,25 TM= (TA + PM= PSATD(TM) IF (PM .LE.P) TA TM= 0.0 RETURN TB ) / 2.0 TM IF (PM .GT. P) TB= TM CONTINUE RETURN END SUBROUTINE UPDATE(IMSWIT) THIS ROUTINE UPDATES THE POROSITY AND PERMIABILITY COMMON BLOCKS PREVIOUSLY DEFINED COMMON /DIVINE/ ERR0R(55), ERRMAX(3), L0PT0T(55), LIML0P(3) COMMON /CELLCH/ CHEM(10,51), T0TALM(10,51), STRNGH(51 ) , WATER(51), INDEX1(10,51), INDEX2(10,51 ) , INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /CELLS/ CELLPO(5 1 ,2 ) , CELLPE(5 1 ,2 ) , CELLP(51,2), DENSF(51,2), SIZEX(51), XINERT(51), INOWP, IFUTP, INOWT, IFUTT DTAUC, DTAUM, CELLT(51,2) THICK, NUMX COMMON /TIME/ DTAUP, DTAUT TAUM, W1 COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2) ALPHA(10), INOWC. IFUTC COMMON /REACT/ REACTA(5,51), IREACT(5,51) TAUP, TAUT, TAUC, SOCO(10,51,2), NUMREA(51) COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ ho 170 180 CELLPE( CELLPE( CELLPO( CELLPO( DENSE ( DENSF ( DO 200 TK 1 , NUMX 1 , NUMX 1 , NUMX I = IFUTC) = IFUTC) = IFUTC) = IFUTC) = IFUTC) = IFUTC) = !, (NUMX -((C E L L T ( I , INOWC) INOWC) INOWC) INOWC) INOWC) INOWC) PRES CALL DENS INOWT)) INOWP)) STP, EQCON, D2VDT2, O) CELLPE( 1 , CELLPE(NUMX, CELLPO(1, CELLPO(NUMX, DENSF(1, DENSF(NUMX, 1) IFUTT) - CELLT(I, * DTAUC / DTAUT) + CELLT(I, INOWT) = ( ( C E L L P ( I , IFUTP) - CELLP(I, * DTAUC / DTAUP) + CELLP(I, INOWP) H20(PRES, TK, VOL, GIBBS, HTP, CV, DVDT, DVDP, F(I.IFUTC) = 1.OEOO / VOL AMOUNT = O.OEOO DO 170 J = 1, NCONST K2 = INDEX2(J,I) IF (K2.EQ.1) THEN K1 = INDEX1(J,I) SUM VOLUMES CALL VMIN (X, THERPH(4,K1), THERPH(13,K1), TK, PRES) AMOUNT = AMOUNT + (CHEM(d.I) * X) ENDIF CONTINUE SUM IN VOLUMES OF REACTANTS IF (NUMREA(I).GT.0) THEN DO 180 d = 1, NUMREA(I) K1 = IREACT(d.I) CALL VMIN (X, THERPH(4,K1), THERPH(12,K1), THERPH(13,K1), TK, PRES) AMOUNT = AMOUNT + (REACTA(J,I) * X) CONTINUE ENDIF CONVERT TO METERS AND FIND FACTOR - NORMALIZE AMOUNT = AMOUNT * 1.0E-06 d = I KK = d - 1 THERPH(12,K1 ) , IF (KK.LT. 1) KK = d IF (d.GE.NUMCHM) d = KK VOLUME = (THICK**2) * (SIZEX(d) + SIZEX(KK ) )/2 . 0 CELLPO(I,IFUTC) = ((VOLUME * (1.0 - XINERT(I))) - AMOUNT) / VOLUME CELLPE(I,IFUTC) = CELLPE(I, INOWC) * CELLPO(I, IFUTC) / CELLPO(I, INOWC) CONTINUE RETURN END SUBROUTINE VAQU(VTP, A1, A2, A3, A4, THETA, 0, W, TK, P) THIS ROUTINE CALCULATES THE VOLUME OF AN AQUEOUS SPECIES USING EQUATION 253 FROM HELGESON, KIRKHAM AND FLOWERS, AdS 281, P. 1409 (1981). RETURNED: VTP - CALCULATED VOLUME AT T AND P PASSED: A1, A2, A3, A4, THETA, W, Q - PARAMETERS IN EQUATION. SEE TEXT FOR DETAILS. P - PRESSURE IN MEGA-PASCALS TK - TEMPERATURE IN DEG K. NOTE: UNITS USED ARE dOULES AND MEGA-PASCALS, NOT CALORIES AND BARS AS IN HELG. ET. AL. REAL VTP, A1, A2, A3, A4, THETA, Q, W, TK, P VTP A1 + (A2 * P) - (W * Q) + ( ( ( A 3 * TK) + (A4 * TK * P)) / (TK - THETA)) RETURN END SUBROUTINE VEL THIS ROUTINE CALCULATES THE DARCY VELOCITY OF THE FLUID IN EACH OF THE ELEMENTS. COMMON /CELLS/ CELLPO(51,2 ) , CELLPE(51,2 ) , CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ ro LO -P-100 c c c c c c c c c c c c c c c DO 100 I = 2, NUMX II = I - 1 PRES = (CELLP(I, IFUTP) + CELLP(II,IFUTP) ) / 2.0 PERM = (CELLPE(I ,INOWC) + CELLPE(II,INOWC)) X (CELLPE(I ,IFUTC) + CELLPE(II,IFUTC)) - PERM PERM = PERM / 2 .0 X X / (2.0 * DTAUC) PERM = PERM + (X * DTAUP) TEMP = (CELLT(I , INOWT) + CELLT(11,INOWT)) X (CELLT(I , IFUTT) + CELLT(II,IFUTT)) - TEMP TEMP = TEMP / 2 .0 X X / (2.0 * DTAUT) TEMP = TEMP + (X * DTAUP) X SIZEX(II ) CALL H20(PRES, TEMP, D2, G2, HTP, STP, DVDT, DVDP, D2VD2T, 0) D2 = 1.OEOO / D2 CALL VISC(VIS2, TEMP, D2) EOCON, CV, VELOC(II,IFUTP) VELOC(II,IFUTP) VELOC(II,IFUTP) CONTINUE RETURN END SUBROUTINE VMIN(VTP, PERM / VIS2 (-1.0E06) * VELOC(II,IFUTP) (CELLP(I,IFUTP) VELOC(II,IFUTP) / X CELLP(II,IFUTP)) P) VZERO, DVDT, DVDP, THIS ROUTINE CALCULATES THE VOLUME OF A SOLID PHASE AT T AND P USING: V(T,P) = V(TR.PR) + (DV/DT) (T - TR) + (DV/DP) (P - PR) RETURNED VARIABLE: PASSED VARIABLES: LOCAL VARIABLES TR = 298 . 15 PR =0.1 VTP = VZERO + VTP VOLUME AT T AND P VZERO - VOLUME AT TR AND PR DVDT - (DV/DT) AT CONSTANT P DVDP - (DV/DP) AT CONSTANT T T - TEMPERATURE IN K P - PRESSURE IN MPA TR PR 298.15 DEG. K 0.1 MPA (DVDT * (T - TR)) + (DVDP * (P - PR)) RETURN END SUBROUTINE VISC(V,TK,DENS) C C ROUTINE TO CALCULATE THE VISCOSITY OF WATER AND STEAM. C FORMULA AND CONSTANTS FROM WATSON, BASU AND SENGERS, C AN IMPOROVED REPRESENTATIVE EQUATIONS FOR THE DYNAMIC C VISCOSITY OF WATER SUBSTANCE. <J. PHYS. CHEM. REF. DATA C VOL 9, NO.4, 1980. P 1255. C THIS ROUTINE IS ONLY ACCURATE OUTSIDE OF A REGION BOUNDED BY C 645.30K < T < 652.55K AND .240 < DENSITY < .410 G/CM3 C C AS FEW GEOLOGICAL SOLUTIONS ARE IN THIS REGION, IT WAS NOT C THOUGHT NECESSARY TO ADD THIS CORRECTION TERM. C THE CORRECTION TERM WOULD INVOLVE CONSIDERABLE CPU C TIME AND ADD CONSIDERABLE LENGTH TO THE ROUTINE. C C PROGRAMMED 9/2/83 E.H. PERKINS C £ C INPUT: TK TEMPERATURES IN DEG. KELVINS Ln C DENS DENSITY IN KG/M3 C C OUTPUT: V VISCOSITY PA SEC C DIMENSION A ( 4 ) , C0EF(6,7) TR = 647.27 DENR = 317.763 A(1) = 0.0181583 A(2) = 0.0177624 A(3) = 0.0105287 A(4) = -0.0036744 CALL MINIT(C0EF, 6, 7, O.OEOO) COEF( 1,1) = 0, .5132047 C0EF(2,1) = 0. .3205656 C0EF(5, 1 ) = -o . , 7782567 C0EF(6,1 ) = 0, . 1885447 COEF(1,2) = 0. .2151778 C0EF(2,2) = 0. .7317883 C0EF(3,2) = 1 . ,241044 C0EF(4,2) = 1 . .476783 C0EF(1,3) = - o . 2818107 C0EF(2,3) = -1 . 070786 C0EF(3,3) = -1 . 263184 30 N> ON C0EF(1,4) = 0. .1778064 C0EF(2,4) = 0. .4605040 C0EF(3,4) = 0. .2340379 C0EF(4,4) = -o. 4924179 C0EF(1,5) = -o. 04176610 C0EF(4,5) = 0. 1600435 C0EF(2,6) = -0. .01578386 C0EF(4,7) = -0. .003629481 T = TK / TR X = (T**( -1 ) ) - 1 .0 D = DENS / DENR Y = D - 1 .0 THE LOW DENSITY LIMIT OF SUM1 = 0. 0 DO 30 II = 1,4 I = II -- i VISCOSITY (AS P > O ) SUM1 CONTINUE SUM1 = 1 . 0 / SUM1 = SUM 1 i = SUM1 + ( A ( I I ) / ( T * * I ) ) SUM1 (SQRT(T)) ,JO).EO.O.OEOO) GO TO 40 (COEF(II,J0) (X**I) * ( Y * * J ) ) VISCOSITY OUTSIDE OF THE CRITICAL REGION SUM2 = O.OEOO DO 50 II = 1, 6 I = II - 1 DO 40 JO = 1, 7 IF (COEF(II, J = J J - 1 SUM2 = SUM2 40 CONTINUE 50 CONTINUE SUM2 = EXP((SUM2 * D)) V = SUM2 * SUM1 * (1.0E-6) RETURN END SUBROUTINE WFNS (RHO,TAU,W,M) DOUBLE PRECISION RH0M1(10), RH0M2(10), RH0M3, TAUM(10), E DOUBLE PRECISION C(10,10), RHO, TAU, W(5,5), GRST, DEXP, 1 AA, AB, AC, RONE, EXPE, RMC, TMC , T25, TM(5), RM(5) DO 1 0=1,5 DO 1 1=1,5 W(I,0)=0. GO TO (15,20.30,30),M READ EQUATION DATA 15 OMAX = 7 IMAX = 10 C 15 READ(17,13) JMAX,IMAX C PRINT 13,JMAX,IMAX C PRINT 160 JMAX = 7 11 = 8 12 = 2 C READ(17,111) JMAX,11,12 C PRINT111,JMAX,11 , 12 E = 4.8 RH0M3= 0.0 C READ(17,10) E.RH0M3 C PRINT1O,E,RH0M3 RH0M1(1) = 634 RH0M1(2) = 1.0 RH0M1(3) = 1.0 RH0M1(4) = 1.0 RH0M1(5) = 1.0 RH0M1(6) = 1.0 £ RH0M1(7) = 1.0 C READ(17,10) (RH0M1 (I ) , 1 = 1 ,7) C PRINT 10,(RH0M1(I),1 = 1,7) DO 9876 1 = 1 , 7 RH0M2(I) = 0.0 9876 CONTINUE C READ(17,10) (RH0M2(I),1=1,7) C PRINT 10,(RHQM2(I),I = 1,7) TAUM(1) = 1.545 TAUM(2) = 2.5 TAUM(3) = 2.5 TAUM(4) = 2.5 TAUM(5) = 2.5 TAUM(6) = 2.5 TAUM(7) = 0.0 C READ(17,10) (TAUM(I),I=1,7) C(1,1) = 0.1508935547E+02 C(2,1) = -.7210865784E+02 C(3,1) = O.1524410858E+03 C(4,1) = -.2000392914E+03 C(5,1) = 0.1932660828E+03 C(6,1) = -.1421213989E+03 C(7,1) = 0.7826339722E+02 C(8,1) = -.2260081482E+02 C(9,1) = -.2293457642E+03 C(10,1) = -.2249741058E+03 C(1,2) = -.1126399040E+01 c ( 2 , 2 ) = - 8 3 2 5 2 1 2 4 7 9 E + 0 1 c 3 , 2 ) = 0 1 7 5 9 5 6 2 6 8 3 E + 0 2 c 4 , 2 ) = - 1 6 5 9 4 0 0 9 4 0 E + 0 2 c 5 , 2 ) = 0 5 6 0 3 1 6 5 6 2 7 E + 0 1 c 6 , 2 ) = 0 1 2 7 4 0 7 3 3 3 4 E + 0 3 c ( 7 , 2 ) = 0 9 3 2 1 6 3 3 9 1 1 E + 0 2 c ( 8 , 2 ) = 0 7 6 9 8 5 5 4 9 9 3 E + 0 2 c ( 9 , 2 ) = 0 4 9 1 1 7 4 3 1 6 4 E + 0 2 c ( 1 0 , 2 ) = - . 4 0 8 3 4 8 1 4 4 5 E + 0 3 c ( 1 . 3 ) = 0 6 2 4 8 4 0 8 3 1 8 E + 0 1 c ( 2 , 3 ) = - 2 5 8 7 3 6 2 6 7 1 E + 0 2 c 3 . 3 ) = 0 5 0 2 8 7 6 8 9 2 1 E + 0 2 c 4 , 3 ) = - 6 4 6 5 4 7 3 9 3 8 E + 0 2 c 5 , 3 ) = 0 0 c 6 , 3 ) = 0 0 c 7 , 3 ) = 0 0 c 8 , 3 ) = 0 0 c 9 , 3 ) = - 1 5 5 2 6 0 4 2 1 8 E + 0 3 c 1 0 , 3 ) = -- . 6 5 3 3 6 1 5 7 2 3 E + 0 3 c 1 , 4 ) = 0 7 5 1 1 5 3 2 3 0 7 E + 0 0 c 2 , 4 ) = - 2 6 4 1 2 5 3 4 7 1 E + 0 1 c 3 , 4 ) = 0 4 8 4 9 1 4 7 7 9 7 E + 0 1 c 4 , 4 ) = 0 3 3 9 5 5 1 6 3 9 6 E + 0 1 c 5 , 4 ) = 0 0 c 6 , 4 ) = 0 0 c 7 , 4 ) = 0 0 c 8 , 4 ) = 0 0 c 9 , 4 ) = - 4 0 1 2 1 2 3 1 0 8 E + 0 1 c 1 0 , 4 ) = -- . 8 0 9 3 4 0 5 1 5 1 E + 0 2 c 1 , 5 ) = - 2 3 6 0 8 5 6 0 5 6 E + 0 1 C ( 2 , 5 ) = 0 9 4 0 3 0 6 8 5 4 2 E + 0 1 c 3 , 5 ) = - 1 8 8 7 0 1 9 3 4 8 E + 0 2 C ( 4 , 5 ) = 0 2 2 9 9 5 7 4 2 8 0 E + 0 2 C ( 5 , 5 ) = 0 0 C ( 6 , 5 ) = 0 0 C l 7 , 5 ) = 0 0 C ( 8 , 5 ) = 0 0 c 9 , 5 ) = 0 5 5 5 9 0 9 5 7 6 4 E + 0 2 c 1 0 , 5 ) = 0 . 2 2 9 7 2 9 7 0 5 8 E + 0 3 c 1 , 6 ) = - 1 0 4 1 7 5 8 5 3 7 E + 0 1 C ( 2 , 6 ) = 0 4 1 4 3 7 2 1 5 8 1 E + 0 1 C ( 3 , 6 ) = - 7 8 6 0 2 6 0 9 6 3 E + 0 1 C ( 4 , 6 ) = 0 5 7 9 3 3 9 2 1 8 1 E + 0 1 C ( 5 , 6 ) = 0 0 C ( 6 , 6 ) = 0 0 C ( 7 , 6 ) = 0 0 C(8,6) = 0.0 C(9,6) = 0.1863822937E+02 C(10,6) = 0.1088137970E+03 C(1,7) = -.1080222130E+00 C(2,7) = 0.4030921459E+00 C(3,7) = -.4694258571E+00 C(4,7) = 0.1748328283E-01 C(5,7) = 0.0 C(6,7) = 0.0 C(7,7) = 0.0 C(8,7) = 0.0 C(9,7) = 0.6496112347E+00 C(10,7) = 0.1228528786E+02 DO 2 d=1,dMAX READ(17,3) (C(I,d),I=1,IMAX) 2 CONTINUE RETURN SHORT VERSION W11.W12.W21 ONLY CONTINUE RMC = RHO-RHOM 1 ( 1 ) TMC=TAU-TAUM(1 ) T25=TAU-TAUM(2) EXPE=DEXP(-E *RHO) RONE=RHO-RH0M1(2) DO 44 d = 2,7 AB=0. AC=0. DO 41 1=2,4 AA=C(I,J)*RONE**(1-2) AB=AB+AA*RONE AC=AC+AA*(1-1) AA=EXPE*(C(9,d)+RH0*C(10,J)) AB=AB+AA+C(1,d) AC=AC+EXPE*C(10,J)- E *AA AA=T25**(d-2) W( 1 , 1 )=W(1,1)+AB*AA W(2,1)=W(2,1)+AC*AA W(1,2)=W(1,2)+AB*AA*(1.+TMC*(d-2)/T25) DO 42 1=5,8 AA=C(I,2)*R0NE**(I-2) W( 1 ,1)=W(1, 1)+AA*RONE W(1,2)=W(1,2)+AA*R0NE W(2,1)=W(2.1)+AA*(I-1) W( 1 , 1 )=W(1,1)*TMC W(2,1)=W(2,1)*TMC DO 43 1=2,8 AA=C(I, 1 )*RMC**(1-2) W(1,1)=W(1, 1)+AA*RMC 43 W(2, 1)=W(2,1 )+AA*(I-1 ) AA=EXPE*(C(9,1)+RHO*C(10,1 ) ) W(1, 1)=W(1, 1 )+C( 1 , 1)+AA W(2,1)=W(2,1)+EXPE*C(10,1)- E *AA W( 1 , 1)=W(1,1)*RH0 W(2,1)=W(2,1)*RH0**2 W(1,2)=W(1,2)*RH0*TAU RETURN C LONG VERSION USING GRST ALL W OR OS 30 KE=4 LE = 3 DO 11 d=1,dMAX TM(1)= GRST(I , d ,RHO,TAU,3, * UMAX,I 1,12,E,RH0M3, RH0M1,RH0M2,TAUM) TM(2)=GRST(I,d,RHO,TAU,6. * UMAX,I 1,12,E.RH0M3, RHOM1,RH0M2,TAUM) TM(3)=GRST(I,d,RHO,TAU,9, * dMAX,I1,I2,E,RH0M3, RHOM1,RH0M2,TAUM) DO 11 1=1,IMAX RM(1)=GRST(I,d,RHO,TAU,4, * UMAX,11,I2,E,RH0M3, RHOM1,RH0M2,TAUM) RM(2)=GRST(I,d,RHO,TAU,5, * UMAX,I 1,12,E,RH0M3, RHOM1,RH0M2,TAUM) GO TO (22,22,23,23),M 23 RM(3)=GRST(I,d,RH0,TAU,7, * UMAX,11,I2.E.RH0M3, RHOM1,RH0M2,TAUM) RM(4)=GRST(I,d,RHO,TAU,8, * JMAX,I1,I2,E,RH0M3, RHOM1,RH0M2,TAUM) 22 DO 11 K=1,KE DO 11 L=1,LE 1 1 W(K,L)=W(K,L) +C ( I , d ) *RM( K ) *TM( I.) GO TO (40,40,35,40),M C FOR W 35 DO 12 K=1,KE DO 12 L=1,LE 12 W(K,L)=W(K,L)*RH0**K*TAU**(L-1) C FOR 0 40 RETURN 13 FORMAT (1013) 3 FORMAT(5D16.10) 150 FORMATC '.6F15.6) 101 F0RMAT(8F1O.O) 4 FORMAT (//) 160 FORMAT (//) 111 FORMAT (1013) 10 FORMAT (7D10.3) END . DOUBLE PRECISION FUNCTION GRST (I,d,RHO,TAU,L, * dMAX,I 1,12,E,RH0M3, RHOM1,RH0M2,TAUM) C L=1 INIT, 2 GRST=ZERO , 3 TAU FN, 4 RHO FN, 5 DERIV RHO FN C 6 DERIV TAU FN, 7 2ND DERIV RHO FN, 8 3RD DERIV RHO FN C 9 2ND DERIV TAU FN DOUBLE PRECISION RHOM1(10), RH0M2(1O), RH0M3, TAUM(10), RHO DOUBLE PRECISION EXPE, EXPEM, E, DRHO, EXPK, DEXP, TAU GRST= 1 . GO TO (1,2,3,4,5,6,7,8,9),L 1 CONTINUE 2 GRST=0 RETURN 3 IF (d-2) 30,31,32 32 GRST=EXPK(TAU-TAUM(2),d-2) 31 GRST=GRST*(TAU-TAUM(1)) 30 RETURN 6 IF (d-2) 2,30,62 62 GRST= ((TAU-TAUM(1))*EXPK(TAU-TAUM(2),d-3)*(d-2) 1 +EXPK(TAU-TAUM(2),J-2)) RETURN 9 IF (d-3) 2,92,91 91 GRST= ((TAU-TAUM(1))*(d-2)*(d-3)*EXPK(TAU-TAUM(2),d-4) 1 +2.*(d-2)*EXPK(TAU-TAUM(2),d-3)) RETURN 92 GRST=2. RETURN 4 LD=0 GO TO 100 5 LD=1 GO TO 100 7 LD = 2 GO TO 100 8 LD = 3 100 LDA=LD+1 IF ( I - 1 1 - 1 ) 20,21,21 20 GRST=EXPK(RH0-RH0M1(d),I-1-LD) GO TO (30,27,28,29),LDA 29 GRST=GRST*(1-3) 28 GRST=GRST*(1-2) 27 GRST = GRST*(I-1 ) RETURN 21 IA = I-11 DRHO=RHO-RH0M2(d) ho -E*EXPE*EXPK(DRHO,IA-1 ) EXPE=DEXP(-E*RHO) EXPEM=EXPE-RH0M3 GO TO (22,23,24,25),LDA 22 GRST=EXPEM*EXPK(DRHO,IA-1) RETURN 23 GRST=EXPEM*(IA-1)*EXPK(DRHO,IA-2) RETURN 24 GRST=EXPEM*(IA-1)*(IA-2)*EXPK(DRHO,IA-3) 1 -2.*E*EXPE*(IA-1)*EXPK(DRHO,IA-2) 2 +E**2*EXPE*EXPK(DRHO,IA-1) RETURN 25 GRST=EXPEM*(IA-3)*(IA-2)*(IA-1)*EXPK(DRHO,IA-4) 1 -3.*E*EXPE*(IA-1 )*(IA-2)*EXPK(DRHO,IA-3) 2 +E**2*EXPE*EXPK(DRH0,IA-2) +E**3*EXPE*EXPK(DRHO,IA-1 ) RETURN END DOUBLE PRECISION FUNCTION EXPK (A,L) DOUBLE PRECISION A IF (L) 1,2,3 1 EXPK=0. RETURN 2 EXPK=1. RETURN 3 EXPK=A**L RETURN END DOUBLE PRECISION FUNCTION PWAG(T68) DOUBLE PRECISION DEXP DOUBLE PRECISION TAU,TEMP,TCRIT,T68,W TEMP= T68 + 273.15 TCRIT= 647.25 TAU= 1 . 0 - TEMP/TCRIT -7.863889 * TAU TAU**1.5 * TAU**2.5) * TAU**6.5) TAU**7.5) * W) W + 1 .898527 * W + (-2.364891 W + (-9.911414 W + (9.982952 * DEXP(TCRIT/TEMP PWAG= 220.93 * W PWAG= PWAG/10. RETURN END SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS S S S THE FUNCTION BELOW THIS COMMENT CALCULATES VAPOUR PRESSURE S c c c c c c c c N3 S FROM T68 USING POLLACK'S EQUATION OF STATE: S TC = CRITICAL TEMPERATURE (DEG K) S PC = CRITICAL PRESSURE (BARS) S PPOL = POLLACK'S PRESSURE (MPA) S U = T (DEG K) / TC S SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS DOUBLE PRECISION FUNCTION PP0L(T68) DOUBLE PRECISION A(8), TC, T68, U, PC, TC = 647.25 PC = 220.93 A(1) = -7.8889166 A(2) = 2.5514255 A(3) = -6.7161690 A(4) = 33.239495 A(5) = -105.38479 A(6) = 174.35319 A(7) = -148.39348 A(8) = 48.631602 U = (T68 + 273.15) / TC LNPIE = 0.0 DO 1 U=1,8 LNPIE = LNPIE+A(J)*(( 1 XXXX= DBLE((FLOAT(J) + 1 LNPIE = LNPIE+A(U)*((1 CONTINUE LNPIE = LNPIE / U PPOL = DEXP (LNPIE) * PC/10.0 RETURN END DOUBLE PRECISION FUNCTION PSATD(T68) LNPIE, DEXP, XXXX 0-U)**((DFLOAT(J)+1.0)/2.0)) 0)/2.0) 0-U)**XXXX) 200 DOUBLE PRECISION DO 200 J=1,30 A(J)= O.C CONTINUE T68, TC, PC, TAU, DEXP, W, T, A(30) PC = TC = T = TAU = 21 .66 DO 643.89 DO T68 + 273 1 .ODO DO IF(TAU .LT. IF(TAU .LT. IF (TAU .LT. A(1) = -7.8158255 A(3)= 17.601192 15 T/TC -0.00001) -0.00001) 0.0) TAU PSATD= RETURN 0.0 0.0 300 A(4)= -18.174658 A(11)= -3.9248806 A(20)= 4.1917387 W = W = W = W = DO 0.0 W + W + W + TAU **( 1 ) * A(1) TAU **( 1 .5) * A(2) TAU **( 1 .9)* A(3) 4,20 300 d EXPON= d EXPON= d/2.0 W= W + TAU **EXPON * A(d) CONTINUE W= DEXP(TC/T * W) PSATD= W * PC RETURN END DOUBLE PRECISION FUNCTION TFIX(TIPTS,TDIFF) CONVERTS T (C 1948) TO T (C 1968) REFERENCES BEDFORD, RE / KIRBY GM/ METROLOGIA, KELL, GS / d CHEM ENG DATA, VOL 20, DOUGLAS TB / d RES NAT BUR STAND, A 5, 83 (1969) 1 (1975) VOL 73, 468, (1969) DOUBLE PRECISION TIPTS, TDIFFW, TDIFFZ, TDIFF, W IF((TIPTS . IF ((TIPTS IF ((TIPTS LT . .GE .GE 0.0) .OR.(TIPTS .GT. . 0.0).AND.(TIPTS .LT. 1064.)) RETURN 630.74)) GO TO 200 630.74).AND.(TIPTS .LE. 1064.43)) GO TO 300 200 CONTINUE TDIFFW= TDIFFW= TDIFFW= TDIFFZ= TDIFFZ= TFIX = TDIFF= RETURN 0.00045 * TIPTS * (TIPTS/100.0 TDIFFW * (TIPTS/419.58 - 1.0) TDIFFW * (TIPTS/630.74 - 1.0) 4.9035 / 100000.0 * TIPTS TDIFFZ / (1.0 - 2.94855 * TIPTS + TDIFFW + TDIFFZ TDIFFW + TDIFFZ - 1.0) (TIPTS/100.0 TIPTS/10000.0) 1 .0) 300 CONTINUE W= -1.3145 + W= W + 1.5625 W= W / (1.0 + TDIFF= W TFIX= TIPTS + RETURN END .5016 * 10. **(-3) * TIPTS 10.**(-6) * TIPTS**2 .101 * 10.**(-4) * TIPTS) DOUBLE PRECIS ION FUNCTION H Z F U N C ( T , H Z C , R ) DOUBLE PRECIS ION T , DLOG, H Z C ( 8 ) HZFUNC= 0 . 0 DO 5 0 0 d = 1 , 6 HZFUNC= HZFUNC + H Z C ( J ) * ( 1 . 0 - ( d - 1 ) ) * T * * ( d - 1 ) / ( 1 0 0 0 . 0 * * ( d - 1 ) ) 5 0 0 CONTINUE HZFUNC= HZFUNC + H Z C ( 7 ) * ( D L O G ( T ) - 1 . 0 ) + (R - H Z C ( 8 ) / 1 0 0 0 . ) * T RETURN END DOUBLE PRECIS ION FUNCTION C P F U N C ( T , H Z C , R ) DOUBLE PRECISION H Z C ( 8 ) , T CPFUNC= 0 . 0 DO 5 0 0 d = 3 , 6 CPFUNC= CPFUNC + H Z C ( d ) * ( ( 2 - d ) * ( d - 1 ) ) * T * * ( d - 2 ) / ( 1 0 0 0 . 0 * * ( d - 1 ) ) 5 0 0 CONTINUE CPFUNC= CPFUNC + H Z C ( 7 ) / T + (R - H Z C ( 8 ) / 1 0 0 0 . ) RETURN END SUBROUTINE B A S I S ( V E C T O R , L ) C T H I S ROUTINE CHANGES THE BASIS OF ALL COMPOSITIONAL ARRAYS C AND RETURNS THE RESULT I N M A T R I X ' S CNEWAO, CNEWPH, CNEWG to C AND CNEWSS -e- c 0 1 C THE VALUES PASSED I N VECTOR ALSO HAVE THEIR B A S I S CHANGED. C L I S THE INDEX OF THE NODE C COMMON /CHEMPH/ C O M P P H ( 1 0 , 2 5 ) , T H E R P H ( 1 4 . 2 5 ) , NUMPH COMMON /CHEMAO/ C O M P A Q ( 1 0 , 2 5 ) , T H E R A Q ( 1 3 , 2 5 ) , NUMAQ COMMON /CHEMSS/ C O M P S S ( 1 0 , 2 0 ) , T H E R S S ( 8 , 2 0 ) , NUMSS COMMON /CHEMG / C O M P G ( 1 0 , 1 0 ) , T H E R G ( 6 , 1 0 ) , NUMG COMMON /NEWCOM/ C N E W A Q ( 1 0 , 2 5 ) , C N E W P H ( 1 0 , 2 5 ) , C N E W S S ( 1 0 , 2 0 ) , C N E W G ( 1 0 , 1 0 ) , I N D X 1 ( 1 0 ) , I N D X 2 ( 1 0 ) , I N D X 3 ( 1 0 ) , NUMELE REAL A ( 1 0 , 1 0 ) , V E C T O R ( 1 0 ) , S A V E ( 1 0 ) CALL M I N I T ( A , 1 0 , 1 0 , O.OEOO) CALL MCOPY(SAVE, VECTOR, 1 , 1 , NUMELE, 1 , 1 0 , 1 , 1 0 , 1) C C BUILD THE CHANGE OF BASIS ARRAY DO 100 1 = 1 , NUMELE K1 = I N D X 1 ( I ) K2 = I N D X 2 ( I ) DO 9 0 d = 1 , NUMELE I F ( K 2 . E Q . 1 ) THEN C SOLID PHASE COMPONENTS A ( d , I ) = C 0 M P P H ( d , K 1 ) C ELSE IF (K2.EQ.2) THEN C AQUEOUS SPECIES COMPONENTS A ( J , I ) = COMPAQ(d,K1) C ELSE IF (K2.EQ.3) THEN C SOLID SOLUTION COMPONENTS A(d,I ) = COMPSS(U,K1) ELSE IF (K2.EQ.4) THEN C GAS COMPONENTS A ( J , I ) = COMPG(J,K1) C ELSE C ERROR WRITE(6,1000) K2 STOP C ENDIF 90 CONTINUE 100 CONTINUE C C FORM NEW BASIS AND MULTIPLY THROUGH CALL INVRT( A, NUMELE, 10, J) IF (d.NE.O) THEN WRITE(6,1001) i ~ IF (L.NE.O) WRITE(6,1002) L ^ STOP ENDIF IF (NUMAQ.GT.O) CALL MMULT(CNEWAQ,A,COMPAQ,NUMELE,NUMELE, NUMAQ,10,25,10,10,10,25) IF (NUMPH.GT.O) CALL MMULT(CNEWPH,A,COMPPH,NUMELE,NUMELE, NUMPH,10,25,10,10,10,25) IF (NUMSS.GT.O) CALL MMULT(CNEWSS,A,COMPSS,NUMELE,NUMELE, NUMSS,10,20,10,10,10,20) IF (NUMG .GT.O) CALL MMULT(CNEWG, A,COMPG, NUMELE,NUMELE, NUMG, 10,25,10,10,10,25) CALL MMULT(VECTOR, A, SAVE, NUMELE, NUMELE, 1, 10, 1, 10, 10, 10, 1) C RETURN 1000 FORMAT('0 *** ERROR IN INDEX 1 IN ROUTINE BASIS ',/, ' K2 HAS A VALUE OF ',15) 1001 FORMAT('0 *** BASIS PASSED TO ROUTINE INVRT FROM ROUTINE', ' BASIS WHICH WAS NOT INDEPENDENT.') 1002 FORMAT('0 PASSED FOR NODE ',15) END SUBROUTINE COND(THERMK,TK,DENS) ro r o THIS ROUTINE CALCULATES THE THERMAL CONDUCTIVITY OF WATER AND STEAM USING THE RECOMMENDED INTERPOLATING EQUATION FOR INDUSTRIAL USE. (d. KESTIN, MECHANICAL ENGINEERING, dULY 1978, VOL 100, ISSUE 8, PAGE 46). THIS EQUATION IS THE EQUATION CONTAINED IN THE IAPS (INTERNATIONAL ASSOCIATION FOR THE PROPERTIES OF STEAM) RELEASE RTC 77. THIS EQUATION DOES NOT GIVE A GOOD REPRESENTATION AT/NEAR THE CRITICAL POINT AS IT PREDICTS A FINITE VALUE AT THE CRITICAL POINT. HOWEVER, IF IT IS EXCLUDED USE IN THE REGION BOUNDED BY T=T(CR) +/- 1.5C AND DEN = DEN(CR) +/- 100KG/M**3 IT IS IDENTICAL TO THE RECOMMENDED INTERPOLATING EQUATION FOR SCIENTIFIC USE (SAME PUBLICATION). THE SCIENTIFIC EQUATION HAS NOT BEEN USED DUE TO THE EXTRA INFO NEEDED AND INCREASED CPU TIME PROGRAMMED: 8/2/83 E.H. PERKINS INPUT: TK TEMPERATURE IN DEG. K DENS DENSITY IN KG/M**3 OUTPUT: THERMK THERMAL CONDUCTIVITY W/K M DIMENSION A(4) , B(3), C ( 6 ) , D(4) TR A(1) A(2) A(3) A(4) B( 1) B(2) B(3) BB1 BB2 C(1) C(2) C(3) C(4) C(5) C(6) DENR D(1) D(2) D(3) D(4) T DRAT DELT = 2 647 . 3 1.02811E-02 99621E-02 1.56146E-02 -4.22464E-03 -3.97070E-01 4.00302E-01 1.06000 -1.71587E-01 2.39219 6.42857E-01 -4.11717 -6. 17937 3.08976E-03 8.22994E-02 1.00932E01 317.7 7.01309E-02 1.18520E-02 1.69937E-03 -1.02000 TK / TR DENS / DENR ABS((T - 1.0)) + C(4) DUM = DELT**(-0.6) 0 = 2.0 + (C(5) * DUM) R = 0 + 1 . 0 IF (T.GE.1.0) S = 1 / DELT IF (T.LE.1.0) S = C(6) * (DUM) THERM 1 = O.OEOO DO 10 I = 1, 4 d = I - 1 THERM 1 = ( A ( I ) * ( T * * J ) ) + THERM 1 10 CONTINUE THERM 1 THERM2 THERM2 C THERM3 THERM3 DUM THERM3 DUM N > THERM3 *~ C 0 0 THERMK C RETURN END SUBROUTINE CPAQU( CP, C1, C2, THETA, A3, A4, W, X, C THIS ROUTINE CALCULATES THE HEAT CAPACITY OF AN AQUEOUS SPECIES C USING EQUATION 273 FROM HELGESON, KIRKHAM AND C FLOWERS, AJS 281, P. 1412 (1981). C RETURNED: CP - CALCULATED HEAT CAPACITY AT T AND P C PASSED: C1, C2, A3, A4, THETA, W, X - PARAMETERS IN C EQUATION. SEE TEXT FOR DETAILS. C P - PRESSURE IN MEGA-PASCALS C C TK - TEMPERATURE IN DEG K. C C NOTE: UNITS USED ARE JOULES AND MEGA-PASCALS, C NOT CALORIES AND BARS AS IN HELG. ET. AL. REAL CP, C1, C2, THETA, A3, A4, W, X, TK, P, PR PR = 0.1E00 CP = C1 + ((C2 * TK) / (TK - THETA)) + (W * TK * X) - ( ( ( 2 . 0 * A3 * (P - PR)) + (A4 * (P**2 - PR**2))) * THETA * TK / ((TK - THETA)**3)) = THERM 1 * (SQRT(T)) = B( 1 ) + (B(2) * DRAT) = THERM2 + (B(3) * EXP(((DRAT + BB2)**2) * BB1) ) = ((D(1) * (( 1 . 0 / T ) * * 1 0 ) ) + D(2)) * (DRAT**1.8) = THERM3 * EXP((C(1) * (1.0 - (DRAT**2.8)))) = D(3) * S * (DRAT**Q) = THERM3 + (DUM * EXP((Q/R) * (1.0 - (DRAT**R))) ) = (C(2) * (T**1.5)) + (C(3) * ((1.0/DRAT)**5) ) = THERM3 + (D(4) * EXP(DUM)) = THERM1 + THERM2 + THERM3 RETURN END SUBROUTINE CPMIN(CP, TK, A, B, C, D, E, F, G) THIS ROUTINE CALCULATES THE CP OF A PHASE USING THE HEAT CAPACITY FUNCTION: CP = A + BT + C/(T**2) + D/(T**.5) + E(T**2) + F/T + G/(T**3) TK - TEMPERATURE IN DEG K CP - RETURNED HEAT CAPACITY ALL OTHER TERMS ARE DEFINED IN THE ABOVE EQUATION CP = A + (B * TK) + (C / (TK**2)) + (D / (SQRT(TK))) + (E * (TK**2)) + (F / TK) + (G / (TK**3)) RETURN END SUBROUTINE DIE(E,TK,D) ROUTINE TO CALCULATE THE DIELECTRIC CONSTANT OF WATER AND STEAM. FORMULA AND CONSTANTS FROM UEMATSU AND FRANCK, STATIC DIELECTRIC CONSTANT OF WATER AND STEAM, J . PHYSICAL CHEMICAL REFERENCE DATA, VOL. 9, NO. 4, 1980. PP 1291. PROGRAMED 4/2/83 EHP E IS THE CALCULATED DIELECTRIC CONSTANT OF WATER - OUTPUT VARIABLE TK IS THE TEMPERATURE IN DEG. K D IS THE DENSITY OF WATER IN KG/M**3 TO = 298.15 A1 = 7.62571E00 A2 = 2.44003E02 A3 = -1.40569E02 A4 = 2.77841E01 A5 = -9.62805E01 A6 = 4.17909E01 A7 = -1.02099E01 A8 = -4.52059E01 A9 = 8.46395E01 A10 = -3.58644E01 DENS = D / 1000.OEOO T = TK / TO E1 = A1 * DENS / ' E2 = ((A2/T) + A3 + (A4 * T)) * (DENS**2) E3 = ((A5/T) + (A6*T) + ( A 7 * ( T * * 2 ) ) ) * (DENS**3) E4 = ( ( A 8 / ( T * * 2 ) ) + (A9/T) + A10) * (DENS**4) E = 1.0 + E1 + E2 + E3 + E4 RETURN END SUBROUTINE DIE1(TK,D,D1,D2,D3,ETRPR,YTRPR,ZTRPR,E, YTP, ZTP, XTP, OTP) ROUTINE TO CALCULATE THE VARIOUS DERIVATIVES OF THE DIELECTRIC CONSTANT OF WATER AND STEAM AS NEEDED BY THE AQUEOUS SPECIES ROUTINES. FORMULA AND CONSTANTS DERIVED THOSE GIVEN BY UEMATSU AND FRANCK IN STATIC DIELECTRIC CONSTANT OF WATER AND STEAM, J . PHYSICAL CHEMICAL REFERENCE DATA, VOL. 9, NO. 4, 1980. PP 1291. PROGRAMED 4/2/83 EHP DEDT - DERIVATIVE OF THE DIELECTRIC CONSTANT WITH RESPECT TO TEMPERATURE AT CONSTANT PRESSURE DEDP - DERIVATIVE OF THE DIELECTRIC CONSTANT WITH RESPECT TO PRESSURE AT CONSTANT TEMPERATURE D2EDT - SECOND DERIVATIVE OF THE DIELECTRIC CONSTANT WITH RESPECT TO TEMPERATURE AT CONSTANT PRESSURE TK IS THE TEMPERATURE IN DEG. K D IS THE DENSITY OF WATER IN KG/M**3 D1 - DERIVATIVE OF THE VOLUME OF WATER WITH RESPECT TO PRESSURE UNITS: M'**3/ MEGA-PASCALS D2 - DERIVATIVE OF THE VOLUME OF WATER WITH RESPECT TO TEMPERATURE UNITS: M**3/ DEG K D3 - SECOND DERIVATIVE OF THE VOLUME OF WATER WITH RESPECT TO TEMPERATURE. UNITS: (M**3)**2 / (DEG K)**2 " Q, X, Y, Z - VARIOUS PARAMETERS NEEDED IN THE AQUEOUS SPECIES ROUTINE. WHEN TRPR IS APPENDED, REFERS TO 298.15 AND 1 BAR, WHEN TP IS APPENDED, REFERS TO CURRENT CONDITIONS. Q = - D(1/E)/DP = (1/E) (DLN E/ DP) = (1/E**2) (DE/DP) Y = - D(1/E)/DT = (1/E) (DLN E/ DT) = (1/E**2) (DE/DT) X = (1/E) ( (D2LN E/DT2) - (DLN E/DT)**2) = (1/E) ((-1/E)(DE/DT)**2 + ( 1/E ) (D2E/DT) - ((1/E)(DE/DT ) ) * * 2 ) TO = 298.15 A1 = 7.62571E00 A2 = 2.44003E02 A3 = -1.40569E02 A4 = 2.77841E01 A5 = -9.62805E01 A6 = 4.17909E01 A7 = -1.02099E01 A8 = -4.52059E01 A9 = 8.46395E01 A10 = -3.58G44E01 CALL DIE( E, TK, D) DENS = D / 1000.0 T = TK / TO DDDP = D1 * 1.OE-03 DDDT = D2 * 1.OE-03 DD2DT = D3 * 1.OE-06 E1P = A1 * DDDP / T E1T = (A1 * DDDT / T) - (A1 * DENS * TO / (TK**2)) E1T2 = ((-1.0) * DDDT * TO / (TK**2)) + (A1 * DD2DT / T) - (A1 * DDDT * TO / (TK**2)) + (A1 * DENS * TO * 2.0 / (TK**3)) E2 = (A2/T) + A3 + (A4 * T) E2P = E2 * 2.0 * DENS * DDDP E2T = (E2 * 2.0 * DENS * DDDT) + ((DENS**2) * (A4 -(A2 * TO / (TK**2) ) ) ) E2T2 = (E2 * 2.0 * ((DDDT**2) + (DENS * DD2DT))) + (4.0 * DENS * DDDT * (A4 - (A2 * TO / ( T K * * 2 ) ) ) ) + ((DENS**2) * A2 * TO * 2.0 / (TK**3)) + (2.0 * DENS * DDDT * (A4 - (A2 * TO / ( T K * * 2 ) ) ) ) E3 = (A5/T) + (A6*T) + (A7*(T**2)) E3P = E3 * 3.0 * (DENS**2) * DDDP E3T = E3 * 3.0 * (DENS**2) * DDDT + ((DENS**3) * (A6 - (A5 * TO / (TK**2)) + (A7 * 2.0 * TK / TO))) E3T2 = (E3 * 3.0 * (((DENS**2) * DD2DT) + ((DDDT**2) * 2.0 * DENS))) + (6.0 * (DENS**2) * DDDT * (A6 -(A5 * TO / (TK**2)) + (A7 * 2.0 * TK / TO))) + ((DENS**3) * ((A7 * 2.0 / TO) + (A5 * TO / TK**3))) E4 = (A8/(T**2)) + (A9/T) + A10 E4P = E4 * 4.0 * (DENS**3) * DDDP E4T = E4 * 4.0 * (DENS**3) * DDDT + ((DENS**4) * ((A8 * (-2.0) * (T0**2) /(TK**3)) - A9 * TO / ( T K * * 2 ) ) ) E4T2 = (E4 * 4.0 * ((DD2DT * (DENS**3)) + (3.0 * (DENS**2) * (DDDT**2)))) + ((8.0 * (DENS**3) * DDDT) * ((A8 * (-2.0) * (T0**2) /(TK**3)) - (A9 * TO / ( T K * * 2 ) ) ) ) + ((DENS**4) * ((A8 * 6.0 * (T0**2) / (TK**4)) + (A9 * TO * 2.0 / ( T K * * 3 ) ) ) ) DEDP = E1P + E2P + E3P + E4P DEDT = E1T + E2T + E3T + E4T DE2DT2 = E1T2 + E2T2 + E3T2 + E4T2 ETRPR = 78.97765 ZTRPR = (-1.0) / ETRPR YTRPR = -5.8017E-05 OTP = DEDP / (E**2) YTP = DEDT / (E**2) ZTP = (-1.OEOO) / E XTP = (( ( - 1 . 0 / E * * 2 ) * (DEDT**2) ) + ((1.0/E) * DE2DT2) -( ( ( 1 . 0 / E ) * (DEDT))**2) ) * (1.0/E) RETURN END SUBROUTINE DIST(T, P, STRENG, TOTAL, C, ACT, XHOLD, VOL, IBAL, ISAT) THIS ROUTINE CALCULATES THE DISTRIBUTION OF SPECIES ACCORDING TO THE ALGORTHIUM OF WOOLERY AND WALTERS COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMSS/ COMPSS(10,20). THERSS(8,20), NUMSS COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /NEWCOM/ CNEWAQ(10,25), CNEWPH(10,25), CNEWSS(10,20), CNEWG(10,10), INDX1(10), INDX2(10), INDX3(10), NUMELE CHARACTER*20 PHNAME(25), SSNAME(20), GNAME(10), DNAME(3) CHARACTER *8 FLNAME(10), AQNAME(25) CHARACTERS ELNAME( 10) COMMON /CHNAME/ PHNAME, SSNAME, GNAME, DNAME, AQNAME, FLNAME, ELNAME TOTAL - TOTAL NUMBER OF MOLES/MOLALITY OF COMPONENTS G - LOG K OF THE SPECIES ACT - LOG ACTIVITY OF THE COMPONENTS CONCAQ - LOG MOLALITY OF THE AQUEOUS SPECIES COLDAQ - LOG MOLALITY OF THE AQUEOUS SPECIES OF THE LAST ITERATION C - CONCENTRATION OF THE COMPONENTS. IF WATER IS A COMPONENT, THEN STORE THE ACTIVITY OF WATER CSAV - CONCENTRATION OF THE COMPONENTS FROM THE LAST ITERATION GAMMAQ - ACTIVITY COEF FOR THE AQUEOUS SPECIES GAMMC - ACTIVITY COEF. FOR THE COMPONENTS REAL C0NCAQ(25), C0LDAQ(25), GAMMAQ(25), GCOMP(10) REAL ACT(10), GAMMC(10), CSAV(10), XHOLD(10), C(10) REAL G(25) , TOTAL(10) ZERO = 1.0E-09 ZERO = 1.OE-07 A10 = ALOG(10.O) CALL CALL CALL CALL CALL MINIT(CSAV, MINIT(GAMMC, MINIT(GAMMAQ, MINIT(CONCAQ, MINIT(COLDAQ, 10, 10, 25, 25, 25, .OEOO) .OEOO) .OEOO) OEOO) OEOO) CALCULATE/SETUP ACTIVITY COEFFIECIENTS CALL H20(P, T, VOL, X1, HTP, STP, G(1), X2, DENS = 1 . 0 / VOL GAMMAQ(1) = AL0G10(0.01801534) C0NCAQ(1) = ALOG10(1.0 / 0.01801534) C0LDAQ(1) = C0NCAQ(1) CALL DIE1(T, DENS, X4, X3, X5, ETRPR, YTRPR, X3, X4, X5, 0) IF (STRENG.GT.O.O) THEN DO 20 I = 2, NUMAQ CALL GAMMA(COEF, ZTRPR , E, ZTP, YTP , X, Q) T.P,DENS,STRENG,THERAQ(12,1), THERAQ(13,1),THERAQ( 11,1)) GAMMAQ(I) = CONTINUE ENDIF COEF GET ACTIVITY/ACTIVITY COEF. OF THE COMPONENTS DO 80 I = 1, NUMELE K2 = INDX2(I) IF (K2.EQ.1) THEN SOLID PHASES ACT(I) = O.OEOO GAMMC(I) = O.OEOO AQ SPECIES ELSE IF (K2.EQ.2) THEN K1 = INDXKI) K3 = INDX3(I) GAMMC(I ) = GAMMAQ(K1) IF (K3.EQ.1) ACT(I) = AL0G1O(C(I)) + GAMMC(I) IF (K3.EQ.2) ACT(I) = C(I) 80 4N 90 95 100 ELSE IF (K2. ACT(I) GAMMC(I ) EO .3) THEN O.OEOO O.OEOO SOLID SOLUTION GASSES ELSE IF (K2.EQ.4) THEN ACT(I) = C ( I ) GAMMC(I) = O.OEOO ENDIF CONTINUE FIND ION AMONG COMPONENTS IF (IBAL.LE.O) THEN COEF = O.OEOO FOR CHARGE BALANCE DO = 0 90 I = 1, NUMELE K2 = INDX2(I) IF (K2.NE.2) GO TO 90 K1 = INDXKI) IF (THERAQ(12,K1).NE.0.0) THEN K3 = INDX3(I) IF (d.EQ.1.AND.K3.EQ.2) GO TO 90 IF (COEF.GE.ABS(C(I)).AND.J.EQ.1) GO TO 90 IF (K3.EQ.1) J = 1 IBAL = I COEF = ABS(C(I)) ENDIF CONTINUE ENDIF GET LOG K'S FOR EACH OF THE SPECIES. FIRST WATER, WHICH IS ALWAYS SPECIES NUMBER 1. 100 1 = 2 , NUMAO CALL GAQU(XLOGK,GM,THERA0(2,I),THERA0(3 THERAQ(5,I),THERAO(10,I),THERAQ(6,I) THERAQ(8,I),THERAQ(9,I),THERAQ(11,1) DO I),THERA0(4,I), THERAQ(7, ZTP, I ) , G(I) CONTINUE GET LOG DO 150 K1 K2 IF ZTRPR, = XLOGK YTRPR, T) K'S FOR EACH OF THE COMPONENTS AND PREPARE TO CHANGE BASIS 1 = 1 , NUMELE = INDX1(I) = INDX2(I) (K2.EQ.1) THEN SOLID PHASE COMPONENTS CALL GMIN(XLOGK, GM, THERPH(2,K1), THERPH(3,K 1 ) , THERPH(5,K1), THERPH(6,K1), THERPH(7,K1), THERPH(8,K1), THERPH(9,K1), THERPH(10,K1), THERPH(11,K1), THERPH(4 , K1 ) , THERPH(12, K1), THERPH(13,K 1 ) , T. P) GCOMP(I) = XLOGK ELSE IF (K2.EQ.2) THEN AQUEOUS SPECIES COMPONENTS GCOMP(I ) = G(K1) ELSE IF (K2.EQ.3) THEN SOLID SOLUTION COMPONENTS ELSE IF (K2.EQ.4) THEN GAS COMPONENTS ENDIF CONTINUE NOTE THAT XHOLD IS USED ONLY AS A DUMMY ARGUEMENT CALL BASIS(XHOLD.O) SUBTRACT OUT LOG K OF COMPONENTS FROM EACH SPECIES DO 220 1 = 1 . NUMAQ DO 210 d = 1, NUMELE IF (ABS(CNEWAQ(U,I)).GE.ZERO) G(I) = G(I) - (CNEWAQ(u,I) * GCOMP(d)) CONTINUE CONTINUE MONOTONE SEQUENCE CONVERGENCE OF W AND W L00P2 = 1 L00P1 = 1 DO 330 1 = 1 , NUMELE K2 = INDX2(I) IF (K2.NE.2) GO TO 330 K3 = INDX3(I) IF (K3.NE.1) GO TO 330 ATEMP = 1.0 K1 = INDX1(I) DO 320 J = 1, NUMAQ IF(K1.EQ.d) GO TO 320 IF(ABS(CNEWAQ(I ,<J)) .LT.ZERO) GO TO 320 BTEMP = (CNEWAQ(I.J) - 1.0) * ACT(I) BTEMP = BTEMP + GAMMC(I) BTEMP = BTEMP + G(U) - GAMMAQ(d) DO 310 K = 1, NUMELE IF(K.EQ.I) GO TO 310 IF(ABS(CNEWAQ(K, J ) ).LT.ZERO) GO TO 310 BTEMP = BTEMP + (CNEWAQ(K.J) * ACT(K) ) 310 320 330 ro Ln 340 390 (CNEWAQ(I.d) * (10.0**BTEMP)) CONTINUE ATEMP = ATEMP + CONTINUE C ( I ) = TOTAL(I) / ATEMP IF ( C ( I ) . L E . 0 . 0 ) THEN WRITE(6,1008) AQNAME(K1) STOP ENDIF CONTINUE CHECK IF CONVERGENCE HAS BEEN OBTAINED K = 0 d = 0 DO 340 1 = 1 , NUMELE K2 = INDX2(I) IF (K2.NE.2) GO TO 340 K3 = INDX3(I) IF. (K3.NE.1 ) GO TO 340 K = K + 1 ATEMP = ABS((CSAV(I) - C ( I ) ) / C ( I ) ) IF (ATEMP.LT.ZERO) d = d + 1 CSAV(I) = C ( I ) ACT(I) = GAMMC(I) + AL0G10(C(I)) CONTINUE L00P1 = L00P1 + 1 IF (K.NE.d .AND. L00P1.LT.5O) GO TO 300 L00P1 = 1 CONCENTRATIONS OF SPECIES/NEW IONIC STRENGTH AND ELECTRICAL BALANCE STRENG =0.0 ELECT = 0.0 BTEMP = 0.0 CONCAQ(I) = AL0G1O( 1.0 / 0.01801534 ) DO 400 1 = 2 , NUMAQ ATEMP = G(I) DO 390 d = 1 ATEMP CONTINUE CONCAQ(I) = ATEMP - GAMMAQ(I) IF (CONCAQ(I).LT.-65.0) X1 = 0.0 IF (CONCAQ(I).GE.-65.0) X1 = 10**C0NCAQ(I) STRENG = STRENG + ((THERAQ(12,I)**2) * X1 * ELECT = ELECT + (THERAQ(12,1) * X1 ) BTEMP = BTEMP + X1 NUMELE (CNEWAQ(d,I) ACT(d)) + ATEMP 0.5) CONTINUE IF (BTEMP .GT. 10.0) BTEMP = 10.0 IF (STRENG .GT. 10.0) STRENG = 10.0 UPDATE ACTIVITY COEFFI ECIENTS - WATER ALWAYS IS POSITION 1 GAMMAQO) = ((-1.0) * BTEMP * 0.01801534 / A10) - CONCAQC 1 ) DO 510 I = 2, NUMAO CALL GAMMA(COEF,T,P,DENS,STRENG,THERAO(12.1), THERAO(13,I),THERAQ(11,1)) GAMMAQ(I ) = COEF CONTINUE DO 520 1 = 1 , NUMELE K2 = INDX2(I) IF (K2.EQ.2) THEN K1 = INDX1(1) GAMMC(I) = GAMMAQ(K1) ENDIF CONTINUE CHARGE BALANCE K1 = INDX1(IBAL ) TOTAL(IBAL) = TOTAL(IBAL) - (ELECT / THERAQ(12,K1 ) ) CHECK FOR CONVERGENCE K = 0 J = 0 DD 600 1 = 2 , NUMAO IF (CONCAQ(I).LT.-65.0) GO TO 600 X1 = 1O**C0NCAQ(I) X2 = 10**COLDAQ(I) ATEMP = ABS((X1 - X2) / X1) J = J + 1 IF (ATEMP.LT.ZERO) K = K + 1 COLDAQ(I) = CONCAQ(I) CONTINUE L00P2 = L00P2 + 1 IF (K.NE.J .AND. LOOP2.LT.50) GO TO 300 IF WATER IS A COMPONENT, SENT BACK ACTIVITY IN C ARRAY DO 610 I = 1, NUMELE K1 = INDXKI) K2 = INDX2(I) IF (K1.EQ.1 .AND. K2 .EQ. 2) THEN INDX3(I) = 2 C( I ) = CONCAQO) + GAMMAQO) ENDIF 610 CONTINUE C OUTPUT C WRITE(6,1001) DO 700 1 = 1 , NUMAO X1 = 0.0 IF (CONCA0(I).GT.-65.0.AND.C0NCA0(I).LT.2.0) X1 = 10**CONCAQ(I) X4 = 10.0**(GAMMAQ(I)) X3 = CONCAO(I) + GAMMAQ(I) X2 = 0.0 IF (X3.GT.-65.0.AND.X3.LT.2.0) X2 = 10 ** X3 X5 = X1 * THERAO(1,1) C WRITE(6,1002) AQNAME(I), X1, CONCAQ(I), X2, X3, X4, GAMMAQ(I), X5 700 CONTINUE WRITE(6,1003) STRENG, ELECT I = INDX1(IBAL) WRITE( 6,1004) AQNAME(I) WRITE(10,1009) (CONCAQ(I), 1 = 1 . NUMAQ), (GAMMAQ(K), K = 1, NUMAQ) C CALCULATE VOLUME OF SYSTEM BASED ON 1000 GRAMS OF WATER N> c VOL CONTAINS VOLUME OF FLUID (WATER) IN (M**3/KG) * 1KG(H20) c£ VOL = VOL C CALCULATE FREE ENERGY OF GASES AND OUTPUT FUGACITY C IF (NUMG. GT. 0) THEN C ENDIF C C CHECK/OUTPUT SUPERSATURATION OF SOLIDS ISAT = 0 IF (NUMPH .GE. 1) THEN WRITE(6,1005) DO 820 1 = 1 , NUMPH CALL GMIN(XLOGK, GM, THERPH(2,I), THERPH(3,I), THERPH(5,I), THERPH(6,I), THERPH(7,I), THERPH(8,I), THERPH(9,I), THERPH(10,1), THERPH(11,1), THERPH(4,I), THERPH(12,1), THERPH(13,I), T, P) X1 = O.OEOO X2 = O.OEOO DO 810 J = 1, NUMELE XLOGK = XLOGK - (CNEWPH(J.I) * GCOMP(J)) X2 = X2 - (CNEWPH(d.I) * ACT(d)) 810 CONTINUE X1 = XLOGK - X2 IF (X1 .GT. 1.0) THEN WRITE(6,1006) PHNAME(I), X1, XLOGK, X2 ISAT = ISAT + 1 ELSE WRITE(6,1007) PHNAME(I), X1, XLOGK, X2 ENDIF CONTINUE ENDIF CHECK FOR SOLID SOLUTION PHASES MUST GO HERE ????? RETURN IN ACT - SUM OF EACH OF THE GLOBAL COMPONENTS IN THE FLUID RETURN IN XHOLD - SUM OF EACH OF THE GLOBAL COMPONENTS IN THE SOLIDS RETURN IN TOTAL - SUM OF EACH OF THE LOCAL COMPONENTS IN THE FLUID NOTE THAT ALL VALUES HERE ARE FOR 1000 GRAMS OF WATER -THEY WILL BE CORRECTED BY THE NUMBER OF MOLES OF WATER IN THE CALLING ROUTINE DO 940 1 = 1 , NUMELE TOTAL(I) = O.OEOO ACT(I) = O.OEOO XHOLD(I) = O.OEOO DO 910 J = 1, NUMAQ IF (CONCAQ(J).GT.-65.0) THEN X1 = 10**CONCAQ(d) ACT(I) = ACT(I) + (X1 * COMPAQ(I,d)) TOTAL(I) = TOTAL(I) + (X1 * CNEWAQ(I,d)) ENDIF CONTINUE CONTINUE IF (NUMPH.GT.O) THEN DO 980 1 = 1 , NUMELE K2 = INDX2(I) IF (K2.EQ.1) THEN K1 = INDX1(1) DO 970 d = 1, NUMELE IF (ABS(C0MPPH(d,K1)).GT.ZERO) XHOLD(d) = XHOLD(I) + (C0MPPH(d,K1) * C ( I ) ) CONTINUE ENDIF CONTINUE ENDIF RETURN FORMAT('0 SPECIES MOLALITY LOG MOL. ACTIVITY ,'LOG ACT. ACTIVITY COEF LOG ACT COEF GRAMS/LITER') FORMAT(1X,A8,2X,E12.5,2X,F10.5,2X,E12.5,2X,F10.5,2X,F10.5,4X, F10.5,2X,E12.5) FORMAT('O IONIC STRENGTH: '.F10.5,/, ELECTRICAL BALANCE: '.E12.5) O 1004 FORMAT('0 ION/COMPONENT USED FOR ELECTRICAL BALANCE: ',A8) 1005 FORMAT(//,5X,'PHASE',21X,'LOG ACTIVITY',9X,'LOG K',10X,'L0G 0') 1006 FORMAT(1X.A20,10X,E12.5,5X,F10.4,5X,F10.4, / *********** SUPERSATURATED ') 1007 FORMAT(1X.A20,10X,E12.5,5X,F10.4,5X,F10.4) 1008 FORMATC//,' ION DRIVEN NEGATIVE DURING DISTIBUTION OF SPECIES', /,' EXAMINE INPUT DATA - ION/COMPONENT WAS: ',A8) 1009 FORMAT(10(1X,E12.5)) END SUBROUTINE SMIN(STP, SZERO, A, B, C, D, E, F, G, DVDT, T, P) THIS ROUTINE CALCULATES THE ENTROPY OF A PHASE PASSED VARIABLES: SZERO - ENTROPY AT TR, PR A, B, C, D, E, F, G - HEAT CAPACITY TERMS DVDT - DV/DT AT CONSTANT P T - TEMPERATURE IN DEG K P - PRESSURE IN MEGA-PASCALS RETURNED VARIABLE: STP - ENTROPY AT T AND P INTERNAL VARIABLES: TR - 298.15 DEG K (REFERENCE TEMPERATURE) PR - 0.1 MEGA-PASCALS CP AND VOLUME EQUATION USED (IN INTEGRATED FORMS) CP = A + BT + C/(T**2) + D/(T**.5) + E(T**2) + F/T + G/(T**3) VTP = VO + ((DV/DT) * (T - TO)) + ((DV/DP) * (P - PO)) TR PR 298.15E00 0.1E00 STP = SZERO + (A * (ALOG((T / T R ) ) ) ) + (B * (T - TR)) + (C * ((1.0/(TR**2)) - (1.0/(T**2)) ) / 2.0) + (D * ((1.0/(SQRT(TR))) - (1.0/(SQRT(T ) )) ) * 2.0) + (E * (T**2 - TR**2) / 2.OEOO) + (F * ((1.O/TR) - ( 1 . 0 / T ) ) ) + (G * ((1.0/(TR**3)) - ( 1 . 0 / ( T * * 3 ) ) ) / 3.0) STP = STP - (DVDT * (P - PR)) RETURN END SUBROUTINE STEAM (P,THETA,V,H,U,S,CP,CV,Td,F,L,NEQ,DPTV,DPRT, DPVT) L=1 INIT, L=2 GIVEN P VAP SIDE, L=3 GIVEN P LIQ SIDE L=4 GIVEN V NECESSARY SUBROUTINES WFNS,GRST,PDSUM C UNITS P IN MPA, THETA IN DEGC IPTS68 C UNITS V IN CC/GM H,U,F IN d/G, C S.CP.CV IN J/G/DEG K, TJ IN MPA/DEG K DOUBLE PRECISION W(5,5),RHO,TAU,P,THETA,V,H,U,S,CP,CV,TJ,F DOUBLE PRECISION DHVT, DPTV, DPVT, FZERO, HZERO, CPZERO, DPRT DOUBLE PRECISION SZERO.TEMP, TA, PCALC, HZC(8), THETA1 DOUBLE PRECISION DLOG, RH1, DRHO, DABS, CPFUNC, HZFUNC V = 1.0 DPVT = 1.0 GO TO (1,12,12, 12,12),L 12 CONTINUE NE0=O TEMP=273.15+THETA RT=R*TEMP TAU=1000./TEMP TA=DLOG(TEMP) SZERO= .001*(HZC(2)+2.*HZC(3)/TAU+3.*HZC(4)/TAU**2+4.*HZC(5) * /TAU**3 + 5. *HZC(6)/TAU**4 + HZC(8)*TA+HZC(8))+HZC(7)/TEMP FZERO= HZC(1)+HZC(2)/TAU+HZC(3)/TAU**2+HZC(4)/TAU**3+HZC(5) * /TAU**4 + HZC(7)*TA + HZC(8)*TA/TAU + HZC(6) / TAU**5 HZERO= HZFUNC(TEMP,HZC,RCONV) CPZERO= CPFUNC(TEMP,HZC,RCONV) GO TO (1,2,3,4) ,L 1 CONTINUE R = 0.46151 HZCCD = 1857.065 HZC(2) = 3229.12 HZC(3) = -419.465 HZC(4) = 36.6649 HZC(5) = -20.5516 • HZC(6) = 4.85233 HZC(7) = 46. HZC(8) = -1011.249 C READ(17,101) R RCONV= R C READ(17,101) (HZC(I),1=1,8) CALL WFNS (RHO,TAU,W,1) RETURN 2 RHO=P/RT DRHO=RHO*.1 25 JUMP=0 RMAX=.1 CALL WFNS (RHO,TAU,W,2) PCALC=RHO*RT*(1.+W(1,1)+W(2,1)) 20 PC1=PCALC JUMP=JUMP+1 IF (UUMP-10) 31,31,32 32 RMAX=RMAX*.5 31 CONTINUE RH1=RHO RHO=RH1+DRHO CALL WFNS (RHO,TAU,W,2) PCALC = RHO*RT*(1.+W(1,1)+W(2,1 ) ) DRHO=(P-PCALC)/(PC1-PCALC)*(RH1-RHO) IF (DABS(DRHO)-RMAX) 26,26,27 27 DRHO=RMAX*DRHO/DABS(DRHO) 26 IF (JUMP-20)22,42,42 22 IF (DABS(DRHO)-.1E-6*RH0) 60,60,33 33 IF(DABS(P-PCALC)-1 .E-5*P) 60,60.20 3 V=.97+.032*(.01*THETA)**2 RH0=1./V DRH0=1./(V+.01+.005*(.01*THETA)**2) -RHO GO TO 25 60 V=1./RH0 4 RH0=1./V CALL WFNS (RHO,TAU,W,3) C IF (RHO .LT. 0.0) WRITE(6,43) P,THETA,RHO,DRHO,L IF (RHO .LT. 0.0) RETURN F=FZERO+ RT*(DLOG(RHO)+W(1,1) ) P=RHO*RT*(1.+W(1,1)+W(2,1)) H=HZERO+ RT*( W(1,1)+W(2,1)+W(1,2)) U=H-P*V S=SZERO+ R*(W(1,1)-W(1,2)+DLOG(RHO)) S = -S C DHVT = DH/DV AT CONSTANT T, SIMILARLY FOR DPTV AND DPVT DHTV = CPZERO+ R*(W(1, 1)+W(2,1)-W(1,2)-W(2,2)-W(1,3 ) ) DHVT = - RHO*RT*(W(1,1) + 3.*W(2, 1)+W(3, 1)+W(1,2)+W(2,2) ) DPTV=RHO*R*( 1 .+W(1,1)+W(2, 1)-W(1,2)-W(2,2)) DPVT = -RH0**2*RT*( 1.+2.*W(1,1)+4.*W(2,1)+W(3,1)) CV=DHTV- DPTV/RHO CP=DHTV-DHVT*DPTV/DPVT Td=1./(DPTV-DPVT*DHTV/DHVT) DPRT= 1,O/(-(RH0**2)) * DPVT C IF((CP/CV*DPRT) .LT. 0.0) RETURN RETURN 42 CONTINUE NE0=1 GO TO 60 101 F0RMAT(8F1O.0) 50 FORMAT (2D20.6 ) 155 FORMAT('0', 'B,C: ',2F15.4) SUBROUTINE CVMIN(CV, TK, A, B, C, D, E, F, G, DVDT, DVDP) THIS ROUTINE CALCULATES THE CV OF A PHASE USING THE HEAT CAPACITY (AT CONSTANT P) FUNCTION AND THE FOLLOWING THERMODYNAMIC RELATIONSHIP CP = A + BT + C/(T**2) + D/(T**.5) + E(T**2) + F/T + G/(T**3) CV = CP + ((DV/DT)**2 * TK / (DV/DP) TK - TEMPERATURE IN DEG K CV - RETURNED HEAT CAPACITY DV/DT - DERIVATIVE DF VOLUME WRT TEMPERATURE AT CONSTANT P DV/DP - DERIVATIVE OF VOLUME WRT PRESSURE AT CONSTANT T ALL OTHER CP TERMS ARE DEFINED IN THE ABOVE EQUATION CALL CPMIN(CP, TK, A, B, C, D, E, F, G) CV = CP + ((DVDT**2) * TK / DVDP) RETURN END SUBROUTINE DER(GRAND, DERIV, NDIR, IDIM, THIS ROUTINE SETS UP THE RIGHT HAND SIDE DERIVATIVE AND SOLVES IT COMMON BLOCKS PREVIOUSLY DEFINED COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMSS/ COMPSS(10,20), THERSS(8,20), NUMSS COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /NEWCOM/ CNEWAQ(10,25), CNEWPH(10,25), CNEWSS(10,20), CNEWG(10,10), INDX1(10), INDX2(10), INDX3(10), NUMELE COMMON /PATH/ C(25), CM0LE(10), XMN0W(1O), XMFUT(10), REAMT(5) , TKNOW, TKFUT, TAUNOW, TAUFUT, PNOW, PFUT, EMAX, STRONG, AMWAT, DTAU, DTK, DPRES, IP0INT(25), INDREA(5) , NUM, IPRINT, NUMREC REAL GRAND(IDIM, IDIM), DERIV(IDIM,JDIM), RHS(40) R = 8.3143 A10 = AL0G(10.OEOO) ZERO = 1.OE-05 NDIR = 0 CALL MINIT(DERIV,IDIM, JDIM, O.OEOO) GET WATER PROPERTIES CALL H20 (PNOW, TKNOW, VOLWAT, GWAT, HWAT, SWAT, XKWAT, CVWAT, DVDTW, DVDPW, DV2DT2, 0) JDIM) FOR THE 1'ST C ADD IN CHANGE IN THE NUMBER OF MOLES OF EACH COMPONENT C (NOTE THAT THIS WILL INCLUDE RADIO-ACTIVE DECAY) C AND INCLUDE THE CHANGE IN THE NUMBER OF MOLES C OF EACH REACTANT C C SPEED IS THE RATE OF EACH REACTION C SPEED = 1.OEOO DO 50 I = 1, NUMELE RHS(I) = DXM(I) IF (NUMREC .GT. O) THEN DO 40 J = 1, NUMREC K = INDREA(J) IF (ABS(CNEWPH(I,K)) .GT. ZERO) RHS(I) = RHS(I) - (CNEWPH(I.K) * SPEED) 40 CONTINUE ENDIF 50 CONTINUE C ACTIVITY OF WATER AND IONIC STRENGTH -- S AND V OF FLUID HAVE BEEN C APPROXIMATED BY THE S AND THE V OF PURE WATER. ,o IONIC = NUMELE + 1 O IAWAT = NUMELE + 2 C RHS(IONIC) = O.OEOO RHS(IAWAT) = VOLWAT * DTK / (R * TKNOW * AMWAT) RHS(IAWAT) = RHS(IAWAT) - (SWAT * DPRES / (R * TKNOW * AMWAT)) DO 150 J = 1, NUMAQ IF (IPOINT(J) .GT. 0) THEN K = IPOINT(J) + IAWAT DH = 0.0 DV = 0.0 DO 140 1 = 1 , NUMELE C GET V AND SUM > DELTA V C GET H AND SUM > DELTA H 140 CONTINUE RHS(K) = DH * DTK / (R * TKNOW * TKNOW) RHS(K) = RHS(K) - (DV * DPRES / (R * TKNOW)) C C DON'T FORGET ACTIVITY TERMS ENDIF 150 CONTINUE C C NOW SOLVE FOR THE FIRST DERIVATIVE CALL MMULT(DERIV, GRAND, RHS, K, K, 1, IDIM, JDIM, IDIM, IDIM, 40, 1) NDIR = 1 RETURN END SUBROUTINE GAMDI1( DGDI1, TK, P, D, STRENG, Z, AZERO, W) C THIS ROUTINE CALCULATES THE DERIVATIVE OF THE ACTIVITY C COEFICIENTS OF AQUEOUS SPECIES TAKEN WITH C RESPECT TO THE IONIC STRENGTH. HELGESON ET AL'S C MODEL IS USED FOR ACTIVITY COEF. C C DGDI1 IS RETURNED AND CONTAINS THE THE FIRST DERIVATIVE OF THE C LOG OF THE ACTIVITY COEFICIENT OF THE SPECIES C TAKEN WITH RESPECT TO THE IONIC STRENGTH C C THE FOLLOWING VARIABLES ARE PASSED C AZERO - ELECTROSTATIC RADIUS (IN ANGSTROMS) C D - DENSITY OF PURE WATER (M**3/KG) C STRENG- IONIC STRENGTH OF THE SOLUTION C C P - PRESSURE IN MPA C TK - TEMPERATURE IN DEG K C W - CONVENTIONAL BORN PARAMETER C C Z - CHARGE ON THE ION - IF 0 OR GREATER THEN 10, C AN ACTIVITY COEF. OF 1 IS USED. C LOCAL VARIABLES C DENS - DENSITY OF PURE WATER (CM**3/G) C W1 - ABSOLUTE BORN PARAMETER (0.5387E05 IS THE ABSOLUTE BORN C PARAMETER FOR HYDROGEN ION (HAL, PAGE 1304) C DIELE - DIELECTRIC CONSTANT OF WATER C SHORT - SHORT RANGE INTERACTION PARAMETER FOR NACL (KG/MOLE) C C SOLVE - SOLVATION PARAMETER FOR NACL (KG/MOLE) DGDI1 =0.0 IF (ABS(Z).GT.10.0.0R.ABS(Z).LT.1) RETURN C CALL NACL(SOLVE,SHORT,P,TK,DSOLDP,DSOLDT,DSHODP,DSHODT) CALL DIE(DIELE,TK,D) W1 = W + (Z * 0.5387E05 * 4.184) DENS = D / 1000.0 A = 1.824829238E06 * SQRT(DENS) / ((DIELE * TK)**1.5) A = (-1.0) * A * (Z**2) B = 50.29158649E08 * SQRT(DENS) / (SQRT(DIELE * TK)) B = AZERO * 1.OE-08 * B C DGDI1 = A / (2.OEOO * SQRT(STRENG) ) DGDI1 = DGDI1 / (1.0E00 + (B * SQRT(STRENG))) C D G D I 1 = D G D I 1 + ( ( A * B ) / ( 2 . O E O O * S O R T ( S T R E N G ) * ( O . O E O O + ( B * S O R T ( S T R E N G ) ) ) * * 2 ) ) ) T = ( - 0 . 0 1 8 0 1 5 3 E O O ) / ( 1 . 0 + ( 0 . 0 1 8 0 1 5 3 E O O * S T R E N G ) ) C = ( ( W 1 * S O L V E ) + S H O R T - ( 0 . 1 9 * ( A B S ( Z ) - 1 . 0 ) ) ) C D G D I 1 = D G D I 1 + T + C R E T U R N E N D S U B R O U T I N E G A Q U ( X L O G K , G . H . S , C 1 . C 2 . T H E T A , A 1 , A 2 , A 3 , A 4 , W, Z P T , Z P R T R , Y P R T R , P , T ) C T H I S R O U T I N E C A L C U L A T E S T H E G I B B S F R E E E N E R G Y A N D T H E L O G K C O F F O R M A T I O N F O R A N A Q U E O U S S P E C I E S U S I N G C H E L G E S O N , K I R K H A M A N D F L O W E R S ( 1 9 8 1 ) E Q U A T I O N S C C R E T U R N E D V A R I A B L E S ^ C X L O G K - L O G K O F F O R M A T I O N C C G - G I B B S F R E E E N E R G Y O F F O R M A T I O N £J C P A S S E D V A R I A B L E S ON C A 1 , A 2 , A 3 , A 4 - T E R M S I N T H E V O L U M E E X P A N S I O N C C 1 , C 2 - T E R M S I N T H E H E A T C A P A C I T Y E X P A N S I O N C C T H E T A - T E R M I N B O T H H E A T A N D V O L U M E E X P A N S I O N C H E N T H A L P H Y C S - E N T R O P Y C D E N S - D E N S I T Y O F W A T E R C W C O N V E N T I O N A L B O R N P A R A M E T E R C Y T R P R - D E R I V A T I V E O F T H E L N O F T H E D I E L E C T R I C C O N S T A N T W R T C T E M P E R A T U R E A T C O N S T A N T P R E S S U R E - E V A L U A T E D A T T R , P R C C T T E M P E R A T U R E ( D E G K ) C P - P R E S S U R E ( M P A ) C T R , P R - R E F E R E N C E T E M P E R A T U R E ( D E G K ) A N D P R E S S U R E ( M P A ) C C R - G A S C O N S T A N T ( J K * * - 1 M 0 L E * * - 1 ) A 1 0 = A L O G ( I O . O ) T R = 2 9 8 . 1 5 P R = 0 . 1 E 0 0 R = 8 . 3 1 4 3 C T H 1 = T - T H E T A T H O = T R - T H E T A G = H - ( T * S ) G = G + ( C 1 * ( T - T R - ( T * A L O G ( T / T R ) ) ) ) G = G + ( C 2 * ( T - T R - ( T H 1 * A L O G ( ( T H 1 / T H O ) ) ) ) ) G = G + ((2.0 * (A1 * TH1 + T * A3) * (P - PR) + (A2 * TH1 + A4 * T) * (P**2 - PR**2)) / (2.0 * TH1)) G = G - (W * (ZPT - ZPRTR - ((T - TR) * YPRTR))) C XLOGK = G / ((-A10) * R * T ) RETURN END SUBROUTINE GMIN(XLOGK, GTP, H, S, A, B, C, D, E, F, G, V, DVDT, DVDP, T, P) C C THIS ROUTINE CALCULATES THE LOG K AND G FOR FOR A SOLID PHASE C C RETURNED VARIABLES C C GTP - GIBBS FREE ENERGY OF FORMATION OF THE PHASE C C XLOGK - LOG (10) K OF FORMATION OF THE PHASE ho c 5 C PASSED VARIABLES C C A, B, C, D, E, F, G, - TERMS OF THE CP EQUATION C C H - ENTHALPHY AT PR AND TR C C S - ENTROPY AT PR AND TR C C V - VOLUME AT PR AND TR (IN CM**3 (= J/MPA) C C D(V) C DVDT = EVALUATED AT CONSTANT P C D(T) C C D(V) C DVDP = EVALUATED AT CONSTANT T C D(P) C C T - TEMPERATURE IN DEG K C P - PRESSURE IN MPA C TR, PR - REFERENCE TEMPERATURE (298.15 DEG K) AND PRESSURE (0.1 MPA) C C R - GAS CONSTANT ( J K**-1 M0LE**-1) C C CP AND VOLUME EQUATION USED (IN INTEGRATED FORMS) C C CP = A + BT + C/(T**2) + D/(T**.5) + E(T**2) + F/T + G/(T**3) to ON CO VTP = VO + ((DV/DT) * (T - TO)) + ((DV/DP) * (P - PO)) TR PR R A10 GTP 298.15 0. 1 8.3143 ALOG(10.0) = H (T * S) < (T - TR)) " T * (ALOG((T / < (T**2 - TR**2) ' T * (T - TR)) ' ((1.0E00/TR) -T R ) ) ) ) / 2.0) 2.0) (1.OEOO/T))) T * ((1.0/(TR**2)) - ( 1 . 0 / ( T * * 2 ) ) ) / 2.0 * (SQRT(T) - SORT(TR))) T * ((1.0/(SQRT(TR)) ) - (1.0/(SORT(T ) ) ) ) > (T**3 - TR**3) / 3.0) T * (T**2 - TR**2) / 2.OEOO) ALOG((T / TR))) T *((1.0/TR) - (1 . 0 / T ) ) ) ((1.0/(TR**2)) - ( 1 . 0 / ( T * * 2 ) ) ) / 2.0) T * ((1.0/(TR**3)) - ( 1 . 0 / ( T * * 3 ) ) ) / 3.0) 2.0) CALL VMIN(VTP0, V, DVDT, DVDP, T, PR) GTP = GTP + ((VTPO - (PR * DVDP)) * (P - PR)) + (DVDP * (P**2 - PR**2) / 2.0) XLOGK = GTP / ((-A10) * R * T ) RETURN END SUBROUTINE H20(PRES, TEMP, VOLUM, GTP, HTP, STP, EOCON, CV, DVDT, DVDP, D2VDT2, I SWT) THIS ROUTINE CALLS THE WATER ROUTINES AND CALCULATES THE PROPERTIES OF WATER PRES - PRESSURE OF CALCULATION (MPA) (PASSED) TEMP - TEMPERATURE OF CALCULATION (TK) (PASSED) GTP - GIBBS FREE ENERGY (J/MOL) (RETURNED) EOCON - EQUILIBRIUM CONSTANT (RETURNED) HTP - H AT T AND P (RETURNED) STP - S AT T AND P (RETURNED) CV - HEAT CAPACITY AT CONSTANT VOLUME (RETURNED) VOLUM - VOLUME AT T AND P (KG/M**3) (RETURNED) DVDT - DV/DT (P=CONST) (KG/M**3/DEG) (RETURNED) DVDP - DV/DP (T=CONST) (KG/M**3/MPA) (RETURNED) C D2VDT2 - D2V/DT2 AT CONTANT PRESSURE (RETURNED) C ISWT - A SWITCH USED IN THE PROGRAM C SHOULD BE EQUAL TO ONE ON THE C FIRST CALL AND ZERO ON THE REST (PASSED) C THE FOLLOWING VECTORS SAVE ALL WATER WATER DATA CALCULATED C THE FIRST DATA IS ALWAYS SAVED ON THE C ASSUMPTION THAT IT IS THE REFERENCE C CONDITIONS (POSN 1 OF ARRAYS) C OTHER POINTS ARE STORED IN POSITIONS 2 C THROUGH 42 AS CALCULATED, WITH THE OLDEST C POINT BEING THROWN AWAY. ALL POINTS ARE C CHECKED BEFORE THE WATER CALCULATION ROUTINE C IS CALLED - IF THE T AND P IS WITHIN .1 DEG C AND 0.01 MPA, THEN THOSE PROPERTIES ARE USED C PHLD - SAVED P, THLD - SAVED T, VOLHLD - SAVED VOLUME C GIBHLD - SAVED GIBBS FREE ENERGY, EQHLD - SAVED EQUILIBRIUM C CONSTANT, HHLD - SAVED ETHALPHY AT T AND P, SHLD - SAVED C ENTROPY AT T AND P, CVHLD - SAVED CV, DVTHLD - SAVED DVDT C AT P, DVPHLD - SAVED DVDP AT T , D2VPHLD - SAVED D2V/DT2 C IPOWAT - POSITION IN ARRRAY TO MAKE NEXT SAVE C LOCAL DOUBLE PRECISION VARIABLES - LAST CHARACTER IS ALWAYS D C C CPD - HEAT CAPACITY AT CONSTANT PRESSURE OF WATER C CVD - HEAT CAPACITY AT CONSTANT VOLUME OF WATER C FD - HELMHOLZ FREE ENERGY OF WATER C HD - ENTHALPHY OF WATER C DPTVD - DERIVATIVE OF P WRT. T AT CONSTANT V C DPRTD - DERIVATIVE OF P WRT. RHO AT CONSTANT T C DPVTD - DERIVATIVE OF P WRT. V AT CONSTANT T C PD - PRESSURE (MPA) OF WATER C SD - ENTROPY OF WATER C TD - TEMPERATURE (DEG K) OF WATER C TJD - JOULE THOMPSON COEF. OF WATER. C UD - INTERNAL ENERGY OF WATER C VD - VOLUME (KG/M**3) OF WATER DOUBLE PRECISION PD, TD, VD, HD, UD, SD, CPD, CVD, TJD, FD DOUBLE PRECISION DPTVD, DPRTD, DPVTD REAL PHLD(42), THLD(42), V0LHLD(42), GIBHLD(42), EQHLD(42), HHLD(42), SHLD(42), CVHLD(42), DVTHLD(42), DVPHLD(42), D2VHLD(42) INTEGER IPOWAT, IMAX SAVE PHLD, THLD, VOLHLD, GIBHLD, EQHLD, HHLD, SHLD, CVHLD, DVTHLD, DVPHLD, D2VHLD, IPOWAT, IMAX C IF (ISWT .EQ. 0) THEN C FIRST CHECKED SAVED VALUES ro O PLIM = 0.01 TLIM =0.1 DO 10 I = 1, IMAX IF (ABS((PHLD(I) - PRES)) .LT. PLIM .AND ABS((THLD(I) - TEMP)) .LT. TLIM ) VOLUM = VOLHLD(I) GTP = GIBHLD(I) EQCON = EQHLD(I) HTP = HHLD(I) STP = SHLD(I) CV = CVHLD(I) DVDT = DVTHLD(I) DVDP = DVPHLD(I) D2VDT2= D2VHLD(I) RETURN ENDIF 10 CONTINUE ELSE IMAX = 0 IPOWAT = 1 ENDIF A10 = ALOG(10.OEOO) R = 8.3143 PD = DBLE(PRES) TD = DBLE(TEMP) - 273.15D00 CALL THE WATER ROUTINE CALL STEAM(PD, TD, VD, HD, UD, SD, CPD, CVD, NE, DPTVD, DPRTD, DPVTD) THEN TRIPLE POINT REFERENCE DATA FOR WATERED T - DEG K; P - MPA; V - 0 / (G); H - J/G; W - G TJD, FD, 3, S - J / (G K) TTRIP = = 273.16E00 STRIP = = 3.5144E00 PTRIP = = 0.0006113E00 VTRIP = = 0.10002E00 HTRIP = = -1597 1 .OEOO WH20 = = 18.01534E00 VOLUM = = SNGL(VD) / 1.0E03 CV = SNGL(CVD) DVDP = = (1.0E00 / SNGL(DPVTD)) / 1.0E03 DVDT STP HTP = DVDP * SNGL(DPTVD) * (-1.0) SNGL(SD) SNGL(FD) GTP E0C0N STP HTP GTP EQCON HTP GTP + + + (TEMP (TEMP STP) -- TTRIP) ) (STRIP * STRIP (STRIP ((TEMP HTRIP ((PRES * 1.0E03 * VOLUM) STP) TTRIP)) - (PTRIP * VTRIP)) / ((-A10) * R * TEMP) STP HTP GTP EOCON WH20 WH20 WH20 WH20 C C C C C C C C C C c c ******** D2V/DT2 IS NOT CALCULATED ???????? D2VDT2 = O.OEOO PHLD(IPOWAT) = PRES THLD(IPOWAT) = TEMP VOLHLD(IPOWAT) = VOLUM GIBHLD(IPOWAT) = GTP EOHLD(IPOWAT) = EQCON HHLD(IPOWAT) = HTP SHLD(IPOWAT) = STP CVHLD(IPOWAT) = CV DVPHLD(IPOWAT) = DVDP DVTHLD(IPOWAT) = DVDT D2VHLD(IP0WAT) = D2VDT2 IMAX = IMAX + 1 IPOWAT = IPOWAT + 1 IF (IMAX .GT. 42) IMAX = 42 IF (IPOWAT .GT. 42) IPOWAT = 2 RETURN END SUBROUTINE HAQU( HTP, HF, C1, C2, THETA, A1, A2, A3, A4, W, YPT, YPRTR, ZPT, ZPRTR, TK, P) THIS ROUTINE CALCULATES THE ENTHALPY OF AN AQUEOUS SPECIES USING EQUATION 275 FROM HELGESON, KIRKHAM AND FLOWERS, AJS 281, P. 1413 (1981). RETURNED@D HTP - CALCULATED ENTHALPY AT T AND P PASSED@D A1 ZPRTR -HF P TK A2, A3, A4, THETA, C l , C2, W, YPT, YPRTR. ZPT, PARAMETERS IN EQUATION. SEE TEXT FOR DETAILS. - DELTA H OF FORMATION AT TR AND PR - PRESSURE IN MEGA-PASCALS - TEMPERATURE IN DEG K. NOTE@D UNITS USED ARE JOULES AND MEGA-PASCALS, NOT CALORIES AND BARS AS IN HELG. ET. AL. REAL HTP, HF, C1, C2, THETA, A1, A2, A3, A4, W, YPT REAL YPRTR, ZPT, ZPRTR, TK, P, PR, TR t o t o C C c c c c c c c c c c c c c c c c c c c c PR = 0.1E00 TR = 298. 15 HTP = HF + ((C1 + C2) * (TK - TR) ) + (C2 * THETA * AL0G(((TK - THETA)/(TR - THETA))) ) + (A1 * (P - PR)) + (A2 * (P**2 - PR**2) / 2.OEOO) + ( ( ( 2 . 0 * A3 * TK * (P - PR)) + (A4 * TK * (P**2 -PR**2))) / (2.0 * (TK - THETA))) + ( ( ( 2 . 0 * THETA * A3 * TK * (P - PR)) + (THETA * A4 * TK * (P**2 - PR**2))) / (2.0 * ((TK - THETA)**2) ) ) + (W * ((TK * YPT) - (TR * YPRTR) - ZPT + ZPRTR)) RETURN END SUBROUTINE HMIN(HTP, HZERO, A, B, C, D, E, F, G, V, DVDT, DVDP, T, P) THIS ROUTINE CALCULATES H AT T AND P FOR A GIVEN PHASE RETURNED VARIABLES HTP = ENTHALPHY AT T AND P PASSED VARIABLES@D T - TEMPERATURE IN DEG K P - PRESSURE IN MPA HZERO - ENTHALPHY AT 298 AND . 1 MPA A, B, C, D, E, F, G - CP TERMS V - VOLUME AT TR, PR DVDT - (DV/DT) AT CONSTANT P DVDP - (DV/DP) AT CONSTANT T INTERNAL VARIABLES@D R - GAS CONSTANT ( J K**-1 MOLE**-i) TR - 298.15 DEG. K PR - 0 . 1 MPA VTPO - VOLUME AT T AND PO CP AND VOLUME EQUATION USED (IN INTEGRATED FORMS) CP = A + BT + C/(T**2) + D/(T**.5) + E(T**2) + F/T + G/(T**3) VTP = VO + ((DV/DT) * (T - TO)) + ((DV/DP) * (P - PO)) TR = 298.15E00 PR = 0.1E00 HTP = HZERO + (A * (T - TR)) + (B * (T**2 - TR**2) / 2.0) + (C * ((1.0E00/TR) - (1.0E00/T))) + (D * 2.0 * (SQRT(T) - SORT(TR))) + (E * (T**3 - TR**3) / 3.0) + (F * ALOG((T / TR))) + (G * ((1.0/(TR**2) ) - ( 1 . 0 / ( T * * 2 ) ) ) / 2.0) r o CALL VMIN(VTP0, V, DVDT, DVDP, T, PR) HTP = HTP + ((VTPO - (PR * DVDP)) * (P - PR)) + (DVDP * (P**2 - PR**2) / 2.0) + ((-1.0) * DVDT * (P - PR) * T) RETURN END SUBROUTINE LEFT(GRAND, IDIM) IN ARRAY AARRAY, COMPONENTS ARE STORED IN THE FIRST NUMELE ROWS/COLUMNS. THE NUMBER OF MOLES OF WATER IS STORED IN THIS AREA, IT'S COLUMN IS DETERMINED BY IT'S COMPONENT NUMBER. THE IONIC STRENGTH IS COLUMN/ROW NUMELE + 1. THE ACTIVITY OF WATER IS STORED IN COLUMN NUMBER NUMELE + 2, THE ACTIVITY OF WATER EQUATION IS ROW NUMBER NUMELE + 2 THERPH(14,25), THERAQ(13,25) , THERSS(8,20). THERG(6,10), CNEWPH(10,25), NUMPH NUMAQ NUMSS NUMG CNEWSS(10,20) , INDX2(10), INDX3O0), COMMON /CHEMPH/ COMPPH(10,25), COMMON /CHEMAQ/ COMPAQ(10,25), COMMON /CHEMSS/ COMPSS(10,20), COMMON /CHEMG / COMPG(10,10), COMMON /NEWCOM/ CNEWAQ(10,25), CNEWG(10,10), INDX1(10), NUMELE COMMON /PATH/ C(25), CM0LE(1O), XMNOW(10), XMFUT(10), REAMT(5), TKNOW, TKFUT, TAUNOW, TAUFUT, PNOW, PFUT, EMAX, STRONG, AMWAT, DTAU, DTK, DPRES, IP0INT(25), INDREA(5) , NUM, IPRINT, NUMREC REAL GRAND(IDIM, IDIM) REAL AARRAY(10, 10), BARRAY(10.25), CARRAY(25, 10) , RESULT(25,25) X = 1000.00E00 / THERAQ(1,1) ZERO = 1.0E-05 IONIC = NUMELE + 1 IAWAT = NUMELE + 2 CALL MINIT(AARRAY, 10, 10, O.OEOO) CALL MINIT(BARRAY, 10, 25, O.OEOO) CALL MINIT(CARRAY, 25, 10, O.OEOO) CALL MINIT(RESULT, 25, 25, O.OEOO) CALL MINIT(GRAND, IDIM, IDIM, O.OEOO) LOAD AARRAY AARRAY(IONIC, IONIC) = 1.0 AARRAY(IAWAT, IAWAT) = 1.0 DO 100 1 = 1 , NUMELE K1 = INDX1(I) K2 = INDX2(I) IF (K2 .EQ. 1) THEN MINERAL COMPONENTS DO 20 d = 1, NUMELE AARRAY(d,I) = CNEWPH(I.KI) CONTINUE ELSE IF (K2. EQ. 2) THEN AQUEOUS SPECIES IF (K 1 .EQ. 1) THEN DO 40 d = 1, NUMELE AARRAY(d,I ) = CNEWAQ(d,K1) DO 30 JI = 2, NUMAQ AARRAY(J.I) = AARRAY(d , I ) + (CNEWAQ(I,d1 ) * C(d) ) CONTINUE AARRAY(d,I) = AARRAY(d,I) / X CONTINUE ELSE DO 50 d = 1, NUMELE AARRAY(d,I) = CNEWAQ(d,K1) * AMWAT * C(K1)/X CONTINUE AARRAYCIONIC,I) = (-0.5) * (THERAQ(12,K1)**2) AARRAY(IONIC,I) = AARRAY(I ONIC,I) * C(K1) AARRAY(IAWAT,I) = C(K1) / X ENDIF ELSE IF (K2. EQ. 3) THEN SOLID SOLUTION COMPONENTS DO 70 d = 1, NUMELE AARRAY(d,I) = CNEWSS(I,K1) CONTINUE ELSE IF (K2. EQ. 4) THEN GAS COMPONENTS DO 90 d = 1, NUMELE AARRAY(d,I) = CNEWG(I,K1) CONTINUE ENDIF CONTINUE AARRAY(IAWAT , IONIC) = O.OEOO DO 110 I = 2, NUMAQ CALL GAMDI1(GDI) AARRAY(IAWAT, IONIC) = AARRAY(IAWAT, IONIC) + ( C ( I ) * GDI) 110 CONTINUE C LOAD BARRAY LOOP = 0 DO 220 1 = 1, NUMAO K = IPOINT(I) IF (K .GT. 0) THEN LOOP = LOOP + 1 DO 210 J = 1, NUMELE BARRAY(J,K) = CNEWAQ(J,I) * AMWAT * C ( I ) / X 210 CONTINUE BARRAY(IONIC,K) = (-0.5E00) * (THERAQ(12,I)**2) * C ( I ) BARRAY(IAWAT.K) = C ( I ) / X ENDIF 220 CONTINUE C LOAD CARRAY C DO 310 I = 1, NUMELE K2 = INDX2(I) <-n IF (K2 .EO. 2) THEN DO 300 J = 1, NUMAO K = IPOINT(U) K1 = INDXKI) IF (K .GT. 0 .AND. CNEW(K1,I) .GT. ZERO) THEN IF (K1 .NE. 1) THEN CALL GAMDI1(GDI) CARRAY(K.I) = CNEWAQ(K1,I) * (-1.0) CARRAY(K,IONIC) = CARRAY(K,I ) * GDI ELSE CARRAY(K,IAWAT) = CNEWAQ(K1,I) * (-1.0) ENDIF ENDIF 300 CONTINUE ENDIF 310 CONTINUE DO 320 1 = 2 , NUMAO K = IPOINT(I) IF (K.GT.O) THEN CALL GAMDI1(GDI) CARRAY(I,IONIC) = CARRAY(K,IONIC) + (GDI) ENDIF 320 CONTINUE C CALCULATE THE INVERSE OF THE GRAND MATIX FROM THE A, B, C ARRAYS C USING THE PARTITIONING TECHNQUE - STORE IN GRAND MATRIX C A B -1 J K GRAND = GRAND C D L M BUILD J PORTION CALL MMULT(RESULT, BARRAY, CARRAY, IAWAT, LOOP, IAWAT, 25, 25, 10, 25, 25, 10) DO 410 d = 1, IAWAT DO 400 1 = 1 , IAWAT RESULT(I.d) = AARRAY(I,d) - RESULT(I.d) CONTINUE CONTINUE I = 0 CALL INVRT(RESULT, IAWAT, 25, I) IF (I.NE.0) THEN WRITE(6,1001) STOP ENDIF CALL MCOPY(GRAND, RESULT, 1, 1, IAWAT, IAWAT, IDIM, IDIM, 25, 25) BUILD L PORTION CALL MMULT(RESULT, CARRAY, GRAND, LOOP, IAWAT, IAWAT, 25, 25, 25,10, IDIM, IDIM) CALL MMULTC(RESULT, -1.0, LOOP, IAWAT, 25, 25) I = IAWAT + 1 CALL MCOPY(GRAND, RESULT, I, 1, LOOP, IAWAT, IDIM, IDIM, 25, 25) BUILD K PORTION CALL MMULT(RESULT, GRAND, BARRAY, IAWAT, IAWAT, LOOP, 25, 25, IDIM, IDIM, 10, 25) CALL MMULTC(RESULT, -1.0, IAWAT, LOOP, 25, 25) CALL MCOPY(GRAND, RESULT, 1, I, IAWAT, LOOP, IDIM, IDIM, 25, 25) BUILD M PORTION (NOTE AS BARRAY IS NOT USED ANY MORE, IT IS USED FOR TEMPERARY STORAGE OF K PORTION CALL MCOPY(BARRAY, RESULT, 1, 1, IAWAT, LOOP, 10, 25, 25, 25) CALL MMULT(RESULT, CARRAY, BARRAY, LOOP, IAWAT, LOOP, 25, 25, 25, 10, 10, 25) CALL MMULTC( RESULT, -1.0, LOOP, LOOP, 25, 25) DO 450 d = 1, LOOP RESULT(J.U) = RESULT(d.j) + 1.0 450 CONTINUE CALL MCOPY(GRAND, RESULT, I, I, LOOP, LOOP, IDIM, IDIM, 25, 25) S3 1001 RETURN FORMAT('O ERROR IN ROUTINE LEFT - SINGULAR MATRIX RETURNED ',/, FROM INVERT ROUTINE. BAD SETUP !!') END SUBROUTINE NEW( TIME, VALUE, THIS ROUTINE GETS THE VALUES AT FUTURE TIMES COMMON /UPPER / PMIN, PMAX, TMIN, TMAX, IF (ISWIT .EO. 1) THEN IF (TIME .LT. PTIME .AND. VALUE = PMIN + ((PMAX ISWIT) FOR PRESSURE AND TEMPERATURE PTIME, PSTART, TTIME, TSTART TIME .GT - PMIN) * ELSE IF (TIME .GE. VALUE = PMAX ELSE IF (TIME .LE. VALUE = PMIN ENDIF ELSE IF (ISWIT .EO. 2) IF (TIME .LT. TTIME VALUE = TMIN + PTIME) THEN PSTART) THEN PSTART) THEN (TIME - PSTART) / (PTIME - PSTART)) THEN .AND. TSTART) THEN (TIME - TSTART) / TSTART) ) TIME .GT. ((TMAX - TMIN) (TTIME ELSE IF (TIME .GE. TTIME) THEN VALUE = TMAX ELSE IF (TIME .LE. TSTART) THEN VALUE = TMIN ENDIF ENDIF RETURN END SUBROUTINE NACL(SOLVE,SHORT,PMA,TK,DSOLDP,DSOLDT,DSHODP,DSHODT) THIS ROUTINE CALCULATES THE SHORT RANGE INTERACTION PARAMETER (SHORT) AND THE SOLVATION PARAMETER (SOLVE) FOR THE GIVEN T (DEG K) AND P (MPA) IT ALSO CALCULATES THEIR DERIVATIVES WITH RESPECT TO T AND P SHORT CONTAINS THE SHORT RANGE INTERACTION PARAMETER SOLVE CONTAINS THE SOLVATION PARAMETER DSHODP CONTAINS THE DERIVATIVE OF THE SHORT RANGE PARAMETER WITH RESPECT TO PRESSURE CO c c c c c c c c c c c c c c c c c c DSHODT CONTAINS THE DERIVATIVE OF THE SHORT RANGE PARAMETER WITH RESPECT TO TEMPERATURE DSOLDP CONTAINS THE DERIVATIVE OF THE SOLVATION PARAMETER WITH RESPECT TO PRESSURE DSOLDT CONTAINS THE DERIVATIVE OF THE SOLVATION PARAMETER WITH RESPECT TO TEMPERATURE NOTE@D VALUES ARE FROM TABLES 29 AND 30, HELG. ET AL, THE VALUE FOR THE SOLVATION PARAMETER IS THEN MODIFIED WITH EQUATION 149. I DIRECTION IN MATRIX IS PRESSURE J IS TEMPERATURE TEMPERATURES ARE FROM 25 TO 500 DEG C PRESSURES ARE FROM .1 (SEE NOTE) TO 500 MPA NOTE@>D THE LOWER PRESSURES ARE ALONG THE BOILING CURVE, BUT NO CORRECTIONS HAS BEEN MADE. INITIALIZE SHORT RANGE INTERACTION PARAMETER AND SOLVATION PARAMETER FOR NACL FOR SUBROUTINE. SH0(6,20) S0L(6,20) 2.47, 2 58, 2 . 66, 2 72, 2 77, 2 82, 2.15, 2 28, 2 . 37 , 2 45, 2 51 , 2 56, 1 .79, 1 95. 2. 06, 2 15, 2 22, 2 28, 1 .39, 1 58, 1 . 72, 1 83, 1 91 , 1 99, 0.93, 1 18, 1 . 35, 1 48, 1 58, 1 67, 0.41 , 0 73, 0. 95, 1 1 1 , 1 23, 1 33, -0.18, 0 25, 0. 51 , 0 72, 0 86, 0 98, -0.85, - o 28, 0. 04, 0 29, 0 47, 0 60, -1.64, -0 86, -0. 46, -0 15, 0 05, 0 21 , -2.57, -1 50, -1. 00, -0 63, -0 38, -0 20, -3.71 , -2 20, -1. 57, -1 13, -0 84, -0 63, -5.21 , -2 99, -2 . 19, -1 67, - 1 33, -1 09, -7.32, -3 88, -2 . 85, -2 24, - 1 85, -1 58, -7.32, -4 91 • -3 . 58, -2 86, -2 40, -2 10, -7.32, -6 1 1 , -4. 38, -3 52, -2 99, -2 65, -7.32, -7 56, -5. 26, -4 24, -3 63, -3 25, -7.32, -9 31 , -6. 24, -5 03, -4 32, -3 85, -7.32, -11 43, -7. 34, -5 87, -5 06, -4 57, -7.32, -14 01 , -8 . 56, -6 78, -5 84, -5 28, -7.32, -17 12, -9 . 88, -7 73, -6 63, -6 00 / -9.77, -9 19, -9 • 12, 9.51 , -10.44, -1 1 76, -5.59, -5 07, -5 • 52, -5.60, -5.66, -5 87, -2.43, -2 63, -2 .65, -2.46, -2.15, -1 68, 0.23, - o 07, -0 . 10, 0.13, 0.71, 1 39, 2.44, 1 71 , 1 • 85, 2.14, 3.05, 4 21 , 4.51 , 4 13, 4 • 12, 4.28, 5.13, 6 26, 6.38, 5 91 , 5 88, 6.16, 7 .05, 8 13, 8.11, 9.73, 11.29, 12.71 , 14.15, 15.49, 15.49, 15.49, 15.49, 15.49, 15.49, 15.49, 15.49, 7 .48, 9.27, 10.80, 12.24, 13.68, 15. 16, 16.48, 17.80, 19.12, 20.33, 21.55, 22.86, 24.03, 7.66, 9.20, 10.73, 12.19, 13.66, 15.10, 16.42, 17.79, 19.11, 20.35, 21.61, 22.84, 23.95, 8.18, 9.59, 11.15, 12.62, 13.99, 15.41 , 16.76, 18.10, 19.40, 20.66. 21.85, 23.09, 24.32, 9.05, 10.40, 11.92, 13.39, 14.83, 16.23, 17.52. 18.81 . 20.13, 21.38, 22.56, 23.74, 24.94, 10.30, 11.58, 13.15, 14.54, 16.01, 17.36, 18.68, 19.88, 21.23, 22.38, 23.64, 24.78, 25.95 SAVE SHO, SOL T = TK - 273.15E00 P = PMA R = ALOG(10.OEOO) * 8.3143EOO * TK d1 = IFIX(T/25.OOEOO) IF (J1.LT.1) d 1 = 1 IF (J1.GT.19) d1 = 19 d2 = 01 + 1 1 1 = 1 + IFIX(P / 100.OEOO) IF (11.LT.1) 11 = 1 IF (11.GT.5) 11 = 5 1 2 = 1 1 + 1 TEMPI = 25.OEOO * FLOAT(d1) TEMP2 = 25.OEOO * FL0AT(d2) PRES1 = (FLOAT(11) - 1.0) * 100.0 PRES2 = (FL0AT(I2) - 1.0) * 100.0 DELTAT = (T - TEMP 1)/(TEMP2 - TEMPI) DELTAP = (P - PRES1)/(PRES2 - PRES 1 ) X1 X2 (DELTAT (DELTAT (SOL(I 1,d2) (S0L(I2,d2) SOL(I 1 , S0L(I2, d 1 ) ) ) d 1 ) ) ) SOL(I 1,d 1 ) SOL(12,d1) DSOLDP = (X2 - X1) * 1.0E-05 / R SOLVE = DELTAP * (X2 - X1) + X1 SOLVE = SOLVE * 1.0E-03 / R X1 = (DELTAP * (S0L(I2,d1) - S 0 L ( I 1 , d 1 ) ) ) + S0L(I1,d1) X2 = (DELTAP * (S0L(I2,d2) - S 0 L ( I 1 , d 2 ) ) ) + S0L(I1,d2) DSOLDT = ((X2 - X1) * 1.0E-03) / (25.OEOO * R) DSOLDT = DSOLDT - (SOLVE / (TK * R)) X1 = (DELTAT * (SH0(I1.J2) - SH0(I1,J1))) + SH0(I1,J1) X2 = (DELTAT * (SH0(I2,J2) - SH0(I2,d1))) + SH0(I2,J1) DSHODP = (X2 - X1) * 1.0E-04 SHORT = ((DELTAP * (X2 - X1)) + X1) * 1.0E-02 X1 = (DELTAP * (SH0(I2,J1) - SHO(I1,d1))) + SHO(I1,d1) X2 = (DELTAP * (SH0(I2,d2) - SHO(I1,d2))) + SH0(I1,d2) DSHODT = (X2 - X1) * 1.0E-02 / 25.OEOO C RETURN END SUBROUTINE GAMMA(COEF,TK,P,D,STRENG,Z,AZERO,W) C THIS ROUTINE CALCULATES ACTIVITY COEFICIENTS ACCORDING TO C HELGESON ET AL'S MODEL C COEF IS RETURNED AND CONTAINS THE LOG OF THE ACTIVITY COEFICIENT C OF THE SPECIES C C THE FOLLOWING VARIABLES ARE PASSED C C AZERO - ELECTROSTATIC RADIUS (IN ANGSTROMS) C DENS - DENSITY OF PURE WATER (CM**3/G) C C D - DENSITY OF PURE WATER (M**3/KG) O c C STRENG- IONIC STRENGTH OF THE SOLUTION C C P - PRESSURE IN MPA C TK - TEMPERATURE IN DEG K C W - CONVENTIONAL BORN PARAMETER C W1 - ABSOLUTE BORN PARAMETER (0.5387E05 IS THE ABSOLUTE BORN C PARAMETER FOR HYDROGEN ION (HAL, PAGE 1304) C C Z - CHARGE ON THE ION - IF 0 OR GREATER THEN 10, C AN ACTIVITY COEF. OF 1 IS USED. C LOCAL VARIABLES C DIELE - DIELECTRIC CONSTANT OF WATER C C SHORT - SHORT RANGE INTERACTION PARAMETER FOR NACL (KG/MOLE) C SOLVE - SOLVATION PARAMETER FOR NACL (KG/MOLE) COEF = 0.0 IF (ABS(Z) .GT. 10.0 .OR. ABS(Z) .LT. 1.0) RETURN C CALL NACL(SOLVE,SHORT,P,TK,DSOLDP,DSOLDT,DSHODP,DSHODT) CALL DIE(01ELE,TK,D) W1 = W + (Z * 0.5387E05 * 4.184) DENS = D / 1000.0 A = 1.824829238E06 * SORT(DENS) / ((DIELE * TK)**1.5) A = (-1.0) * A * (Z**2) * SORT(STRENG) B = 50.29158649E08 * SQRT(DENS) / (SORT(DIELE * TK)) B = 1.0 + (AZERO * 1.0E-08 * B * SORT (STRENG)) T = (-1.0) * ALOG((1.0 + (0.0180153 * STRENG))) C = ((W1 * SOLVE) + SHORT - (0.19 * (ABS(Z) - 1.0))) * STRENG COEF = (A/B) + T + C RETURN END SUBROUTINE SETUP5 THIS ROUTINE SETS UP THE INITIAL DISTRIBUTION OF SPECIES FOR EACH NODE. COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(5 1 ) , WATER(51), INDEXK10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CELLS/ CELLPO(51,2), CELLPE(51,2), CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC COMMON /CHEMAQ/ COMPAQ(10,25), THERAQ(13,25), NUMAO COMMON /NEWCOM/ CNEWAOv10.25), CNEWPH(10,25), CNEWSS(10,20), CNEWG(10,10), INDX1(10), INDX2(10), INDX3(10), NUMELE REAL C(10), TOTAL(10), ACT1(10), ACT2(10) NOTE THAT ON THE INITIAL CALL, THE IONIC STRENGTH IS ZERO, BUT FOR LATER CALLS, THE IONIC STRENGTH OF THE LAST NODE IS USED 10 = 0 STRENG = O.OEOO NUMELE = NCONST CALL MINIT(ACT1, 10, 1, O.OEOO) CALL MINIT(ACT2, 10, 1, O.OEOO) DO 40 I = 1, NUMCHM DO 10 d = 1, NCONST INDX1(d) = INDEX 1(d,I) INDX2(J) = INDEX2(d,I) INDX3(d) = INDEX3(d,I) C(d) = CHEM(d,I) TOTAL(d) = TOTALM(d.I) CONTINUE T = CELLT(I,INOWT) P = CELLP(I,INOWP) IB = IBAL(I) WRITE( 6,1001) I, T, P WRITE(10,1004) TAUM, DTAUM CALL DIST(T, P, STRENG, TOTAL, C, ACT 1, ACT2, VOL, IB, ISAT) FROM DIST, IF ISAT IS NOT ZERO, THEN THE FLUID IS SUPERSATURATED. ACT 1 CONTAINS THE TOTAL MOLALITY OF GLOBAL COMPONENTS IN THE FLUID ACT2 CONTAINS THE NUMBER OF MOLES OF GLOBAL COMPONENTS IN THE SOLID PHASES TOTAL CONTAINS THE TOTAL MOLALITY OF LOCAL COMPONENTS IN THE FLUID IF (ISAT.NE.O) 10 = 1 DO 20 J = 1, NCONST AQCO(J,I,INOWC) = ACT1(d) AQCO(J,I,IFUTC) = ACT1(d) SOCO(d,I,INOWC) = ACT2(d) SOCO(J,I,IFUTC ) = ACT2(d) CHEM(J.I) = C ( J ) TOTALM(J.I) = TOTAL(J) CONTINUE IBAL(I) = IB STRNGH(I) = STRENG USING VOLUME OF FLUID PER 1000 GRAMS H20, CALCULATE NUMBER OF MOLES OF WATER. d = I K = d - 1 IF (K.LT.1) K = d IF (d.GE.NUMCHM) d = K VOLUME = THICK * THICK * ((SIZEX(d) + SIZEX(K))/2.0) VOLUME = VOLUME * CELLPO(I,INOWP) WATER(I) = (VOLUME / VOL) * (1000.OEOO / THERAQ(1,1)) WRITE(6,1002) I, WATER(I) NOW CONVERT TOTAL MOLALITES TO TOTAL NUMBER OF MOLES ADD SOLID PHASES TO TOTALM ARRAY DO 30 d = 1, NCONST TOTALM(d.I) = TOTALM(d.I) * WATER(I) * THERAQ(1,1) TOTALM(d.I) = TOTALM(d.I) / 1000.00E00 K = INDEX2(d,I) IF (K.E0.1) TOTALM(d.I) = TOTALM(d.I) + CHEM(d.I) CONTINUE CONTINUE IF (IQ.NE.O) THEN WRITE(6,1003) STOP ENDIF C RETURN 1001 FORMATC1 DISTRIBUTION OF SPECIES CALLED AT TIME 0 FOR ', ' NODE: ',15,/,' WITH A TEMPERATURE OF '.F10.3, ' ( D E C K ) AND A PRESSURE OF '.F10.3,' (MPA)') 1002 FORMAT(//,' TOTAL NUMBER OF MOLES OF WATER AT NODE: ',15, ' = '.E12.5) 1003 FORMAT('0',' *********************************************' i/ j //,' DISTRIBUTION OF SPECIES AT TIME 0 FOUND NODES',/. ' THAT ARE SUPERSATURATED. TRY AGAIN WITH NEW ',/, ' INITIAL CONDITIONS. ',//, 1004 F0RMAT(2(1X,E12.5)) END SUBROUTINE S0LVEM(ITERP, ITERT, ITERC, ITERM) C NEW COMMON BLOCK. THIS BLOCK IS ONLY USED IN THE REACTION C SUBROUTINES COMMON /PATH/ C ( 2 5 ) , CM0LE(10), XMN0W(10), XMFUT(10), REAMT(5), TKNOW, TKFUT, TAUNOW, TAUFUT, PNOW, PFUT, EMAX, STRONG, AMWAT, DTAU, DTK, DPRES, IP0INT(25), INDREA(5), NUM, IPRINT, NUMREC 00 L U> C XMNOW, XMFUT ARE THE TOTAL NUMBER OF MOLES OF EACH OF THE COMPONENTS C AT PRESENT AND FUTURE TIMES C C TKNOW, TKFUT IS THE TEMPERATURES AT PRESENT AND FUTURE TIMES. C PNOW, PFUT IS THE PRESSURES AT PRESENT AND FUTURE TIMES. C TAUNOW, TAUFUT IS THE TIMES AT PRESENT AND FOR THE FUTURE. C C AMWAT IS THE NUMBER OF MOLES OF WATER C NUM IS THE NUMBER OF COMPONENTS (EQUAL TO NUMEL) C C IPRINT IS A SWITCH IF THERE SHOULD BE ANY OUTPUT C C EMAX IS AN ERROR LIMIT TEST C C STRONG IS THE IONIC STRENGTH OF THE SOLUTION C C IS THE LOG MOLALITY OF EACH OF THE AQUEOUS SPECIES C IPOINT INDICATES WHERE AN AQUEOUS SPECIES WILL BE IN THE C GRAND MATRIX C PREVIOUSLY DEFINED COMMON BLOCKS C COMMON /CELLCO/ CHEMO(10,51) COMMON /CELLCH/ CHEM(10,51), TOTALM(10,51), STRNGH(51), WATER(51), INDEX1(10,51), INDEX2(10,51), INDEX3(10,51), IBAL(51), NUMCHM, NCONST COMMON /TIME/ DTAUP, DTAUT, DTAUC, DTAUM, TAUP, TAUT, TAUC, TAUM, W1 COMMON /CELLS/ CELLPO(51,2 ) , CELLPE(5 1 ,2 ) , CELLP(51,2), CELLT(51,2), DENSF(51,2), SIZEX(51), XINERT(51), THICK, NUMX, INOWP, IFUTP, INOWT, IFUTT COMMON /TRANS/ VEL0C(51,2), AQCO(10,51,2), SOCO(10,51,2), ALPHA(10), INOWC, IFUTC COMMON /REACT/ REACTA(5,51), IREACT(5,51 ) , NUMREA(51 ) COMMON /CHEMPH/ COMPPH(10,25), THERPH(14,25), NUMPH COMMON /CHEMAO/ COMPAO(10,25), THERAQ(13,25), NUMAQ COMMON /CHEMSS/ COMPSS(10,20), THERSS(8,20), NUMSS COMMON /CHEMG / COMPG(10,10), THERG(6,10), NUMG COMMON /NEWCOM/ CNEWAQ(10,25), CNEWPH(10,25), CNEWSS(10,20), CNEWG(10,10), INDX1(10), INDX2(10), INDX3(10), NUMELE REAL GCOMP(IO), ACT(10), G(25) A10 = ALOG(10.0E00) ZERO = 1.0E-05 IPRINT = 1 EMAX = 1.0E-05 NODES 1 AND NUMX ARE CONSTANT AT ALL TIMES, SO NO CHEMICAL REACTIONS ARE CALCULATED DO 900 L = 2, (NUMX - 1) CALL IMINIT(IPOINT, 25, 1, O) CALL MINIT(ACT, 10, 1, O.OEOO) S = (CELLT(L,IFUTT) - CELLT(L,INOWT) ) / DTAUT TKNOW = ( S * ((TAUM - DTAUM) - (TAUT - DTAUT))) + CELLT(L,INOWT) TKFUT = ( S * (TAUM - (TAUT - DTAUT))) + CELLT(L,INOWT) S = (CELLP(L,IFUTP) - CELLP(L,INOWP) ) / DTAUP PNOW = ( S * ((TAUM - DTAUM) - (TAUP - DTAUP))) + CELLP(L,INOWP) PFUT = ( S * (TAUM - (TAUP - DTAUP))) + CELLP(L,INOWP) TAUNOW = TAUM - DTAUM TAUFUT = TAUM DO 100 J = 1, NUMELE INDX1(d) = INDEX 1(d,L) INDX2(d) = INDEX2(d,L) 100 INDX3(d) = INDEX3(d,L) CHEMO(d,L) = CHEM(d.L) CMOLE(d) = CHEM(d.L) XMNOW(d) = TOTALM(d.L) S = (SOCO(d,L,IFUTC) - SOCO(d,L,INOWC)) + (AQCO(d,L,IFUTC) - AQCO(d,L,INOWC)) S = S / DTAUC XMFUT(d) = S * (TAUM - (TAUC - DTAUC)) + XMNOW(d) CONTINUE STRONG = STRNGH(L) AMWAT = WATER(L) 00 1 10 CALCULATE ACTIVITY COEFFICIENTS CALL H20(PN0W, TKNOW, DENS, GIBBS, HTP, CV, DVDT, DVDP, D2VDT2, O) DENS = 1.OEOO / DENS C(1) = O.OEOO CALL DIE1(T, DENS, DVDP, DVDT, D2VDT2, YTRPR, E, TRP, ZTP, X, 0) DO 110 I = 2, NUMAO CALL GAMMA(COEF,TKNOW,PNOW,DENS, THERAQ(12,1), THERAO(13,1), C ( I ) = COEF CONTINUE STP, G(1), ETRPR, STRONG, THERAO(11. WHICH I ) ) 120 GET LOG K'S FOR EACH OF THE SPECIES. FIRST WATER, IS ALWAYS SPECIES NUMBER 1. DO 120 I = 2, NUMAO CALL GAOU(XLOGK,GM,THERAO(2,I),THERAO(3,I), THERAQ(4,I),THERAQ(5,I),THERAQ(10,1), THERAQ(6,I),THERAQ(7,I),THERAQ(8,I), THERAOO, I ) , THERAQ( 11,1), ZTP, ZTRPR, YTRPR, PNOW, TNOW) G(I) = XLOGK CONTINUE GET LOG K'S FOR EACH OF THE COMPONENTS DO 190 1 = 1 , NUMELE K1 = INDEX1(I,L) K2 = INDEX2(I,L) IF (K2.EO.1) THEN SOLID PHASE COMPONENTS CALL GMIN(XLOGK, GM, THERPH(2,K1), THERPH(3,K1), THERPH(5,K1), THERPH(6,K1 ) , THERPH(7,K1), THERPH(8,K1), THERPH(9,K1), THERPH(10,K1), THERPH(11,K1), THERPH(4,K1), THERPH(12,K1), THERPH(13,K1), TKNOW, PNOW) GCOMP(I) = XLOGK ELSE IF (K2.E0.2) THEN C AQUEOUS SPECIES COMPONENTS C IF WATER IS A COMPONENT, THEN C THE ACTIVITY IS STORED RATHER C THAN THE MOLALITY. GCOMP(I) = G(K1) ACT(I) = C(K1) * CMOLE(I) C ELSE IF (K2.EQ.3) THEN C SOLID SOLUTION COMPONENTS C ELSE IF (K2.EQ.4) THEN C GAS COMPONENTS END IF 190 CONTINUE C FORM NEW BASIS FOR MINERALS AND SPECIES CALL BASIS(XMFUT.L) DO 200 1 = 1, NUMELE XMFUT(I) = XMFUT(I) + XMNOW(I) IF (INDX2(I) .EQ. 2) IPOINT(INDX1(I)) = I * (-D M 200 CONTINUE CO C ^ C SUBTRACT OUT LOG K OF COMPONENTS FROM EACH SPECIES K = 0 DO 220 1 = 1 , NUMAQ DO 210 J = 1, NUMELE IF (ABS(CNEWAQ(J,I)).GE.ZERO) G ( I ) = G(I) - (CNEWAQ(d,I) * GCOMP(J)) 210 CONTINUE IF (IPOINT(I).EQ.O) THEN K = K + 1 IPOINT(I) = K END IF 220 CONTINUE C CALCULATE MOLALITIES OF ALL SPECIES - NOTE ACTIVITY OF WATER IS C STORED RATHER THAN MOLALITY C BTEMP = 0.0 DO 400 1 = 2 , NUMAQ ATEMP = G(I) DO 390 d = 1, NUMELE IF (ABS(CNEWAQ(d,I)).GE.ZERO) ATEMP = (CNEWAQ(J.I) * ACT(d)) + ATEMP 390 CONTINUE 400 450 00 500 550 C ( I ) = ATEMP - C ( I ) IF (C(I).GE.-65.0) BTEMP = BTEMP + (10 CONTINUE C(1) = ( ( - 1 . 0 ) * BTEMP * 0.01801534 / A10) GET REACTANTS NUMREC = NUMREA(L) IF (NUMREC .NE. 0) THEN DO 450 1 = 1 . NUMREC INDREA(I) = IREACT(I.L) REAMT(I) = REACTA(I,L) CONTINUE END IF CALL PATCAL(ITERP. ITERT, ITERC, ITERM. L) NOW SAVE VALUES AT TIME TAUFUT FOR NODE L STRNGH(L) = STRONG WATER(L ) = AMWAT DO 500 1 = 1 , NUMELE K1 = INDX1(J) K2 = INDX2(J) INDEX1(J,L) = K1 INDEX2(J,L) = K2 INDEX3(J,L) = INDX3(J) TOTALM(d.L) = XMNOW(J) CHEM(J.L) = CM0LE(K1) CONTINUE NUMREA(L) = NUMREC IF (NUMREC .NE. O) THEN DO 550 1 = 1 , NUMREC IREACT(I.L) = REACTA(I,L ) = CONTINUE END IF INDREA(I ) REAMT(I ) 900 CONTINUE RETURN END * C ( I ) )
- Library Home /
- Search Collections /
- Open Collections /
- Browse Collections /
- UBC Theses and Dissertations /
- The theoretical basis for the modelling of chemical...
Open Collections
UBC Theses and Dissertations
Featured Collection
UBC Theses and Dissertations
The theoretical basis for the modelling of chemical reactions in rock-water systems with specific reference… Perkins, Ernest Henry 1986
pdf
Page Metadata
Item Metadata
Title | The theoretical basis for the modelling of chemical reactions in rock-water systems with specific reference to the heat flow, fluid flow and solute transport laws |
Creator |
Perkins, Ernest Henry |
Publisher | University of British Columbia |
Date Issued | 1986 |
Description | In order to understand the processes involved in water and steam floods during secondary and enhanced oil recover, waste disposal, in-situ mining and leaching, or many different types of geological phenomenona, the chemical interactions between the fluid and the surrounding minerals must be known as a function of pressure, temperature and composition. These systems are generally open systems, thus the changes in pressure, temperature and bulk composition are coupled to the chemical reactions occurring throughout the entire system and cannot be independently specified. Based on the equations of mass action and mass balance, further equations have been derived which allow chemical reactions between a fluid and solid phases to be evaluated. The equations are based on the derivatives of the mass action and mass balance equations with respect to time, and are used in a series expansion to predict the composition of the fluid and the solid phases at future times. The equations are coupled to those constraining pressure, temperature and mass flux-which have been modified to allow this coupling. Because of various limitations on many of the equations used, only a single fluid in porous media can be modelled. A computer program has been written to test the equations and concepts developed in this thesis. The results allow the following generalization for natural flow systems with decreasing pressure and temperature along the flow path to be made. Excluding systems with sufficient mechanical energy to create new flow paths and excluding all phases which exhibit decreasing solubility with increasing temperature or with decreasing pressure, every natural flow system which attempts to maintain equilibrium between the fluid and solid phases in contact with the fluid will ultimately seal itself. |
Genre |
Thesis/Dissertation |
Type |
Text |
Language | eng |
Date Available | 2010-08-07 |
Provider | Vancouver : University of British Columbia Library |
Rights | For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use. |
DOI | 10.14288/1.0052535 |
URI | http://hdl.handle.net/2429/27183 |
Degree |
Doctor of Philosophy - PhD |
Program |
Geological Sciences |
Affiliation |
Science, Faculty of Earth, Ocean and Atmospheric Sciences, Department of |
Degree Grantor | University of British Columbia |
Campus |
UBCV |
Scholarly Level | Graduate |
AggregatedSourceRepository | DSpace |
Download
- Media
- 831-UBC_1986_A1 P47.pdf [ 14.14MB ]
- Metadata
- JSON: 831-1.0052535.json
- JSON-LD: 831-1.0052535-ld.json
- RDF/XML (Pretty): 831-1.0052535-rdf.xml
- RDF/JSON: 831-1.0052535-rdf.json
- Turtle: 831-1.0052535-turtle.txt
- N-Triples: 831-1.0052535-rdf-ntriples.txt
- Original Record: 831-1.0052535-source.json
- Full Text
- 831-1.0052535-fulltext.txt
- Citation
- 831-1.0052535.ris
Full Text
Cite
Citation Scheme:
Usage Statistics
Share
Embed
Customize your widget with the following options, then copy and paste the code below into the HTML
of your page to embed this item in your website.
<div id="ubcOpenCollectionsWidgetDisplay">
<script id="ubcOpenCollectionsWidget"
src="{[{embed.src}]}"
data-item="{[{embed.item}]}"
data-collection="{[{embed.collection}]}"
data-metadata="{[{embed.showMetadata}]}"
data-width="{[{embed.width}]}"
async >
</script>
</div>
Our image viewer uses the IIIF 2.0 standard.
To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0052535/manifest