Paper ID #11801

Stimulating the learning process in mathematics and numerics by use of com- puter programs like Mathematica.

Prof. Ivar G. Johannesen, HiOA

Associate Professor, and Akershus University College, Faculty of Engineering (1988-). Master’s degree in Nuclear Physics from 1975, Special interests in engineering education di- dactics, mathematical physics, computational mathematics and modelling, fluid flow analysis, differential geometry Page 26.1402.1

c American Society for Engineering Education, 2015 Stimulating the Learning Process in Mathematics and Numerics using Mathematica.

Abstract –The development of fast, powerful laptop computers during the last twenty years has greatly facilitated the solving of complex problems in a variety of scientific research areas. By using such devices, teachers and educators are able to utilize their research results in their day-to-day work among students on campus. In my situation, teaching engineering students mathematics and physics at Oslo and Akershus University College, I have benefited greatly from using Mathematica, an excellent programmng tool developed by Steven Wolfram and his colleagues at Wolfram Research, Champaign, Illinois. We are now on the 10th iteration since the program’s release in 1988. My experience started with version two in 1990, and since then I have used the program extensively in lecturing and research.

In this paper I outline my experiences with this programming tool, using examples from teaching fluid mechanics, and I comment on the feedback from students participating in the data lab. In addition to short courses introducing the program, the students have used it in first level calculus courses, working on integration, power series, Fourier series, and numerical analysis. I have also tried to use programming examples to motivate students in courses in hydrodynamics and indoor climate problems in the environmental engineering program. Illustrative animations are easy to perform to model dynamic systems. This year I am distributing programming examples of numerical solutions of PDE’s in a master’s course in fluid mechanics.

INTRODUCTION Teaching mathematics is often associated with tedious calculations on whiteboards, and trying to get the students grasp the essence of the topic at hand. Prerequisite knowledge is often inadequate when freshmen enter college, and extensive repetitions of basic skills is required. My experience is from teaching forthcoming engineers at Oslo and Akershus University College. During the first two years, the young students take part in calculus courses, working hard on differentiation and integration problems, proceeding to linear algebra and complex numbers, differential equations and convergence criteria for sequences and series. The curriculum students experience is not always what they find most interesting, and motivation plays an important role in their ability to follow the syllabus.

During the last ten years, there has been growing interest in integrating pure mathematical topics into the specialized courses attended by the students. Students often ask teachers: “Why are we learning this?”; “What significance does it have to my study program?”; “Will I ever use this knowledge as a practicing engineer?” Questions like this can be hard to answer concretely and honestly. There are good reasons for the students to question the relevance of X in their study program, but the answers are rather vague in the student’s ears. Typical answers might be that mathematics constitutes the basis for all scientific disciplines, that calculations underlie most study work, that a good understanding of mathematics enables you to think clearly and logically and make abstractions based on the present situation. Even less constructive responses might be that mathematics reflects the beauty of nature, or that everything in nature can be explained in

mathematical terms. These things may be true, but such answers are not helpful in relation to the Page 26.1402.2 students’ ongoing struggle with arithmetic. One way of attacking the relevance problem is to incorporate more modelling and simulations in study courses, and to increase the credits for those courses. Increased collaboration between scientific staff and graduate engineers will enhance the quality of education. Our experience has been that such efforts often fail, and that the courses remain largely unaffected by the additional material. Students are given credits twice for the same proficiency. Incorporating mathematical subjects in engineering courseware must involve some new elements.

COMPUTERS AS AN EDUCATIONAL TOOL Another approach is to look closely into the contents of the study courses, and to use this knowledge in the pure mathematics courses. In close collaboration with the professor in the subject, we design an applied mathematics program that goes beyond the basic skills.

