use warnings;
use strict;

use ChemPlugin;

$|=1;

# create the ChemPlugin instance
my $cp = new ChemPlugin();

# Configure the instance
$cp->Config('Na+ = 1 mmol/kg; Cl- = 1 mmol/kg; pH = 3');
$cp->Config('react 2 mmol NaOH; delxi = 0.1');

# Initialize the instance.
$cp->Initialize();
printf("pH = %8.4f\n", $cp->Report1('pH'));

while(1){
   my $deltat = $cp->ReportTimeStep();
   if($cp->AdvanceTimeStep($deltat)){
      last; 
   }
   if($cp->AdvanceChemical()){
      last;
   }
   printf("pH = %8.4f\n", $cp->Report1('pH'));
}

$cp->destroy();

