Chemplugin™ User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
The Geochemist’s Workbench® Release 15 ChemPlugin™ User’s Guide The Geochemist’s Workbench® Release 15 ChemPlugin™ User’s Guide Craig M. Bethke Aqueous Solutions, LLC Champaign, Illinois Printed August 31, 2021 This document © Copyright 2021 by Aqueous Solutions LLC. All rights reserved. Earlier editions copyright 2000–2020. This document may be reproduced freely to support any licensed use of the GWB software package. Software copyright notice: Programs GSS, Rxn, Act2, Tact, SpecE8, Gtplot, TEdit, React, Phase2, P2plot, X1t, X2t, Xtplot, and ChemPlugin © Copyright 1983–2021 by Aqueous Solutions LLC. An unpublished work distributed via trade secrecy license. All rights reserved under the copyright laws. The Geochemist’s Workbench®, ChemPlugin, We put bugs in our software, and The Geochemist’s Spreadsheet are a registered trademark and trademarks of Aqueous Solutions LLC; Microsoft®, MS®, Windows XP®, Windows Vista®, Windows 7®, Windows 8®, and Windows 10® are registered trademarks of Microsoft Corporation; PostScript® is a registered trademark of Adobe Systems, Inc. Other products mentioned in this document are identified by the trademarks of their respective companies; the authors disclaim responsibility for specifying which marks are owned by which companies. The software uses zlib © 1995-2005 Jean-Loup Gailly and Mark Adler, and Expat © 1998-2006 Thai Open Source Center Ltd. and Clark Cooper. The GWB software was originally developed by the students, staff, and faculty of the Hydrogeology Program in the Department of Geology at the University of Illinois Urbana-Champaign. The package is currently developed and maintained by Aqueous Solutions LLC at the University of Illinois Research Park. Address inquiries to Aqueous Solutions LLC 301 North Neil Street, Suite 400 Champaign, IL 61820 USA Warranty: The Aqueous Solutions LLC warrants only that it has the right to convey license to the GWB software. Aqueous Solutions makes no other warranties, express or implied, with respect to the licensed software and/or associated written documentation. Aqueous Solutions disclaims any express or implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Aqueous Solutions does not warrant, guarantee, or make any representations regarding the use, or the results of the use, of the Licensed Software or documentation in terms of correctness, accuracy, reliability, currentness, or otherwise. Aqueous Solutions shall not be liable for any direct, indirect, consequential, or incidental damages (including damages for loss of profits, business interruption, loss of business information, and the like) arising out of any claim by Licensee or a third party regarding the use of or inability to use Licensed Software. The entire risk as to the results and performance of Licensed Software is assumed by the Licensee. See License Agreement for complete details. License Agreement: Use of the GWB is subject to the terms of the accompanying License Agreement. Please refer to that Agreement for details. Cover photo: Salinas de Janubio by Jorg Hackemann. Contents Chapter List 1 Introduction................................ 1 2 Overview.................................. 7 3 Titration Simulator............................ 17 4 Retrieving Results............................ 23 5 Direct Output............................... 31 6 Extending Runs.............................. 37 7 React Emulator.............................. 41 8 Linking Instances............................. 47 9 Flow and Transport............................ 55 10 Diffusion and Dispersion........................ 63 11 Advection-Dispersion Model...................... 77 12 Heat Transfer............................... 87 13 Reactive Transport Model........................ 103 14 Multithreading............................... 115 15 Cluster Computing............................ 127 16 Hybrid Parallelization.......................... 147 Appendix: ChemPlugin Setup....................... 155 Appendix: Member Functions....................... 161 Appendix: Configuration Commands................... 257 Appendix: Report Function......................... 307 v Appendix: Units Recognized........................ 321 Index...................................... 327 vi Contents 1 Introduction1 4.1.2 Vector quantities....... 25 1.1 How it works...........1 4.1.3 NULL target.......... 26 1.2 Advantages............2 4.2 An example............ 26 1.3 Languages supported......4 4.3 Source code........... 29 2 Overview7 5 Direct Output 31 2.1 Creating and destroying instances7 5.1 Scheduling output........ 31 2.1.1 Deleting instances......7 5.2 Self-scheduled output...... 32 2.1.2 Console messages......8 5.2.1 Print output.......... 32 2.1.3 Option flags..........9 5.2.2 Plot output.......... 32 2.1.4 Environmental variables...9 5.3 On-demand output........ 32 2.2 Controlling instances.......9 5.3.1 Print output.......... 33 2.2.1 Configuringandinitializingan 5.3.2 Plot output.......... 34 instance............ 10 5.4 Contents of print-format output. 36 2.2.2 Linking instances....... 10 5.5 Source code........... 36 2.2.3 Time marching........ 11 2.2.4 Console messages...... 12 6 Extending Runs 37 2.2.5 Retrieving results....... 12 6.1 Extending a titration....... 37 2.2.6 Output streams........ 13 6.2 C++ source code......... 39 2.3 Example program........ 13 7 React Emulator 41 2.4 Using this Guide......... 15 7.1 Program structure........ 41 3 Titration Simulator 17 7.2 Main program........... 42 3.1 Program structure........ 17 7.2.1 Input loop........... 42 3.2 Client program.......... 17 7.2.2 Time marching loop..... 43 3.2.1 Configuration step...... 18 7.3 Running the example program. 44 3.2.2 Initialization step....... 19 7.4 mReact C++ code........ 45 3.2.3 Time marching loop..... 19 8 Linking Instances 47 3.3 Running the example program. 20 8.1 Linking instances......... 47 3.4 Assembled C++ code...... 21 8.2 Free outlets............ 48 3.5 Generalization.......... 22 8.3 Removing links.......... 48 4 Retrieving Results 23 8.4 Example programs........ 49 4.1 Report()familyofmemberfunctions 23 8.4.1 Linear chain.......... 49 4.1.1 Scalar values......... 24 8.4.2 Grid.............. 50 vii Contents 8.4.3 Bifurcating tree........ 52 11.4 C++ source code......... 82 8.4.4 C++ source code....... 54 12 Heat Transfer 87 9 Flow and Transport 55 12.1 Initial temperature........ 87 9.1 Flow rate............. 55 12.2 Temperature calculation..... 88 9.1.1 Setting the flow rate..... 55 12.2.1 Advective transfer...... 89 9.1.2 Retrieving the flow rate... 56 12.2.2 Conductive transfer..... 89 9.1.3 Steady and transient flow.. 56 12.2.3 Heat sources......... 90 9.2 Stability.............. 56 12.2.4 Stability............ 90 9.3 Flow-through reactor....... 57 12.2.5 Time marching loop..... 90 9.3.1 Program structure...... 58 12.3 Externally prescribed temperature 91 9.3.2 Inlet fluid........... 58 12.4 Model of heat conduction.... 91 9.3.3 Stirred reactor........ 59 12.4.1 Simulation parameters.... 92 9.3.4 Links and flow rates..... 59 12.4.2 Configuring and initializing 9.3.5 Time marching loop..... 59 instances........... 92 9.3.6 Program output........ 60 12.4.3 Linking instances....... 93 9.3.7 C++ source code....... 61 12.4.4 Time marching loop..... 93 12.4.5 Running the client...... 94 10 Diffusion and Dispersion 63 12.5 Model of advective heat transfer 94 10.1 Transmissivity........... 63 12.5.1 Simulation parameters.... 94 10.1.1 Determining transmissivity.. 64 12.5.2 Configuring and initializing 10.1.2 Setting transmissivity..... 65 instances........... 94 10.1.3 Retrieving the transmissivity 65 12.5.3 Linking instances....... 95 10.2 Numerical stability........ 66 12.5.4 Time marching loop..... 95 10.3 Model of diffusion........ 67 12.5.5 Running the client...... 96 10.3.1 Program structure...... 67 12.6 C++ source code......... 96 10.3.2 Output function........ 68 12.6.1 Heat conduction code.... 96 10.3.3 Simulation parameters.... 69 12.6.2 Advective heat transfer code 99 10.3.4 Output file........... 69 10.3.5 Configuring and initializing 13 Reactive Transport Model 103 instances........... 70 13.1 Program structure........ 103 10.3.6 Linking instances....... 71 13.2 Output function.......... 104 10.3.7 Time marching loop..... 71 13.3 Simulation parameters...... 105 10.3.8 Running the client...... 72 13.4 Create instances......... 105 10.3.9 C++ source code....... 73 13.5 Configure instances....... 106 13.6 Initialize instances........ 107 11 Advection-Dispersion Model 77 13.7 Set transport parameters.... 107 11.1 Numerical stability........ 77 13.8 Link the instances........ 108 11.2 Advection-dispersion model... 78 13.9 Time marching loop....... 108 11.2.1 Program structure...... 78 13.10 Running the model........ 109 11.2.2 Simulation parameters.... 79 13.11 C++ source code......... 109 11.2.3 Configure and initialize in- stances............ 80 14 Multithreading 115 11.2.4 Link the instances...... 81 14.1 Code changes.......... 115 11.3 Running the model........ 81 14.1.1 Header files.......... 115 viii Contents 14.1.2 Number of instances..... 116 A.2.4 Perl.............. 158 14.1.3 Instantiation.......... 116 A.2.5 Python............. 159 14.1.4 Configuration......... 117 A.2.6 MATLAB............ 160 14.1.5 Initialization.......... 118 14.1.6 Linking............. 118 Appendix: Member Functions 161 14.1.7 Loop scheduling....... 119 B.1 C++................ 163 14.1.8 Time marching loop..... 120 B.1.1 Configuring and initializing 14.2 Speedup............. 121 instances........... 164 14.3 C++ source