The necessary skill in handling basic computations in mathematics must never be forgotten. Pure mathematics must underlie every study program in engineering education. The concept of modelling a complex real world process in mathematical terms is essential. The model will involve simplifications and approximations of the full problem. The students must realize the implications and limitations of such models. Do they really describe the full problem in simpler terms? Modelling will inevitably lead to a mathematical formulation given as a differential equation. It can be extremely complicated and hard to solve. In hydrodynamics, the fundamental equation of motion leads to Navier - Stokes’ equations – a system of nonlinear partial differential equations. Very few exact solutions are known. Some very simple, idealized flow patterns exist that can be solved within the full context of the equations – such as Couette flow between moving plates and Poiseuille flow in fully developed flow in circular pipes. In other idealized flows (non-viscous flow, irrotational flow), the equations are simplified because of the absence of terms. The solutions to this reduced set of equations, known as Euler equation, are called approximate solutions. The viscous tem in Navier - Stokes equations disappears in these idealized flows, but for totally different reasons. No flow is free of viscosity, it is merely an approximation that means that the viscous forces can be ignored compared to inertial forces. Even the full Navier- Stokes’ equations rely on some suppositions about the flowing medium, for instance, that they only hold for Newtonian fluids.

During the last decade, computers have become much faster and much more powerful, leading to new perspectives on how complex problems students can handle. With a mobile computer connected to wireless Internet, the student can perform complicated calculations when and where she wants, and online help and information are always at hand.

The teaching of subjects in study programs should reflect the new situation. Since 1990, I have had the opportunity to use Mathematica, which was developed in 1988 by Stephen Wolfram. It has evolved into world wide, leading mathematical software that is suitable for both scientific and educational work. Mathematica is able to show the results of internal computations in symbolic form. This enables us to explore topics in depth, and to vary parameters to see the effect of these changes. The solutions can be visualized in a number of ways, thereby elucidating the concept under study. Especially the dynamic features in the latest versions have revolutionized visualization of evolving processes.

In this paper I will discuss some examples of how the computer program can help to understand problems in the hydrodynamics curriculum, both in the bachelor’s and master’s program. The first example studies turbulent and laminar flow in a circular pipe. A heat exchanger is to transport a given amount of water through a cross section of the pipe, with restrictions on the pressure drop due to friction, and the task is to calculate the necessary diameter. The pressure drop is given by the Page 26.1402.3 퐿 푣2 formula ∆푝 = 2 푓 휌 푑 where 푓 is the Fanning friction factor,  is the (temperature dependent) density of water,  is the velocity of the fluid, 퐿 the pipe length, and 푑 the diameter of the duct. The 푞 velocity, , is calculated from the given volume flow rate 푞 and cross section area:  = 푑2. 휋 4 푑 푣 휌 Reynolds number is defined as the ratio of inertial forces to viscous forces: 푅푒 = where 휇 is 휇 the viscosity coefficient. For turbulent flow, an implicit relationship exists between the friction 1 factor and Reynolds number, 푓 = . This gives us four coupled equations which are (4 lg(푅푒 √푓)−0.4)2 solved numerically in Mathematica. The result for a given set of numerical values (푞 = 2.5 litre/ sec, 퐿 = 100 m and ∆푝 = 103 kPa) is shown in the following output.

The calculations give a diameter 푑 = 38.97 mm. Flow pipes are manufactured in standard dimensions, and from lookup tables the students conclude that the smallest possible pipe suitable for this project is a 2" OD BWG 10 pipe with a diameter of 푑 = 43.99 mm. We also recognize the value of Reynolds number to ensure that our assumption about turbulent flow is correct.

After these calculations, the students can change some of the premises and recalculate. Say, for instance, that we cool the water to 5°C and use the same (standard) pipe diameter, the pressure drop is reduced with 40%:

Page 26.1402.4

Notice also that, when the diameter is known, the equations are no longer coupled and are much easier to solve. The Fanning friction factor is still implicitly defined, but can be read off the Moody diagram.

Reducing the volume flow to 푞 = 0.1 l/s, we find the flow to be laminar, since we have defined Re = 2100 as the critical value.

