Although computers were invented to automate tedious and error-prone tasks, computer programming is a tedious and error-prone task itself. This is a well-known paradox in the field of computational mathematical modelling. Recently, automatic code generation has been proposed to solve this paradox. In this approach, a required code to model physical problems is generated by compiling an input file which mimics mathematical notations. In this thesis, the automatic code generation has been extended to support developing models for problems with discontinuities. Examples of this kind of problems in real world are cracks, slip planes and singularities in materials as well as phase interfaces in multiphase flows. This framework is designed in the...