Notice: Wiley Online Library will be unavailable on Saturday 30th July 2016 from 08:00-11:00 BST / 03:00-06:00 EST / 15:00-18:00 SGT for essential maintenance. Apologies for the inconvenience.
 Modeling the diffusion of elements in olivine from volcanic rocks has recently become one of the most useful techniques to determine the timescales of the processes that occur in magma reservoirs before eruptions. However, many potential users are not versed in the numerical methods needed to solve the diffusion equation for timescale determinations. Here we present DIPRA (Diffusion Process Analysis), a user-friendly computer tool that models easily and intuitively the olivine chemical zoning by performing an automatic, visual, and quick fit to the natural profiles. The code is developed under a finite difference scheme and allows simultaneous modeling of diffusion of Fe, Mg, Mn, Ni, and Ca. DIPRA accounts for most variables that affect the diffusivity, including temperature, pressure, oxygen fugacity, major element composition, and anisotropy. Initial and boundary conditions can be done as complex as desired, including changing boundary composition with time. Such versatility allows modeling the large variety of scenarios that are characteristic of volcanic systems. We also have implemented a methodology to estimate objectively the uncertainties of the timescales from the uncertainties of the data and temperature. We expect that our application will increase the number and quality of timescale determinations from crystal zoning studies. It may be also useful as a teaching resource for higher education courses.
If you can't find a tool you're looking for, please click the link at the top of the page to "Go to old article view". Alternatively, view our Knowledge Base articles for additional help. Your feedback is important to us, so please let us know if you have comments or ideas for improvement.
 One of the most innovative recent advances in volcanology and igneous petrology has been to be able to quantify the timescales and rates of magmatic processes [e.g., Turner and Costa, 2007]. A good knowledge of these timescales is generally important for understanding a wide range of phenomena, from the time of magma transport through the crust, to magma differentiation and mixing, to the processes that occur right before an eruption [e.g., Dosseto et al., 2010].
 These timescales have been traditionally obtained by using radiogenic techniques, and great advances have been made with precise measurements of short-lived isotopes of the so-called U-Th disequilibria series [e.g., Condomines et al., 2003; Cooper and Reid, 2008; Schmitt, 2011]. A complementary methodology is the modeling of concentration gradients in minerals [e.g., Costa et al., 2008; Costa and Morgan, 2010], which is based on chemical diffusion within the crystals. This approach is increasingly being used thanks to the larger number of precise determinations of diffusion coefficients [e.g., Zhang and Cherniak, 2010] and the possibility of determining chemical gradients very quickly and with a good spatial resolution using micro or nano beam analytical techniques [e.g., Sylvester, 2008; Fayek, 2009].
 Application of diffusion modeling in volcanic rocks is relatively straightforward because the diffusion clock is stopped at the time of eruption due to the fast cooling, in contrast to metamorphic rocks. Most determinations have been obtained using minor trace elements or isotope profiles in feldspar [Mg, Sr and isotopes, Ba; e.g., Zellmer et al., 1999; Costa et al., 2003, Costa et al., 2010; Morgan et al., 2006; Davidson et al., 2007; Druitt et al., 2012], olivine [Fe, Mg, Ni, Ca, Mn; e.g., Nakamura, 1995; Pan and Batiza, 2002; Costa and Chakraborty, 2004; Costa and Dungan, 2005; Holzapfel et al., 2007; Kahl et al., 2011], pyroxenes [Fe, Mg, Ca; e.g., Morgan et al., 2004, Morgan et al., 2006; Saunders et al., 2012], and quartz [Ti, Li; Wark et al., 2007; Charlier et al., 2012; Matthews et al., 2012].
 Despite the availability of diffusion data in minerals and the ease of measurements of chemical gradients, the number of studies that determine the timescales of magmatic processes by modeling the crystal composition is still limited. This is probably due in part to the lack of a user-friendly tool to solve the diffusion equation in natural crystals. In this contribution, we aim to alleviate this situation by providing a user-friendly program to model the chemical zoning in olivine. We choose this mineral because it is widespread in igneous rocks, its major and minor elements can be measured precisely and with a good spatial resolution using an electron microprobe, and the diffusion coefficients of several major and minor elements have been determined at the conditions of interest [e.g., review in Chakraborty, 2010]. Therefore, multiple time determinations can be obtained from a single traverse in a crystal thin section [e.g., Costa and Dungan, 2005], allowing for more robust results than approaches based on a single element.
 The code that we present (DIPRA - Diffusion Process Analysis-) allows modeling multi-element diffusion in olivine interactively, where the fits to the data, initial and boundary conditions, and other parameters can be visualized directly on the screen. As in any other program, the results are only meaningful if the premises of the modeling are based on good constraints of the magmatic system [Costa et al., 2008]. The program, a user guide, and some solved examples are provided as auxiliary material.1