As a final question, we ask the students to investigate the highest possible temperature of the water flow in laminar conditions (pipe diameter and flow rate unchanged):

We conclude that the temperature can rise to about 8°C before we enter the turbulent (or at least the intermediate) phase.

This example clearly show that many problems that are too complicated to solve using pencil and paper, are within reach when using computational help. Once the equations are established, the students can investigate the consequences of shifting parameter values and thereby gain further insight in the problem.

The next example will explore the effect of flushing on the flow rate to a shower. The bathroom plumbing of a building consist of 1.5 cm – diameter copper pipes with threaded connections, as shown in the figure. The gage pressure at inlet is 200 kPa during a shower.

Page 26.1402.5

We assume the flow to be steady, incompressible, turbulent, and fully developed. The reservoir is open to the atmosphere, and the velocity heads are negligible. The properties of water at 200 C are  = 998 kg/m3, µ = 1.002 10-3 kg/m s. The roughness of copper pipes is ε =1.5 10-6 m. The loss coefficients of the shower head and the reservoir are 12 and 14, respectively.

At first, the reservoir is full, so that there is no flow in that branch. We want to calculate the flow rate through the shower head. The figure shows the various minor losses through the shower branch. The piping system of the shower alone involves 11 m of piping, a tee with line flow ( KL=0.9), two standard elbows (KL=0.9 each), a fully open globe valve (KL=10), and a shower head (KL=12). Therefore ∑ KL= 24.7. Noting that the shower head is open to the atmosphere, and the velocity heads are negligible, the energy equation (Bernoulli) for a control volume between 1 and 2 simplifies to

2 2 푃 푣 푃 푣 푃1,푔푎푔푒 1 + 훼 1 = 2 + 훼 2 + ℎ ⟾ = (푧 − 푧 ) + ℎ 2 푔 2 푔 2 푔 2 푔 퐿 2 푔 1 2 퐿

200000 Numerically, ℎ = ( − 2) 푚 = 18.4 푚 퐿 998∗ 9.81

퐿 푉2 The head loss is given by the formula ℎ = ( 푓 + ∑퐾 ) . 퐿 푑 퐿 2 푔 휀 1 2.51 The friction factor is calculated using Colbrooke’s formula: = −2.0 lg( 푑 + ) √푓 3.7 푅푒 √푓 The calculation is done using Mathematica:

Page 26.1402.6

The volume flow rate of cold water is therefore 푉̇ = 0.00053 m3/s or 0.53 l/s.

When the toilet is flushed, the float moves and opens the valve. The discharged water starts to refill the reservoir, resulting in parallel flow after the tee connection. The head loss and minor loss coefficients for the shower branch were determined to be ℎ퐿,2 = 18,4 푚 and ∑퐾퐿,2 = 24.7. The corresponding quantities for the reservoir branch can be similarly determined to be 200000 ℎ = ( − 1) 푚 = 19.4 푚 퐿,3 998 ∗ 9.81

퐾퐿,3 = 2 + 10 + 0.9 + 14 = 26.9 푚

Conservation of mass gives the relation 푉1̇ = 푉2̇ + 푉3̇

We set up the relevant equations and solve it for the unknown entities. We are particularly interested in finding 푉2̇ , the volume flow rate through the shower. The problem involves solving 12 equations with 12 unknowns.

Page 26.1402.7

3 The results of this calculation give the volume rate in the shower branch as 푉2̇ = 0.00042 m /s. Therefore, the flushing of the toilet reduces the flow rate of cold water through the shower by 21% from 0.53 l/s to 0.42 l/s, causing the shower water to suddenly become very warm. If the velocity heads were considered, the flow rate through the shower would be 0.43 l/s. Therefore, the assumption of negligible velocity heads is reasonable in this case.

This neat example presents opportunities for some interesting discussions in the classroom.

Page 26.1402.8

The final example will simulate the flow into a vacuum cleaner attachment. We will consider the flow of air into the floor attachment nozzle of a typical household vacuum cleaner. The width of the slot is w = 2 mm, and its length is L = 35.0 cm. The slot is held a distance b = 2.0 cm above the floor, as shown in the figure.

