code for Oxygen Dynamics