Introduction and Setup is part of a free web series, ChemPlugin Modeling with Python, by Aqueous Solutions LLC.
This section gives examples of reactive transport models that can be constructed with ChemPlugin, the next explains how it works, and the following sections provide instructions for setting up your computer. Once you're set up, the ChemPlugin Modeling with Python course sequence will walk you through developing a series of short client programs from scratch.
ChemPlugin instances self-link to create reactive transport simulators in virtually any configuration, whether a continuum in one, two, or three dimensions, a network, or a straight or branching chain. The insets below show examples of how reactive transport models might be configured by linking ChemPlugin instances in various geometries.
You supply the top-level program that calls the shots. ChemPlugin instances do the work, solving the mass and heat transport equations, and evaluating the chemical state of equilibrium and kinetic reactions.
The client program is the boss.
It may be a small program you write, or a legacy flow model being repurposed as an RT simulator.
The client spawns ChemPlugin instances.
An instance may be a nodal block, a reach of stream, a reactor tank, and so on.
An instance is controlled by its member functions.
A call to “Config()” configurates the instance, “Initialize()” set its initial state.
Instances self-link and work together.
The link instances work as a quorum to trace reactive transport.
Results are available to client program.
Client uses “Report()” member function to retrieve results from an instance.
From the Python.org download pages, download and run the Python 3.6.0 Windows x86-64 executable installer, or the latest stable release. Or, if you run 32-bit Windows, you should install the 32-bit versions of both Python and ChemPlugin. The installer window should look like this
Make sure you are installing the 64-bit version of Python. Check the box “Add Python 3.x to PATH” and then click “Install Now”. Follow the wizard to completion.
Verify the installation by opening “cmd.exe” and typing the command “python”. You should see
Open Notepad++ and on the menu bar click on “Settings → Preferences”. Choose “Language” on the left, set “Tab size: 4” on the right, and then select “Replace by space”, before closing the dialog
To use ChemPlugin, you need a link to the ChemPlugin 2021 SDK installer, as well as an activation code. Alternatively, you may have access to the installer for The Geochemist's Workbench Advanced Professional 2021, which includes the ChemPlugin 2021 SDK. Either way, run the installer, taking care to choose the 64 bit version.
During the process, note the directory (e.g., “\Program Files\ChemPlugin”) in which the ChemPlugin software is installed
At the completion of the process, be sure to check the box “Set user PATH and PYTHONPATH environment variables”
After you click “Finish”, wait for the installer to configure your computer. If you did not check the box, you can still configure your environmental variables manually, as described below.
As the installation completes, you should see the activation dialog. If not, navigate to the installation directory and double-click on “activate.exe”. In the dialog, click on “New…”, paste your activation code in the space provided, and click on “Activate”
Click “Finish” and you are done!
The final step is to set two environmental variables:
Open the Windows control panel by pressing the Windows key and typing “Control”. Select “Control Panel” and choose “System and Security”, followed by “System”. The panel should look like
Choose “Advanced system settings” and then click on “Environment Variables…”
This will bring up a dialog with your current settings, which might look something like
Select variable “PATH” or “Path”, then click “Edit…” to bring up a sub-dialog listing the entries in PATH
Click on “New” and add the installation directory (e.g., c:\Program Files\ChemPlugin”). You may prefer to use the “Move Up” button to shift your entry to the top of the list.
Click “OK” to close the dialog.
Returning to the previous dialog, choose “New…” to create a variable PYTHONPATH that points to the “src” subdirectory of the installation directory. If PYTHONPATH already exists, click on “Edit…” instead and append the “src” subdirectory to the existing string, separated from it by a semicolon
Click “OK” and verify the two variables are properly set
Click “OK” again, close the Control Panel, and you are done!
Start the command prompt, type “python”, and issue the two commands
from ChemPlugin import * cp = ChemPlugin("stdout")
You should see:
Craig M. Bethke and Brian Farrell. © Copyright 2016–2022 Aqueous Solutions LLC. This lesson may be reproduced and modified freely to support any licensed use of The Geochemist's Workbench® software, provided that any derived materials acknowledge original authorship.
Bethke, C.M., 2008, Geochemical and Biogeochemical Reaction Modeling. Cambridge University Press, New York, 547 pp.
Bethke, C.M., 2022, The Geochemist's Workbench®, Release 15: ChemPlugin™ User's Guide. Aqueous Solutions LLC, Champaign, IL, 332 pp.