The total volume flow rate through the vacuum hose is 푉̇ = 0.110 m3/s. First, we want to predict the flow field in the center of the attachment (xy plane in the figure) and plot several stream lines. We assume steady, incompressible, and planar flow. The majority of the flow field is irrotational.

We model the slot as a line sink (line source with negative source strength). With this approximation, we are ignoring the finite width w of the slot. Instead we model the flow into the slot as flow into the line sink, i.e., a point at (0,b) in the xy plane. The strength of the line sink is obtained by 푉̇ − 0.110 dividing the total volume rate by the length L of the slot: = = −0.314 m2/s. 퐿 0.35

Clearly, the line sink by itself is not sufficient to model the flow, since air would flow into the slot from all directions, including up through the floor. To avoid this problem, we add another elementary irrotational flow to model the effect of the floor. We do this using the images method. With this technique, we place a second identical sink below the floor at position (0,-b). We call this second sink the image sink. Since the x- axis is a line of symmetry, the x- axis is itself a streamline of the flow, and hence can be thought of as the floor. The irrotational flow to be analyzed is sketched in the following illustrations:

Page 26.1402.9 푉̇ Two sources of strength are shown. The top one is called the flow sink, and it represents suction 퐿 into the vacuum cleaner attachment. The bottom one is the image sink. For both sources, 푉̇ is negative.

The composite stream function of the flow is a superposition of stream functions of individual sources.

푉/̇ 퐿 휓 = 휓 + 휓 = (휃 + 휃 ) 1 2 2 휋 1 2

