import ChemPlugin.*; public class FlowThrough1 { public static void main(String[] args) { System.out.println("Model a flow-through reactor"); System.out.println(""); //Configure and initialize the inlet fluid. ChemPlugin cp_inlet = new ChemPlugin("stdout"); String cmd = "Ca++ = 1 mmol/kg; HCO3- = 1 mmol/kg; pH = 1; balance on Cl-"; cp_inlet.Config(cmd); cp_inlet.Initialize(); //Configure and initialize the stirred reactor. ChemPlugin cp = new ChemPlugin("stdout"); String cmds = "swap Calcite for Ca++; Calcite = 0.03 free m3; Cl- = 1 mmol/kg;" + "swap CO2(g) for H+; fugacity CO2(g) = 1; balance on HCO3-;" + "volume = 1 m3; fix f CO2(g); delxi = 0.01; pluses = banner"; cp.Config(cmds); cp.Initialize(1.0, "day"); // Link reactor to inlet and free outlet; set rate of flow. CpiLink link1 = cp.Link(cp_inlet); CpiLink link2 = cp.Link(); // creates outlet link link1.FlowRate(10.0,"m3/day"); link2.FlowRate(-10.0,"m3/day"); cp.PlotHeader("FlowThrough.gtp", "char"); cp.PlotBlock(); while (true) { double deltat = cp.ReportTimeStep(); if (cp.AdvanceTimeStep(deltat) != 0){ System.exit(1); } if (cp.AdvanceTransport() != 0){ System.exit(0); } if (cp.AdvanceChemical() != 0){ System.exit(0); } cp.PlotBlock(); } } }