Physics of nonsteady state diffusion of lightweight atoms in a heavy atom matrix. Introducing an opensource tool for simulatedexperiments in fluid mechanics
Abstract
The practicebased learning methodologies offer to undergraduate professors different ways to illustrate certain general physic principles. Traditional experimental workbenches have been extensively used during decades for academic lessons in order to complete theoretical dissertations or lectures, aiming at assuring an adequate understanding. The high cost of materials and laboratory equipment, the excessive preparation time, and the difficulty for carrying out offsitecampus replications by students, are disadvantages that can discourage of trying new kinds of experimental tasks. This paper gives insight of simulatedexperiment possibilities through an opensourcebased computational suite in teaching fluid mechanics. Physics underlying diffusion of a light specie in a heavier atom matrix, as function of time and position, were explained to students as an example to teach them the Fick’s Second Law expression. We present a docent stepbystep programme, scheduled in three sessions. The expected solution is firstly explained and then compared both to a real case, by published results, and to the virtualclassroom experiment, by resolving a differential equation with numerical schemes. Students were able to make their own hypothesis, change input parameters, and contrasting their initial assumptions.
Keywords: physics of diffusion, simulatedexperiment, opensource, virtual learning
1 Introduction
Almost every physics teacher would agree to attribute the essential role of practice lessons in the learning process. The evolution of physics learning approaches since early sixties of twentieth century was extensively reviewed by Trumper [1], explaining the traditional and constructivist point of view and showed the principles and advantages of the microcomputerbased laboratories (immediate feedback, partner collaboration, reduced cost,…) in alignment with the American Association of Physics Teachers (AAPT) basis [2]. In the current frame of the European Higher Education Area, learning methods have been focused as one of the critical paths to achieve encouragement of students [3]. The design of attractive teaching resources, although requires a initial reflection and development, have shown in different experiences a effective improvement of motivation and even in student results [4, 5, 6, 7, 8, 9]. Hence, new computational simulation tools include the main characteristics needed to achieve good teaching results.
Some considerations can be argued talking about a wellguided practicelearning with computational applications: (i) they allow a constant student improve due to a constant self evaluation; (ii) different individual skills and team job strategies may be developed in the same set of sessions; (iii) students have the possibility of emulate activities of professional labassistant without the inherent risks of a real practice; (iv) a higher amount of time can be spent in demonstration experiments instead of lectures or theoretical formulations (learning the meaning by applying it, instead of learning formula by reading it); (v) the globalnet offers a free source of data and fullyfunctional computational codes, downloadable and installable by students. The latter has to be included as a main objective for practice design, to ensure the accessibility and repeatability of sessions.
In this manuscript we present a basic course aiming at teaching the basic concepts of fluid mechanics particularizing on diffusion at the atomic level. Diffusion of hydrogen in metals is an interesting and complex problem of technological importance in different fields. For example, hydrogen interaction, from an engineering standpoint, frequently results in compromising the mechanical and chemical properties of materials [10, 11]. Diffusion of hydrogen and its isotopes has been, and still continues being, one of the key challenges in Nuclear Fusion [12, 13].
On the other hand, hydrogen is seen as a versatile energy carrier for the future. One of the promising methods for hydrogen storage makes use of the capability of some metals and alloys to easily uptake this element. The development of efficient hydrogen storage systems requires, however, a detailed knowledge on how hydrogen diffuses in metals [14].
Although the chief aspects of hydrogen diffusion in metals are complex, and they need an understanding from quantum to crystallographic (dependence on lattice structure) effects, basic concepts from a classical point of view constitute a basic pillar to be learnt. Our approach uses a particular docent methodology that combines experimental data into computer aided fluid dynamics tools, allowing to teach and visualize physical concepts underlying the physics of nonsteady state diffusion of hydrogen in a heavy atom matrix.
In addition to the docent introduction of the physical laws into an opensource computational toolbox and visualization module, we present a teaching plan organized in three sessions that combine cooperative with guided learning methodologies.
2 Organization of docent sessions
To achieve an effective learning for students, planning becomes a key issue for practicebased approach. A meditated structure of sessions must include not only the lesson material, but the pathway to accomplish students global comprehension of concepts. This means a holistic point of view that starts with the previous and new knowledge, and goes on with the need of incorporate skills and attitudes that have to be developed.
Planning have been organized in order to do not constrain the learning environment in the main classroom, but to involve students to be free of choosing the place to continue their work. The use of free and opensource codes allows them to install the tools needed to carry out tasks on their own desktops, and even using webbased resources among their class or group partners (forums, networking, allocation of tasks).
A model of cooperative learning was used, distributing students in small groups around a computer terminal (23 students per post). This strategy has been shown to contribute to an overall increase in motivation and promotion of cognitive development [15]. Moreover, the course was carried out using a guided learning approach, where the students were guided step by step across the different exercises and problems, what was necessary to satisfy the needs of the students at each stage, at the time that ensured to keep the rhythm of overall progress of the learning experience.
In this case, the description of nonsteady state diffusion problem was the initial lesson, particularized for the case of a lightweight atom for the diffusive specie. Attendees to the lessons were undergraduate engineering students. Table 1 shows the schedule of teaching sessions proposed.
Session  Duration  Task 