Rearranging and taking the tangent of both sides: 2 휋 휓 tan 휃1 + tan 휃2 tan = tan ((휃1 + 휃2) = 푉̇ 1 − tan 휃1 tan 휃2 퐿 푦−푏 푦+푏 From the picture we find 휃 = arctan , 휃 = arctan . A little algebra gives us the result 1 푥 2 푥 푉̇ 2 푥 푦 휓 = arctan( ) 2 휋 퐿 푥2 − 푦2 + 푏2

The velocity field 푉 = (푢, 푣) can be found from the stream function by the relations 푢 = 휕 휓 휕 휓 , 푣 = − . We are particularly interested in the field along the x- axis. An easy calculation 휕 푦 휕 푥 푉̇ 푥 gives 푢 = , 푣 = 0. The velocity is horizontal along the symmetry axis, as expected. A 휋 퐿 푥2+푏2 plot in Mathematica is shown, visualizing the velocity field near the line sinks. The sinks themselves and highlighted in red, and the dividing stream line along y = 0 is marked with thicker line. The arrows points towards the sink positions, since air is sucked into the hose.

2

1

0

1

2

2 1 0 1 2 Page 26.1402.10

Next we look at the pressure field along the floor. Since we have made the irrotational flow approximation, the Bernoulli’s equation can be used to generate the pressure field. (The Bernoulli constant is independent of streamlines in irrotational flow). Ignoring gravity, 푃 푉2 푃 푉 2 푃 + = 푐표푛푠푡 = ∞ + ∞ = ∞ 휌 2 휌 2 휌

We have already calculated the velocity 푉(푥) along the floor and therefore know the result 푉∞ = 0. To define a pressure coefficient ( dimensionless ratio static pressure difference/ dynamic pressure), we need a reference velocity for the denominator. Having none, we generate one from the known 푉̇ parameters, namely 푉 = − , where we insert a negative sign to make 푉 positive. Then we 푟푒푓 푏 퐿 푟푒푓 2 2 2 푃 −푃∞ 푉 푏 푉 define the pressure coefficient 퐶푝 = 1 = − 2 = − 2 . Substituting 푉 = 푢 = 휌푉 2 푉 푉̇ 2 푟푒푓 푟푒푓 퐿2 푉̇ 푥 푏2푥2 , we finally find 퐶 = − . 휋 퐿 푥2+푏2 푝 휋 (푥2+푏2)2

We introduce non-dimensional variables for axial velocity and distance, ∗ 푢 푢 푏 ∗ 푥 푢 = = 푉̇ , 푥 = . Note that 퐶푝 is already non-dimensional. 푉푟푒푓 푏 퐿 2 1 푥∗ 1 푥∗2 Along the floor, 푢∗ = , 퐶 = − ( ) . 휋 1+푥∗2 푝 휋 1+푥∗2

* * * The next figure shows the graph of u (x ) and Cp (x ). I have scaled the curve for the pressure coefficient to make the curves more comparable. The minimum point is still correct, but the minimum value calculated will differ from what you see on the graph. The velocity curve is indeed correct. 0.15

0.10

0.05

3 2 1 1 2 3

0.05

0.10

0.15

We see that u* increases from 0 at x*= - ∞ to a maximum value 0.159 at x = -1. The velocity is positive for negative values of x* , as expected since air is being sucked into the vacuum cleaner. As * speed increases, pressure decreases. Cp = 0 at x = - ∞ and decreases to its minimum value at x = - 1. Calculations in Mathematica gives the minimum value – 0.0253. Between x*= - 1 and x* = 0, the speed decreases to zero, while the pressure increases to zero at the stagnation point directly below the vacuum cleaner nozzle. To the right of the nozzle (positive values for x*) the velocity is antisymmetric, while the pressure is symmetric.

The maximum speed (minimum pressure) along the floor occurs at x* = ± 1, (x = ±b) which is the same distance as the height of the nozzle above the floor. The maximum speed along the floor is Page 26.1402.11 푉̇ −0.314 |푢| = −|푢∗| = −0.159 ( ) = 2.50 m/s. 푚푎푥 max 푏 퐿 0.020

We expect the vacuum cleaner to be most effective at sucking up dirt from the floor when the speed along the floor is greatest and the pressure along the floor is smallest. Thus, contrary to what housewives may have thought, the best performance is not directly below the suction inlet, but rather at x = ± b.

Experimenting with some small granular material (like sugar or salt) on a hard floor will convince us of the results outlined in this problem. It turns out that the irrotational approximation is quite realistic for flow into the inlet of a vacuum cleaner, everywhere except very close to the floor, because flow is rotational there.

EVALUATION OF THE PROJECTS After the end of courses, students are asked to evaluate the curriculum and projects using a questionnaire. We are particularly interested in students learning outcomes. We ask for their opinion of learning outcomes from the lectures, the problem solving exercises, and the work in the computer lab. We also ask questions like: Is the curriculum communicated in an understandable way? Do you get satisfactory answers to your questions during the course? Are you using the web resources at hand? Have you been stimulated to further study of the field?

We specifically ask about the outcomes of working with computational tools. Have these projects enhanced their understanding and interest for the topics? Will they continue to look for such tools in their further study time on campus?

On a scale from 1- 5, where 5 is the top score, about 80 % of the students score most of the questions 4 or 5, while 3 or less was very rare. One of the students gave the top score of 5 to every item on the questionnaire! The computer lab projects are more popular than solving tasks using pencil and paper, but the outcome may vary. Many students commented that visualization of the problem proved very elucidating. The ease of programming in Mathematica was also often mentioned. Most of the students only had experience of Matlab in earlier courses. Page 26.1402.12

SUMMARY OF EARLIER WORK IN COMPUTATIONS Opinions always differ about what the optimal learning environment is. Many teachers (including myself) are ageing people who remember attending lectures during our time at university where the professor talked endlessly in front of a vast community of inactive attendees. The formulas were entered on the white board at a great pace before being wiped off again. Today the focus is on student-active learning, peer reviewing, flipped classrooms, clickers and other ideas for involving the students in the educational process. The teaching is hopefully research based, so the students can feel that they are part of an evolving curriculum where the newest principles are presented. The introduction of small- sized computers and laptops with an increasing amount of memory and computational power has revolutionized the way scientists and engineers work. Of course, this has affected how new generations study. This places a great responsibility on lecturers as regards how they teach their courses. Thousands of pages have been written on didactics and principles of teaching. My contribution to all this has been extensive use of the mathematical computational tool Mathematica. I hope my fascination for the program has inspired the students to explore the new world of scientific thinking.

Although I have concentrated on topics in fluid mechanics in this paper, my experience of using Mathematica as a teaching tool is not limited to physics. In my calculus courses, we investigate, among other things, how Taylor series and Fourier series approximate the exact function in convergence intervals. The latest versions of Mathematica ( version 6 +) have a dynamic interface that is excellent for creating animations of dynamical systems. Experts worldwide have contributed to thousands of demonstrations and program snippets using the Manipulate command, which is extremely powerful. People who are interested can visit the website http://demonstrations.wolfram.com/ . By downloading the Mathematica Player for free, you can evaluate the commands in the CDF document and do the animations in the web browser without installing the Mathematica program on your computer.

In a paper submitted to the ICEE conference in San Juan, Puerto Rico1 in 2006, I wrote about the birth of the environmental engineering program at Oslo University College, how it was organized and my contributions to courses in thermodynamics. In one project, we looked for pollution in room air due to exhalation of C02 by persons in the room. Using the maximum values for the CO2 contents for acceptable smell given in the scientific literature we studied the relationship between room volume per person and the need for fresh air ventilation per hour. This is of great importance in kindergartens, school classrooms, and work areas in factories.

Another project concerned heat conduction through a multilayer wall isolating a cold storage facility from the warm environment. We can even incorporate temperature-dependent conduction coefficients to make the equations nonlinear. I also prepared a project on impurity cleaning in a cascading set of tanks filled with brackish water that flowed through the system. The outlet valve in one tank is connected to the inlet valve in the next tank. When the velocities in and out are equal, the total amount of water in the tanks is constant. We can also study the effect of unintentionally opening a valve for extra inlet of fresh water, so that the total amount of brackish water increases in this particular tank, and calculate the amount of salt in each tank after, say, an hour.

At the ICEE conference in Coimbra, Portugal in 2007 I presented a paper2 containing more examples from pure mathematics. The projects dealt with inverse functions, arc length calculations, and explorations with conditionally convergent series. The students found it astonishing that it is possible to alter the sum of a series simply by rearranging terms. The alternating harmonic series serves as an

excellent example because some rearrangements are possible using simple hand calculations. The Page 26.1402.13 surprising fact is that it is possible to rearrange the series to give any preset value of the sum. A nice program showing this is always presented at lectures on series convergence.

CONCLUSIONS There is always discussion about what constitutes the best learning environment for students. Many lecturers feel uncomfortable in their teaching situation because they see that students are not aware of their low learning outcome. Moreover, what is best practice for one student, may not be right for others. Some students need a lot of drill exercises to become familiar with the new concepts, and ask for such training exercises. Others find it frustrating to spend time solving the same types of problems. Solving inhomogeneous differential equations with initial conditions is tedious and boring for students when they know that the coefficients can be calculated in milliseconds on a laptop they carry in their school bags.

I believe that there is room for both experiences in such courses. The need to learn basic skills may better be met by hand calculations. I believe we must not overwhelm the majority of students with many new exercises in the same category. But again, it is important to see the students as individuals and adapt the auxiliary material used in lectures to suit each one of them. Every problem ought to have some new aspects. When understood, more interesting and complicated situations can be explored with the help of computational tools. In this paper, I have shed light on some typical problems where numerical tools are necessary to obtain a result. The feedback from students is clearly positive, and they feel they are working on interesting and relevant problems in their study program.

[1] Experience in project-based learning in Environmental Engineering courses at Oslo University College. [2] Increasing the learning outcome in mathematics by use of computer programs like Mathematica. Page 26.1402.14