ReadMe.md

Chemical Equilibria Solver - EqSolvR

Package for solving chemical equilibria for a given set of reactants and products. The motivation for this program was to enable the calculation, between 300°C and 400°C at 0.5 kb, of pH and speciation given a simple mix of salts. This package has been written in such a manner that an advanced user can easily set their own reactants, products and log K at any temperature in the generic version (chemsolve_generic). chemsolve_generic is the workhorse for chemsolve. Equations are solved numerically using the multiroot function from rootSolve package.

The eq_creator.xlsx excel spreadsheet, created by Lucjan Sajkowski, can be used to easily format the complicated R inputs for the generic version.

Manual

Installation

Install R by following the instructions on https://cran.r-project.org

Open R and install the devtools package

install.packages("devtools")

And finally install EqSolvR

devtools::install_github("shearwavesplitter/EqSolvR")

To use EqSolvR

library('EqSolvR')

Example

library('EqSolvR')
## Run the solver with the default species of Na, Cl, K, SO4, Ca, and Mg 
## Defaults to a charge balance against Cl (bal="Cl")
d <- chemsolve(Tc = 400, Nat = 0.4, Kt = 0.2, Clt = 0.6, SO4t = 0.2,Cat = 0.1, Mgt = 0.1, start = c(1e-06, 1e-05, 0.3, 0.1, 0.3,0.01, 0.001, 0.02), maxitr = 100, exprod = NULL, exconstit = NULL,exnumz = NULL, excharges = NULL, exa = NULL, exK = NULL, bal = "Cl")

To cite this package

Stefan Mroczek and Ed Mroczek (2017). EqSolvR: Chemical Equilibrium Solver. R package version 1.2.5.

  @Manual{,
    title = {EqSolvR: Chemical Equilibrium Solver},
    author = {Stefan Mroczek and Ed Mroczek},
    year = {2017},
    note = {R package version 1.2.5},
  }


shearwavesplitter/EqSolvR documentation built on Feb. 5, 2020, 1:51 a.m.