1A Theoretical lecture  30 min  Introduction to physics of diffusion 
The nonsteady state problem: Seconds Fick’s Law  
Solution with error function  
1B Example  20 min  Example problem: hydrogen diffusion through vanadium 
Objectives description. Teamleaders choice  
2 Spreadsheet  50 min  Inputs needed and expected results. Questions and answers 
Introduction of opensource application  
Individual work: approach to the new tool  
Basic mesh generation  
3A Simulation  50 min  Boundary and initial conditions 
Schemes and control configurations  
Simulation run  
3B Validation  50 min  Visualization of results. Data extraction 
Comparison with analytical and experimental approaches 
3 Understanding non steadystate diffusion. Fick’s second law.
An initial session was set up as a group lecture to introduce the theoretical expressions underlying the physics of non steadystate diffusion (session 1A).
Let us begin considering two species (A=diffusing and B=matrix)
that remain physically bounded by their own interface. We can assure that
concentration of the lightest one (A) is constant in its side, i.e.
concentration is time independent. At constant energy, a material
flow will be initialized through the heavier specie (B) so that the
atoms of A will pass among molecular lattice of B. This means that
concentration of A ([A] denoted below as c) will
grow up inside the B matrix. This non steadystate diffusion problem
is commonly resolved by Fick’s second law, which can be expressed
with a laplacian equation without convective term:
(1) 
If the problem is constrained to x axis, eq. 1 can be written as:
(2) 
Here c(x,t) represents [A] in x position and at t time. The diffusion coefficient D is assumed to be independent of time and position, although it can show a strong temperature (T) dependence. Arrhenius form is commonly used to estimate values of diffusion coefficient:
(3) 
A possible solution for eq. 1 can be defined with the use of the error function as follows [16, 17]:
(4) 
Where is the constant surface concentration of specie A, is the initial uniform [A] into the B matrix, and is the concentration of the specie A at a certain position x. The error function can be computed as:
(5) 
Equation 4 allows to estimate [A] variation in
function of time and distance, provided that adequate constants are
previously known ().
These equations can be solved numerically in the continuum aided by computational codes. For the purpose of the present article, next section shows an example problem with the same parameters that were used in our course at University of Burgos.
4 Case problem. Hydrogen diffusion through vanadium.
4.1 Validation through experimental setup.
The use of recent innovative results to illustrate theory with a practical example (session 1B), helps to put students into contact with real physics, what is positive to raise their attention and motivation. Recent scientific achievements related to the study of diffusion in nanosized materials, have been carried out at Uppsala University. In this case, a new measurement technique was developed to obtain accurate results, even with low concentrations of the diffusive specie. Traditional methodologies, such as nuclear magnetic resonance, quasielastic neutron scattering or mechanical relaxation methods, have been widely and extensively used to study hydrogen diffusion rates. However, they cannot offer the timeevolution profile of concentrations inside the samples. On the contrary, an innovative technique based on an optical setup, which can be applied on any metal, has been developed [18]. A monochromatic light beam is emitted by a a lightemitting diode (LED) source, and then split on a semitransparent mirror in order to allow two simultaneous measurements (intensity of source and optical transmission through the sample). The illumination is homogenized by a diffusor before passing trough a vacuum chamber, inside which the sample is fixed. The passing light is finally registered by a charged coupled device (CCD), and optical transmittance can be simultaneously monitored.
The method was employed to quantify the movement of hydrogen through a thin film of vanadium [17]. Samples were prepared over a monocrystalline double side polished magnesium oxide substrate, which is transparent and have a lattice parameter comparable with vanadium, and then covered with a layer of polycrystalline palladium, in order to protect the sample from oxidation. Palladium exhibits a much weaker affinity for hydrogen than vanadium, hence concentration in palladium can be neglected. Sample dimensions were a 100 mm x 100 mm, with 50 nm of thickness. Vanadium is covered with aluminum zirconium which quickly is oxidized in air to obtain a hydrogen impermeable layer, except for a window at one of the ends. The experiment starts when molecular hydrogen is introduced into the chamber, which is dissociated on the palladium film. Atomic hydrogen goes inside vanadium, migrating laterally and changing concentration profile. The previously explained apparatus can register light penetration and convert it, recording the concentration at shorttime intervals. An example of visual output can be watched online at http://www.nature.com/ncomms/journal/v3/n6/extref/ncomms1897s1.mov.
The above described experimental workbench was decided to be used as a template to design a computeraided simulated docent experiment. Simulations using opensource code, aiming the understanding of theoretical concepts and expressions, where validated by means of published experimental results.
4.2 Review of main concepts.
After description of the experimental approach during session 1B, objectives and concepts were reviewed to accomplish students comprehension:

