(241g) Using Templates for Making Programming Languages More User Friendly | AIChE

(241g) Using Templates for Making Programming Languages More User Friendly

Authors 

Shacham, M. - Presenter, Ben Gurion University of the Negev
Brauner, N., Tel-Aviv University
Hesketh, R., Rowan University
Holman, J. C., Rowan University
In a survey that has been carried out recently by Hesketh et al. (2020) they found that: "... just over half of faculty believe that graduates are well prepared to use computer software and programming to solve engineering problems." They also pointed out that a possible reason for the low integration of software use is the perceived barriers for its use by faculty. In response to the question on what the barriers for faculty are for not using computer aids, the most common response was that faculty were not trained in these computer tools, and that faculty do not have the time required to learn how to use these tools. That survey indicates that many faculties did not use these software programs as undergraduates and currently do not use the software in their research, so there is little incentive to learn programming.

However, our experience has shown that it is possible to create software packages that are easy to learn and apply by both the students and the faculty. The POLYMATH package was introduced by Shacham and Cutlip about 30 years ago (e. g., Shacham and Cutlip, 1992) and it is still being successfully used, both in education (e.g., Valdivia et al. 2021) and scientific research (e.g., Anitha and Garlapati, 2020). POLYMATH is easy to use because it requires the user to input only the information related to the problem which is being solved.

For example, both Valdivia et al. (2021) and Anitha and Garlapati, (2020) use POLYMATH for carrying out nonlinear regression to fit a nonlinear model to experimental data. In such case the user needs to input only the experimental data, the equation representing the nonlinear model and initial estimates for the model's parameter values. Using this input, the program calculates and displays the optimal parameter values, some statistical indicators of the goodness of the fit, and produces various plots that demonstrate the goodness of the fit between the experimental and calculated data.

This arrangement is very convenient for scientists, who are interested in obtaining the desired results with minimal programming effort. However, it is inappropriate for students learning programming. POLYMATH is able to output a MATLAB script file, but if they don’t have access to POLYMATH then they will need to write this file. If they used POLYMATH they could follow the logic from entering equations in POLYMATH to constructing a MATLAB script file. Furthermore, to keep the use of POLYMATH simple, its use is limited to Single-Model Single-Algorithm (SMSA) problems. Solution of complex Multiple-Model and/or Multiple-Algorithm (MMMA) problems require the use of more versatile programming languages. More detailed discussion of this issue can be found, for example, in the review paper by Shacham et al. (2009).

` Based on these observations, we are attempting to develop computing tools that allow easy and efficient numerical problem solving, however also enable studying computer programming at both basic and advanced levels. The selected tool for this purpose is a template, implemented, for example, in MATLAB, where the user is required to enter only problem specific information. The MATLAB program solves the problem and displays the results in numerical and graphical forms. But unlike in the case of POLYMATH, the entire code of the program is visible to the user and can be modified by him, as necessary.

At this stage we are developing templates for solving nonlinear algebraic equations (NLE), ordinary differential equations (ODE), and linear, polynomial, and nonlinear regression, for MATLAB and Python. This is supported by the finding of Hesketh et al. (2020) that the predominant programming languages taught in "computing in chemical engineering" courses are MATLAB (78%) followed by Python (31%). The templates enable scientists to solve specific types of problems without learning programming, thus the effort required for problem solution is similar to the effort required when using POLYMATH for the same purpose.

For students learning computer programming the templates are provided at the start of the course. First the students are assigned exercises that can be solved by the appropriate template just by providing the problem specific information. Consider, for example the problem presented by Shacham et al. (2003). In this exercise the molar volume (V), the compressibility factor, the isothermal enthalpy and entropy departures, and the fugacity coefficients are calculated and plotted for water. In this example, the single-NLE solver template can calculate the molar volume at one temperature (T) and one pressure (P) values. The user provides only the function that calculates f(V) for a specified value of V, and an initial estimate for the molar volume value. By solving similar examples with the appropriate templates, the students experience the importance of the programming in problem solving. In a later, more advanced stage of the course, the students are required to modify the template-based solution, for this example, to enable the calculation, display, and plot of all the additional variables (enthalpy and entropy departures, etc.) studying the effects of the temperature and pressure variations and display all the pertinent values.

In the extended abstract and the conference presentation we present in detail an example of the dual template use. It demonstrates the potential of the new approach to facilitate process computations and learning programming via gradual enhancement of the template program to enable solving problems of higher complexity level. This approach will be demonstrated by solving boundary value (a single-model multiple-algorithm type) problems. Preliminary results of the classroom testing of the template-based programming study will also be reported.

References

  1. Anitha, N. and C. Garlapati, "Solubility model correlations of some substituted phenol compounds in supercritical carbon dioxide", AIP Conference Proceedings 2270, 040013 (2020); https://doi.org/10.1063/5.0019510, Published Online: 02 November 2020.
  2. Hesketh, R. P., Grover, M., & Silverstein, D. L. (2020). CACHE/ASEE survey on computing in chemical engineering. ASEE Annual Conference and Exposition, Conference Proceedings, 2020-June, [293].
  3. Shacham, M. and M. B. Cutlip, "POLYMATH: General, User-Friendly Numerical Computation Package", paper 226a, presented at the AIChE 1992 Annual Meeting, Miami Beach, Florida, Nov. 1-6, 1992.
  4. Shacham, M., Brauner, N. and M. B. Cutlip, "An Exercise for Practicing Programming in the ChE Curriculum--Calculation of Thermodynamic Properties Using the Redlich-Kwong Equation of State.", Chem. Eng. Educ., 27(2), 148 (2003)
  5. Shacham, M., Cutlip, M. B. and N. Brauner, "From Numerical Problem Solving to Model Based Experimentation – Incorporating Computer Based Tools of Various Scales into the ChE Curriculum", Chem. Eng. Educ, 43(4), 315 (2009)
  6. Valdivia, A. E. O., Osornio, C. M., and Y. M. V.-Rodríguez, "PBL with the Application of Multiple and Nonlinear Linear Regression in Chemical Kinetics and Catalysis", American Journal of Educational Research, 9(1) 11-17 (2021),