Optimization of dialysate flow and mass transfer during automated peritoneal dialysis.