The aim of this work is to set up mathematical models and numerical methods to investigate the mass transfer process occurring during the peritoneal dialysis (PD) therapy. More precisely the final goal is the set up of tools to find for each patient submitted to PD the best therapy profile to purify blood and remove water from the patients. First, we build up specific mathematical models to represent the physical phenomena we are interested in. As discussed in chapter 1, starting from the Kedem-Katchalsky equations, we end up with a systems of nonlinear ordinary differential equations describing the various aspects of the physical problem. Then, we propose a method based on nonlinear programming techniques to solve the inverse problem arising from the need to assess the peritoneal membrane characteristics which are not directly measurable on the patient. Thanks to its flexibility we are able to support the main standard tests nowadays in use to assess the kinetic properties of the peritoneum. We devise a suitable parametrization of the control function (DPD Dynamic Peritoneal Dialysis) that allows to improve the standard PD profiles with a larger set of treatments. Then we propose an optimization algorithm to improve the PD efficiency. Moreover, in the framework of control theory, we devise an algorithm based on the maximum principle of Pontryagin for switched systems to investigate deeply the PD optimal control problem. Afterwards we carry out numerical simulations, investigating the main inputs influencing the peritoneal dialysis efficiency. Specifically we show an extensive comparison between the APD (Automated Peritoneal Dialysis) and DPD (Dynamic Peritoneal Dilaysis) in order to assess the conditions under which DPD allows to improve the PD performance. Then a numerical investigation based on the algorithm devised for switched systems is carried out to assess the adequacy of DPD. Moreover we set up a procedure to reach an efficiency target and minimize the patient's exposure to glucose in order to improve the PD biocompatibility. Finally, we present the validation results of the mathematical model in order to verify its accuracy. A comparison between the APD and DPD is presented. Moreover we carry out a statistical analysis to assess the error distribution related to the most relevant quantities in order to evaluate strengths and weaknesses of this model and to identify the needs for a further improvement.