Diffusion mechanism explains the migration of one specie inside another one.

Fick’s second law allow performing calculations of concentration in function of time and position. This equation requires a well known and defined boundary conditions.

The key parameter for calculations is the diffusion coefficient, which is directly related with the two species involved. This value can vary in function of temperature, and even position and concentration along the samples. Average values are used in engineering procedures to simplify the problem, but obtaining accurate enough results for applications.

A new experimental measurement technique will be discussed putting on the table a technical report from Uppsala University [17]. Data were extracted, and compared with theoretical expressions.

Finally, a computerbased experiment simulation will be configured to validate the used code by statistical comparison. Students should be able to reproduce the experiment with similar conditions, changing initial concentrations, diffusion parameters or sample dimensions, and being capable to discuss the obtained results.
4.3 Use of openaccess resources for the students.
Main resources for session 1B can be found at the online facilities of Uppsala University Library, which includes a openaccess repository with scholar and research publications. The final report from Bliersbach [17] can be accessed, so descriptions about methods and diffusion results are available for academic uses. The report declares a fitted solution for Fick’s second law which validates the proposed methodology. For example, table 2 describe the concentration profile [H/V] for the mentioned sample geometry at 423 K, and 465 s after hydrogen exposure. These data are plotted in fig. 1 showing a descent slope. Inside Bliersbach conclusions, the average diffusivity for a initial concentration [H/V]=0.060 and 423 K was computed as m/s. This value is accurate enough to be used for similar initial concentrations, as can be deduced by simple interpolation with other data from Uppsala’s report.
x (cm)  [H/V] 

0.00E+00  0.052000 
3.88E03  0.050992 
4.49E02  0.042318 
6.81E02  0.037395 
8.54E02  0.033995 
9.74E02  0.03165 
1.16E01  0.02825 
1.31E01  0.025553 
1.48E01  0.022738 
1.65E01  0.02004 
1.82E01  0.017576 
1.98E01  0.015229 
2.16E01  0.012998 
2.33E01  0.011353 
2.50E01  0.00959 
2.72E01  0.007826 
5 Comparison between experimental measurements and theoretical behavior in our lesson.
Regarding the docent methodology followed, Session 2 started with a brief description of the sources and goals
sought. In addition, the collaborative learning methodology was settled down with the groups formation and team leaders selection.
As it has been exposed previously, the solution for the eq. 1
gives a path to obtain the [A] at any time and position. The use
of the error function can be also substituted by the complementary
error function, obtaining a more compact expression:
(6) 
Error function (and complementary) are available in the common spreadsheet suites. From a figure of Upssala’s reports, we can extract some useful inputs for the practice in order to calculate the particular solution. Table 2 shows the profile for t=465 s for an initial hydrogen concentration (t=0, x=0) [H/V]=0.052. As mentioned above, m/s can be a used as average diffusivity at 423 K for initial concentrations around 0.060. Therefore, session 2 includes a initial validation of published results with the use of equations 4 or 6. By plotting both data and error function results, an overall quantitative comparison can be carried out (fig. 1). Basic statistics are also a chance in this first steps. As Bliersbach profiles (e.g., table 2) were used to fit the theoretical solutions of Fick’s equation in order to obtain a diffusion constant, negligible differences are showed between both plots (fig. 1). The average computed error when eq. 6 is used to predict hydrogen concentration is below 0.8 %, with a maximum of 2.7%. Following the idea of providing a globalavailability of resources, as well as easy access to the students, the noncommercial suite Gnumeric was selected for performing calculations, as it is showed in fig. 2.
6 Running and Configuring the computeraided simulation experiment.
Last part of session 2 involved teaching the basis of an initial approach towards the opensource code selected for running the simulated experiment. OpenFOAM® is a validated tool for field calculations based in the Finite Volume Method (FVM) [19]. Several solvers are implemented in the OpenFOAM® main package, making it useful for a wide range of scientific and engineering applications (e.g., fluid dynamics, heat and mass transport, thermophysical and chemical properties). Due to the UNIXbased structure of the code, this part of the lessons has to be carefully stepbystep oriented, leading to the learners comprehension of OpenFOAM® input requirements to solve the problem of diffusion (table 3 shows the main structure and modules needed to run this computer experiment by means of OpenFOAM® suite).
Therefore, Session 3A must include a deep explanation of the particular case definition (0, constant, and system folders) in OpenFOAM®’s framework. A standard laplacianFoam solver was used to design the simulatedexperiment. Because of the unidimensional nature of Uppsala observations, size of specimen can be varied without induced errors if the total length is higher enough, i.e. no undesirable boundaryeffects are involved. Therefore, sample dimensions were reduced in two directions to increase calculation speed, but thickness was increased to avoid meshing problems. The proposed shape for the simulatedexperiment was as shown in fig. 3. To identify the faces, friendly names should be used for geometry descriptions (e.g. input, output and walls). The mesh was defined with 250x200x5 cells, and duration of simulation was initially fixed to 500 s (storing data each 15 s).
Folder  Subfolder  Contents 

