(263g) A Scaffolded Approach to Process Modeling Education with Literate Programming Tools | AIChE

(263g) A Scaffolded Approach to Process Modeling Education with Literate Programming Tools


Trujillo, F. J., University of New South Wales
Mathematical models allow the designer to optimize and predict, and so process modeling is a core within any chemical engineering program, either as a separate course or embedded across the curriculum. Process modeling education has students use mathematical and computational skills to develop, test, and interpret models. To succeed, students must rebuild and refine their knowledge from introductory courses in programming and numerical methods plus also use material from their chemical engineering core: heat transfer, diffusion, chemical kinetics, etc. The reality is, of course, that past coursework can rapidly disappear into the mists of time and subsequent instructors must help the students become reacquainted with it.

A common approach to the teaching of engineering modeling is to focus on the use of numerical methods techniques with a small amount of simple programming skills being needed to deliver the required results. Understanding the principles of the model, developing skepticism based on the “garbage in, garbage out” principle, and robustly interpreting the results are key steps at this early stage that then permit successful engagement with sophisticated simulation packages in later stage courses.

For teaching purposes, the mathematics and its embodiment in code are insufficient on their own, with inclusion of the context of the problem, a description of the approach in words and interpretation of the results being necessary. Jupyter notebooks offer a literate programming environment in which numerical methods and data analysis code can be interactively developed and refined in ‘cells’, while relevant rich context including text, images and equations is interspersed amongst the code. For the engineer undertaking one-off model development and also in the educational scenario, the Jupyter notebook offers the ideal fusion of code, documentation and output.

To scaffold the three-fold development in programming, numerical methods and discipline knowledge, we have created Jupyter notebooks in which problem statements (in Markdown, with images included and mathematics via MathJax) are accompanied by code cells (in Python or Octave). As well as the problem statement, questions come with some hints on possible approaches or fragments of code as starting points to help students. A small amount of guidance, without giving away the entire solution, allows students to attempt much harder questions and develop their skills. Within each week’s tutorial set, progressively less help is offered as confidence and competence is gained.

To facilitate maintenance of the tutorial notebooks, the problem and solution notebook are generated out of the same annotated precursor/template notebook using some simple Python modules we have developed; the notebook with the problems is generated by redacting parts of the code to leave some partial solutions or fragments as hints, omitting the output of the code, and omitting the analysis of the model output. After editing the instructor-facing template to move questions, fixing bugs, improve explanations etc, the student-facing problem and solution sheets are both automatically regenerated.

Beyond the educational advantages of this scaffolded approach in the classroom setting, we have also found that marking take-home assignments where students work in outline templates was faster than where students work completely independently outside of the template. While little assistance is offered in these assessment activities, the notebook imposes some additional structure onto the work and may also hint towards using certain variable names, reducing the time required to decide on the grades for each piece of work, thereby allowing the time to be spent offering better feedback to the students. Jupyter notebooks can be exported to PDF and these are marked within our learning management system’s PDF grading tools; alternatively, tools like nbgrader can work with the notebooks directly.

Hosting and deployment of any computational tool presents interesting challenges, particularly for large class sizes. The benefits and limitations of cloud-hosted Jupyter notebooks at CoCalc.com will be discussed and the use of the templating system will be demonstrated.