Mathematical analysis of a batch electrocoagulation reactor