def test_add_phases_with_elements_right_use(): """Test the normal use of addAqueousPhaseWithElements, addGaseousPhaseWithElements and addMineralPhaseWithElements.""" editor1 = ChemicalEditor() editor1.addAqueousPhaseWithElements("H C O Ca") editor1.addGaseousPhaseWithElements("H C O") editor1.addMineralPhaseWithElements("Ca C O") editor2 = ChemicalEditor() editor2.addAqueousPhaseWithElements(["H", "C", "O", "Ca"]) editor2.addGaseousPhaseWithElements(["H", "C", "O"]) editor2.addMineralPhaseWithElements(["Ca", "C", "O"]) system1 = ChemicalSystem(editor1) system2 = ChemicalSystem(editor2) _check_equivalent_chemical_systems(system1, system2)
def equilibrium_inverse_with_h_o_na_cl_ca_mg_c_defined_ph(): """ Build a problem with H, Na, Cl, Ca, Mg, C with defined pH """ database = Database("supcrt98.xml") editor = ChemicalEditor(database) editor.addAqueousPhaseWithElements("H O Na Cl Ca Mg C") editor.addGaseousPhaseWithElements("H O C") system = ChemicalSystem(editor) problem = EquilibriumInverseProblem(system) problem.add("H2O", 1, "kg") problem.add("NaCl", 0.1, "mol") problem.add("CaCl2", 2, "mmol") problem.add("MgCl2", 4, "mmol") problem.pH(4.0, "CO2") return (system, problem)
def equilibrium_inverse_with_h_o_na_cl_ca_mg_c_fixed_amount_and_activity(): """ Build a problem with H, Na, Cl, Ca, Mg, C with fixed species amount, activity and defined pH """ database = Database("supcrt98.xml") editor = ChemicalEditor(database) editor.addAqueousPhaseWithElements("H O Na Cl Ca Mg C") editor.addGaseousPhaseWithElements("H O C") system = ChemicalSystem(editor) problem = EquilibriumInverseProblem(system) problem.add("H2O", 1, "kg") problem.add("NaCl", 0.1, "mol") problem.add("CaCl2", 2, "mmol") problem.add("MgCl2", 4, "mmol") problem.pH(3.0, "HCl") problem.fixSpeciesAmount("CO2(g)", 1.0, "mol") problem.fixSpeciesActivity("O2(g)", 0.20) return (system, problem)