0  Boundary and Initial condition variable files  
constant  Other property dictionaries (transportProperties)  
polyMesh  Mesh geometry (blockMeshDict)  
system  Run configuration and numerical schemes  
(controlDict, fvSchemes; fvSolution) 
Boundary conditions are key points of numeric schemes for resolving differential equations. To simulate the same conditions used for the fitted analytic solution, a zero gradient was imposed for temperature over the output and lateral walls but a constant concentration was fixed in the input ([H/V] = 0.052). The case was parallelized before running to take advantage of multiplecore hardware.
7 Visual postprocessing of simulation results
One of the important features of the OpenFOAM® toolbox is the 3d visualization capability, thanks to the ParaView VTK opensource engine [20]. A graphical output allows the learners exploring the physical meaning of eq. 1. ParaFOAM is an adapted version of ParaView, embedded as a third party software in the main package of the tool, and configured to acquire data from OpenFOAM® results.
The friendly interface of ParaFOAM makes easy the visualization and analysis of concentration evolution in time scale. Examples of some snapshots are shown in fig. 4. On the other hand, the position dependence can be readily computed by performing different profiles at selected times. Numerical values of these profiles can also be extracted at screen (in a table view) and then imported to a CSV file, which can be subsequently used at a spreadsheet to make global charts or statistical comparisons. The time dependence of profiles shown in fig. 5 may give insight of the atoms migration speed, which decreases when increasing time. The experience has shown that graphical tasks are a valuable help for students understanding. A complete contour plot can be moreover performed (fig. 6) to obtain another approach to the computed solution which cannot otherwise visualized. A brief explanation of features and capabilities of ParaFOAM was made during the last session (3B), giving the students a solid frame for homework and the path for the required final report.
8 Validation.
A final validation was carried out among the three sets of available data: experimental measurements of Uppsala, fitted Fick’s equation solution and insilico simulatedexperiment results. Concentration results from OpenFOAM® calculations are stored in text files, including hydrogen concentration for each one of the mesh cellcenters. Each timestep is separated in different folders from time t=0 to t=finalstep. Students are free to open each one of concentration files, but there is no way to recognize directly the nodes or cells involved for each stored data. Hence, a previous visualization work is the best to obtain coherent lists of concentrations for different time steps, identifying concentration evolution with exact time and position parameters. Data extraction can be constrained to a single longitudinal line due to the expected unidimensional behavior.
A qualitative comparison can afterwards be assessed by a overall graph, as showed in fig. 1, which was used to legitimate the proposed practice. Final statistics gave an average error of 0.90 % between simulated and laboratory experiments.
9 Conclusions
An opensource computational tool, OpenFOAM®, has been validated for its use in a docent scheme for fluid mechanics. Physics of non steady state diffusion of light atom species have been revisited and exported to be solved aided by an opensource computational tool.
In order to gain insight the physics of diffusion, a particular case at the forefront of research, has been studied. Diffusion predictions of hydrogen in vanadium were carried out comparing two different procedures: a real published experiment that brings precise data thanks to a new innovative technique, and fitted theoretical functions.
Our lessons helped both students and teachers to clarify the following key concepts: Fick’s second law behavior, diffusion coefficient, importance of boundary conditions, time and position dependence of migration specie concentration, and the need of validation procedures for computational codes.
With a multisession programme, a simulatedexperiment practice was performed to explain the light atoms diffusion behavior to undergraduate engineering students. Two main objectives have been achieved: students motivation about physics learning, and increased academic performance. The experience has shown to the authors that better understanding results are obtained when coupling real laboratory and simulatedexperiments, taking advantage of a graphical postprocessing 3Dsuite and encouraging students to obtain representative plots as outputs. Different proposals of graphical examples are provided to attendees for didactic objectives, in order to give a clear pathway for their final summary. Therefore, the use of new computational techniques as learning tools have been demonstrated to be a good way to draw the attention of engineering students and reach several learning benefits.
References
References
 [1] Ricardo Trumper. The Physics Laboratory  A Historical Overview and Future Perspectives. Science & Education, 12:645–670, 2003.
 [2] American Association of Physics Teachers AAPT. Goals of the Introductory Physics Laboratory. American Journal of Physics, 66(6):483–485, 1998.
 [3] Carlos Romero and Elvira Martínez. Achievements of engineering students on a fluid mechanics course in relation to the use of illustrative interactive simulations. European Journal of Physics, 34(4):873–885, July 2013.
 [4] D G Dewhurst, J Hardcastle, P T Hardcastle, and E Stuart. Comparison of a computer simulation program and a traditional laboratory practical class for teaching the principles of intestinal absorption. The American journal of physiology, 267(6 Pt 3):S95–104, December 1994.
 [5] Eli Meir, Judith Perry, Derek Stal, Susan Maruca, and Eric Klopfer. How effective are simulated molecularlevel experiments for teaching diffusion and osmosis? Cell biology education, 4(3):235–48, January 2005.
 [6] Javad Hashemi, Katherine A AustinStalcup, Edward E Anderson, and Naveen Chandrashekar. Elements of a Realistic Virtual Laboratory Experience in Materials Science : Development and Evaluation. International Journal of Engineering Education, 21(3):534–545, 2005.
 [7] William Clark and David DiBiasio. Computer Simulation of Laboratory Experiments for Enhanced Learning. In Annual Conference & Exposition of American Society for Engineering Education (ASEE), pages 1–13, Hawaii, 2007. ASEE.
 [8] Gerald W Meisner, Harol Hoffman, and Mike Turner. Learning Physics in a Virtual Environment : Is There Any ? Lat. Am. J. Phys. Educ., 2(2):87–102, 2008.
 [9] S. CuestaLópez and L. RomeroSantacreu. Improving comprehension by means of 3d visualization tools and other icts in specialized scientific educational workshops. In In INTED2013 Proceedings. 7th International Technology, Education and Development Conference, 2013, page 6572–6577. IATED, 2013.
 [10] D.J. Fisher. Hydrogen Diffusion in Metals: A 30Year Retrospective. Defect and Diffusion Forum, 167168. Scitec Publications, 1999.
 [11] A.K. Das. Metallurgy of Failure Analysis. Columbus, OH, McGrawHill, 1997.
 [12] Robert E. Stickney. Diffusion and Permeation of Hydrogen Isotopes in Fusion Reactors: a Survey. The Chemistry of Fusion Technology. pp 241319. SpringerVerlag US, 1972.
 [13] HongBo Zhou, YueLin Liu, Shuo Jin, Ying Zhang, G.N. Luo, and GuangHong Lu. Investigating behaviours of hydrogen in a tungsten grain boundary by first principles: from dissolution and diffusion to a trapping mechanism. Nuclear Fusion, 50(2):025016, 2010.
 [14] G. Hoogers. Fuel Cell Technology Handbook. FL: CRC Press.Boca Raton, 2003.
 [15] Steven E. Jungst, Joe P. Colleti, and Janette R. Thompson. Using studentcentered learning techniques in forestry classes at Iowa State University. In Third Biennial Conference on University Education in Natural Resources, March 2528, 2000, University of Missouri, Columbia, 2000.
 [16] J Crank. The Mathematics of Diffusion. Oxford University Press, London, 2 edition, 1975.
 [17] Andreas Bliersbach. Hydrogen diffusion in nanosized materials investigated by direct imaging. Technical report, Upssala University, Upssala, 2011.
 [18] Gunnar K Pálsson, Andreas Bliersbach, Max Wolff, Atieh Zamani, and Björgvin Hjörvarsson. Using light transmission to watch hydrogen diffuse. Nature communications, 3(May):892, January 2012.
 [19] OpenFOAM Foundation. OpenFOAM. The Open Source CFD Toolbox. User Guide. Number May. 2012.
 [20] A. Henderson. ParaView Guide. A Parallel Visualization Application. Kitware Inc., 2007.