2 Diffusion Model in Olivine Crystal
 The random motion of the molecules of a given component i in a mixture leads to a particle flux density Ji (m−2s−1) proportional to the gradient of concentration (First Ficks' Law; see Figure 1):
where θi is the number of particles per unit volume of the mixture (m−3); and Di is the diffusivity or the diffusion coefficient (m2s−1). The differential equation of matter conservation states that:
which asserts that the number of particles inside a control volume changes with time only accordingly to the diffusive flux. Complexities, such as mechanical mixing, crystal growth, or diffusive flux by pressure or temperature gradients, are not modeled here [e.g., Lasaga, 1998, and references therein for more complex cases]. The above equation can be expressed in other concentration units (as mole fraction χi) if we assume that the density distribution of the mixture does not change significantly with time during chemical mixing.
 Here we aim to model the diffusion of Fe – Mg (as forsterite, Fo = Mg/(Mg + Fe), in mole fraction), Mn, Ni, and Ca in olivine because their concentrations can be easily measured with an electron microprobe, and their diffusivities have been determined in the laboratory [e.g., Petry et al., 2004; Coogan et al., 2005; Dohmen and Chakraborty, 2007a, 2007b; Dohmen et al., 2007]. The diffusivities of Mn and Ni depend on the concentration of Fo. The diffusivity of Ca probably is also dependent on Fo, but its dependence has not been yet characterized (Table 1). Therefore, equation (2) can be written as:
where we have considered a one-dimensional approach; i subscript stands for Fo, Mn, Ni, or Ca; and θFo is the concentration of Fo. Other elements for which their diffusivities have also been determined [e.g., review in Chakraborty, 2010] are Cr [Ito and Ganguly, 2006], Li [Dohmen et al.., 2010], and H [e.g., Demouchy and Mackwell, 2006], but they require much more sophisticated equipment to be measured (e.g., ion microprobe, laser ablation inductively coupled plasma–mass spectrometry, and Fourier transform infrared spectroscopy) and often have lower spatial resolution. Thus, they have not been considered here.
Table 1. Experimentally Determined Diffusion Coefficients Used in DIPRA
aDiffusion coefficients are given in m2s−1, where fO2 represents the oxygen fugacity in Pa and is calculated in DIPRA from the NNO buffer as reference; χFo is the mole fraction of Fo; p is the pressure in Pa; T is the temperature in absolute degrees, and R is the ideal gas constant also in SI units. For Fo, Mn, and Ni, the diffusion parallel to  is six times faster than parallel to  and  (D ~ D ~ (1/6)D). Ei is the activation energy, and its value is for Fo: EFo = 201,000 J/mol; for Mn: EMn = 201,000 J/mol; for Ni: ENi = 220,000 J/mol; and for Ca: ECa, = 193,000 J/mol, ECa, = 201,000 J/mol, ECa, = 207,000 J/mol. Note that the diffusivities of Mn and Ni depend on the Fo mole fraction [see Dohmen and Chakraborty, 2007a, 2007b; Chakraborty, 2010; Dohmen et al., 2007; Holzapfel et al., 2007].
 There is a strong anisotropy in the diffusion according to the crystalline structure of the olivine that has also been experimentally investigated [e.g., Dohmen and Chakraborty, 2007a, Dohmen and Chakraborty, 2007b, Dohmen et al., 2007]. Thus, Di along the direction of the electron microprobe traverse depends on its orientation respect to the crystallographic axes of olivine and can be calculated from [e.g., Costa and Chakraborty, 2004]:
being Di,[1 0 0] the diffusivity of the component i parallel to the crystallographic axis  of olivine, and analogously for Di, [0 1 0] and Di,[0 0 1]. α, β, and γ are the angles between the direction of the track of the electron microprobe and the axes , , and , respectively. First, the orientation of the crystallographic axes has to be determined, which can be readily done in situ with electron backscattered diffraction [e.g., Prior et al., 1999]. Then, α, β, and γ can be obtained by means of a stereographic projection. If the crystal orientation cannot be quantitatively determined, it might be possible to make an approximation by using the crystal morphology and optical properties.
3 Method of Solution
 A numerical method is needed to solve equation (3) for a general case. Here we use finite differences explicit in time because it is computationally fast for our purposes, and implicit approaches are rather more complicated when the diffusivity is not constant. We use the scheme of forward difference in time and second-order accurate central difference for the space derivative [e.g., Press et al., 2007]. The discretized diffusion equation once written in one forward time step is (see auxiliary material for details):
whereas above i represents Fo, Mn, Ni, or Ca; k and j refer to the spatial and time steps indexes, respectively; Δx is the size of the one-dimensional cell; and Δt is the size of the time step. In the above equation, we have already considered that the diffusivities in DIPRA are programmed as functions of the concentration of Fo in units of mole fraction (χFo). On the contrary, concentration of Mn, Ni, and Ca can be given according to the user choice (Ci). The diffusivity and its derivative are evaluated in without being discretized by using the empirical relationships of Table 1.
 The handicap of using an explicit method is that the numerical scheme is not stable for every combination of Δt and Δx. However, the time and spatial steps can be selected by the user to reach a compromise between runtime and compliance of the stability condition:
3.2 Initial and Boundary Conditions
 The diffusion equation can be solved as an initial-value problem: moving forward in time given initial and boundary concentrations. This is the approach commonly used to model diffusion in volcanic crystals. Initial conditions are typically associated with the maximum concentration measured in the olivine crystal or in the largest crystals, and boundary conditions are usually fixed by the concentrations measured at the crystal rim, which is thought to be in equilibrium with the liquid or the environment where the crystal resides [Costa et al., 2008].
 Both nonuniform initial conditions Ci (x, t = 0) and constant or time-dependent boundary conditions [Ci (x = 0, t), Ci (x = xmax,t)] may be directly chosen by using the DIPRA interface. A typical case thought to be a good approximation to many real situations consists in considering that at t = 0 the concentration is distributed as a series of steps or plateaus of different concentrations. For an arbitrary number of plateaus M (see Figure 2 for details):
where s(φ) is the step function:
az is the concentration of the plateau z, while xz marks the position that separates the plateau z from the plateau z + 1. In DIPRA, the user only has to supply the values az, xz in a text file, and the program can read it. Time-dependent boundary conditions can be also modeled by using a sequence of time steps (Figure 2b). Other types of initial and boundary conditions, such as those applicable for equilibrium or fractional crystallization [e.g., Costa et al., 2008], can also be incorporated by typing in the appropriated equation that better describes the zoning (e.g., a polynomial of concentration and distance).
3.3 Best Fit to the Natural Data
 Natural chemical profiles are plotted as curves of concentration against position. By comparing natural with theoretical curves, we can determine the times of diffusion and from there obtain the timescale of the processes that we think created the zoning. Previously, best fits have been done visually, but DIPRA selects automatically the model with minimum root mean square (rms) within a range of times chosen by the user:
being N the total number of data; is the experimental concentration of the component i measured at the position p; and is the theoretical concentration of the component i computed at the position p and time jΔt. is calculated from a simple interpolation between and and it is met that kΔx < p < (k + 1)Δx. This interpolation process is necessary because in general the position where the concentration is measured in the natural crystal does not correspond to those of the model. The program automatically chooses the curve with the value of j which minimizes equation (9).
3.4 Uncertainties in the Diffusion Times
 Another difficulty that potential users find is to assign an uncertainty to the diffusion time that best fit the natural data. We have implemented in DIPRA a new error analysis of the best time that includes those uncertainties related to the concentration and temperature [Costa et al., 2008]. Errors associated to the cell size and to the interpolation cited above are not considered, but the results will be more accurate for finer meshes as in any other numerical scheme and can be easily minimized as to be negligible. As a measure of the goodness of the best fit, we use the ratio between the number of theoretical concentrations which are not inside the error bars of the data and the total number of data (N). We call discrepancy to this ratio, which should be zero in an ideal case for appropriate boundary and initial conditions. The error bar size is chosen by the user according to the natural data noise and analytical uncertainty (see Figure 3). In summary, DIPRA calculates automatically the following uncertainty for the diffusion time (see auxiliary material for details):
where n and m are the number of theoretical curves with lower and larger diffusion time than the best fit for which the discrepancy is the same as in the best fit (see Figure 3 for details). The second term comes from considering that time and diffusion coefficient scale as t ∝ 1/D while D ∝ exp(−τi/T). τi depends on the component i and includes the exponential term of the diffusion coefficient (e.g., activation energy, pressure, and gas constant) except for temperature (see Table 1 for details). σ(T) is the uncertainty of the temperature, which can reach values up to ±50°C depending on the geothermometers [e.g., Putirka, 2008]. The error of the diffusion time is higher for larger times and lower for higher temperatures. It is not symmetrical in general. The second term of equation (10) becomes dominant for larger uncertainties in the temperature and lower uncertainties in the concentrations measured in the laboratory.
4 Some Examples
 One of the strengths of DIPRA is that it can fit Fe – Mg, Mn, Ni, and Ca concentrations by displaying the best fit on the screen (Figure 4). Users can interact with the program by uploading new natural data, by adjusting an uncertainty to the concentrations according to the instrumentation or data noise, and by examining the effect of the different parameters of the physical model. The program calculates a matrix of concentrations for all the different times and positions, and the user can visualize an animation with the different profiles with which the code seeks the best fit to the natural data. The final settings, results, and graphs can be saved after modeling for a further treatment. We show below two illustrative simulations computed with DIPRA for different zoning patterns, two components (Fo and Mn), and different initial and boundary conditions. The examples are also representative of natural zoning profiles in olivine of mafic volcanic rocks.
4.1 Simple Initial and Boundary Conditions
 We model a crystal with normal zoning (decreasing concentration from core to rim) as being initially homogeneous (Figure 5 and 6). Diffusion is driven by a different concentration at the boundary as if the crystal is immersed in a melt in equilibrium with a lower Fo and Mn content. This could be the case of a simple olivine xenocryst immersed in a more evolved melt from which it grew. We assume a time-invariant concentration at the boundary, as if the melt composition had not changed with time. This is representative of a much larger volume of liquid with regards to the crystal. Other initial conditions are possible to reproduce the profile, and the interested reader can see Costa et al.  or Costa and Morgan  for a discussion of how to infer the most appropriated initial and boundary conditions. Table 2 reports the conditions and results from modeling the Fo and Mn concentrations. We choose T = 1125°C with uncertainty of 10°C, P = 101,325 Pa, fO2 = 3.4 ⋅ 10−4 Pa (NNO buffer), a cell size of ∆x = 6 µm, a time step of ∆t = 30,000 s, and assume that the electron microprobe traverse is parallel to . The computed diffusion time is between 1320 and 1750 days for Fo, and between 1610 and 2300 days for Mn. The time obtained from the two elements overlaps, which suggest that the models are realistic. Figures 5 and 6 are an output from DIPRA including the natural data, initial conditions, the minimum and maximum time among which the code seeks the best fit, and the best curve together with the natural data.
Table 2. Results and Key Parameters Used to Model the Diffusion Profiles Shown in Figures 5 and 6
Uncertainty in concentration
Boundary conditions (xmin)
Boundary conditions (xmax)
Diffusion time (days)
Uncertainty time (− days)
Uncertainty time (+ days)
4.2 Nonhomogeneous Initial Conditions and Time-Dependent Boundaries
 Another common type of compositional zoning in olivine is multiple zones with normal and reverse trends, as can be induced by multiple magma mixing events [e.g., Kahl et al., 2011; Figure 7]. Such zoning can be modeled by considering nonhomogeneous initial conditions and time-dependent concentrations at the boundaries. Here we have done a model where first we fit the inner part of the zoning and the condition at the boundary stays the same as the initial, and then the boundary changes to the measured rim composition in order to fit the full profile. The exact time at which the condition is changed is done by a trial and error iterative process by the user. We consider T = 1125°C with uncertainty of 10°C, P = 101,325 Pa, fO2 = 3.4 ⋅ 10−4 Pa, cell size of Δx = 2 µm, a time step of Δt = 7000 s, and we assume diffusion parallel to the  crystallographic axis as above. Initial conditions, boundary conditions, and final results are shown in Table 3. Figure 8 shows the matrix of solutions in the whole grid (also an output from DIPRA) where it can be clearly seen the time-dependent boundary conditions.
Table 3. Results and Key Parameters Used to Model the Diffusion Profile Shown in Figure 7
Uncertainty of Concentration
Initial conditions a1
Initial conditions a2
Initial conditions a3
Initial conditions x1 (µm)
Initial conditions x2 (µm)
Boundary conditions -xmin- b1
Boundary conditions -xmin- b2
Boundary conditions -xmin- t1 (s)
Boundary conditions -xmax- b1
Boundary conditions -xmax- b2
Boundary conditions -xmax- t1 (s)
Diffusion time (days)
Uncertainty time (− days)
Uncertainty time (+ days)
 The program with a graphic interface that we have built allows modeling diffusion of multiple elements in olivine (Fe, Mg, Ca, Ni, and Mn) using any choice of initial and boundary conditions, and incorporates the main thermodynamic parameters that control diffusion. The program does an automatic fit and provides the error associated, but the user can visually control the result and interact with the program by changing the different variables directly on the screen. Given the ease and quality of the major and minor element concentration profiles in olivine that can be obtained with an electron microprobe, we think that the program can be used to generate many models of multiple elements, which should increase the number of timescale determinations of magmatic processes. The ease of use of DIPRA makes it a potentially useful tool for teaching petrology, kinetics of chemical reequilibration, and timescales of magmatic processes in higher education courses.
 F. Costa acknowledges many discussions about diffusion modeling in olivine with S. Chakraborty, R. Dohmen, and D. Morgan. Reviews of M. Streck and anonymous helped to improve the manuscript. Thanks to C. Bouvet de Maisonneuve for testing of the code and suggestions. This work was started thanks to a fellowship of Introduction to Research (2008) granted to Társilo Girona by Consejo Superior de Investigaciones Científicas, included into the JAE INTRO program. Support from A*STAR and EOS-NTU (Magma Plumbing system project) is also acknowledged.