Generate SysCAD database from PHREEQC Database File

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: Models ➔ PHREEQC Add-On ➔ Utility

 Generate SysCAD Database for AQSol   Generate SysCAD Database for ChemApp   Generate SysCAD Database for PHREEQC 

Latest SysCAD Version: 18 May 2022 - SysCAD 9.3 Build 139.30918

This utility is currently in BETA Test Mode - contact SysCAD for more information and to ensure you are using the most recent version.


Applicability

This help file is applicable to PHREEQC.

NOTE: The utility is for adding a list of species into a new SysCAD.93.db3 file.

  • It will use data from existing databases (in SysCAD database format), examples of such are Default.93.db3, SysCAD.93.db3 from user projects (these can be renamed for better identification).
  • It will NOT extract data from PHREEQC databases.
  • It will add species to the new database based on the .dat files selected. It will include species that are listed in the .dat file as well as species that "may" form given the list of ions present.
  • If a species is not found in the existing database, it will add the species with minimum data (Long Name, Short Name, compound, definition, phase, occurrence), but will leave all the other properties blank. User will need to check and fill in data from other sources after the database is created.

General Information

Utility file name: SysCADPHREEQCUtils.exe

  • The utility can be placed in any folder, but the folder must meet the following requirements:
    PHREEQC Utility Folder Structure
    1. There must be an existing SysCAD.93.db3 file inside the folder to serve as a template (for species table layout).
      • CAUTION: depending on user selections, this file may be stripped down to contain only water and steam, then new data will be added based on the PHREEQC model species list. Stripping of the file is optional.
      • Please use a “copy” of the actual SysCAD.93.db3 file to avoid destroying user data.
    2. There must be a subfolder, “DB3Files”, containing the following files:
      • May contain the Default.93.DB3 file (copy from SysCADxxx\BaseFiles folder).
      • May contain user’s own database files, formatted in SysCAD DB file format.
      • Any database files stored in the DB3Files subfolder will be used to populate the SysCAD.93.DB3 file.
      • when more than one database is present, there may be multiple entries for the same species, if a species has multiple sets of data, user must choose which set of data to add to the SysCAD.93.DB3 file.
      • as an alternative to the above, user can specify a preferred database. In this case, the preferred database will be used whenever possible, with alternate databases used elsewhere and placeholder species created where no data is available. Selecting a preferred database will avoid choosing data for each case where multiple options are available.
      • The databases in this folder will be used to build a list of options presented to the user by the utility.
    3. There must be a subfolder, “DatabaseFiles”:
      • Users must place copies of each DAT file that they wish to include in the generation of the SysCAD database file.
      • There is an option to select one or all of the contained DAT files in the generation of the database.
    4. Optional: User can place a Replacements.txt file in the same folder as the executable. This is a tab-delimited file that contains replacement strings. If not found, it is simply not used.
      Replacements.txt
      TPS Replacements File.png
      • If the above file were used, any AQSol or PHREEQC species containing the string Ice would be replaced with H2O in the creation of SysCAD species.
    5. Optional: User can place a Config.txt file in the same folder as the executable. This is a formatted file that contains configuration settings. If not found, it is simply not used.
      Config.txt
      TPS Config File.png
      • INCLUDE_ELEMENTS: specify in the line below this keyword the elements you want to include, comma separated list.
      • EXCLUDE_ELEMENTS: specify in the line below this keyword the elements you want to exclude, comma separated list.
      • INCLUDE_OCCURRENCES: specify in the line below this keyword the occurrences you want to include, comma separated list. Can be s, l, or g.
      • INCLUDE_PHASES: specify in the line below this keyword the phases you want to include, comma separated list. These are substrings, thus, in the example above, any phase which contains slag (case insensitive) would be included.
      • EXCLUDE_SUBSTRINGS: specify in the line below this keyword any substrings within species that you want to exclude, comma separated list. For example, entering C2, C3, C4 (case sensitive) would exclude ethyl, propyl, and butyl species.
      • ALLOW_DUPLICATE_SHORT_NAME: specify in the line below this keyword either 0 (false) or 1 (true). If you allow duplicate short names, the short names will be appended with _1, then _2, etc. For example, if you have multiple types of silica, you would get SiO2, SiO2_1, SiO2_2, etc.
      • CREATE_DEFAULT_SPECIES_IF_NO_MATCHES_FOUND: specify in the line below this keyword either 0 (false) or 1 (true). If you allow default species to be created, you will get default species (with no thermodynamic or properties data) as placeholders when a matching species is not found. If false, only matched species will be added to the database (with thermodynamic and properties data taken from the db3 file). Default value is true.
      • CREATE_ION_LIST: specify in the line below this keyword 1 (true) or 0 (false). If true, an IonList.dat file will be created which contains all ionic species (for ion mapping). If false, ions will be added directly to the SysCAD database, usually using default thermochemical data for the liquid species (unless you have data for these ionic species and specify an appropriate source database.
      • The IonList.txt is created by executing the utility (if Create_Ion_List = 1 in Config.txt).
      • If no Config.txt file exists, all species are loaded unfiltered.

How to use the utility

The utility has two functions:

  1. assisting with the creation of IonList.txt.
  2. creating the SysCAD.93.db3 file.

Creating the database

  1. Run SysCADPHREEQCUtils.exe
  2. The utility will ask for selection of a preferred database. Select the corresponding preferred database, or -1 if none is preferred. If -1 is selected, the user will manually select the data for each species where more than one option exists (see later step).
  3. Select the DAT file for which you wish to create a database. Select -1 to create files which incorporate all of the DAT files in the DatabaseFiles folder.
  4. Where a suitable species does not exist in the available SysCAD database source files, a placeholder species will be created with NO thermodynamic data.
  5. Upon completion, the utility will show a summary, confirming the database was created successfully. Press any key to close the utility.
    PHREEQC Utility - Create SysCAD.93.db3
NOTES:
  • If the species data does not exist in the reference SysCAD databases, then a place holder species with no thermodynamic or physical properties data will be used. When this happens, any project using this database will log appropriate warnings on load, look out for these species when Checking the Created SysCAD.93.db3
    In the above screenshot, we have 20 solid species using default (placeholder) data. In other words, 20 solid species have no thermodynamic data or physical properties data, and will use SysCAD default values when used in a project.
  • While running the utility, if you have NOT selected a preferred database (ie used -1 as selection) and multiple data is found for a species, you will be prompted to select one of the options:
    Select Species PHREEQC.png
    In the above example, the utility has found 2 sets of data for “NaCl” in the available databases, we have selected data set 2 by typing in the "2".
  • User can use <Ctrl+Z> to quit the utility at any time.

Checking the Created SysCAD.93.db3

Check the SysCAD.93.db3 file before copying it to your actual project's cfgfile folder. You can use any SQLite DB reader, such as DB Browser for SQLite. View the SpeciesData table to see the data. Species for which no data was found in the reference databases will appear as having each of the definition columns filled, but all of the property columns blank.

PlaceholderSpecies DBBrowser.png

In the above example, NaCl*2H2O is using placeholder data.

Copy the files to the CfgFiles folder

Generally speaking, user only need to use this Utility to generate the SysCAD.93.db3 file at the start of a new PHREEQC project group. Once the database has been created, the SysCAD.93.db3 file, as well as the associated PHREEQC database files used to generate them, should be copied to the PHREEQC SysCAD project group\CfgFiles sub-folder. For SysCAD with PHREEQC flowsheets using multiple PHREEQC database files, it is required to create the database using all of the PHREEQC database files at the same time when using this utility.

Troubleshooting

Error Description Possible cause / suggested solution.
Utility Startup Errors Missing SysCAD Template species database (SysCAD.93.db3) The SysCAD.93.db3 file is missing from the Utility folder. This file is required as a starting point. User may copy any valid SysCAD.93.db3 file from the SysCADxxx folder here.
No SysCAD reference species database found in folder DB3Files The "DB3Files" folder is missing or empty. Please check the folder name and or make sure it contains at least one SysCAD database, such as the Default.93.db3
No Model files found in folder DatabaseFiles The "DatabaseFiles" folder is missing or empty. Please check the folder name and or make sure it contains at least one PHREEQC database file with extension .DAT.