155
Surface evolution and grain boundary migration in a system of 5 grains. Vadim Derkach

Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Surface evolution and grain boundary migrationin a system of 5 grains.

Vadim Derkach

Page 2: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Surface evolution and grain boundary migrationin a system of 5 grains.

Research Thesis

In partial fulfillment of the requirements for the degree of Master of Science inApplied Mathematics

Vadim Derkach

Submitted to the Senate of the Technion - Israel Institute of Technology

Adar 5770 Haifa March 2010

Page 3: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

This research thesis was carried out under the supervision of Prof. Amy Novick-Cohen andDr. Arkady Vilenkin at the Faculty of Mathematics at the Technion.

The generous financial help of the Technion is gratefully acknowledged.

I would also like to acknowledge receipt of a scholarship from the Benin Foundation of theJewish Agency and the New York Federation.

I also wish to thank RBNI for receipt of a 50% subsidy grant for NANCO computer usage.

I am grateful to Prof. Amy Novick-Cohen and Dr. Arkady Vilenkin for their professionaland personal support, patience, valuable advice, and guidance at every stage of this work.

I would like also to thank Dr. Anne Weill of the Taub Computer Center, Prof. Uri Asherof University of British Columbia, and Prof. Shlomo Ta’asan of Carnegie Mellon Universityfor their interest, comments, and suggestion regarding various numerical issues.

My deepest gratitude to my family, especially to my parents Anatoly and Larisa, and mywife Yuliya for all encouragement, support and understanding throughout this research.

Page 4: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Table of Contents

Abstract 1

List of Symbols 3

1 Introduction 51.1 The problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Physical background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.2.1 Basic concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2.2 Motion by mean curvature and surface diffusion . . . . . . . . . . . 101.2.3 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.2.4 Scaling the laws of motion . . . . . . . . . . . . . . . . . . . . . . . . 141.2.5 Physical parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1.3 Earlier investigations of grain boundary migration . . . . . . . . . . . . . . 151.4 Equilibrium angles at the quadruple junction . . . . . . . . . . . . . . . . . 281.5 Balance of mass flux at the quadruple junction and top corner points . . . . 311.6 Mass conservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321.7 Energy dissipation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

2 Mathematical Formulation 362.1 Parametric representation of surfaces . . . . . . . . . . . . . . . . . . . . . . 362.2 Governing equations for the grain boundaries and exterior surfaces . . . . . 402.3 Uniform distribution of surface grid points . . . . . . . . . . . . . . . . . . . 402.4 Conditions along the thermal groove lines . . . . . . . . . . . . . . . . . . . 412.5 Conditions along the internal triple junction line . . . . . . . . . . . . . . . 422.6 Conditions along the exterior free boundaries . . . . . . . . . . . . . . . . . 422.7 Conditions at the quadruple junction and at the corner points . . . . . . . . 442.8 The PDAE system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482.9 Various geometries for study . . . . . . . . . . . . . . . . . . . . . . . . . . . 492.10 Benchmark criteria for testing our numerical algorithm . . . . . . . . . . . . 50

2.10.1 The test: m = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502.10.2 The test: mass conservation . . . . . . . . . . . . . . . . . . . . . . . 512.10.3 The test: energy dissipation . . . . . . . . . . . . . . . . . . . . . . . 51

3 Numerical Simulations 523.1 Approximations and numerical methods . . . . . . . . . . . . . . . . . . . . 52

3.1.1 Available numerical methods for solving the problems . . . . . . . . 523.1.2 Numerical solution of systems of differential - algebraic equations (DAE) 523.1.3 Approximation of the Jacobian matrix . . . . . . . . . . . . . . . . . 53

Page 5: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

3.1.4 Approximation of derivatives . . . . . . . . . . . . . . . . . . . . . . 543.1.5 Approximations along triple junction lines and free boundary lines . 563.1.6 Approximation of the integral in the mass flux conditions . . . . . . 57

3.2 A numerical algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633.3 Improving the algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

4 Results and Conclusions 704.1 Verifying the von Neumann-Mullins law . . . . . . . . . . . . . . . . . . . . 724.2 Verifying mass conservation and energy dissipation . . . . . . . . . . . . . . 734.3 Results for m = 0 and m = 0.1 . . . . . . . . . . . . . . . . . . . . . . . . . 784.4 Comparative results as the parameter m varies from 0 to 0.1 . . . . . . . . 854.5 Comparison our results for m = 0.1 with results of Mullins 1957 [41] . . . . 894.6 Conclusion and future directions . . . . . . . . . . . . . . . . . . . . . . . . 91

A A Parametric Expression for sH 93

B Condition Formulations to Avoid in Numerical Calculation of the Jaco-bian 97

C Source code in C 99

Bibliography 136

Page 6: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

List of Figures

1.1 Sketch of a 5 grain geometry. . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Sketch of (a) partitioned 5 grain geometry, (b) resultant 3 grain geometry. . 61.3 SEM micrographs of the composition of the molar system (99.5% SnO2 +

0.5% MnO2 + 0.2% Nb2O5) sintered at 1300 oC for: (a) 1h; (b) 4h [32]. . . 81.4 Surface grooves attributed to jerky motion of grain boundaries in steel after

annealing for 1h at 1000C in vacuum [16]. . . . . . . . . . . . . . . . . . . 91.5 Cross-sectional view of a ”groove root”. . . . . . . . . . . . . . . . . . . . . 121.6 The geometric dimensional parameters: Lx, Ly, Lz. . . . . . . . . . . . . . . 141.7 An idealized thermal groove [41]. . . . . . . . . . . . . . . . . . . . . . . . . 151.8 The anchor angles −θ0, θ0, at a notch [42]. . . . . . . . . . . . . . . . . . . 181.9 A idealized cylindrical catenoidal grain [42]. . . . . . . . . . . . . . . . . . . 181.10 The quarter loop bicrystal geometry [19, 20, 21]. . . . . . . . . . . . . . . . 211.11 A circular cylinder grain [4, 2]. . . . . . . . . . . . . . . . . . . . . . . . . . 221.12 The definition of the variables in the central cross-section [2]. . . . . . . . . 231.13 (i) a periodic array of pre-existing holes, and (ii) a hexagonal array of grains [10]. 251.14 (a) double , (b) triple and (c) quadruple bubbles [26]. . . . . . . . . . . . . 261.15 (a) bicrystal and (b) tricrystal geometries [25]. . . . . . . . . . . . . . . . . 271.16 A sketch of the quadruple junction. . . . . . . . . . . . . . . . . . . . . . . . 281.17 A tetrahedron construction at the quadruple junction. . . . . . . . . . . . . 301.18 Balance of mass flux at the quadruple junction. . . . . . . . . . . . . . . . . 31

2.1 The system of 3 grains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372.2 Corner points of the 3 grain system. . . . . . . . . . . . . . . . . . . . . . . 442.3 Various geometries for study . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

3.1 The grid mesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.2 A sketch of Γ at the quadruple junction. . . . . . . . . . . . . . . . . . . . . 583.3 A sketch of vectors V and U at the quadruple junction. . . . . . . . . . . . 593.4 Visualization of the nz = 163188 nonzero entries in the Jacobian matrix for

our system with N = 20, M = 10, m = 0.1, dt = 0.25, Lx = 30, Ly = 30,Lz = 0.25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

4.1 Initial conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714.2 Verifying of the Von Neumann-Mullins law . . . . . . . . . . . . . . . . . . 724.3 The x-coordinate of the quadruple junction. . . . . . . . . . . . . . . . . . . 734.4 The volume of system as a function of time, for various values of the param-

eter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Page 7: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

4.5 The relative change in the volume of system as a function of time, for variousvalues of the parameter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

4.6 The total area of the grain boundaries as a function of time, for various valuesof the parameter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

4.7 The total area of the exterior surfaces as a function of time, for various valuesof the parameter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

4.8 The total weighted area as a function of time, for various values of the pa-rameter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

4.9 Results for m = 0.0 at times (a) t = 10 and (b) t = 100. . . . . . . . . . . . 794.10 Results for m = 0.0 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60,

(e) t = 90, (f) t = 100. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804.11 Results for m = 0.1 at times (a) t = 10 and (b) t = 100. . . . . . . . . . . . 814.12 Results for m = 0.1 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60,

(e) t = 90, (f) t = 100. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824.13 Results for m = 0.1 at times (a) t = 10 and (b) t = 100, (top view). . . . . . 834.14 Results for m = 0.1 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60,

(e) t = 90, (f) t = 100, (top view). . . . . . . . . . . . . . . . . . . . . . . . 844.15 The height of (a) the quadruple junction and (b) the corner point IIt as a

function of time, for various values of the parameter m. . . . . . . . . . . . 864.16 The height of (a) the corner point IIIt and (b) the corner point IV t as a

function of time, for various values of the parameter m. . . . . . . . . . . . 874.17 The height of (a) the corner point CI and (b) the corner point CII as a

function of time, for various values of the parameter m. . . . . . . . . . . . 884.18 The height of the corner point CIII as a function of time, for various values

of the parameter m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894.19 The depth of various corner points as a function of time, for m = 0.1. . . . 904.20 The natural logarithm of the normalized depth of the various corner points

as a function of time, for m = 0.1. . . . . . . . . . . . . . . . . . . . . . . . 91

Page 8: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

List of Algorithms

1 Newton’s iteration method for solving F(Y)=0 . . . . . . . . . . . . . . . . 532 Calculating a discrete approximation to the solution of the PADE system . 653 Mapping of the indexes (s, i, j, v) of (Vi,j)

sv to an index ℓ of uℓ (uℓ ∈ U) . . . 66

4 Mapping the elements (Vi,j)sv to elements uℓ of U . . . . . . . . . . . . . . . 66

5 Approximating the Jacobian . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Page 9: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

List of Listings

C.1 Code from the source file main.c . . . . . . . . . . . . . . . . . . . . . . . . 99C.2 Code from the header file vars.inc.h . . . . . . . . . . . . . . . . . . . . . . 108C.3 Code from the header file f.inc.h . . . . . . . . . . . . . . . . . . . . . . . . 110C.4 Code from the source file f.inc.c . . . . . . . . . . . . . . . . . . . . . . . . 110C.5 Code from the header file inout.inc.h . . . . . . . . . . . . . . . . . . . . . 117C.6 Code from the source file inout.inc.c . . . . . . . . . . . . . . . . . . . . . 117C.7 Code from the header file math.inc.h . . . . . . . . . . . . . . . . . . . . . 120C.8 Code from the source file math.inc.c . . . . . . . . . . . . . . . . . . . . . 121C.9 Code from the header file share.inc.h . . . . . . . . . . . . . . . . . . . . . 126C.10 Code from the source file share.inc.c . . . . . . . . . . . . . . . . . . . . . 126

Page 10: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Abstract

Surface evolution and grain boundary migration play an important role in many modern

technological applications. These processes influence the microstructure of the material,

and the properties of the microstructure are critical in determining the mechanical, electric,

magnetic, and optical properties of metal and ceramic materials. For example, smaller grains

size tends to increase tensile strength and ductility, and larger grain size are preferable for

improved high-temperature creep properties.

We investigate grain boundary motion in polycrystalline material layers (solids) with

columnar structure, particularly in thin films, with a microstructure given by their net-

work of grains and grain boundaries. A good understanding of reliability and failure of

material layers is a critical issue in diverse technological areas, such as microelectronics,

pharmaceutics, optics, etc.

This thesis focuses on the numerical simulation and analysis of grain boundary migration

in an idealized system of 5 grains embedded in a thin film. Since even the system of 5

grains in the special geometry is very difficult to study in full generality, we make certain

symmetry assumptions which reduce our problem to a simpler system containing 3 grains.

We consider the motion of the grain boundaries and the external surfaces which couple

along thermal grooves. The grain boundaries and the external surfaces are assumed to be

governed by motion by mean curvature and by motion by surface diffusion respectively.

Along the groove line, it is reasonable to assume that the boundary conditions are given by

Young’s law, continuity of the surface chemical potential, and balance of mass flux. At the

quadruple junction and along the exterior boundary of the domain, boundary conditions are

formulated in accordance certain symmetry assumption as well as the physical principles

1

Page 11: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

indicated above.

There is a physical parameter m which we define as the ratio of the free energy of the

grain boundary to the free energy of the exterior surface. The ratio m is influential in

determining the nature of the grain boundary motion, since m > 0 causes the appearance

of ”thermal grooves” at the intersection of the grain boundary with the exterior surface.

Theoretically the parameter m may vary between 0 and 2, but our mathematical model is

only valid within the range m ∈ [0,√3] ⊂ [0, 2]. For many materials, in particular for most

metals, m ∈ [0, 13 ], so this does not constitute a serious constraint.

From the conditions prescribed above we obtain a nonlinear system of partial differential

algebraic equations. In order to solve this nonlinear system numerically, we discretize the

system using a finite difference scheme, then employ various numerical algorithms (the back-

ward Euler method, Newton’s method) to obtain a solution. Since computer memory and

CPU time is somewhat problematic, we parallelize parts of our computational algorithm.

The aim of the numerical simulations is to get insight into the coupled motion, and

to understand some known phenomena like grain grooving, break-up of thin films, pitting

at quadruple junctions, jerky motion, etc., which influence the robustness and stability of

polycrystalline materials. While many phenomena remain to be studied in greater depth,

our results so far indicate that we have developed a framework in which the phenomena

listed above may be investigated. We have been able, for example, to follow pitting depths

as a function of time and to verify the predictions of the von Neumann-Mullins law in the

limit m ↓ 0.

2

Page 12: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

List of Symbols

s Laplace - Beltrami operator, known also as the surface Laplacian.

∇s Surface gradient.

⟨·, ·⟩ Inner or scalar product.

· Scalar product.

× Vector product.

⟨·, ·, ·⟩ Triple product.

∥ · ∥ L2 norm.

Si A regular 2D evolving surface in 3D, i = 1, . . . , 6.

∂Si Boundary of surface Si.

Xi Parametric representation of the surface Si.

H i The mean curvature of surface Si.−→n i Unit normal vector to the surface Si.−→τ i Unit tangent vector to the surface Si which orthogonally intersects ∂Si.−→τ I Tangent vector to the surface defined in (2.1.12).−→τ II Tangent vector to the surface defined in (2.1.13).

Πi Exterior bounding planes i = 1, . . . , 5.

ri0 An arbitrary fixed point located on bounding plane Πi.−→N i Unit normal vector to bounding plane Πi.

Γ A continuous curve in R3 that lies on surface S and orthogonally intersects ∂S.

ζ Preimage of Γ in the αβ plane in radial coordinates.

t Time variable.

tk Time step.

α, β Parametric spatial variables.

s An arc length parametrization variable.

dS An element of surface area.

ds An element of curve length.

σs Free energy per unit area of the exterior surface.

σgb Free energy per unit area of the grain boundary.

m Ratio of the free energy of the grain boundary to the free energy of the exterior surface.

3

Page 13: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

θ Dihedral angle along the ”groove root”.

φ, ψ The equilibrium angles at the quadruple junction.

Ta Time needed for annihilation of the corner grain .

Na Number of iterations needed for annihilation of the corner grain.

E(t) The total free energy of the system of 3 grains.

|Si| Area of surface Si.

Ω(t) A compact subset of R3.

∂Ω(t) A piecewise smooth boundary of Ω(t).

|Ω(t)| Volume of Ω(t).

Vn Normal velocity.

Vτ Tangent velocity.

µ Chemical potential.

A Reduced grain boundary mobility.

B Surface diffusion coefficient.

Ω The atomic volume.

J A surface flux.

ν The number of drifting atoms per unit area on the exterior surface.

v The average velocity of drifting atoms on the exterior surface.

Ds The surface diffusivity.

k Boltzmann’s constant.

T Absolute temperature (Kelvin).

b The boundary displacement associated with hopping events.

ν The Debye frequency.

E The difference in free energies between the atoms in the two grains.

L A typical length scale.

T A typical time scale.

Lx, Ly, Lz Geometric dimensional parameters.

4

Page 14: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Chapter 1

Introduction

1.1 The problem formulation

This thesis focuses on investigation of grain boundary migration in an idealized system

of 5 grains, see Fig. 1.1. Since even the system of 5 grains in the the special geometry

Figure 1.1: Sketch of a 5 grain geometry.

indicated in Fig. 1.1 is very difficult to study in full generality, we make certain symmetry

assumptions which reduce our problem to a simpler system containing 3 grains, see Fig. 1.2.

In all of the above systems, the grains are assumed to be of the same material but to have

different crystal lattice orientations. In developing a model to describe the time evolution

of the grain system, we take into account capillary driving forces which tend to reduce the

total surface free energy. For simplicity, we consider only the isotropic case in which the

properties of material do not depend on direction. In the isotopic case, reduction of the

surface energy implies reduction of the surface area weighted by the free energy per unit

area of the various surfaces. For simplicity, we also neglect the possible effects of elasticity,

evaporation, defects, and volume diffusion.

In studying grain boundary migration, we coupled the motion of the grain boundaries

5

Page 15: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

(a) (b)

Figure 1.2: Sketch of (a) partitioned 5 grain geometry, (b) resultant 3 grain geometry.

with the motion of the exterior surfaces, since the influence of the exterior surface on grain

boundary motion is significant along the ”thermal grooves” where the grain boundaries meet

the exterior surface. We study the dynamics of system of coupled surfaces which evolve in

time. Each surface moves according to a prescribed equation of motion, and the various

surfaces are coupled and bounded via an assortment of types of boundary conditions.

In our system of 3 grains, there are 3 grain boundaries, 3 exterior surfaces and 5 bounding

planes. The bounding planes are assumed to be stationary and not to move with time. We

also assume mirror symmetry of the system relative to the bounding planes. The curve

along which a grain boundary intersects an exterior surface is known as a ”groove root,”

”groove line,” ”thermal groove” or ”triple junction line.” We refer to the curve along which

a grain boundary or an exterior surface intersects a bounding plane as an ”exterior free

boundary,” and we refer to curve along which 3 grain boundaries intersect as a ”internal

triple junction line.” We shall refer to the vertex where four triple junction lines meet as a

”quadruple junction” or ”quadruple point,” and the vertices where free boundaries intersect

as ”corner points.”

Each grain boundary in our system of 3 grains is assumed to evolve according to motion

by mean curvature [40, 41]

Vn = A H, (1.1.1)

where Vn denotes the normal velocity of the grain boundary surface, H denotes its mean

curvature, and A is a kinetic coefficient known as the reduced mobility of grain boundary.

which depends on the material properties. Each exterior surface is assumed to evolve

according to motion by surface diffusion [41, 42]

Vn = −BsH, (1.1.2)

where Vn denotes here the normal velocity of the exterior surface, B denotes a kinetic

6

Page 16: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

coefficient (the surface diffusion coefficient), which depends on the material properties, and

s denotes the Laplace - Beltrami operator, known also as the ”surface Laplacian.” Note

that equations (1.1.1) and (1.1.2) describe only the normal velocity of the surfaces. Instead

of specifying the tangential velocities, we impose conditions on the surface parametrization

(equi-spacing).

Along the groove root, the boundary conditions that we shall impose are given by a

”persistence condition” that states that grain boundary and the exterior surfaces remain

attached, a balance of mechanical forces (Young’s law, which is an isotropic version of

Herring’s law [6, 5]), continuity of the chemical potential, and the balance of mass flux.

See [42, 19, 20] for a discussion of these conditions. Along the internal triple junction

line, we impose a ”persistence condition” as well as Young’s law. Along the free boundary

on the exterior surfaces, we impose a ”persistence condition,” mirror symmetry, and zero

mass flux. Along the free boundary of the grain boundaries we impose only a ”persistence

condition” and mirror symmetry. In the sequel we shall describe the boundary conditions

to be imposed at the quadruple junction and at the corner points.

The governing equations and conditions described above yield a system of equations

that describes the evolution in time of the grain system. Our aim is to develop a technique

(an algorithm) to numerically solve this system of equations, and to run simulations to

gain insight into various physical phenomena which so far have only been very partially

studied. Our algorithm extends and generalizes the approach of Pan et.al.[45, 46] and

Averbuch et.al. [1].

1.2 Physical background

1.2.1 Basic concepts

At present, almost all commonly used metals and many ceramic materials used in industry

and technology are polycrystalline, where by polycrystalline we mean that they constitute

solids that are composed of a large number of crystals of varying sizes and orientations. To

be more specific, a crystal is a solid material composed of atoms, molecules, or ions, which

are spatially arranged in an orderly fashion on a crystalline lattice. A small crystal is

often referred to as a grain. In other words, a grain is a small volume of a material,

having a given and continuous crystalline lattice orientation [9]. An interface between two

grains in a polycrystalline material is referred to as a grain boundary. In general, grain

boundaries are a few nanometers wide, and account for only a small fraction of material.

A sketch of grains and grain boundaries can be seen in Fig. 1.3. The network of grains

and grain boundaries determine the microstructure of the material, and the properties

of the microstructure in turn, are crucial in determining the various mechanical, electric,

magnetic, and optical properties of the material.

It has been recognized that the properties of materials depend not only on the processes

7

Page 17: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 1.3: SEM micrographs of the composition of the molar system (99.5% SnO2 + 0.5%MnO2 + 0.2% Nb2O5) sintered at 1300 oC for: (a) 1h; (b) 4h [32].

which occur inside the individual grains, but also, for example, on the boundaries between

grains. Diverse phenomena such as plasticity, conductivity, recrystallization, yielding, and

embrittlement all depend strongly on the structure and properties of the grain boundaries.

For example, since grain boundaries constitute defects, in crystal structures they effect the

electrical and thermal conductivity properties of the material.

At sufficiently high temperatures, the grain boundaries migrate in order to reduce their

net energy, which is referred to as the grain boundary energy (free energy/area). The

grain boundary migration tends to heal the lattice disorientation and to improve the homo-

geneity of the material. Grain boundary migration is important in many microstructural

processes such as in recrystallization and grain growth, and it plays an essential role in the

creation of new materials and in shaping the physical and mechanical properties of mate-

rials. It is a highly complicated process, since there are various sources of driving forces

which may cause migration of grain boundaries in polycrystalline materials. These may in-

clude stored deformation energy, grain boundary energy, magnetic field effects, temperature

gradients, and more [16, 35]. The interface between a solid material and a ambient gas is

referred to as the free surface or exterior surface of the specimen and we refer to the

energy (free energy/area) of this region as the exterior surface energy.

In analyzing the microstructural properties of materials, the effect of exterior surface

evolution may be influential, especially in thin films. By thin films we mean material layers

ranging in thickness from a few nanometers to several micrometers. Thin films are very

important in many common engineering applications of metals and ceramic materials, such

as in electronic semiconductor devices, optical coatings, and some drug delivery applications.

Their use in energy applications areas includes cells, and is also growing at a fast pace.

A very important microstructural characteristic of a material is the average grain size.

8

Page 18: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

The grain size affects properties of the material such as strength, toughness, ductility,

hardness, corrosion resistance, high/low temperature behavior and wear resistance. For

example, grain boundaries disrupt the motion of dislocations through the material. Hence

reducing crystalline size is a common way to improve strength.

In physics, typically one distinguishes between isotropic and anisotropic materials.

Materials are characterized as being isotropic if their properties are independent of spatial

direction, whereas the properties of anisotropic materials depend on the direction along

which they are measured. Most liquids and all gases are isotropic, but many crystals

are anisotropic, for example, to light (optical anisotropy), due to the symmetries of the

underlying crystalline lattice.

Figure 1.4: Surface grooves attributed to jerky motion of grain boundaries in steel afterannealing for 1h at 1000C in vacuum [16].

When a grain boundary intersects an exterior surface, new surface defects are formed,

known as grooves or thermal grooves. Grooving or thermal grooving is a phenomenon

which occurs to some degree in all polycrystals of natural and artificial origin (minerals,

metals, alloys, ceramics, etc.), and can be critical in determining the structure of the resul-

tant material, particularly in close proximity to the exterior surface. The grooving is often

understood to correspond to a drag force that slow down the motion of grain boundaries

which meet the exterior surface, although under appropriate configuration, they can actu-

ally lead to acceleration of the grain boundary [19]. They occur as a result of the balance

between the surface energy of the exterior surface and the surface energy of the grain bound-

ary [16]. Other important phenomena include pitting and jerky motion. Pitting refers

to creation of small holes in materials, for example at the vertices where grain boundaries

intersect (quadruple junctions). Both thermal groove and pitting can be responsible for

the initiation of breakup of materials. They play an important role in regard to stability

of materials, particularly in thin films. Jerky motion refers to rapid oscillatory variation

in the velocity of the moving grain boundary, and has been thought to reflect attachment

and detachment of the grain boundaries from the thermal grooves. This behavior has been

9

Page 19: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

attributed to the commonly occurring phenomena that grain boundaries appear ”jerky” on

exterior surface. See Fig. 1.4 where the surface grooves have been conjectured to have been

formed as a result of jerky motion.

A general overview of all of the basic concepts described in this section can be found

in [35, 16, 9].

1.2.2 Motion by mean curvature and surface diffusion

Let us consider volume conserving changes in the shape of a grain. These changes can

occur by diffusion of material from one surface location to another in response to one

or more driving forces. These may include applied fields (e.g. electromagnetic, stress),

internal stresses, and capillary driving forces. In response to these driving forces, processes

like surface diffusion (movement of atoms/molecules over solid surfaces), volume diffusion

(diffusion within the solid), and evaporation/condensation, may transport material [7, 43].

Following Mullins [44] we focus on capillarity driving forces, and consider surface dif-

fusion as the dominating transport process of material along the exterior surface of thin

films. We also assume that the exterior surface is in local equilibrium. By this we mean

that the chemical potential µ varies in space and time, but that it is varying so slowly that

at any given point, one can assume equilibrium in a small neighborhood of that point. This

also means that µ can be approximated by its equilibrium value. Note that the chemical

potential µ can be identified as the changes in the surface free energy per atom.

Let J denote a surface flux (atoms per unit length per unit time), then the evolution of

the surface may be described [41, 14]

Vn = −Ω∇sJ , (1.2.1)

which follows from consideration of mass conservation, where Vn denotes the normal velocity

of the surface element, ∇s denotes the surface gradient operator, Ω denotes the atomic

volume, and J may be expressed as [44]

J = ν v, (1.2.2)

where ν denotes the number of drifting atoms per unit area and v denotes the average

velocity of these drifting atoms.

Assuming local equilibrium, we can express v via the Nernst - Einstein formula [6, 41]

v =Ds

kT∇sµ, (1.2.3)

where Ds denotes the surface diffusivity, k is the Boltzmann constant and T denotes the

10

Page 20: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

absolute temperature. From (1.2.2) and (1.2.3) we obtain that

J =ν Ds

kT∇sµ. (1.2.4)

Thus from equations (1.2.1) and (1.2.4) we obtain that

Vn = −ν ΩDs

kTsµ. (1.2.5)

Let σs denote the free energy per unit area of the exterior surface of the grain, and let

H denotes its mean curvature. Then neglecting possible effects of anisotropy, we can write

down the relationship between µ and H at given point on the exterior surface [6], namely

µ = σs ΩH. (1.2.6)

Equation (1.2.6) implies that decreasing the mean curvature of the exterior surface implies a

decrease of the chemical potential, which causes an overall decrease in the total free energy

of the exterior surface.

From (1.2.5), (1.2.6), we find that shape changes of the exterior surface are determined

by the equation

Vn = −σs ν Ω2Ds

kTsH = −BsH, (1.2.7)

where B denotes the kinetic coefficient given by the expression,

B =σs ν Ω

2Ds

kT. (1.2.8)

Note that equation (1.2.7) is equivalent to equation (1.1.2), and is refer to as motion by

surface diffusion.

Next, consider motion by mean curvature. It is well known that change in the free energy

of the system associated with reduction of the grain boundary area provides the driving

force for normal grain growth. This driving force leads to the well known result that grain

boundaries migrate toward their center of curvature. The relationship between this type of

curvature driven growth and the grain boundary energy is provided by the Gibbs-Thomson

relation [35]. In this case, Vn, the grain boundary normal velocity is proportional to, H,

the mean curvature [33], namely

Vn = Hσgb b ν Ω

k Te−E

k T = A H, (1.2.9)

where σgb denotes surface free energy of the grain boundary, b is the boundary displacement

associated with the hopping event, ν is the Debye frequency, E is the difference in free

11

Page 21: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

energies between the atoms in the two grains, T is the temperature, k is the Boltzmann

constant, and A is the reduced grain boundary mobility, given by the following expression,

A =σgb b ν Ω

k Te−E

k T , (1.2.10)

Note that equation (1.2.9) is equivalent to equation (1.1.1) and refered to as motion by

mean curvature.

1.2.3 Boundary conditions

In this section we shall to explain some of the physical background of Young’s law, continuity

of the chemical potential, and balance of mass flux. We also explain the conditions arising

from symmetry considerations and zero mass flux. Following Herring [6, 5] we assume local

Figure 1.5: Cross-sectional view of a ”groove root”.

equilibrium along triple junction lines, and note that the condition of local equilibrium

implies a relation between the geometry along a triple junction line (dihedral angles) and

surface free energies of three surfaces. Since we are considering only the isotropic case, and

the two grains are taken to be identical except for their relative crystalline orientation, this

relation may be expressed as [8]

σs−→τ 1 + σs

−→τ 2 + σgb−→τ 3 = 0, (1.2.11)

where σs and σgb denote respectively the surface free energies (energy/area) of the exte-

rior surface and the grain boundary, and −→τ i, i = 1, 2, 3 refer to unit tangent vectors to

surface Si at the triple junction line which intersect the triple junction line orthogonally.

See Fig. 1.5. The relation (1.2.11), is known as Young’s law. If we set m =σgb

σsand divide

12

Page 22: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

equation (1.2.11) by σs, we obtain

−→τ 1 +−→τ 2 +m−→τ 3 = 0. (1.2.12)

Theoretically the parameter m may vary between 0 and 2, but, for example in metals, it is

known from experiments that 0 < m < 13 . The angle between vectors −→τ 1 and −→τ 2, known

as the dihedral angle, can be directly found from (1.2.12), namely

θ = π − 2 arcsin(m2

). (1.2.13)

Note that along the internal triple junction line, all of the dihedral angles are given by

θ = 2π3 , since the surface free energies are equal. Thus the Young’s law can be expressed

along the internal triple junction line as

−→τ 1 +−→τ 2 +−→τ 3 = 0. (1.2.14)

The chemical potential along the exterior surface can be identified with the mean cur-

vature (1.2.6), and hence continuity of the chemical potential can be written as

H1 = H2, (1.2.15)

where H i, i = 1, 2 denote the mean curvature of surfaces Si evaluated on either side of the

”groove root”.

Mass flux along the exterior surface is assumed to be proportional ∇sH, see equa-

tion (1.2.4). Hence balance of mass flux across thermal grooves may be expressed as

⟨−→τ 1,∇sH1⟩+⟨−→τ 2,∇sH

2⟩= 0, (1.2.16)

where ∇sHi, i = 1, 2 denote the surface gradient of the mean curvature of surface Si

evaluated on either side of the ”groove root”, and −→τ i, i = 1, 2 are as prescribed earlier.

Let −→n denotes a unit normal vector to the grain boundary or exterior surface S, and

let−→N denotes unit normal vector to the intersected bounding plane Π. Then the mirror

symmetry condition where the exterior surface intersects one of bounding planes may be

written as ⟨−→n ,−→N⟩ = 0, (1.2.17)

and the zero mass flux condition may be expressed as⟨−→N,∇sH

⟩= 0. (1.2.18)

13

Page 23: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

1.2.4 Scaling the laws of motion

In order to adopt a dimensionless formulation for our problem, we note that the governing

equations given in (1.1.1), (1.1.2) and (1.2.11) contain four physical parameters, A , B, σgb

and σs, whose dimensions are given by

[A ] =L2

T, [B] =

L4

T, [σgb] =

M

T 2, [σs] =

M

T 2, (1.2.19)

where L denotes length, T denotes time and M denotes mass. Thus[B

A

]= L2,

[B

A 2

]= T. (1.2.20)

To obtain a dimensionless formulation, we shall use A and B to define a typical length L

and a typical time T scales, by setting

L =

√B

A, T =

B

A 2. (1.2.21)

Lz

Lx

Ly

xy

z

Figure 1.6: The geometric dimensional parameters: Lx, Ly, Lz.

In the geometry which we wish to consider there are three natural geometric parameters

Lx, Ly, Lz, see Fig. 1.6, whose dimensions are given by

[Lx] = L, [Ly] = L, [Lz] = L. (1.2.22)

Hence we may define new dimensionless parameters and variables for our problem by setting

m =σgbσs, Lx −→ Lx

L, Ly −→ Ly

L, Lz −→

Lz

L, (1.2.23)

and

t −→ t

T, x −→ x

L, y −→ y

L, z −→ z

L. (1.2.24)

14

Page 24: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

1.2.5 Physical parameters

As explained in Section 1.2, the parameters A and B denote the reduced mobility of

grain boundary, and surface diffusion coefficient respectively. Taking values from the lit-

erature [40, 42, 19], we obtain that A ≈ 10−11 − 10−16m2/s and B ≈ 10−28m4/s. Hence

from (1.2.21) we get the following typical length and time scales

T =B

A 2≈ 10−6 s− 104 s, L =

√B

A≈ 10−9m− 10−6m. (1.2.25)

Note that 10−6m = 1µm, 10−9m = 1nm.

1.3 Earlier investigations of grain boundary migration

In this section we present a summary of some previous investigations of grain boundary

migration and thermal grooving evolution.

W.W. Mullins 1957 (”Theory of Thermal Grooving”) [41]:

In this article, Mullins considered the evolution of a symmetrical grain boundary, exterior

surface profile whose initial configuration consists of a flat grain boundary, positioned along

the negative y axis, which is perpendicular to an exterior surface located along the entire

x axis, see Fig. 1.7. Because of the symmetry with respect to the y axis, only the profile

y(x, t) for x ≥ 0 need to be considered. Note that in this configuration, the grain boundary

surface remains flat as a function of time. In the derivation and solution of the differential

Figure 1.7: An idealized thermal groove [41].

equations describing the development of the groove profile, the following assumptions were

used:

1. The system is closed and contains a polycrystalline metal which is in quasi-static

equilibrium with its vapor.

2. The properties of the interface are independent of the orientation of the adjacent

crystals.

15

Page 25: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

3. The only mechanisms operative in the transport of matter are evaporation-condensation

and surface diffusion.

Mullins first considered the case when evaporation-condensation ”Vn = 2AH” is the

main transport process:

∂y

∂t= A

∂2y

∂x2, 0 < x <∞, 0 < t <∞,

∂y

∂x(0, t) = m, 0 < t <∞,

y(∞, t) = 0, 0 < t <∞,

y(x, 0) = 0, 0 < x <∞,

(1.3.1)

where the assumption has been made that |∂y∂x | ≪ 1. This problem is well-known in the

theory of heat conduction and its solution is given by

y(x, t) = −2m (At)12 ierfc

(x

2 (At)12

), (1.3.2)

where ierfc, the integral error function, is defined as

ierfc(x) =1√π

(e−x2 − x erfc(x)

), (1.3.3)

where erfc(x) = 1− erf(x) and erf(x) = 2√π

x∫0

e−t2dt

Mullins afterwards considered the case when surface diffusion ”Vn = 2B∆sH” is the

main transport process:

∂y

∂t= −B∂

4y

∂x4, 0 < x <∞, 0 < t <∞,

∂y

∂x(0, t) = m,

∂3y

∂x3(0, t) = 0, 0 < t <∞,

y(∞, t) = 0,∂y

∂x(∞, t) = 0, 0 < t <∞,

y(x, 0) = 0, 0 < x <∞,

(1.3.4)

again assuming that |∂y∂x | ≪ 1. The solution to (1.3.4) may be written as

y(x, t) = m (B t)14

∞∑k=0

ak

(x

(B t)14

)k

, (1.3.5)

16

Page 26: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

where

a0 = − 1

212Γ(5/4)

, a1 = 1, a2 = − 1

232Γ(3/4)

, a3 = 0

ak+4 = akk − 1

4(k + 1)(k + 2)(k + 3)(k + 4), k = 0, 1, . . .

(1.3.6)

Note that for x = 0, Mullins found the solution to (1.3.4) directly by using the Laplace

transform technique. Setting y(x, p) =∞∫0

e−p t y(x, t) dt, the system (1.3.4) implies that

B∂4y

∂x4+ p y = 0, 0 < x <∞, 0 < p <∞,

∂y

∂x(0, p) =

m

p,

∂3y

∂x3(0, p) = 0, 0 < p <∞,

y(∞, p) = 0,∂y

∂x(∞, p) = 0, 0 < p <∞.

(1.3.7)

The solution of (1.3.7) is the following exponentially damped trigonometric function:

y(x, p) =mB1/4

p5/4e− p1/4

21/2 B1/4xsin

(− p1/4

21/2B1/4x− π

4

). (1.3.8)

Laplace inversion may in principle be applied to (1.3.8) for any value of x. If x = 0, it yields

that

y(0, t) = − m

21/2Γ(5/4)(B t)1/4. (1.3.9)

W.W.Mullins 1958 (”The Effect of Thermal Grooving on Grain Boundary Mo-

tion”) [42]:

The purpose of Mullins’ investigation in this paper was to analyze the effect that groov-

ing has on a grain boundary that is steadily moving or that is inclined at an angle to the

exterior surface. Mullins amplified the idea that thermal grooving may inhibit the motion

of a boundary that terminates on a surface by proposing a specific description of the way

in which inhibition may occur. His analysis provided explanations for several problems

concerning grain growth in sheets that had previously not been adequately accounted for.

17

Page 27: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 1.8: The anchor angles −θ0, θ0, at a notch [42].

He first considered a thermal groove which could be represented by a rigid V-notch that

remains fixed despite changes in the configuration of the associated grain boundary. This

configuration assumes that system evolves without surface diffusion (a static approxima-

tion). The anchor angles, −θ0, θ0 are shown in Fig. 1.8. A grain boundary lying within

the sector bounded by [−θ0, θ0] will be anchored to the notch, since it would be forced to

lengthen in order to escape. Outside this range, a grain boundary will spontaneously escape

from the notch, as this reduces length and hence energy. Note the effectiveness of the notch

as an anchor depends not upon its depth, but only on the angle θ0.

Figure 1.9: A idealized cylindrical catenoidal grain [42].

He afterwards considered a columnar circular grain extending through a sheet, see

Fig. 1.9, and made the same static approximation as before. Constrained by the circular

grooves, the boundary is free to minimize its area inside the sheet. The resultant mini-

mal surface is a cylindrical catenoid. It corresponds to the shape assumed by a soap film

stretched between two parallel circular frames. In this case Mullins used two properties of

a catenoid:

The mean curvature H vanish at all points on the catenoidal surface.

The angle θ at which the catenoid meets the normal to the exterior surface (Fig. 1.9)

depends solely on the ratio of the sheet thickness a to the radius of curvature of the

circular trace r of the catenoid on the exterior surface, i.e. θ = f(ar

).

18

Page 28: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Combining the above properties with the static approximation, Mullins inferred that a

columnar grain for which θ = f(ar

)< θ0 will be anchored to its groove, whereas if

θ = f(ar

)> θ0, the columnar grain can pull out of the circular grooves and shrink.

In this paper Mullins also considered the case when the simplifications of the static

approximation are abandoned. Let y(x, t) denote the surface profile shown in Fig. 1.7. Let

us assume that surface diffusion ”Vn = 2B∆sH” controls the evolution of this profile,

namely∂y

∂t= −B∂

4y

∂x4, (1.3.10)

that the surface free energy and the surface diffusion coefficient do not depend upon the

orientation of the adjacent crystal, and that |∂y∂x | ≪ 1. Consider now a frame of reference

that moves parallel to the x-axis with the instantaneous speed V at the groove root. Defining

ϵ = x−t∫

t0

V (τ) dτ as the distance along the x-axis from the groove root, and applying the

chain rule for differentiation, we obtain that

∂y

∂t= −B∂

4y

∂ϵ4+ V

∂y

∂ϵ, (1.3.11)

Let us construct a traveling profile for the groove in terms of two branches which we denote

by y+ for ϵ ≥ 0 and y− for ϵ ≤ 0. The boundary conditions, for t > 0, are taken to be as

follows:

y−(0, t) = y+(0, t),

∂y+∂ϵ

(0, t)− ∂y−∂ϵ

(0, t) = m,

∂2y+∂ϵ2

(0, t) =∂2y−∂ϵ2

(0, t),

∂3y+∂ϵ3

(0, t) =∂3y−∂ϵ3

(0, t).

(1.3.12)

Mullins considered the case of a steady moving ”traveling wave” profile characterized

by the conditions V (t) = V0 and ∂y∂t (ϵ, t) = 0, and satisfying the far field conditions:

y−(−∞, t) = y+(+∞, t) = 0 (no variation in height of the exterior surface far from the

groove). Equation (1.3.11) then becomes an ordinary differential equation for y(ϵ, t), namely

∂4y

∂ϵ4+ α3 ∂y

∂ϵ= 0, (1.3.13)

where α ≡(V0B

) 13 . The solution of equation (1.3.13) subject to the boundary condi-

19

Page 29: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

tions (1.3.14) is given byϵ ≤ 0 y(ϵ, t) = − m

3αeαϵ,

ϵ ≥ 0 y(ϵ, t) = −2m

3αe−

α2ϵ cos

(√3

2αϵ+

π

3

).

(1.3.14)

Using this solution and setting θ ≡ y+(0, t) + y−(0, t)

2, Mullins obtained that

θ =m

6≡ θc, (1.3.15)

V0 = −B( m3 d

)3, (1.3.16)

where d = −y±(0, t) is the depth of the groove. Note that the critical angle, θc, has a fixed

value, which is independent of the size or speed of the groove, and the groove velocity V0

is inversely proportional to the cube of the depth of the profile. In conclusion, we remark

that it makes some sense to assume the angle θ0 can be taken to be approximated by θc.

H.J.Frost, C.V.Thompson, D.T.Walton 1990 (”Simulation Of Thin Film Grain

Structures-I. Grain Growth Stagnation”) [18]:

They present simulations pertaining to the phenomena of grain growth stagnation, em-

ploying an approximate version of Mullins’ idea. They based their algorithm on the as-

sumption that if the inclination of the grain boundary to the external surface is less or

equal to the critical angle, then locally the grain boundary has the shape of a catenoid and

should thus be stationary.

Jacob Kanel, Amy Novick-Cohen, Arkady Vilenkin ( 2003 ”A traveling wave

solution for coupled surface and grain boundary motion”) [19], (2004 ”Coupled

surface and grain boundary motion: a traveling wave solution”) [20] and (

2004 ”Coupled surface and grain boundary motion: nonclassical traveling wave

solutions”) [21]:

In these papers, a nonlinear formulation for coupled grain boundary and exterior surface

evolution in a quarter loop bicrystal geometry was presented. See Fig. 1.10. Note that much

of the structure of the nonlinear formulation remains the same as in the linear formulation

for the evolution of the exterior surface coupled to a groove root as was considered by

Mullins (1958).

It was shown in [19], under the assumption that the exterior surface and the grain

boundary could be described as graphs of functions relative to the planar surface of the

unperturbed bicrystal, that for various levels of linearization, there exists a unique traveling

wave solution, and that the primary effect of considering various different formulations is

only to perturb the coefficients in the equation for the wave speed. Their analysis allowed

20

Page 30: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 1.10: The quarter loop bicrystal geometry [19, 20, 21].

the amount of drag induced by the groove root to be estimated, and it was shown to be

smaller than previously thought. In particular, it was shown that for certain values of the

parameters, grain groove attachment may in fact lead to grain boundary acceleration.

In [20] it was demonstrated that the shape of the grain boundary and of the exterior

surface as well as the speed of the traveling wave could be uniquely determined by the

solutions of following problem:

Ψsss = sin(Ψ), s ∈ (−∞, 0) ∪ (0,+∞),

Ψ(0+) = Ψ(0−) + 2 arcsin(m/2),

Ψs(0+) = Ψs(0

−),

Ψss(0+) = Ψss(0

−),

Ψ(±∞) = 0.

(1.3.17)

Here Ψ denotes the angle between the exterior surface of the bicrystal and the planar

surface of the unperturbed bicrystal, and s denotes a scaled arc length parametrization of

the exterior surface whose origin is taken to lie at the groove root. They also proved that

1. For any m ∈ [0, 2) there exists at most one solution Ψ ∈ C3((−∞, 0) ∪ (0,+∞)

)to (1.3.17) which satisfies −π

2 ≤ Ψ ≤ π2 .

Note that this implies uniqueness of solutions within the class of single-valued func-

tions.

2. For 0 < m≪ 1, there exists a solution Ψ to (1.3.17).

3. Suppose that 0 < m < 0.92068702. Then there exists a solution Ψ to (1.3.17) which

satisfies |Ψ| < π2 .

In [21] it was demonstrated that the reduction to (1.3.17) is valid in greater generality

than was presented in [20] and that it is not necessary to require that the exterior surface

and the grain boundary can be described as graphs relative to the planar surface of the

unperturbed bicrystal. They also prove that

21

Page 31: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

1. For any 0 ≤ m < 2, there exists a solution to (1.3.17) which is C3 regular on

(−∞, 0) ∪ (0,+∞).

Donghong Min and Harris Wong 2002 (”A model of migrating grain-boundary

grooves with application to two mobility-measurement methods”) [30]:

They analyze the following problem. Consider a grain boundary which migrates at con-

stant speed V and forms a groove at a exterior surface via surface diffusion in a quarter-loop

geometry. It turns out that the grain boundary tip is not perpendicular to the exterior sur-

face, but inclined at an angle ω. They determine the inclination angle ω by solving for

a quasi-steady groove profile. They find that the nondimensionalized grooving equations

depend only on the supplementary dihedral angle θ, and are independent of the migration

speed of the grain boundary. The normalized groove profile is calculated numerically and

by asymptotic analysis in the limit ω → 0. This yields the inclination angle ω at the

grain-boundary tip as a function of θ.

A.Vilenkin, A.Novick-Cohen 2007 (”Grain boundary migration in thin film, the

effects of grain grooves in nano-films”) [4] and A.Novick-Cohen, O.Zelekman-

Smirin, A.Vilenkin 2010 (”The effects of grain grooves on grain boundary mi-

gration in nano-films”) [2]:

In these papers, a geometry with a circular cylinder grain immersed in a thin single crystal

film was considered, see Fig. 1.11. The numerical results given here indicate stagnation of

the grain shrinkage in comparison to the shrinkage rate of a freely moving grain boundary

(m = 0). They also show that there is a critical cylinder radius which satisfies the following

condition: if the initial radius of cylinder is less than the critical radius then grains shrink

and annihilate, and if the initial radius is larger than the critical radius then groove depth

growth during grain shrinkage leads to break up of the film. The numerical simulations

Figure 1.11: A circular cylinder grain [4, 2].

22

Page 32: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

exhibit acceleration of the rate of shrinkage of the grain just prior to annihilation.

Let us consider their mathematical formulation for axisymmetrical problem presented in

Fig. 1.11. The definition of the relevant variables in the central cross-section are presented

in Fig. 1.12. Note that the external surface, h(r, t), and the grain boundary, r(u, t), both

depend on one spatial variable, u or r, and on time, t. In these papers, the motion of

the exterior surface is assumed to be governed by surface diffusion, and the motion of the

grain boundary is assumed to be governed by motion by mean curvature. In terms of these

Figure 1.12: The definition of the variables in the central cross-section [2].

parameters and variables, motion by mean curvature and motion by surface diffusion may

be stated, respectively, as

rt = A

(ruu

1 + r2u− 1

r

), 0 < u < u∗(t), (1.3.18)

ht = −B 1

r

(rKr√1 + h2r

)r

, 0 < r < +∞, r = R(t), (1.3.19)

where K =1

r

(r hr√1 + h2r

)r

. These equations were solved for t > 0 in conjunction with the

boundary conditions:

u∗(t) = L+ h(R(t)±, t), r(u∗(t), t) = R(t), h(R(t)+, t) = h(R(t)−, t)

arctan (hr(R(t)+, t))− arctan (hr(R(t)

−, t)) = 2 arcsin (m/2),

arctan (hr(R(t)+, t)) + arctan (hr(R(t)

−, t)) + 2 arctan (ru(u∗(t), t)) = 0,

K(R(t)+, t) = K(R(t)−, t),Kr√1 + h2r

∣∣∣∣∣(R(t)+,t)

=Kr√1 + h2r

∣∣∣∣∣(R(t)−,t)

hr(0, t) = 0, Kr(0, t) = 0, ru(0, t) = 0, h(+∞, t) = 0, K(+∞, t) = 0

r(u, 0) = R0, 0 < u < L, h(r, 0) = 0, 0 < r < +∞

(1.3.20)

In this geometry there are two important limiting shapes for the grain boundary. One

of the limiting shapes is a catenoid (m = 2) and the second shape is a cylindrically shaped

grain boundary (m = 0). A. Novick-Cohen, O. Zelekman-Smirin, A. Vilenkin (2010) showed

23

Page 33: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

that in a thin film, grain growth is strongly affected by the exterior surfaces, and found

that the exterior surface does not allow the formation of a stationary catenoidally shaped

grain boundary which stops grain boundary migration. Note that this result conflicts the

arguments suggested by Mullins (1958) which served as the basis for the simulations in H.J.

Frost, C.V. Thompson, D.T.Walton (1990).

The paper also contains an asymptotic analysis of the mathematical model, based on

the assumption that m and L/R0 are small. In this case it was shown that grain boundary

has a parabolic profile to leading order, and that R(t), the distance of the groove root to

the origin, can be calculated from to leading order according to the law of motion

Rt(t) =

[ω(t)

u∗(t)− 1

R(t)

], (1.3.21)

where ω(t) ≈ ru(u∗(t), t) and u∗(t) denote, respectively, the tilt angle of a grain bound-

ary and the thickness of the film at the groove root. If R20 ≫ 1 and mR0/L = O(1),

then the groove is quasi-stationary, and pinch-off ensues. If R20 ≫ 1, but nevertheless

mR0/L = O(mα) with 0 < α < 1, thenω(t)

u∗(t)≈ 1

6R0=

m

6L, and annihilation ensues in

accordance with the prediction:

Rt(t) =

[m

6L− 1

R(t)

]. (1.3.22)

Srolovitz, Safran 1986 (”Capillary Instabilities in thin films. I.Energetics”) [10]:

They suggest that thermal grooving and pitting can be responsible for the initiation of

breakup. They examine the stability of, for example, a continuous thin film with respect

to a periodic array of pre-existing holes (Fig. 1.13 (i)) or a set of isolated islands via a

constrained energy minimization technique.

24

Page 34: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

(i) (ii)

Figure 1.13: (i) a periodic array of pre-existing holes, and (ii) a hexagonal array ofgrains [10].

They find that pre-existing holes will grow if they are larger than a critical value,

ζ =

(R

a

)2 (1 +

γsγv

), which is a function of, R, the inter-hole spacing, a, the thickness

of the film, γs and γv, which are, respectively, the film-substrate surface energy and the

film-vapor surface energy. For small values of ζ, the pre-existing holes will shrink, for a

small range of values of ζ , the holes will reach a metastable size, and for large values of ζ,

the film pinches off and forms islands. They also considered an idealized hexagonal array

of grains (Fig. 1.13 (ii)). In this case they derived an equation for a pit depth which they

solve numerically for given values of the film thickness and grain size. Note that some of

their calculations seem to contain mistakes and need to be rechecked.

F.Y.Genin, W.W.Mullins and P.Wynblatt 1992 (”Capillary instabilities in thin

films. A model of thermal pitting at grain boundary vertices”) [14]:

They prove, for a special geometry consisting of one grain with appropriate boundary

conditions, that for a given angle at the root of the grain boundary groove, the rate at

which the pit deepens is found to be appreciably faster than that at which the groove

deepens far from the pit. Hence, when the assumptions of this study are fulfilled, thin

film breakup should usually start via the formation of holes where thermal pits penetrate

through the film. The pitting has been described theoretically by finding, both analytic and

numerical solutions to the equation for surface evolution by surface diffusion under boundary

conditions that represent a sector between two grain boundaries which intersect along a

triple junction line at 90o. The solutions yield a self-similar surface shape (proportional in

time) whose linear dimensions are proportional to t1/4, which is consistent with the results

of Mullins (1957).

25

Page 35: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

J.W.Barrett and H.Garcke and R.Nurnberg, Preprint 04/2009 (”Parametric

approximation of surface clusters driven by isotropic and anisotropic surface

energies”) [26]:

In this paper they study the evolution of set of surfaces with boundaries in R3. They

assume that the surfaces are governed by motion of mean curvature or by motion by surface

diffusion. They take there to be are only two types of grain boundaries: boundaries where

three surfaces meet called triple junction lines, and boundaries which lie on the boundary of

some fixed domain. Along the boundaries, they assume persistence, balance of mechanical

forces, continuity of chemical potential and balance of mass flux. Note that they consider

the governing equations and boundary conditions in both isotropic and anisotropic cases,

and present a variational (weak) formulation of the problem. They also introduce a finite

element discrete analogue of the weak formulation and prove existence and uniqueness of

the discrete system.

Under the assumption that all of the surfaces are governed by the same law of evolution,

they undertake numerical simulations for the geometries from Fig. 1.14. Note that they

present also results for certain additional geometries which we do not mention here.

(a) (b) (c)

Figure 1.14: (a) double , (b) triple and (c) quadruple bubbles [26].

J.W.Barrett and H.Garcke and R.Nurnberg, Preprint 04/2009 (Finite ele-

ment approximation of coupled surface and grain boundary motion with appli-

cations to thermal grooving and sintering) [25]:

In this paper they study coupled diffusion surface and grain boundary motion in bicrys-

tals and tricrystals in three space dimensions, see Fig. 1.15. Their approach is built on

previous work by the authors [26]. Their finite element approximation, which uses only

conforming piecewise linear elements, can deal with fully anisotropic surface energies and

mobilities. Their scheme in general is unconditionally stable and easy to solve in practice,

as the algebraic equations for the discrete unknowns at each time step are linear. Moreover,

the resulting triangulations exhibit good mesh properties, so that no mesh smoothing is

required in practice.

26

Page 36: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

(a) (b)

Figure 1.15: (a) bicrystal and (b) tricrystal geometries [25].

Zhenguo Pan, Brian Wetton 2008 (”Stability of Travelling Wave Solutions for

Coupled Surface and Grain Boundary Motion”) [46]:

In this paper they numerically investigate the linear stability of a travelling wave solution,

in a PDAE formulation, for coupled surface diffusion and grain boundary motion in a quarter

loop bicrystal geometry, see Fig. 1.10. The analysis is based on a linearized system whose

spectrum is approximated numerically on a finite computational domain. Numerical results

given evidence that the travelling wave solution is convectively stable both for curves in two

dimensions and for surfaces in three dimensions.

Zhenguo Pan (PhD thesis 2008) [45]:

He studies coupled surface diffusion and grain boundary motion in the context of a quar-

ter loop geometry, see Fig. 1.10, and other related problems. Different formulations are

presented: the cartesian formulation which he presents is simplest, but can not handle

non-single-valued situation; a parabolic formulation is derived in parametric form which is

convenient for analysis because of the parabolic character of all its components, but its nu-

merical performance is not as good as a PDAE formulation which he presents. The PDAE

formulation uses algebraic equations to maintain grid spacing on a staggered grid, and

good numerical performance is achieved. This approach was applied to several problems of

physical interest, and gave more accurate results than the other methods did.

M.Khenner, A.Averbuch, M.Israeli, M.Nathan 2001 (”Numerical Simulation of

Grain-Boundary by Level Set Method”) [31]:

In this paper a numerical investigation was undertaken of grain-boundary grooving by

means of a level set method in an idealized polycrystalline interconnect which consists of

grains separated by parallel grain boundaries. They assume that surface diffusion is the main

transport process, and they present results of numerical modeling and simulation of grain-

boundary grooving. Let y(x, t) describe the shape of the evolving exterior surfaces. The

basic idea of their method consists in embedding the curve y(x, t) in a higher dimensional

27

Page 37: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

space, and considering the evolution of a two-dimensional field Φ(x, y, t) such that its zero

level set, Φ(x, y, t) = 0, coincides with the curve of interest, y(x, t), at any given time t.

The resultant evolution equation has the form

Φt + Vn |∇Φ| = 0, given Φ(x, y, 0). (1.3.23)

In order to solve (1.3.23), an adaptive mesh around the propagating interface is used. They

distinguish between the ”near field,” which corresponds to a thin band of neighboring level

sets around the propagating front, and the ”far field,” which contains the rest of the grid

points. The evolution equation is solved only in the near field. The values of Φ at grid

points in the far field are not updated at all. When the interface in motion reaches the

edge of the narrow band, a new narrow band is constructed around the current interface

position.

1.4 Equilibrium angles at the quadruple junction

Let us consider a quadruple junction, see Fig. 1.16. Let τA, τB, τC , τB denote unit tangent

A

B

Q

D

C

surfacesurface

grain boundary

Figure 1.16: A sketch of the quadruple junction.

vectors to the triple junction lines which meet at the quadruple junction, and assume that

28

Page 38: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

the quadruple junction satisfies three conditions:

1. Local limiting regularity (in the limit as the quadruple junction is approached, triple

junction lines became straight).

2. Young’s law holds along all triple junction lines, up to the quadruple junction.

3. Three-fold symmetry holds at quadruple junction, with respect to the 3 grains sur-

rounding the internal triple junction line.

We shall now see the consequences of these three assumptions, We remark that the third

assumption is not strictly necessary, but it is included here for ease of presentation.

Imposition of local limiting regularity and symmetry at the quadruple junction implies

that there are two angles φ and ψ such as

⟨τA, τB⟩ = ⟨τA, τC⟩ = ⟨τB, τC⟩ = cos(φ), (1.4.1)

⟨τA, τD⟩ = ⟨τB, τD⟩ = ⟨τC , τD⟩ = cos(ψ). (1.4.2)

We also impose the range for which φ and ψ make sense, namely

0 ≤ φ ≤ 2π

3,

π

2≤ ψ ≤ π. (1.4.3)

Building a tetrahedron based on the vectors τA, τB and τC yields the construction given on

Fig. 1.17. From trigonometric identities and (1.2.13), it follows that

sin

2

)= sin

(π2− arcsin

(m2

))= sin

(arccos

(m2

))=

√1− m2

4, (1.4.4)

cos

2

)= cos

(π2− arcsin

(m2

))= cos

(arccos

(m2

))=m

2. (1.4.5)

For φ, we obtain from Fig. 1.17 that

EJ

EH=sin

2

)EJ

AE=cos

(π3

) => EH =

AE

2 sin(θ2

) , (1.4.6)

and

cos(φ2

)=EH

AE=

1

2 sin(θ2

) =1

2√

1− m2

4

=1√

4−m2. (1.4.7)

Thus

cos (φ) = 2 cos2(φ2

)− 1 =

2

4−m2− 1 =

m2 − 2

4−m2, (1.4.8)

sin (φ) =√

1− cos2 (φ) = 2

√3−m2

4−m2. (1.4.9)

29

Page 39: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

A

B

C

Q

E

F G

H

O

JL

Figure 1.17: A tetrahedron construction at the quadruple junction.

We shall now investigate the values that m can assume. From (1.4.9) we obtain the restric-

tion that

3−m2 ≥ 0 ⇒ m ≤√3. (1.4.10)

Hence m is required to satisfy m ∈ [0,√3] ⊂ [0, 2]. In particular we see that the above

construction cannot be valid for m ∈ [√3, 2]. Such high values of m are rare in most

physical systems, and sufficiently high values of m have been shown elsewhere to yield some

surprising consequences [21], namely that the surface profile need not be single valued.

The constraint on the possible range of m is apparently a result of our limiting regularity

assumption.

For ψ, we obtain from Fig.1.17 that

AE

AL=cos

(π6

)AE

AQ=sin

(φ2

) =>

AL

AQ=

sin(φ2

)cos(π6

) , (1.4.11)

30

Page 40: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

and

sin (π − ψ) =AL

AQ

=> sin (ψ) =

2 sin(φ2

)√3

. (1.4.12)

From equation (1.4.7), we see that

sin(φ2

)=

√1− cos2

(φ2

)=

√3−m2

4−m2, (1.4.13)

and hence from (1.4.12) we get that

sin (ψ) =2√3

√3−m2

4−m2, (1.4.14)

cos (ψ) =

√1− sin2 (ψ) =

1√3

m√4−m2

. (1.4.15)

Note that (1.4.14)-(1.4.15) are well defined for m in the range m ∈ [0,√3].

We conjecture that the angles φ and ψ indicated above predict a locally energy mini-

mizing configuration in the neighborhood of the quadruple junction.

1.5 Balance of mass flux at the quadruple junction and top

corner points

Let Γi = Γi (si) denote a curve which lies on exterior surface Si and which is bounded by

two triple junction lines. Let −→n Γidenote a unit vector which is orthogonal to Γi and which

lies on the tangent plane of exterior surface Si. Let us suppose that si is an arc length

parametrization of Γi, and that Γi normally intersects the two triple junction lines. Balance

B

C

A

Q

Q

Figure 1.18: Balance of mass flux at the quadruple junction.

31

Page 41: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

of mass flux at quadruple junction can be expressed as

3∑i=1

∫Γi

−→n Γi · ∇sHi dsi = 0. (1.5.1)

Note that we can write analogous conditions at all top corner points.

1.6 Mass conservation

In this section we demonstrate time invariance of the ”mass” or volume of our system. It

is well known [12, 37] thatd

d t|Ω(t)| =

∫∂Ω(t)

Vn dS, (1.6.1)

where Ω(t) is a compact subset of R3 which has a piecewise smooth boundary ∂Ω(t), Vn

denotes the normal velocity, and dS denotes an element of surface area. We now demonstrate

for our problem that ”mass is conserved”, i.e.d

d t|Ω(t)| = 0. In our system of 3 grains there

are 5 bounding planes Πi, i = 1, . . . 5, and 3 exterior surfaces Si, i = 1, 2, 3. Thus

∂Ω(t) =

3∪j=1

Sj5∪

i=1

Πi,

and equation (1.6.1) can be written as

d

d t|Ω(t)| =

∫∂Ω(t)

Vn dS =

3∑i=1

∫Si

Vn dS +

5∑i=1

∫Πi

Vn dS. (1.6.2)

Since the bounding planes do not move, we have that Vn = 0 on Πi, i = 1, . . . 5. Consider

the exterior surfaces Si, i = 1, 2, 3, which move according to motion by surface diffusion,

see (1.1.2). Each Si, i = 1, 2, 3 evolves according to Vn = −BsH. Hence

d

d t|Ω(t)| =

3∑i=1

∫Si

Vn dS = −Bk∑

i=1

∫Si

sHi dS. (1.6.3)

By the divergence or Gauss theorem on smooth manifold [37] we obtain that

d

d t|Ω(t)| = −B

k∑i=1

∫Si

∇s · ∇sHi dS = −B

k∑i=1

∫∂Si

⟨−→τ i,∇sHi⟩dS, (1.6.4)

where ∂Si refers to the boundary of exterior surface Si, and −→τ i, i = 1, 2, 3 refer to unit

tangent vectors to Si along ∂Si which intersect ∂Si orthogonally.

32

Page 42: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Recall that ∂Si, i = 1, 2, 3 consist of thermal groove lines and exterior free boundaries,

see Section 1.1. Recall also that we are imposing balance of mass flux along thermal groove

lines and zero mass flux along free boundaries, see equations (1.2.16) and (1.2.18). Hence

from these conditions and equation (1.6.4), we obtain that

d

d t|Ω(t)| = 0. (1.6.5)

See also a similar formulation of this result in [26].

1.7 Energy dissipation

In this section we shall demonstrate the decrease (non-increase) in the total free energy of

our system as a function of time. Let Si, i = 1, 2, 3 denote the grain boundaries, and let

Sj , j = 4, 5, 6 denote the exterior surfaces, then the total free energy E(t) of the system of

3 grains is given by

E(t) = σs

3∑i=1

∣∣Si(t)∣∣+ σgb

6∑j=4

∣∣Sj(t)∣∣ , (1.7.1)

where σs and σgb denote the free energy per unit area of exterior surface and grain boundary

respectively,∣∣Si(t)

∣∣ and ∣∣Sj(t)∣∣ denote the surface area of the exterior surfaces and the grain

boundaries respectively. In order to demonstrate energy dissipation, we need to show thatdd tE(t) ≤ 0, namely

d

d tE(t) = σs

3∑i=1

d

d t

∣∣Si(t)∣∣+ σgb

6∑j=4

d

d t

∣∣Sj(t)∣∣ ≤ 0. (1.7.2)

In our demonstration we shall employ the following geometric balance law [37]

d

d t|S(t)| = −

∫S(t)

HVn dS −∫

∂S(t)

Vτ ds, (1.7.3)

where H denotes the mean curvature, Vn and Vτ denote the normal and tangent velocity

respectively, dS and ds denote elements of surface area and curve length respectively, −→ndenotes a unit normal vector which pointed away from the specimen, and −→τ denotes a unit

tangent vector along ∂S(t) which intersects ∂S(t) orthogonally. We also use the following

variation of the divergence theorem∫S

ϕϕdS = −∫S

|∇ϕ|2 dS +

∫∂S

ϕ ⟨−→τ ,∇ϕ⟩ ds, (1.7.4)

where ϕ denotes an arbitrary sufficiently smooth function.

33

Page 43: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Let us consider the area of the exterior surface, Si. From (1.7.3) we obtain that

d

d t

∣∣Si(t)∣∣ = −

∫Si(t)

H iVni dS −∫

∂Si(t)

Vτ i ds

(1.1.2)= B

∫Si(t)

H isHi dS −

∫∂Si(t)

Vτ i ds

(1.7.4)= − B

∫Si(t)

∣∣∇sHi∣∣2 dS + B

∫∂Si(t)

H i⟨−→τ i,∇sH

i⟩ds−

∫∂Si(t)

Vτ i ds.

(1.7.5)

Let us consider the area of grain boundary, Sj . From (1.7.3) we obtain that

d

d t

∣∣Sj(t)∣∣ =−

∫Sj(t)

HjVnj dS −∫

∂Sj(t)

Vτj ds

(1.1.1)= − A

∫Sj(t)

[Hj]2dS −

∫∂Sj(t)

Vτj ds.

(1.7.6)

Substitution of expressions from (1.7.5) and (1.7.6) into equation (1.7.2) gives

d

d tE(t) = σs

3∑i=1

d

d t

∣∣Si(t)∣∣+ σgb

6∑j=4

d

d t

∣∣Sj(t)∣∣

= − σs B3∑

i=1

∫Si(t)

∣∣∇sHi∣∣2 dS − σgb A

6∑j=4

∫Sj(t)

[Hj]2dS+

σs B3∑

i=1

∫∂Si(t)

H i⟨−→τ i,∇sH

i⟩ds−

σs

3∑i=1

∫∂Si(t)

Vτ i ds− σgb

6∑j=4

∫∂Sj(t)

Vτj ds.

(1.7.7)

The boundaries ∂Si(t) of exterior surfaces consist of thermal groove lines and extetior

free boundaries, from conditions of continuity of the chemical potential (1.2.15), balance of

mass flux (1.2.16) and zero mass flux (1.2.18), we obtain that

σs B3∑

i=1

∫∂Si(t)

H i⟨−→τ i,∇sH

i⟩ds = 0. (1.7.8)

Let us note that the tangent velocity Vτ , can be written as

Vτ =⟨−→τ , V ⟩ , (1.7.9)

34

Page 44: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

where V denote the velocity vector. Along exterior free boundaries,⟨−→τ , V ⟩ = 0 is implied

by the condition of mirror symmetry (1.2.17). Along triple junction lines, the vector velocity

V is equal for all of the triple surfaces by virtue of the persistence condition.

Note that the boundaries ∂Si(t) of the exterior surfaces consist of thermal groove lines

and exterior free boundaries and the boundaries ∂Sj(t) of the grain boundaries consist

of thermal groove lines, interior triple junction line, and exterior free boundaries. From

the conditions of persistence, mirror symmetry (1.2.17), balance of mechanical forces along

thermal groove lines (1.2.12), and balance of mechanical forces along the interior triple

junction line (1.2.14), we obtain that

−σs3∑

i=1

∫∂Si(t)

Vτ i ds− σgb

6∑j=4

∫∂Sj(t)

Vτj ds = 0. (1.7.10)

Thus

d

d tE(t) = −σs B

3∑i=1

∫Si(t)

∣∣∇sHi∣∣2 dS − σgb A

6∑j=4

∫Sj(t)

[Hj]2dS ≤ 0, (1.7.11)

and henced

d tE(t) ≤ 0. (1.7.12)

See also a similar formulation of this result in [26, 25].

35

Page 45: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Chapter 2

Mathematical Formulation

In this section we present a parametric formulation of the governing equations and boundary

and initial conditions for the PDAE (Partial Differential Algebraic Equation) system.

2.1 Parametric representation of surfaces

Here and throughout the remainder of this thesis we shall useX(α, β, t) = (x(α, β, t), y(α, β, t), z(α, β, t))

to represent a regular parametric 2D surface, S, in 3D. We shall assume that 0 ≤ α, β ≤ 1

and that t ∈ [0, T ] for some T > 0. Note that when α (or β) is constant, X = X(·, β, t) (orX = X(α, ·, t)) denotes a parametric curve in 3D. We also shall assume thatX ∈ C2

([0, 1]2 × [0, T ]

)for the grain boundaries surfaces and X ∈ C4

([0, 1]2 × [0, T ]

)for the exterior surfaces. Note

that in order to prescribe the governing equations and boundary and initial conditions we

need to define the orientation of α and β on each surface. Our choice of the orientations

are presented in Fig. 2.1. Our approach generalizes the approaches implemented by Z.Pan

& B.Wetton (2008), [46], Z.Pan (Ph.D. Thesis 2008), [45] and by A.Averbuch, M.Israeli

& I.Ravve (2003), [1]. In these references, numerical computations were undertaken for

various grain systems based on parametric representation of the surfaces and use of ghost

points. We as in [45, 46] will make use equi-spacing. Note, however, that almost all of the

work undertaken in [1, 45, 46] was for overly simplistic and planar geometries.

The vector −→n will represent here the normal to the surface S, which may be expressed

as−→n =

Xα ×Xβ

∥Xα ×Xβ∥. (2.1.1)

The normal velocity, Vn, of S can then be written as

−→Vn = ⟨Xt,

−→n ⟩ . (2.1.2)

36

Page 46: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 2.1: The system of 3 grains.

The mean curvature H of S is given by [37]

H =1

2

⟨⟨Xβ , Xβ⟩ Xαα − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xα, Xα⟩ Xββ

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2,−→n

⟩, (2.1.3)

or in the equivalent normalized form

H =1

2

⟨ Xαα

∥Xα∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Xαβ

∥Xα∥ ∥Xβ∥+

Xββ

∥Xβ∥2

1−⟨

∥Xα∥,Xβ

∥Xβ∥

⟩2 ,−→n

⟩. (2.1.4)

Let us recall that the surface Laplace - Beltrami operator s may be defined via the

surface tangential gradient operator ∇s, [37], namely

s = ∇s · ∇s where ∇s = ∇−−→n ∂−→n . (2.1.5)

37

Page 47: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Recalling that ∇sH is given by [37]

∇sH =(g1,1Xα + g2,1Xβ

)Hα +

(g2,2Xβ + g1,2Xα

)Hβ , (2.1.6)

where the elements of metric tensor gi,j and its determinant g are given by

g1,1 = ⟨Xα, Xα⟩ , g1,2 = g2,1 = ⟨Xα, Xβ⟩ , g2,2 = ⟨Xβ , Xβ⟩ , (2.1.7)

g = ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2 = ∥Xα∥2 ∥Xβ∥2(1−

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩2), (2.1.8)

and gi,j , the elements of inverse metric tensor, are defined by

g1,1 =⟨Xβ , Xβ⟩

g, g1,2 = g2,1 =

−⟨Xα, Xβ⟩g

, g2,2 =⟨Xα, Xα⟩

g. (2.1.9)

From equations (2.1.8) and (2.1.9) we obtain that

∇sH =⟨Xβ , Xβ⟩ Xα − ⟨Xα, Xβ⟩ Xβ

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2Hα +

⟨Xα, Xα⟩ Xβ − ⟨Xα, Xβ⟩ Xα

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2Hβ .

Thus (2.1.6) can be written as follows

∇sH =−−→τ I Hα −−→τ II Hβ

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2, (2.1.10)

or in the normalized form

∇sH =−−→τ I⋆ Hα

∥Xα∥ −−→τ II⋆ Hβ

∥Xβ∥

1−⟨

Xα∥Xα∥ ,

∥Xβ∥

⟩2 , (2.1.11)

where −→τ I , −→τ II and −→τ I⋆ , −→τ II⋆ defined as the vectors

−→τ I = Xβ ⟨Xα, Xβ⟩ −Xα ⟨Xβ , Xβ⟩ , (2.1.12)

−→τ II = Xα ⟨Xα, Xβ⟩ −Xβ ⟨Xα, Xα⟩ , (2.1.13)

−→τ I⋆ =Xβ

∥Xβ∥

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩− Xα

∥Xα∥, (2.1.14)

−→τ II⋆ =Xα

∥Xα∥

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩−

∥Xβ∥. (2.1.15)

The surface Laplace - Beltrami operator acting on H, the mean curvature, may be

38

Page 48: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

written as [37]

sH =

∂∂α

(g1,1

√g Hα + g1,2

√g Hβ

)+ ∂

∂β

(g2,1

√g Hα + g2,2

√g Hβ

)√g

, (2.1.16)

where g and gi,j are given in (2.1.9)-(2.1.8). Via some straightforward but rather technical

calculation, see Appendix A, we obtain that sH may be written as

sH =⟨Xβ , Xβ⟩ Hαα − 2 ⟨Xα, Xβ⟩ Hαβ + ⟨Xα, Xα⟩ Hββ

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2+⟨

⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,−→τ I⟩

(⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2

)2 Hα+

⟨⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,

−→τ II⟩

(⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2

)2 Hβ ,

(2.1.17)

or in the equivalent normalized form

sH =

Hαα

∥Xα∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Hαβ

∥Xα∥ ∥Xβ∥+

Hββ

∥Xβ∥2

1−⟨

∥Xα∥,

∥Xβ∥

⟩2 +

⟨Xββ

∥Xβ∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Xαβ

∥Xα∥ ∥Xβ∥+

Xαα

∥Xα∥2,−→τ I⋆

⟩(1−

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩2)2

∥Xα∥+

⟨Xββ

∥Xβ∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Xαβ

∥Xα∥ ∥Xβ∥+

Xαα

∥Xα∥2,−→τ II⋆

⟩(1−

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩2)2

∥Xβ∥,

(2.1.18)

where −→τ I , −→τ II , −→τ I⋆ , and −→τ II⋆ are given in (2.1.12)-(2.1.15)

Let us consider the inner product of ∇sH with the vectors −→τ I or −→τ II . Straightforward

calculations give

⟨−→τ I ,−→τ I⟩= ⟨Xβ , Xβ⟩ g,

⟨−→τ I ,−→τ II⟩= −⟨Xα, Xβ⟩ g,

⟨−→τ II ,−→τ II⟩= ⟨Xα, Xα⟩ g,

39

Page 49: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

and for

⟨∇sH,

−→τ I

∥−→τ I∥

⟩and

⟨∇sH,

−→τ II

∥−→τ II∥

⟩we obtain

⟨∇sH,

−→τ I

∥−→τ I∥

⟩=

−⟨Xβ , Xβ⟩Hα + ⟨Xα, Xβ⟩Hβ

∥−→τ I∥,⟨

∇sH,−→τ II

∥−→τ II∥

⟩=

−⟨Xα, Xα⟩Hβ + ⟨Xα, Xβ⟩Hα

∥−→τ II∥,

(2.1.19)

or in the normalized form

⟨∇sH,

−→τ I

∥−→τ I∥

⟩=

− Hα∥Xα∥ +

⟨Xα

∥Xα∥ ,Xβ

∥Xβ∥

⟩Hβ

∥Xβ∥

∥−→τ I⋆∥,

⟨∇sH,

−→τ II

∥−→τ II∥

⟩=

− Hβ

∥Xβ∥ +⟨

Xα∥Xα∥ ,

∥Xβ∥

⟩Hα

∥Xα∥

∥−→τ II⋆∥.

(2.1.20)

2.2 Governing equations for the grain boundaries and exte-

rior surfaces

We recall that the motion of each grain boundary Si, i = 4, 5, 6 is governed by mean

curvature motion (1.1.1), namely

⟨X i

t ,−→n i⟩= H i, i = 4, 5, 6, (2.2.1)

and that each exterior surface Si, i = 1, 2, 3 is governed by surface diffusion motion (1.1.2),

namely ⟨X i

t ,−→n i⟩= −sH

i, i = 1, 2, 3, (2.2.2)

where explicit expressions for−→n i, H i and sHi are given in (2.1.1), (2.1.3) and (2.1.17).

2.3 Uniform distribution of surface grid points

As prescribed in Section 1.1, instead of specifying the tangential velocities, we impose

conditions on the surface parameterizations. More specifically, we shall impose unform grid

spacing, which also helps to improve numerical performance. These conditions may be

expressed as

∥Xα∥α =0,

∥Xβ∥β =0.(2.3.1)

40

Page 50: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Noting that

∥Xα∥α =(√

⟨Xα, Xα⟩)α=

⟨Xα, Xαα⟩∥Xα∥

,

∥Xβ∥β =

(√⟨Xβ , Xβ⟩

=⟨Xβ , Xββ⟩

∥Xβ∥,

we can replace conditions (2.3.1) by the equivalent conditions,

⟨Xα, Xαα⟩ =0,

⟨Xβ , Xββ⟩ =0.(2.3.2)

Hence the uniform grid spacing conditions to be imposed on all surfaces are⟨Xi

α, Xiαα

⟩=0 i = 1, . . . , 6,⟨

Xiβ , X

iββ

⟩=0 i = 1, . . . , 6.

(2.3.3)

Note that the conditions expressed in equations (2.3.3) hold also along grain boundaries.

2.4 Conditions along the thermal groove lines

Conditions along the thermal groove lines were prescribed in equations (1.2.12), (1.2.15),

and (1.2.16). Recall that in our geometry there are 3 thermal groove lines. Let Xp, Xq

denote parametric representations of the exterior surfaces Sp, Sq, respectively, and let Xℓ

denote a parametric representation of the grain boundary surface Sℓ. Recall also that

thermal groove lines corresponds to curves where three surfaces Sp, Sq, Sℓ intersect. The

conditions along thermal grooves can be prescribed as

Xp = Xq = Xℓ, (persistence) (2.4.1)⟨ −→τ lII

∥−→τ lII∥,

−→τ pII

∥−→τ pII∥

⟩= cos

(π − θ

2

), (Young’s law) (2.4.2)⟨ −→τ ℓII

∥−→τ ℓII∥,

−→τ qI

∥−→τ qI∥

⟩= cos

(π − θ

2

), (Young’s law) (2.4.3)

⟨Xpα, X

pαα⟩ = 0, (equi-spacing grid) (2.4.4)

Hp = Hq, (chemical potential continuity)(2.4.5)⟨∇sH

1,−→τ pII

∥−→τ pII∥

⟩+

⟨∇sH

q,−→τ qI

∥−→τ qI∥

⟩= 0, (balance of mass flux) (2.4.6)

In (2.4.1)-(2.4.6) the indexes p, q, ℓ assume the values1, 2, 4; 2, 3, 5; 3, 1, 6

, see

Fig 2.1. Moreover θ has been defined in equation (1.2.13), H and ∇sH have been pre-

scribed in equations (2.1.3), (2.1.17) respectively, and −→τ I , −→τ II defined in equations (2.1.12),

41

Page 51: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

(2.1.13).

2.5 Conditions along the internal triple junction line

In our system of 3 grains, the internal triple junction line corresponds to a curve where

surfaces S4, S4, and S6 intersect. The conditions along the internal triple junction line can

be prescribed as

X4 = X5 = X6, (persistence) (2.5.1)⟨ −→τ 4I

∥−→τ 4I∥,

−→τ 5I

∥−→τ 5I∥

⟩= cos

(2

), (Young’s law) (2.5.2)⟨ −→τ 4I

∥−→τ 4I∥,

−→τ 6I

∥−→τ 6I∥

⟩= cos

(2

), (Young’s law) (2.5.3)⟨

X4β , X

4ββ

⟩= 0, (equi-spacing grid) (2.5.4)

2.6 Conditions along the exterior free boundaries

Recall that in our system there are 5 bounding planes Πi, i = 1, . . . 5, and on each of these

planes it is necessary to prescribe free boundary conditions. This shall be undertaken below,

but let us first consider how we wish to define the bounding planes. Let r0 = (x0, y0, z0)

denote the position of an arbitrary point on one of the planes, and let−→N denote a unit normal

vector to these plane. The plane may be prescribed as the set of all points r = (x, y, z) such

that ⟨r − r0,

−→N⟩= 0. (2.6.1)

Note that in the numerics, the point r0 will be chosen so as to be bounded away from the

evolving surfaces S.

The boundary conditions along the exterior free boundaries where the exterior surfaces

Sp, p = 1, 2, 3 intersect the bounding planes shall be taken to be⟨Xp − rq0,

−→N q⟩= 0, (attachment to the bounding plane (persistence)) (2.6.2)⟨−→n p,

−→N q⟩= 0, (mirror symmetry with respect to the bounding plane)(2.6.3)

⟨Xpα, X

pαα⟩ = 0, (equi-spacing grid) (2.6.4)⟨

∇sHp,−→N q⟩= 0, (zero mass flux) (2.6.5)

42

Page 52: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

and by ⟨Xp − rℓ0,

−→N ℓ⟩= 0, (attachment) (2.6.6)⟨−→n p,

−→N ℓ⟩= 0 (mirror symmetry) (2.6.7)⟨

Xpβ , X

pββ

⟩= 0, (equi-spacing grid) (2.6.8)⟨

∇sHp,−→N ℓ⟩= 0, (zero mass flux) (2.6.9)

where the indexes p, q, ℓ assume the values1, 4, 1; 2, 2, 3; 3, 3, 4

.

The boundary conditions along the exterior free boundaries for the grain boundary

surface S4 are given by ⟨X4 − r50,

−→N 5⟩= 0, (attachment) (2.6.10)⟨−→n 4,

−→N 5⟩= 0, (mirror symmetry) (2.6.11)⟨

X4α, X

4αα

⟩= 0, (equi-spacing grid) (2.6.12)

where S4 intersect the bounding mid-plane Π5, and by⟨X4 − r10,

−→N 1⟩= 0, (attachment) (2.6.13)⟨

X4 − r20,−→N 2⟩= 0, (mirror symmetry) (2.6.14)⟨

X4β , X

4ββ

⟩= 0, (equi-spacing grid) (2.6.15)

where S4 intersect the bounding planes Π1 and Π2.

The boundary conditions along the exterior free boundaries for surfaces p = 5, 6 are

given by ⟨Xp − r50,

−→N 5⟩= 0, (attachment) (2.6.16)⟨−→n p,

−→N 5⟩= 0, (mirror symmetry) (2.6.17)

⟨Xpα, X

pαα⟩ = 0, (equi-spacing grid) (2.6.18)

and by ⟨Xp − rℓ0,

−→N ℓ⟩= 0, (attachment) (2.6.19)⟨−→n p,

−→N ℓ⟩= 0, (mirror symmetry) (2.6.20)⟨

Xpβ , X

pββ

⟩= 0, (equi-spacing grid) (2.6.21)

where the indexes p, ℓ assumed the values5, 3; 6, 4;

.

43

Page 53: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Let us consider the conditions of the form⟨−→n ,−→N⟩ = 0. Note that such conditions

can also be equivalently formulated as⟨−→τ ,−→N⟩ = 1. As explained in Appendix B, the

formulation⟨−→τ ,−→N⟩ = 1 is problematic for numerical calculation of the Jacobian.

2.7 Conditions at the quadruple junction and at the corner

points

Figure 2.2: Corner points of the 3 grain system.

In this section I will explain the conditions to be used at the quadruple junction and

at the corner points. LetIt, IIt, IIIt, IV t, Ib, IIb, IIIb, IV b, CI , CII , CIII

denote a set

containing the quadruple junction and the corner points, see Fig. 2.2.

Conditions at Ib

This is the point where grain boundaries S4, S5, S6 and the bounding mid-plane Π5 inter-

sect. The conditions in this point are given by

X4 = X5 = X6 (persistence) (2.7.1)⟨X4 − r50,

−→N 5⟩= 0, (attachment) (2.7.2)⟨

X4α

∥X4α∥,X5

α

∥X5α∥

⟩= cos

(2

), (Young’s law) (2.7.3)⟨

X4α

∥X4α∥,X6

α

∥X6α∥

⟩= cos

(2

). (Young’s law) (2.7.4)

44

Page 54: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Conditions at IIb

This point is the point where the grain boundary S4 and the 3 bounding planes Π1, Π2,

and Π5 intersect. Since this point is stationary in time it satisfies⟨X4 − r10,

−→N 1⟩= 0, (attachment) (2.7.5)⟨

X4 − r20,−→N 2⟩= 0, (attachment) (2.7.6)⟨

X4 − r50,−→N 5⟩= 0. (attachment) (2.7.7)

Conditions at IIIb and IV b

Point IIIb is the point of intersection of grain boundary S5 with the two bounding planes,

Π3 and Π5. We impose the following conditions at this point,⟨−→n 5,−→N 3 +

−→N 5⟩= 0, (mirror symmetry) (2.7.8)⟨

X5 − r30, N3⟩= 0, (attachment) (2.7.9)⟨

X5 − r50,−→N 5⟩= 0. (attachment) (2.7.10)

In a sense, we would like to require both that⟨−→n 5,

−→N 3⟩= 0 and that

⟨−→n 5,−→N 5⟩= 0, but

by looking at equations (2.6.16)-(2.6.21), we see that this appears to be overly restrictive.

Point IV b is the point of intersection of grain boundary S6 with the two bounding

planes, Π4 and Π5. By analogy with point IIIb we impose the following condition at IV b

⟨−→n 6,−→N 4 +

−→N 5⟩= 0, (mirror symmetry) (2.7.11)⟨

X6 − r40,−→N 4⟩= 0, (attachment) (2.7.12)⟨

X6 − r50,−→N 5⟩= 0. (attachment) (2.7.13)

45

Page 55: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Conditions at the quadruple junction I t

At the quadruple junction, we shall impose the following conditions

X1 = X2 = X3 = X4 = X5 = X6, (persistence) (2.7.14)⟨X4

β

∥X4β∥,X1

α

∥X1α∥

⟩= cos(ψ), (angle condition) (2.7.15)⟨

X4β

∥X4β∥,X2

α

∥X2α∥

⟩= cos(ψ), (angle condition) (2.7.16)⟨

X4β

∥X4β∥,X3

α

∥X3α∥

⟩= cos(ψ), (angle condition) (2.7.17)

H1 = H2 = H3, (chemical potential continuity) (2.7.18)3∑

i=1

∫Γi

−→n Γi · ∇sHi dsi = 0, (balance of mass flux) (2.7.19)

where cos(ψ) and the angle conditions are explained in Section 1.4, and the balance of mass

flux condition is discussed in Section 1.5.

Conditions at II t

At IIt, the surfaces S1, S2, S4 and the bounding planes Π1 and Π2 intersect. Here, the

following conditions are imposed

X1 = X2 = X4, (persistence) (2.7.20)⟨X4

α

∥X4α∥,−→N 1,

−→N 2

⟩= 0, (mirror symmetry) (2.7.21)⟨

X4 − r10,−→N 1⟩= 0, (attachment) (2.7.22)⟨

X4 − r20,−→N 2⟩= 0, (attachment) (2.7.23)

H1 = H2, (continuity of the chemical potential) (2.7.24)2∑

i=1

∫Γi

−→n Γi · ∇sHi dsi = 0. (balance of mass flux) (2.7.25)

We remark that (2.7.21) has been imposed in the spirit of (2.7.8), as a seemingly sensible

”minimal” mirror symmetry condition.

46

Page 56: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Conditions at CI, CII and CIII

At CI the exterior surface S1 and bounding planes Π1 and Π4 intersect. We impose the

following conditions ⟨−→n 1,−→N 1 +

−→N 4⟩= 0, (mirror symmetry) (2.7.26)⟨

X1 − r10,−→N 1⟩= 0, (attachment) (2.7.27)⟨

X1 − r40,−→N 4⟩= 0, (attachment) (2.7.28)∫

Γ1

−→n Γ1 · ∇sH1 ds1 = 0, (zero mass flux) (2.7.29)

where (2.7.26) has been prescribed in analogy with (2.7.8).

At point CII , the surface S2 and the planes Π2 and Π3 intersect. By analogy with the

point CI , we prescribe the following conditions⟨−→n 2,−→N 2 +

−→N 3⟩= 0, (mirror symmetry) (2.7.30)⟨

X2 − r20,−→N 2⟩= 0, (attachment) (2.7.31)⟨

X2 − r30,−→N 3⟩= 0, (attachment) (2.7.32)∫

Γ2

−→n Γ2 · ∇sH2 ds2 = 0, (zero mass flux) (2.7.33)

At the point CIII , the surface S3 and the planes Π3 and Π4 intersect. By analogy with

points CI and CII we prescribe following conditions⟨−→n 3,−→N 3 +

−→N 4⟩= 0, (mirror symmetry) (2.7.34)⟨

X3 − r30,−→N 3⟩= 0, (attachment) (2.7.35)⟨

X3 − r40,−→N 4⟩= 0, (attachment) (2.7.36)∫

Γ3

−→n Γ3 · ∇sH3 ds3 = 0, (zero mass flux) (2.7.37)

47

Page 57: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Conditions at III t and IV t

At the point IIIt, the surfaces S2, S3, S5 and the bounding plane Π3 intersect. The

conditions shall be prescribed as

X5 = X2 = X3, (persistence) (2.7.38)⟨−→n 5,−→N 3⟩= 0, (mirror symmetry) (2.7.39)⟨

X5α, X

⟩= 0, (mirror symmetry) (2.7.40)⟨

X5 − r30,−→N 3⟩= 0, (attachment) (2.7.41)

H2 = H3, (continuity of the chemical potential) (2.7.42)∑i∈2,3

∫Γi

−→n Γi∇sHi dsi = 0. (balance of mass flux) (2.7.43)

At the point IV t, the surfaces S1, S3, S6 and the bounding plane Π4 intersect. By

analogy with IIIt, the conditions shall be prescribed as

X6 = X1 = X3, (persistence) (2.7.44)⟨−→n 6,−→N 4⟩= 0, (mirror symmetry) (2.7.45)⟨

X6α, X

⟩= 0, (mirror symmetry) (2.7.46)⟨

X6 − r40,−→N 4⟩= 0, (attachment) (2.7.47)

H1 = H3, (continuity of the chemical potential) (2.7.48)∑i∈1,3

∫Γi

−→n Γi∇sHi dsi = 0. (balance of mass flux) (2.7.49)

2.8 The PDAE system

Combining the governing equations: motion by surface diffusion, motion by mean curvature,

uniform grid spacing, and the boundary and initial conditions, we obtain the following

48

Page 58: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

PDAE (Partial Differential Algebraic Equation) system

⟨Xpt ,−→n p⟩ =sH

p

⟨Xpα, X

pαα⟩ =0⟨

Xpβ, X

pββ

⟩=0

, p = 1, 2, 3

⟨Xqt ,−→n q⟩ =Hq

⟨Xqα, X

qαα⟩ =0⟨

Xqβ, X

qββ

⟩=0

, q = 4, 5, 6

Boundary Conditions as prescribed in (2.4.1)-(2.7.49)

Initial Conditions

(2.8.1)

In our numerical simulations, the initial conditions will be chosen in accordance with

the configuration portrayed in Fig. 2.1, as well as in Fig. 2.3 (a). Note that if m = 0, then

no thermal groove are formed, and the configuration portrayed in Fig. 2.3 (a) will remain

planar. For m > 0, thermal grooves form.

2.9 Various geometries for study

Various geometries of interest to study are portrayed in Fig 2.3. The geometry in Fig. 2.3.

(a) corresponds to the 3 grain geometry which we have been discussing up to now. The geom-

etry in Fig. 2.3 (b) and (c) was studied in [25]. The geometries portrayed in Fig. 2.3 (e) and (f)

are reminiscent of geometries discussed in [10]; the geometry in Fig. 2.3 (f) is relevant in

particular to considerations of pitting. The other geometries portrayed in Fig. 2.3 constitute

geometries of interest to consider in future work.

(a) (b) (c)

(d) (e) (f)

Figure 2.3: Various geometries for study

49

Page 59: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

2.10 Benchmark criteria for testing our numerical algorithm

2.10.1 The test: m = 0

When the relative surface energy is equal to zero, the grain boundaries evolve by motion

by mean curvature and no thermal grooves form. In this context, we may rely on the von

Neumann-Mullins relation [40, 15]

dS

dt=

A π

3(n− 6), (2.10.1)

to predict the surface area S = S(t) of the ”corner grain”. In (2.10.1), S = S(t) denotes

the area of the exterior surface of a given embedded grain in polycrystalline specimen, A is

the reduced mobility, n denotes the number of quadruple junctions surrounding the grain.

In considering the corner grain, we see that by mirror symmetry, it may be considered

as one quarter of an embedded grain with n = 4 quadruple junctions on its perimeter.

The area of the corner grain thus correspond to 14 of the area obtained by reflection. Note

that our calculation of H is in 3D, whereas (2.10.1) is based on calculation of H in 2D;

therefore there is a factor of 12 to be included. Thus, we may use the von Neumann-Mullins

relation (2.10.1) to predict that the area of the corner grain evolves as

dS

dt= −A π

12. (2.10.2)

By integration, we obtain that

S(t) = S0 −A π

12t (2.10.3)

where S0 = S(0). Writing (2.10.3) in terms of dimensionless variables, we obtain that

S(t) = S0 −π

12t. (2.10.4)

where S0 = S(0). From (2.10.4), we can obtain the time Ta needed for annihilation of the

corner grain, that is

Ta =12

πS0. (2.10.5)

In the numerical simulations, if t denotes the time step, then the number of iterations

Na needed for grain annihilation to occur is

Na =Tat

=12S0πt

. (2.10.6)

We remark that if 0 < m ≪ 1 and if the thickness of the thin film is relatively large,

then (2.10.4) should still be roughly accurate, though as thinner specimens are considered

and m is increased, thin film break up may occur before the grain has time to annihilate.

50

Page 60: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

2.10.2 The test: mass conservation

We have shown in Section 1.6 that within the context of our problem formulation, mass is

conserved. Hence, volume should also be conserved, or at least approximately conserved,

by our numerical algorithm.

2.10.3 The test: energy dissipation

We have shown in Section 1.7 that within the context of our problem formulation, the

total free energy of the system should decrease. Hence, the surfaces area (grain boundaries,

exterior surfaces) weighted by their free energy per unit area, should also decrease, or at

least approximately decrease, by our numerical algorithm.

51

Page 61: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Chapter 3

Numerical Simulations

In this chapter, we present a numerical algorithm for solving the PDAE system appearing

in (2.8.1). This numerical algorithm is based on discretization of the governing equations

and finite difference methods. The PDAE system is reduced to an ODAE system (in time)

which we then solve by using a backward Euler (implicit) method. Then at each time step,

we use Newton’s method to solve the resultant system of nonlinear equations. Newton’s

method requires calculation of a Jacobian matrix which can be a very difficult process, so

our approach for approximation of the Jacobian matrix will be also presented.

3.1 Approximations and numerical methods

In this section we discuss available numerical methods for solving the problems. We then

recall some well known numerical results, and outline some of the approximations which we

will use.

3.1.1 Available numerical methods for solving the problems

3.1.2 Numerical solution of systems of differential - algebraic equations

(DAE)

Let n ∈ N be arbitrary, and for T > 0, let us consider the general system of n DAE

F(Y ′, Y, t

)= 0, t ∈ [0, T ], (3.1.1)

where t denotes time and Y : [0, T ] → Rn, or more specifically Y (t) = (y1(t), . . . yn(t)).

Let Y k = Y (tk) denote an approximation of Y at the time tk ≥ 0, k = 0, 1, . . . , NTmax , for

NTmax ∈ N, and let tk = tk − tk−1 and t0 = 0. Applying the backward Euler method [39]

to the system (3.1.1), we obtain a n× n system of nonlinear equations for Y k, namely

F

(Y k − Y k−1

tk, Y k, tk

)= 0, k = 1, . . . , NTmax . (3.1.2)

52

Page 62: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Note that in order to solve (3.1.2), we need to prescribe the initial vector Y 0 which can be

obtained from initial conditions. Let us also note that F : Rn → Rn is a function given by

n real-valued component functions, f1

(Y k−Y k−1

tk, Y k, tk

), . . . , fn

(Y k−Y k−1

tk, Y k, tk

), and its

Jacobian with respect to Y k can be expressed as∂f1∂yk1

· · · ∂f1∂ykn

.... . .

...∂fn∂yk1

· · · ∂fn∂ykn

. (3.1.3)

The system (3.1.2) may be solved for k = 1, . . . , NTmax by Newton’s iteration method [23,

11], see variant of Newton’s method in Algorithm 1. Note that Newton’s iteration method

is a method for finding successively better approximations to the zeroes (or roots) of a

real-valued function F (Y ). Usually Newton’s method is iterated until an estimate of the

local error will be not greater than some user-defined tolerance ε.

Algorithm 1 Newton’s iteration method for solving F(Y)=0

Input: Y0 (initial guess), ε (tolerance), Nmax (maximum number of iterations)Output: YSet Y = Y0Set i = 1repeat

Calculate F (Y ) and Jacobian J(Y )Solve J(Y ) δ = −F (Y )Update Y = Y + δSet i = i+ 1

until ||F (Y )|| ≤ ε or ||δ|| ≤ ε or i > Nmax

3.1.3 Approximation of the Jacobian matrix

In general, evaluation of the Jacobian matrix analytically can be a difficult or cumber-

some process. There is however a convenient numerical technique [23] by which to obtain

approximation of this matrix. We shall now describe this technique which is based on

central difference approximations, namely, the partial derivatives ∂F∂yi

, i = 1, . . . , n, can be

approximated by∂F

∂yi=F (y + ε ei)− F (y − ϵ ei)

2 ϵ+O

(ε2), (3.1.4)

where ei = (0, . . . ,

element i︷︸︸︷1 , . . . , 0) and ε is a small positive parameter.

An important issue is the choice of the parameter ε. In [23] the suggestion is made that

ε should be chosen as the square root of the machine epsilon. In our computer calculations

which use double precision, the machine epsilon is 10−16, and so the square root of the

53

Page 63: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

machine epsilon is ε = 10−8. In our calculations we shall choose ε = 10−6. This choice of ε

suffices for the overall accuracy of our calculations.

3.1.4 Approximation of derivatives

In this section, we present results with regard to the approximation of derivatives using

finite difference methods. As explained in Section 2.1, X = X(α, β, t) represents a regular

parametric 2D surface in 3D which evolves in time, and we take 0 ≤ α, β ≤ 1 and t ∈ [0, T ]

for some T > 0.

In our approximations we shall use a staggered grid with ghost points, see Fig.3.1. The

boundary of the staggered grid is located midway between two grid points, between an

interior grid point and the ”ghost” of the grid point. The grid points on the boundary we

be referred to as the groove points of the grid. This approach allows us to use central finite

difference methods at the interior points of the grid as well as at the groove points. Note

that since we impose equi-spacing of the grid points on the surface (2.3.1), the points on

the surface also form staggered grid.

Let Xki,j = X(αi, βj , tk) denote the approximation of X at the staggered grid point (i, j)

at time tk ∈ [0, T ], for αi = (i− 1/2)hα, βj = (j − 1/2)hβ , i = 0, 12 , 1, . . . , N,N + 12 , N + 1,

j = 0, 12 , 1, . . . ,M,M + 12 ,M + 1, where hα, hβ denote the grid spacings, and N , M denote

the number of inner grid points along each direction, see Fig. 3.1. The Xki,j with indexes

α

β

0

0

c1

c1

1

1

2

2

3

3

4

4

i−2

i−2

i−1

i−1

i

i

i+1

i+1

i+2

i+2

N−3

N−3

N−2

N−2

N−1

N−1

N

N

c2

c2

N+1

N+1

0 0c

1c

1

1 1

2 2

3 3

4 4

j−2 j−2

j−1 j−1

j j

j+1 j+1

j+2 j+2

M−3 M−3

M−2 M−2

M−1 M−1

M Mc

2c

2

M+1 M+1

ghost points

corner points

groove points

inner points

Figure 3.1: The grid mesh

54

Page 64: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i = 0, N + 1 or j = 0,M + 1 will be referred to as ghost points and the Xki,j with indexes

i = 12 , N + 1

2 or j = 12 ,M + 1

2 will be referred to as groove points. We shall also, where

convenient, denote groove points as points where i or j ∈ c1, c2.

Let us outline how we can approximate the derivatives ∂ X∂ t ,

∂X∂α ,

∂X∂β ,

∂2X∂α2 ,

∂2X∂β2 ,

∂2X∂α∂β at

(αi, βj , tk) for i = 1, . . . , N , j = 1, . . . ,M at time tk. The first order forward approximation

of the time derivative of X at (αi, βj , tk) with respect to t is given by

(∂ X

∂ t

)k

i,j

=Xk+1

i,j −Xki,j

tk+O(tk) , (3.1.5)

where tk = tk − tk−1. The second order centered difference approximation of the first

partial derivatives with respect to α and β are given by(∂X

∂α

)k

i,j

=Xk

i+1,j −Xki−1,j

2hα+O

((hα)

2), (3.1.6)(

∂X

∂β

)k

i,j

=Xk

i,j+1 −Xki,j−1

2hβ+O

((hβ)

2). (3.1.7)

The second order centered difference approximation of the second partial derivatives with

respect to α and β are given by(∂2X

∂α2

)k

i,j

=Xk

i+1,j − 2Xki,j +Xk

i−1,j

h2α+O

((hα)

2), (3.1.8)(

∂2X

∂β2

)i,j

=Xk

i,j+1 − 2Xki,j +Xk

i,j−1

h2β+O

((hβ)

2). (3.1.9)

The second order centered difference approximation of the second mixed derivatives are

given by(∂2X

∂α∂β

)k

i,j

=Xk

i+1,j+1 −Xki−1,j+1 −Xk

i+1,j−1 +Xki−1,j−1

4hα hβ+O

((hα)

2 + (hβ)2). (3.1.10)

Approximation of the derivatives ∂X∂α ,

∂X∂β at (αi, βj , tk) when i ∈ 1

2 , N+12 or j ∈ 1

2 ,M+12

at time tk, can be obtained using equations (3.1.6), (3.1.7), namely

(∂X

∂α

)k

i,j

=Xk

i+ 12,j−Xk

i− 12,j

hα+O

((hα)

2), (3.1.11)(

∂X

∂β

)k

i,j

=Xk

i,j+1 −Xki,j−1

2hβ+O

((hβ)

2), (3.1.12)

55

Page 65: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

for i ∈ 12 , N + 1

2, j = 1, . . . ,M .

(∂X

∂α

)k

i,j

=Xk

i+1,j −Xki−1,j

2hα+O

((hα)

2), (3.1.13)

(∂X

∂β

)k

i,j

=Xk

i,j+ 12

−Xki,j− 1

2

hβ+O

((hβ)

2), (3.1.14)

for i = 1, . . . , N , j ∈ 12 ,M + 1

2.

(∂X

∂α

)k

i,j

=Xk

i+ 12,j−Xk

i− 12,j

hα+O

((hα)

2), (3.1.15)

(∂X

∂β

)k

i,j

=Xk

i,j+ 12

−Xki,j− 1

2

hβ+O

((hβ)

2), (3.1.16)

for i ∈ 12 , N + 1

2, j ∈ 12 ,M + 1

2.Note that derivatives ∂2X

∂α2 ,∂2X∂β2 ,

∂2X∂α∂β at (αi, βj , tk) when i ∈ 1

2 , N+ 12 or j ∈ 1

2 ,M+ 12

at time tk, can be also obtained in similar fashion, but we do not need them in our com-

putations. We also note that the approximations above can be used for calculating the

derivatives of the mean curvature H.

3.1.5 Approximations along triple junction lines and free boundary lines

As explain in Section 3.1.4, we have 3 types of grid points, interior points, groove points,

and ghost points. Suppose that we know the value of X(α, β, t) at inner and ghost points,

and we wish to approximate X(α, β, t) at the groove points. This means that at some time

tk the values Xki,j , i = 0, . . . N + 1, j = 0, . . . ,M + 1 are known, and we want to find Xk

i,j

for i ∈ 12 , N + 1

2 or j ∈ 12 ,M + 1

2.By using Taylor expansions, we obtain for i = 0, 1, . . . , N,N +1, j = 0, 1, . . . ,M,M +1

that

Xki, 1

2

=5Xk

i,0 + 15Xki,1 − 5Xk

i,2 +Xki,3

16+O

((hβ)

4), (3.1.17)

Xki,M+ 1

2

=5Xk

i,M+1 + 15Xki,M − 5Xk

i,M−1 +Xki,M−2

16+O

((hβ)

4), (3.1.18)

Xk12,j

=5Xk

0,j + 15Xk1,j − 5Xk

2,j +Xk3,j

16+O

((hα)

4), (3.1.19)

XkN+ 1

2,j

=5Xk

N+1,j + 15XkN,j − 5Xk

N−1,j +XkN−2,j

16+O

((hα)

4). (3.1.20)

In addition to these approximations, we also need to approximate X 12, 12, X 1

2,M+ 1

2,

XN+ 12, 12, and XN+ 1

2,M+ 1

2. This can be accomplished by using equations (3.1.17) - (3.1.20).

56

Page 66: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

For example, suppose we wish to approximate Xk12, 12

. From (3.1.17), we get that

Xk12, 12

=5Xk

12,0+ 15Xk

12,1− 5Xk

12,2+Xk

12,3

16+O

((hβ)

4),

and similarly from (3.1.19), we get that

Xk12, 12

=5Xk

0, 12

+ 15Xk1, 1

2

− 5Xk2, 1

2

+Xk3, 1

2

16+O

((hα)

4)

Averaging the expressions above, we obtain the more symmetric approximation

Xk12, 12=

5(Xk

12,0+Xk

0, 12

)+ 15

(Xk

12,1+Xk

1, 12

)− 5

(Xk

12,2+Xk

2, 12

)+(Xk

12,3+Xk

3, 12

)32

. (3.1.21)

Note that the accuracy in (3.1.21) is given by O((hα)

4 + (hβ)4). In the same manner,

we can obtain approximations for X 12,M+ 1

2, XN+ 1

2, 12, XN+ 1

2,M+ 1

2. And as in Section 3.1.4,

the approximations which have been obtained can also be used in estimating the mean

curvature along triple junction lines and free boundary lines.

Note that in (3.1.17)-(3.1.21) we have obtained order forth accuracy in order to conserve

the overall accuracy of system (2.8) after discretization. Further remarks with respect to

the overall accuracy of the algorithm will be given in Section 3.2.

3.1.6 Approximation of the integral in the mass flux conditions

Recall that in Section 1.5, balance of mass flux at the quadruple junction and the top

corner points was prescribed in terms of a condition which included various integrals. In

this section, I will discuss approximation of such integrals, namely integrals of the form∫Γ

−→n Γ · ∇sH ds, (3.1.22)

where Γ = Γ(s) denotes a continuous curve which lies on an exterior surface S and which

is bounded on either end by either bounding planes or by thermal groove lines. Moreover,−→n Γ denotes a unit normal vector to Γ which lies in the tangent plane of the exterior surface

S, s is an arc-length parametrization of Γ, and Γ normally intersects the bounding planes

or thermal groove lines, see Fig.3.2.

Since we cannot hope to calculate the integral (3.1.22) analytically, we will use an

approximation based on the Trapezoidal Rule. Let LΓ denote the length of Γ, then

∫Γ

−→n Γ · ∇sH ds =(−→n Γ · ∇sH

∣∣s=0

+ −→n Γ · ∇sH∣∣s=LΓ

) LΓ

2+O

((LΓ)

3

12

)(3.1.23)

57

Page 67: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 3.2: A sketch of Γ at the quadruple junction.

I will now calculate an approximation for the value of LΓ. Let ζ :(r(θ) cos θ, r(θ) sin θ

)| θ ∈

[0, π2

]denote the preimage of Γ in the αβ plane in radial coordinates. Here θ = 0 corresponds to

s = 0, and θ = π2 corresponds to s = LΓ , and LΓ may be expressed as [12]

LΓ =

π2∫

0

√g11 (ζ ′1)

2 + 2 g12 (ζ ′1) (ζ′2) + g22 (ζ ′2)

2 dθ, (3.1.24)

where gij defined in (2.1.7). It is easy to check that

ζ ′ (θ) =(r′(θ) cos θ − r(θ) sin θ, r′(θ) sin θ + r(θ) cos θ

), (3.1.25)

and

ζ ′ (0) =(r′(0), r(0)

), (3.1.26)

ζ ′(π2

)=

(−r(π2

), r′(π2

)). (3.1.27)

From the Trapezoidal Rule, we obtain that

LΓ =

√g11 [r′]

2 + 2 g12 r′ r + g22 r2∣∣∣∣θ=0

π

4+√

g11 r2 − 2 g12 r′ r + g22 [r′]2

∣∣∣∣θ=π

2

π

4+O

(π3

96f ′′(ξ)

),

(3.1.28)

where ξ ∈ (0, π2 ) and f(θ) :=√g11 (ζ ′1)

2 + 2 g12 (ζ ′1) (ζ′2) + g22 (ζ ′2)

2. Let us now approximate

r′(0), r′(π2

). Since ζ (θ) defines a curve in the αβ plane, we have that

α =r(θ) cos (θ)

β =r(θ) sin (θ)⇐⇒

θ =arctan

α

),

r =√α2 + β2.

(3.1.29)

58

Page 68: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Hence

θα =αβα − β

α2 + β2, (3.1.30)

rα =β βα + α√α2 + β2

. (3.1.31)

Noting that r′ =rαθα

we get that

r′ =β βα + α

αβα − β

√α2 + β2 (3.1.32)

To evaluate (3.1.32) we need to calculate α(0), β(0), βα(0), and α(π2

), β(π2

), βα

(π2

).

It follows from (3.1.29) that

α(0) = r(0), β(0) = 0, (3.1.33)

α(π2

)= 0, β

(π2

)= r

(π2

). (3.1.34)

For a given vector τ = (τ1, τ2) which is tangent to the curve β = β(α) at some point

along the curve, let ω denote the angle between τ and α - axis at this point. Then clearly

βα = tan(ω) =τ2τ1.

Figure 3.3: A sketch of vectors V and U at the quadruple junction.

We now wish to obtain an explicit expression for (3.1.33) and (3.1.34) at either end

point of the curve Γ. We shall proceed as follows. Let−→U ,

−→V be two tangent vectors at a

point on the parametric surface, see Fig. 3.3. Then they can be expressed in the form

−→U = u1Xα + u2Xβ , (3.1.35)−→V = v1Xα + v2Xβ . (3.1.36)

The cosine of angle between these tangent vectors is readily calculated to be [3]

cos(−→U ,

−→V ) =

g11 u1 v1 + g12(u1 v2 + u2 v1) + g22 u2 v2

∥−→U ∥ ∥

−→V ∥

, (3.1.37)

where gij defined in (2.1.7).

59

Page 69: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

From condition that Γ normally intersects the bounding planes or thermal groove

lines, see Section 1.5, we obtain that at θ = 0 there are two vectors−→U and

−→V such as

−→U = τ1Xα + τ2Xβ,

−→V = 1Xα + 0Xβ , and

−→U ⊥ −→

V . Thus

cos(−→U ,

−→V ) = 0 ⇐⇒ g11 τ1 + g12τ2 = 0 ⇐⇒ τ2

τ1= −g11

g12. (3.1.38)

Hence

βα(0) = −g11g12

= −⟨Xα, Xα⟩⟨Xα, Xβ⟩

. (3.1.39)

Similarly, at θ = π2 there are two vectors

−→U and

−→V such as

−→U = τ1Xα+τ2Xβ ,

−→V = 0Xα+1Xβ ,

and−→U ⊥ −→

V . Thus

cos(−→U ,

−→V ) = 0 ⇐⇒ g12 τ1 + g22τ2 = 0 ⇐⇒ τ2

τ1= −g12

g22. (3.1.40)

Hence

βα

(π2

)= −g12

g22= −

⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

. (3.1.41)

From (3.1.32), (3.1.33) and (3.1.34) we now get that

r′(0) =α

βα= −r(0)

⟨Xα, Xβ⟩⟨Xα, Xα⟩

, (3.1.42)

r′(π2

)= −β βα = r

(π2

) ⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

. (3.1.43)

By referring to (3.1.28) and using (3.1.33)-(3.1.34), (3.1.42)-(3.1.43), we may calculate LΓ,

LΓ =

(r(0)

√g

∥Xα∥

∣∣∣∣θ=0

+ r(π2

) √g

∥Xβ∥

∣∣∣∣θ=π

2

4+O

(π3

96f ′′(ξ)

). (3.1.44)

Let us express (3.1.23) and (3.1.44) in terms of functional evaluations on our discretized

grid, see Section 3.1.4. We set r(0) = hα2 , r

(π2

)=

2 , so that θ = 0 corresponds to first

(last) groove grid point on the α-axis and θ = π2 corresponds to first (last) groove grid

point to on the β in our discretization. As explained in Section 1.5, it is only necessary

to calculate the integral on the exterior surfaces, and from Section (3.1.4) we know that

hα = 1N and hβ = 1

M where N , M denote the number of inner grid points along each

direction, see Fig. 3.1. Hence

∫Γ

−→n Γ · ∇sH ds ≈

(((−1)ν1Xα

∥Xα∥· ∇sH

)i,j

+

((−1)ν2Xβ

∥Xβ∥· ∇sH

)p,q

)LΓ

2, (3.1.45)

60

Page 70: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

where

LΓ ≈

(hα2

( √g

∥Xα∥

)i,j

+hβ2

( √g

∥Xβ∥

)p,q

4. (3.1.46)

For each of the exterior surfaces, calculations of the form (3.1.22) must be undertaken at

each of the four corners, and thus for each of the external surfaces the indexes i, j, p, qassume values in the set

1,1

2,1

2, 1

;

N,

1

2, N +

1

2, 1

;

1,M +

1

2,1

2,M

;

N,M +

1

2, N +

1

2,M

,

and

ν1 =

0, if i = 1

1, if i = N, ν2 =

0, if q = 1

1, if q = N.

Suppose that h := r(0) = λ r(π2

), where we shall assume that λ = O(1). We shall now

see that LΓ = O(h). Let Lζ be the length of ζ, and let s be the arc length parametrization

of ζ. Then for (3.1.24) we obtain that

LΓ =

π2∫

0

√g11 (ζ ′1)

2 + 2 g12 (ζ ′1) (ζ′2) + g22 (ζ ′2)

2 dθ =

Lζ∫0

√g11 (ζ ′1)

2 + 2 g12 (ζ ′1) (ζ′2) + g22 (ζ ′2)

2

(ζ ′1)2 + (ζ ′2)

2ds,

(3.1.47)

where

Lζ =

π2∫

0

√(ζ ′1)

2 + (ζ ′2)2 d θ =

π2∫

0

√(rθ)2 + (r)2 d θ. (3.1.48)

So if Lζ = O(h) we may use the Trapezoidal Rule on LΓ, so long as the integrand is C2 in

term of the variable s ∈ [0, Lζ ].

Let P r denote the Hermite interpolation of r [11], namely

P r(θ) = a+ b θ + c θ2 + d θ2(θ − π

2

)= a+ b θ +

(c− π

2d)θ2 + d θ3, (3.1.49)

where the coefficients a, b, c, d can be found from the system1 0 0 0

0 1 0 0

1 π2

π2

4 0

0 1 π π2

4

a

b

c

d

=

r(0)

rθ(0)

r(π2

)rθ(π2

)

. (3.1.50)

61

Page 71: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Hence

a =r(0)

b =rθ(0)

c =4

π2

(r(π2

)− a− b

π

2

)d =

4

π2

(rθ

(π2

)− b− cπ

)=⇒

a =r(0)

b =rθ(0)

c =4

π2

(r(π2

)− r(0)− π

2rθ(0)

)d =

4

π2

(rθ

(π2

)+ rθ(0)−

4

π

(r(π2

)− r(0)

))Then from (3.1.42) and (3.1.43)

a =r(0)

b =− r(0)⟨Xα, Xβ⟩⟨Xα, Xα⟩

c =4

π2

(r(π2

)− r(0) + r(0)

π

2

⟨Xα, Xβ⟩⟨Xα, Xα⟩

)d =

4

π2

(r(π2

) ⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

− r(0)⟨Xα, Xβ⟩⟨Xα, Xα⟩

− 4

π

(r(π2

)− r(0)

))(3.1.51)

From assumption h := r(0) = λr(π2

), λ = O(1), we obtain that

a =h

b =− h⟨Xα, Xβ⟩⟨Xα, Xα⟩

c =h4

π2

(λ− 1 +

π

2

⟨Xα, Xβ⟩⟨Xα, Xα⟩

)d =h

4

π2

(⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

−⟨Xα, Xβ⟩⟨Xα, Xα⟩

− 4

π(λ− 1)

). (3.1.52)

Hence from (3.1.49) and (3.1.52) we get

P r(θ)

h=1−

⟨Xα, Xβ⟩⟨Xα, Xα⟩

θ − 4

π2

2

⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

− π⟨Xα, Xβ⟩⟨Xα, Xα⟩

− 3 (λ− 1)

)θ2+

4

π2

(⟨Xα, Xβ⟩⟨Xβ , Xβ⟩

−⟨Xα, Xβ⟩⟨Xα, Xα⟩

− 4

π(λ− 1)

)θ3

. (3.1.53)

It follows from (3.1.53) that

Lζ =

π2∫

0

√(rθ)2 + (r)2 d θ =

π2∫

0

√(P r

θ )2 + (P r)2 d θ = O(h) , (3.1.54)

that is the length of ζ isO(h), thus from (3.1.47) we obtain that LΓ = O(h) for h := r(0) = r(π2

),

where λ = O(1) . Note that the approximation accuracy of integral in the equation (3.1.45)

62

Page 72: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

are given by O((LΓ)

3)= O

(h3).

3.2 A numerical algorithm

In this section I shall outline a numerical algorithm for solving the PDAE system (2.8.1).

Let us rewrite this system in a form which is more appropriate for computations, namely

⟨Xpt ,−→n p⟩ =sH

p

H =1

2

⟨⟨Xp

β , Xpβ

⟩Xp

αα − 2⟨Xp

α, Xpβ

⟩Xp

αβ + ⟨Xpα, X

pα⟩ Xp

ββ

⟨Xpα, X

pα⟩⟨Xp

β , Xpβ

⟩−⟨Xp

α, Xpβ

⟩2 ,−→n p

⟨Xpα, X

pαα⟩ =0⟨

Xpβ , X

pββ

⟩=0

⟨Xqt ,−→n q⟩ =1

2

⟨⟨Xq

β , Xqβ

⟩Xq

αα − 2⟨Xq

α, Xqβ

⟩Xq

αβ + ⟨Xqα, X

qα⟩ Xq

ββ

⟨Xqα, X

qα⟩⟨Xq

β , Xqβ

⟩−⟨Xq

α, Xqβ

⟩2 ,−→n q

⟨Xqα, X

qαα⟩ =0⟨

Xqβ , X

qββ

⟩=0

Boundary Conditions & Initial Conditions

. (3.2.1)

In (3.2.1) p ∈ 1, 2, 3 and q ∈ = 4, 5, 6. In accordance with (3.2.1), we shall consider

the mean curvature, Hp, of the exterior surfaces Sp, p = 1, 2, 3 as an additional variable.

Thus we shall not need to calculate the third and fourth derivatives of X with respect to α,

β. We shall discretize each exterior surface using N ×N interior grid points and we shall

discretize each grain boundary surface using N ×M interior grid points.

Let (Xki,j)

p and (Hki,j)

p denote the value of Xp and Hp at grid point (i, j) at some given

time tk, and let (Xki,j)

q denote the value of Xq at grid point (i, j) at some given time tk.

In order to discretize the governing equations in system (3.2.1), we need to approximate

the derivatives ∂ Xp

∂ t∂Xp

∂α , ∂Xp

∂β , ∂2Xp

∂α2 , ∂2Xp

∂β2 , ∂2Xp

∂α∂β ,∂Hp

∂α , ∂Hp

∂β , ∂2Hp

∂α2 , ∂2Hp

∂β2 , ∂2Hp

∂α∂β ,∂ Xq

∂ t∂Xq

∂α ,∂Xq

∂β , ∂2Xq

∂α2 , ∂2Xq

∂β2 , ∂2Xq

∂α∂β at the interior grid points, and in order to discretize the boundary

conditions we need approximate the derivatives ∂Xp

∂α , ∂Xp

∂β , ∂Hp

∂α , ∂Hp

∂β , ∂Xq

∂α , ∂Xq

∂β at the

groove points of grid (the points where at least one of the indexes assumes a value in

the set 12 , N + 1

2 ,M + 12). Although discrete approximation for all of these derivatives

were presented in Section 3.1.4, writing system (3.2.1) in full detail is very involved. The

numerical program using in running simulations contains various functions that evaluate

and return derivatives at inner and groove grid points.

63

Page 73: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

The overall accuracy of the system (3.2.1) is determined by order of accuracy of the

derivatives and other approximations that we present within this thesis. We expect that the

overall accuracy of our discretization of the system (3.2.1) in space to be O((hα)

2 + (hβ)2)

and in time to be O(t). Note that we do not prove convergence (consistence, stability) of

our method, though we hope there to be convergence, and we’ve tested the behavior of our

algorithm when smaller time steps and grid partitions are implemented, see Chapter 4.

As mentioned in Section 2.8, in our numerical simulations, the initial conditions will

be chosen in accordance with the configuration portrayed in Fig. 2.1. This means that we

discretize the flat configurations by using staggered grid formulation. Note that our initial

conditions in this case do not satisfy to the boundary conditions.

Let us outline the steps that we undertake in order to solve the system (3.2.1). We

discretize the governing equations and boundary conditions in system (3.2.1) in space using

the approximations given in Sections 3.1.4-3.1.6. In this manner we obtain an ODAE

system, namely

F(U ′, U, t

)= 0, (3.2.2)

where the vector U = (u1, u2, . . . , uℓ, . . .) denotes some ordering of the elements

(Xi,j)p =

((xi,j)

p, (yi,j)p, (zi,j)

p), (Hk

i,j)p, i, j ∈ 0, 1, . . . , N,N + 1,

(Xi,j)q =

((xi,j)

q, (yi,j)q, (zi,j)

q), i ∈ 0, 1, . . . , N,N + 1, j ∈ 0, 1, . . . ,M,M + 1.

Note that vector U does not include variables evaluated at the groove points of our grid, since

at the groove points, the variables can be approximated using equations (3.1.17)-(3.1.20)

given in Section 3.1.5. The number of elements in the vector U is equal to 3N (4N +3M).

We solve equation (3.2.2) by using the backward Euler method; that is, we use (3.1.5) to

approximate the time derivative of U , and obtain a system of nonlinear equations with

respect to Uk, k = 0, 1, ..., NTmax ,

F

(Uk − Uk−1

tk, Uk, tk

)= 0, (3.2.3)

where U0 corresponds to a spatial discretization of the initial conditions. A discrete ap-

proximation of the solution of (3.2.1) for some set of tkNTmax1 can be found from equa-

tion (3.2.3), using Algorithm 2.

64

Page 74: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Algorithm 2 Calculating a discrete approximation to the solution of the PADE system

Input: U0, ε, NTmax , tkNTmax1 , Nmax

Output: Uk for k = 1, ..., NTmax

Set t = 0for k = 1, . . . , NTmax doV = Uk−1

Set t = t+tkSet i = 1repeat

Calculate F(V−Uk−1

tk, V, t

)Calculate the Jacobian J(V ), see Algorithm 5Solve J(V ) δ = −F (V ) (a linear system, Ax = b)Update V = V + δSet i = i+ 1

until ||F (V )|| ≤ ε or ||δ|| ≤ ε or i > Nmax

Set Uk = Vend for

A very important concern in our algorithm is the arrangement of the elements (Xi,j)p,

(Hi,j)p, (Xi,j)

q within the vector U = (u1, u2, . . . , uℓ, . . .). Let us define (Vi,j)sv as follows

(Vi,j)sv =

(xi,j)p, if v = 1, s = p

(yi,j)p, if v = 2, s = p

(zi,j)p, if v = 3, s = p

(Hi,j)p, if v = 4, s = p

(xi,j)q, if v = 1, s = q

(yi,j)q, if v = 2, s = q

(zi,j)q, if v = 3, s = q

(3.2.4)

If we define a 1−1 mapping of indices (s, i, j, v) of the elements of (Vi,j)sv to the set values of

the index ℓ of the vector U , this prescribes an arrangement of the elements (Xi,j)p, (Hi,j)

p,

(Xi,j)q within the vector U . A mapping of the indexes in a fairly ”natural” ordering is given

in Algorithm 3. The arrangement of the elements (Vi,j)sv within the vector U is presented

in Algorithm 4.

65

Page 75: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Algorithm 3 Mapping of the indexes (s, i, j, v) of (Vi,j)sv to an index ℓ of uℓ (uℓ ∈ U)

Input: s, i, j, v, N , MOutput: ℓ

if p ≤ 3 thenℓ = 4 (s− 1) (N + 2)2 + 4 i (N + 2) + 4 j + v

elseℓ = 12 (N + 2)2 + 3 (s− 1) (N + 2) (M + 2) + 3 i(M + 2) + 3 j + v

end ifNote that p ≤ 3 corresponds to exterior surfaces

Algorithm 4 Mapping the elements (Vi,j)sv to elements uℓ of U

Input: (Vi,j)sv, N , M

Output: U = (u1, u2, . . . , uℓ, . . .)for s = 1, . . . , 6 do

if s ≤ 3 thenSet n = N , m = N , k = 4

elseSet n = N , m =M , k = 3

end iffor i = 0, . . . , n+ 1 do

for j = 0, . . . ,m+ 1 dofor v = 1, . . . , k do

Use a mapping algorithm to calculate ℓ from (s, i, j, v) (Algorithm 3)Set uℓ = (Vi,j)

sv

end forend for

end forend for

Another important issue in our algorithm is the approximation of the Jacobian of the

function F given in equation (3.2.3). Our approach is presented in Algorithm 5.

Algorithm 5 Approximating the Jacobian

Input: V , F , N , MOutput: Jacobian JSet Length = 3N (4N + 3M)Set ε = 10−6

for i = 1, . . . , Length do

Set e = (0, . . . ,

element i︷︸︸︷1 , . . . , 0)

Calculate F (V + ε e)Calculate F (V − ε e)

Set column i in matrix J to be F (V+ε e)−F (V−ε e)2 ε

end for

In this thesis we have implemented the algorithm prescribed above in MATLAB. Al-

66

Page 76: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

though this program gives the expected results, for relatively large values of N and M ,

the program running time is very long, and requires a large amount of computer memory,

so running the program on a standard PC is not possible. Hence we have developed an

approach to improve our algorithm which so far only been partially implemented. This

approach is discussed in Section 3.3, below.

3.3 Improving the algorithm

We now discuss how to improve the algorithm.

To improve the algorithm for calculating the Jacobian matrix. From consideration

of the equations in System 3.2.1, it can be seen that changes in the entries at some

grid point (i, j) only influence the values of the entries in some small neighborhood

of grid points around the grid point. Hence by defining a neighborhood for each

grid point, and undertaking functional evaluations only in this neighborhood of grid

points, reduce the running time for the algorithm. Note that there are grid points

with different number of grid points in their effective neighborhood.

To improve the running time of our program, it would be best to write the program

in a programming language such as C/C++.

Running time can also be improved by undertaking parallel computation. Parallel

programming is a form of computation in which many calculations are carried out

simultaneously. Various parts of our algorithm can be subdivided into smaller parts,

which can be solved concurrently (”in parallel”). For example, the evaluation of the

function F and its Jacobian J can be dune using parallel computations.

The algorithm for solving the unsymmetrical sparse linear system of equations Ax = b

(Jδ = −F ) which appears in Newton iterations in Algorithm 2 can also be parallelized.

There are various approaches which we can use for solving Ax = b. In our problem,

A is an unsymmetrical sparse matrix whose structure is roughly portrayed in Fig 3.4.

There exist direct methods such as LU decomposition, block LU decomposition, incomplete

LU decomposition, as well as iterative methods such as Jacobi, Gauss-Seidel, GMRES for

solving such linear system of equations. Direct methods for solving sparse system depend

crucially on the precise sparsity pattern of the matrix. For our algorithm, in future work

we hope to parallelize one of the direct methods. To do so would require reordering the

variables within the vector U , see Section 3.2, so that the resultant matrix will be block

tridiagonal. All of the blocks can be solved in parallel via LU decomposition, except for the

final block which constitutes the Schur complement [17]. Iterative methods require a good

choice of a preconditioning matrix P , and typically the choice of P is as difficult as solving

67

Page 77: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Figure 3.4: Visualization of the nz = 163188 nonzero entries in the Jacobian matrix for oursystem with N = 20, M = 10, m = 0.1, dt = 0.25, Lx = 30, Ly = 30, Lz = 0.25.

the original system. The preconditioning matrix P may be obtained, for example from the

LU decomposition.

In this thesis, part of the improvements listed above have been done. We have write the

simulation program in ”C”. We have rewritten the algorithm which calculates the Jacobian,

so that now it takes into account only a given neighborhood of grid points. We have also

parallelized our program, so that the calculations of the function F and its Jacobian J are

done in parallel. The calculation of the solution of the linear system of equations Ax = b

has still not been parallelized, which means that so far we have been solving this system on

one core of computer.

Finally, let us comment on the software tools which we used. We used the programming

language ”C”, as well as various extension and packages. The parallel part of program was

68

Page 78: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

based on the MPI [29] library of extensions to ”C”. MPI or ”Message Passing Interface” is a

language-independent communications protocol that allows various computers to communi-

cate with each other. This simulation program was run on the high-performance computers

of Technion Center for Computational Nanoscience and Nanotechnology (”NANCO” of

RBNI). In order to solve the unsymmetrical sparse linear systems, Ax = b, we used the

UMFPACK [38] solver. UMFPACK is a set of routines for solving unsymmetric sparse lin-

ear systems, Ax = b, using the Unsymmetric MultiFrontal method. Note that this package

is used by MATLAB for solving such systems. We also attempted to solve this system

by using the PETSc [36] package, but ran into difficulties and received the error message

”Detected zero pivot in LU factorization” while running the simulations. PETSc is a set

of data structures and routines for the scalable (parallel) solution of scientific applications

modeled by partial differential equations. It employs the MPI standard for parallelism.

Perhaps in the future, the difficulties with implementation of the PETSc package will be

resolved, which will allow us to implement PETSc in solving the Ax = b system.

69

Page 79: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Chapter 4

Results and Conclusions

In this chapter, we shall discuss the testing of our numerical algorithm as discussed in

Section 2.10, and we will present numerical results for certain values of the parameters:

Lx, Ly, Lz, m, N , M , t. Afterwards, we shall summarize our results, and indicate some

directions for further study.

Although we have been running our numerical simulations for various sets of param-

eter values, we shall only present here results for following set of parameters: Lx = 30,

Ly = 30, Lz = 0.25, N = 50, M = 25, t = 0.5. Note that these parameter values cor-

respond to those of a thin film, since the height to width ratio is given by Lz/Lx = 1/120

(Lz/Ly = 1/120), and Lz = 0.25 implies that the dimensional height of the film is given

by 0.25× L where L ≈ 10−9m− 10−6m, see Section 1.2.5. We also have been running the

program with Lz/Lx = 1 (Lz/Ly = 1).

The initial conditions are present in Fig 4.1. Note that in all of the figures presented

in this section, for the sake of simplifying only part of the grid points are portrayed. From

equation (2.10.5), it can be seen that the time needed for annihilation of the corner grain

when m = 0 is Ta ≈ 859.4. Our present running time is 100. In debugging our program, we

have tested it by using various time steps, t, t2 ,

t4 , and various numbers of grid points,

N, M as well as 2N, 2M .

70

Page 80: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 5 10 15 20 25 30

0

5

10

15

20

25

30

t=0.000000

Lx

Ly

(a)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

t=0.000000

Ly

Lz

(b)

Figure 4.1: Initial conditions.

71

Page 81: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

4.1 Verifying the von Neumann-Mullins law

In this section we verify one of our benchmark criteria for testing the validity of our numer-

ical algorithm, the the von Neumann-Mullins law. See Section 2.10.

0 10 20 30 40 50 60 70 80 90 100195

200

205

210

215

220

225

230

Time

Are

a of

ext

erio

r su

rfac

e S

3

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000Von Neumann−Mullins

Figure 4.2: Verifying of the Von Neumann-Mullins law

In Fig.4.2 the area of the exterior surface S3 as a function of time is portrayed for

various values of parameter m. We can see that when m = 0, our results correspond to the

predictions of the von Neumann-Mullins law. There is monotone decrease in the area of

surface S3 as a function of time for all tested values of the parameter m. As we increase the

parameter m, the rate of grain annihilation decreases. This correlates well with the known

result that for relatively small thin specimen, groove formation may slow down the grain

boundary velocity [19].

72

Page 82: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 10015

15.2

15.4

15.6

15.8

16

16.2

16.4

16.6

16.8

17

Time

x−co

ordi

nate

of t

he q

uadr

uple

junc

tion

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

Figure 4.3: The x-coordinate of the quadruple junction.

In Fig. 4.3, the x-coordinate of the quadruple junction as a function of time is portrayed

for various values of the parameter m. The results presented in this figure can be used

to determine the velocity of the quadruple junction in xy-plane for various values of the

parameters m since, as our initial conditions have been taken to be symmetric relative

to xy-plane (see Fig. 4.1), it suffices to consider only the x-coordinate of the quadruple

junction.

4.2 Verifying mass conservation and energy dissipation

First, let us consider the results for mass conservation. As explained in Section 1.6, our

system should conserve the total volume of the 3 grains. In Fig. 4.4, we can see that the

overall volume of the grains remains roughly constant over time. In Fig. 4.5, we can see the

relative change in the volume of the system as a function of time.

73

Page 83: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 100224.97

224.98

224.99

225

225.01

225.02

225.03

225.04

Time

Vol

ume

m=0.000000, N=50, M=25, dt=0.500000m=0.001000, N=50, M=25, dt=0.500000m=0.010000, N=50, M=25, dt=0.500000m=0.050000, N=50, M=25, dt=0.500000m=0.100000, N=50, M=25, dt=0.500000

Figure 4.4: The volume of system as a function of time, for various values of the parameterm.

74

Page 84: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 100−1.5

−1.3

−1.1

−0.9

−0.7

−0.5

−0.3

−0.1

0.1

0.3

0.5

0.7

0.9

1.1

1.3

1.5x 10

−4

Time

Rel

ati

ve

change

inth

evolu

me:

V(t

)−V

(0)

V(0

)

m=0.000000, N=50, M=25, dt=0.500000m=0.001000, N=50, M=25, dt=0.500000m=0.010000, N=50, M=25, dt=0.500000m=0.050000, N=50, M=25, dt=0.500000m=0.100000, N=50, M=25, dt=0.500000

Figure 4.5: The relative change in the volume of system as a function of time, for variousvalues of the parameter m.

Next we exhibit the energetic behavior of our system. In Fig. 4.6 we can see that the

overall area of grain boundaries decreases as a function of time, for various values of the

parameter m. Note that this result supports our theoretical results in Section 1.7.

75

Page 85: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 1007

8

9

10

11

12

13

Time

Are

a of

gra

in b

ound

arie

s

m=0.000000, N=50, M=25, dt=0.500000m=0.001000, N=50, M=25, dt=0.500000m=0.010000, N=50, M=25, dt=0.500000m=0.050000, N=50, M=25, dt=0.500000m=0.100000, N=50, M=25, dt=0.500000

Figure 4.6: The total area of the grain boundaries as a function of time, for various valuesof the parameter m.

In Fig. 4.7, we can see that the overall area of exterior surfaces changes only slightly

over time, but this result does not contradict previous results. In Fig. 4.8, we can see that

the total weighted area of all the surfaces in the system decreases as a function of time.

76

Page 86: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 100899.95

900

900.05

900.1

900.15

900.2

900.25

Time

Are

a of

ext

erio

r su

rfac

es

m=0.000000, N=50, M=25, dt=0.500000m=0.001000, N=50, M=25, dt=0.500000m=0.010000, N=50, M=25, dt=0.500000m=0.050000, N=50, M=25, dt=0.500000m=0.100000, N=50, M=25, dt=0.500000

Figure 4.7: The total area of the exterior surfaces as a function of time, for various valuesof the parameter m.

77

Page 87: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 100899.8

900

900.2

900.4

900.6

900.8

901

901.2

901.4

901.6

Time

Tot

al w

eigh

ted

area

, Aex

t(t)+

m A

gb(t

)

m=0.000000, N=50, M=25, dt=0.500000m=0.001000, N=50, M=25, dt=0.500000m=0.010000, N=50, M=25, dt=0.500000m=0.050000, N=50, M=25, dt=0.500000m=0.100000, N=50, M=25, dt=0.500000

Figure 4.8: The total weighted area as a function of time, for various values of the parameterm.

4.3 Results for m = 0 and m = 0.1

In this section we present results from our numerical simulations for m = 0 and m = 0.1.

As expected, when m = 0 there is no formation of thermal grooves, see Figs. 4.9-4.10. We

can see the beginning of the annihilation process of the corner grain.

78

Page 88: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=10.000000

Lx

Ly

(a)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=100.000000

Lx

Ly

(b)

Figure 4.9: Results for m = 0.0 at times (a) t = 10 and (b) t = 100.

79

Page 89: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=10.000000

Lx

Ly

(a)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=20.000000

Lx

Ly

(b)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=50.000000

Lx

Ly

(c)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=60.000000

Lx

Ly

(d)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=90.000000

Lx

Ly

(e)

0 5 10 15 20 25 30

0

5

10

15

20

25

30

m=0.00000, t=100.000000

Lx

Ly

(f)

Figure 4.10: Results for m = 0.0 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60, (e)t = 90, (f) t = 100.

In Figs. 4.11-4.14 results are presented for m = 0. As expected for m = 0 we can observe

the formation of thermal grooves. From the results presented in these figures it is not yet

clear whether annihilation of the corner grain will occur prior to break up of the thin film.

Considerable pitting seems to be occurring at the quadruple point as well as at the corner

80

Page 90: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

point located x = y = 0, which seems to be leading to break up.

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=10.000000

Ly

Lz

(a)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=100.000000

Ly

Lz

(b)

Figure 4.11: Results for m = 0.1 at times (a) t = 10 and (b) t = 100.

81

Page 91: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=10.000000

Ly

Lz

(a)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=20.000000

Ly

Lz

(b)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=50.000000

Ly

Lz

(c)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=60.000000

Ly

Lz

(d)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=90.000000

Ly

Lz

(e)

05

1015

2025

30

0

10

20

30

0

0.05

0.1

0.15

0.2

0.25

0.3

Lx

m=0.10000, t=100.000000

Ly

Lz

(f)

Figure 4.12: Results for m = 0.1 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60, (e)t = 90, (f) t = 100.

82

Page 92: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

m=0.10000, t=10.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(a)

m=0.10000, t=100.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(b)

Figure 4.13: Results for m = 0.1 at times (a) t = 10 and (b) t = 100, (top view).

83

Page 93: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

m=0.10000, t=10.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(a)

m=0.10000, t=20.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(b)m=0.10000, t=50.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(c)

m=0.10000, t=60.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(d)m=0.10000, t=90.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(e)

m=0.10000, t=100.000000

Lx

Ly

0 5 10 15 20 25 30

0

5

10

15

20

25

30

(f)

Figure 4.14: Results for m = 0.1 at times (a) t = 10, (b) t = 20, (c) t = 50, (d) t = 60, (e)t = 90, (f) t = 100, (top view).

84

Page 94: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

4.4 Comparative results as the parameter m varies from 0 to

0.1

In this section we present the height of the quadruple junction and the corner points relative

to the mid-plane of the specimen. In Figs. 4.15-4.16 we can see monotone decrease as a

function of time in the height of the quadruple point and the corner points IIt, IIIt, IV t.

Note that because of the symmetry of the initial conditions with respect to the xy-plane,

the behavior of the corner points IIIt, IV t is the same.

85

Page 95: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 1000.08

0.1

0.12

0.14

0.16

0.18

0.2

0.22

0.24

0.26

Time

Hei

ght o

f the

qua

drup

le ju

nctio

n

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(a)

0 10 20 30 40 50 60 70 80 90 1000

0.05

0.1

0.15

0.2

0.25

0.3

0.35

Time

Hei

ght o

f the

cor

ner

poin

t IIt

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(b)

Figure 4.15: The height of (a) the quadruple junction and (b) the corner point IIt as afunction of time, for various values of the parameter m.

86

Page 96: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 100

0.16

0.18

0.2

0.22

0.24

0.26

Time

Hei

ght o

f the

cor

ner

poin

t III

t

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(a)

0 10 20 30 40 50 60 70 80 90 100

0.16

0.18

0.2

0.22

0.24

0.26

Time

Hei

ght

of th

e co

rner

poi

nt IV

t

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(b)

Figure 4.16: The height of (a) the corner point IIIt and (b) the corner point IV t as afunction of time, for various values of the parameter m.

87

Page 97: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

0 10 20 30 40 50 60 70 80 90 1000.245

0.246

0.247

0.248

0.249

0.25

0.251

Time

Hei

ght o

f the

cor

ner

poin

t CI

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(a)

0 10 20 30 40 50 60 70 80 90 1000.245

0.246

0.247

0.248

0.249

0.25

0.251

Time

Hei

ght o

f the

cor

ner

poin

t CII

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

(b)

Figure 4.17: The height of (a) the corner point CI and (b) the corner point CII as a functionof time, for various values of the parameter m.

88

Page 98: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

In Figs. 4.17-4.18, we can see nonmonotone behavior of the height of the corner points

CI , CII , CIII . Note that the behavior of CI and CII is identical, due to symmetry of the

initial conditions with respect to the xy-plane.

0 10 20 30 40 50 60 70 80 90 1000.238

0.24

0.242

0.244

0.246

0.248

0.25

0.252

Time

Hei

ght o

f the

cor

ner

poin

t CIII

m=0.000000m=0.001000m=0.010000m=0.050000m=0.100000

Figure 4.18: The height of the corner point CIII as a function of time, for various values ofthe parameter m.

4.5 Comparison our results form = 0.1 with results of Mullins

1957 [41]

In this section we compare our results with the results of Mullins [41]. In [41], Mullins

considers the problem of a flat grain boundary which initially perpendicularly intersects the

exterior surface. Under the assumptions that surface diffusion is the main transport process

and that m ≪ 1, he calculated the depth, d(t), of a thermal groove as a function of time,

and found that

d(t) = d0 −m

23/4 Γ(5/4)t1/4. (4.5.1)

Note that in equation (4.5.1), Mullins’ results is given in our dimensionless variables. We

may write (4.5.1) in following form

ln(d0 − d(t)) =1

4ln(t) + ln

(m

23/4 Γ(5/4)

). (4.5.2)

89

Page 99: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Equation (4.5.2) implies that the natural logarithm of d0 − d(t) is a linear function of the

natural logarithm of time. In Fig. 4.19, we compare the depth of the various corner points

with the ”Mullins depth” calculated according to equation (4.5.1). We can see that the

behavior of the corner point IIt, see Fig. 2.2, is almost the same as in Mullins’ result.

0 20 40 60 80 100 120 140 160 180 2000

0.05

0.1

0.15

0.2

0.25

Time

Hei

ght

m=0.100000, QP

m=0.100000, IIt

m=0.100000, IIIt or IVt

m=0.100000, mid point between QP and IIt

m=0.100000, mid point between QP and IIIt or IVt

m=0.100000, t1/4 (Mullins)

Figure 4.19: The depth of various corner points as a function of time, for m = 0.1.

In Fig. 4.20, we can see that the behavior of all of the corner points is approximately

proportional to t1/4.

90

Page 100: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

−1 0 1 2 3 4 5 6−4

−3.5

−3

−2.5

−2

−1.5

−1

ln(Time)

ln(H

eigh

t 0−H

eigh

t)

m=0.100000, QP

m=0.100000, IIt

m=0.100000, IIIt or IVt

m=0.100000, mid point between QP and IIt

m=0.100000, mid point between QP and IIIt or IVt

m=0.100000, t1/4 (Mullins)

Figure 4.20: The natural logarithm of the normalized depth of the various corner points asa function of time, for m = 0.1.

4.6 Conclusion and future directions

In this thesis we considered a special 3D geometry containing 5 (3) grains. Relying on a

physical model which coupled surface diffusion and grain boundary motion, we constructed

a mathematical model (a PDAE system of equations) describing the time evolution of our

system. We also calculated analytically the equilibrium values of the angles at the quadru-

ple point, and demonstrated that our mathematical model is only valid within the range

m ∈ [0,√3] ⊂ [0, 2]. Our system can be used to model physical processes such as thermal

grooving and pitting. Moreover, we presented an algorithm for numerical solution of the

mathematical model, and have written a simulation program which is based on MATLAB

and ”C”. We considered various formulations of the boundary conditions, and verified

their suitability for our numerical algorithm. We have parallelized part of our numerical

computations using MPI extension libraries. Finally, we have presented an assortment of

numerical results. To our knowledge, our simulations are the first simulations of a realistic

3 grain thin film geometry in 3D. Hence we expect our method (algorithm) to be useful for

further study of thin film stability properties.

Some additional directions for further study:

91

Page 101: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Prove that the values of the equilibrium angles at the quadruple junction hold without

our symmetry assumptions, and that the predicted angles correspond to a locally

energy minimizing configuration in the neighborhood of the quadruple junction.

Consider conditions for convergence (consistence, stability) of this algorithm.

Improve the program. Rewrite the algorithm for solving unsymmetric sparse linear

system of equations, Ax = b.

Consider the more general anisotropy case.

Calculate annihilation (pitting) times.

Choose problem parameters and less symmetric initial conditions which may permit

us to see jerky motion and traveling wave solutions.

Running additional simulations in order to compare with results of A.Novick-Cohen,

O.Zelekman-Smirin & A.Vilenkin (2010), [2].

Compare our results with previous results of the research group from Regensburg,

J.W.Barrett, H.Garcke & R.Nurnberg (2009), [25]. In their work they used a finite

element method in order to approximate the evolution of the grain systems presented

in Fig. 2.3 (b) and (c).

92

Page 102: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Appendix A

A Parametric Expression for sH

Let us now simplify the expression (2.1.16), namely

sH =

∂∂α

(g1,1

√g Hα + g1,2

√g Hβ

)+ ∂

∂β

(g2,1

√g Hα + g2,2

√g Hβ

)√g

. (A.1)

Note that

sH =g1,1Hαα +(g1,2 + g2,1

)Hαβ + g2,2Hββ+(

∂∂α

(g1,1

√g)+ ∂

∂β

(g2,1

√g))

√g

+

(∂∂α

(g1,2

√g)+ ∂

∂β

(g2,2

√g))

√g

=g1,1Hαα +(g1,2 + g2,1

)Hαβ + g2,2Hββ+(

∂α

(g1,1)+

∂β

(g2,1))

Hα +

(∂

∂α

(g1,2)+

∂β

(g2,2))

Hβ+(g1,1 ∂

∂α

(√g)+ g2,1 ∂

∂β

(√g))

√g

+

(g1,2 ∂

∂α

(√g)+ g2,2 ∂

∂β

(√g))

√g

,

∂g

∂α= 2 ⟨Xα, Xα⟩ ⟨Xβ, Xαβ⟩+ 2 ⟨Xβ , Xβ⟩ ⟨Xα, Xαα⟩ −

2 ⟨Xα, Xβ⟩ ⟨Xβ , Xαα⟩ − 2 ⟨Xα, Xβ⟩ ⟨Xα, Xαβ⟩ ,∂g

∂β= 2 ⟨Xα, Xα⟩ ⟨Xβ, Xββ⟩+ 2 ⟨Xβ , Xβ⟩ ⟨Xα, Xαβ⟩ −

2 ⟨Xα, Xβ⟩ ⟨Xβ , Xαβ⟩ − 2 ⟨Xα, Xβ⟩ ⟨Xα, Xββ⟩ ,

93

Page 103: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

∂α

(g1,1)+

∂β

(g2,1)=2 ⟨Xβ , Xαβ⟩ g − ⟨Xβ , Xβ⟩ ∂

∂α (g)

g2+

−⟨Xα, Xββ⟩ g − ⟨Xβ , Xαβ⟩ g + ⟨Xα, Xβ⟩ ∂∂β (g)

g2

=⟨Xβ , Xαβ⟩ g − ⟨Xα, Xββ⟩ g −

(⟨Xβ , Xβ⟩ ∂

∂α (g)− ⟨Xα, Xβ⟩ ∂∂β (g)

)g2

,

∂α

(g1,2)+

∂β

(g2,2)=2 ⟨Xα, Xαβ⟩ g − ⟨Xα, Xα⟩ ∂

∂β (g)

g2+

−⟨Xβ , Xαα⟩ g − ⟨Xα, Xαβ⟩ g + ⟨Xα, Xβ⟩ ∂∂α (g)

g2

=⟨Xα, Xαβ⟩ g − ⟨Xβ , Xαα⟩ g −

(⟨Xα, Xα⟩ ∂

∂β (g)− ⟨Xα, Xβ⟩ ∂∂α (g)

)g2

,

g1,1∂

∂α(√g) + g2,1

∂β(√g) =

⟨Xβ , Xβ⟩ ∂∂α (g)− ⟨Xα, Xβ⟩ ∂

∂β (g)

2 g32

,

g1,2∂

∂α(√g) + g2,2

∂β(√g) =

⟨Xα, Xα⟩ ∂∂β (g)− ⟨Xα, Xβ⟩ ∂

∂α (g)

2 g32

.

Thus,

sH =⟨Xβ , Xβ⟩ Hαα − 2 ⟨Xα, Xβ⟩ Hαβ + ⟨Xα, Xα⟩ Hββ

g+

2 ⟨Xβ , Xαβ⟩ g − 2 ⟨Xα, Xββ⟩ g −(⟨Xβ , Xβ⟩

∂g

∂α− ⟨Xα, Xβ⟩

∂g

∂β

)2 g2

Hα+

2 ⟨Xα, Xαβ⟩ g − 2 ⟨Xβ , Xαα⟩ g −(⟨Xα, Xα⟩

∂g

∂β− ⟨Xα, Xβ⟩

∂g

∂α

)2 g2

Hβ .

Now we going to simplify the following expressions

I = 2 ⟨Xβ , Xαβ⟩ g − 2 ⟨Xα, Xββ⟩ g −(⟨Xβ , Xβ⟩

∂g

∂α− ⟨Xα, Xβ⟩

∂g

∂β

),

II = 2 ⟨Xα, Xαβ⟩ g − 2 ⟨Xβ , Xαα⟩ g −(⟨Xα, Xα⟩

∂g

∂β− ⟨Xα, Xβ⟩

∂g

∂α

),

94

Page 104: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

so

I =2 ⟨Xβ , Xαβ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − 2 ⟨Xβ, Xαβ⟩ ⟨Xα, Xβ⟩2−

2 ⟨Xα, Xββ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩+ 2 ⟨Xα, Xββ⟩ ⟨Xα, Xβ⟩2−

2 ⟨Xβ , Xβ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xαβ⟩ − 2 ⟨Xβ, Xβ⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xαα⟩+

2 ⟨Xβ , Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xβ , Xαα⟩+ 2 ⟨Xβ, Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xα, Xαβ⟩+

2 ⟨Xα, Xβ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xββ⟩+ 2 ⟨Xα, Xβ⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xαβ⟩−

2 ⟨Xα, Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xβ , Xαβ⟩ − 2 ⟨Xα, Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xα, Xββ⟩−

=2 ⟨Xα, Xαα⟩ ⟨Xβ , Xβ⟩2 + 2 ⟨Xβ , Xαα⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xβ⟩−

4 ⟨Xβ , Xαβ⟩ ⟨Xα, Xβ⟩2 + 4 ⟨Xα, Xαβ⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xβ⟩−

2 ⟨Xα, Xββ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩+ 2 ⟨Xβ, Xββ⟩ ⟨Xα, Xα⟩ ⟨Xα, Xβ⟩

=2 ⟨Xβ , Xβ⟩⟨Xαα, Xβ ⟨Xα, Xβ⟩ −Xα ⟨Xβ , Xβ⟩

⟩−

4 ⟨Xα, Xβ⟩⟨Xαβ, Xβ ⟨Xα, Xβ⟩ −Xα ⟨Xβ , Xβ⟩

⟩+

2 ⟨Xα, Xα⟩⟨Xββ , Xβ ⟨Xα, Xβ⟩ −Xα ⟨Xβ , Xβ⟩

⟩,

II =2 ⟨Xα, Xαβ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − 2 ⟨Xα, Xαβ⟩ ⟨Xα, Xβ⟩2−

2 ⟨Xβ , Xαα⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩+ 2 ⟨Xβ , Xαα⟩ ⟨Xα, Xβ⟩2−

2 ⟨Xα, Xα⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xββ⟩ − 2 ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xαβ⟩+

2 ⟨Xα, Xα⟩ ⟨Xα, Xβ⟩ ⟨Xβ , Xαβ⟩+ 2 ⟨Xα, Xα⟩ ⟨Xα, Xβ⟩ ⟨Xα, Xββ⟩+

2 ⟨Xα, Xβ⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xαβ⟩+ 2 ⟨Xα, Xβ⟩ ⟨Xβ , Xβ⟩ ⟨Xα, Xαα⟩−

2 ⟨Xα, Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xβ, Xαα⟩ − 2 ⟨Xα, Xβ⟩ ⟨Xα, Xβ⟩ ⟨Xα, Xαβ⟩

=− 2 ⟨Xβ , Xαα⟩ ⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩+ 2 ⟨Xα, Xαα⟩ ⟨Xβ, Xβ⟩ ⟨Xα, Xβ⟩−

4 ⟨Xα, Xαβ⟩ ⟨Xα, Xβ⟩2 + 4 ⟨Xβ , Xαβ⟩ ⟨Xα, Xα⟩ ⟨Xα, Xβ⟩−

2 ⟨Xβ , Xββ⟩ ⟨Xα, Xα⟩2 + 2 ⟨Xα, Xββ⟩ ⟨Xα, Xα⟩ ⟨Xα, Xβ⟩

=2 ⟨Xβ , Xβ⟩⟨Xαα, Xα ⟨Xα, Xβ⟩ −Xβ ⟨Xα, Xα⟩

⟩−

4 ⟨Xα, Xβ⟩⟨Xαβ , Xα ⟨Xα, Xβ⟩ −Xβ ⟨Xα, Xα⟩

⟩+

2 ⟨Xα, Xα⟩⟨Xββ , Xα ⟨Xα, Xβ⟩ −Xβ ⟨Xα, Xα⟩

⟩.

Let us define −→τ I and −→τ II as the following vectors

−→τ I = Xβ ⟨Xα, Xβ⟩ −Xα ⟨Xβ , Xβ⟩ , (A.2)

−→τ II = Xα ⟨Xα, Xβ⟩ −Xβ ⟨Xα, Xα⟩ , (A.3)

95

Page 105: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

then for I and II we obtain

I = 2⟨⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,

−→τ I⟩,

II = 2⟨⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,

−→τ II⟩,

and the surface Laplacian may be written as

sH =⟨Xβ , Xβ⟩ Hαα − 2 ⟨Xα, Xβ⟩ Hαβ + ⟨Xα, Xα⟩ Hββ

⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2+⟨

⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,−→τ I⟩

(⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2

)2 Hα+

⟨⟨Xα, Xα⟩ Xββ − 2 ⟨Xα, Xβ⟩ Xαβ + ⟨Xβ , Xβ⟩ Xαα,

−→τ II⟩

(⟨Xα, Xα⟩ ⟨Xβ , Xβ⟩ − ⟨Xα, Xβ⟩2

)2 Hβ ,

(A.4)

or in the equivalent normalized form

sH =

Hαα

∥Xα∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Hαβ

∥Xα∥ ∥Xβ∥+

Hββ

∥Xβ∥2

1−⟨

∥Xα∥,

∥Xβ∥

⟩2 +

⟨Xββ

∥Xβ∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Xαβ

∥Xα∥ ∥Xβ∥+

Xαα

∥Xα∥2,−→τ I⋆

⟩(1−

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩2)2

∥Xα∥+

⟨Xββ

∥Xβ∥2− 2

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩Xαβ

∥Xα∥ ∥Xβ∥+

Xαα

∥Xα∥2,−→τ II⋆

⟩(1−

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩2)2

∥Xβ∥,

(A.5)

where

−→τ I⋆ =Xβ

∥Xβ∥

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩− Xα

∥Xα∥, (A.6)

−→τ II⋆ =Xα

∥Xα∥

⟨Xα

∥Xα∥,Xβ

∥Xβ∥

⟩−

∥Xβ∥. (A.7)

96

Page 106: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Appendix B

Condition Formulations to Avoid

in Numerical Calculation of the

Jacobian

In our algorithm we numerically calculate the Jacobian matrix of the function F , see Sec-

tion 3.2. As mentioned in Section 2.6 we have equivalent formulations of some of the

conditions. For example ⟨−→n ,−→N⟩ = 0, (B.1)

and ⟨−→τ ,−→N⟩ = 1, (B.2)

where−→N denotes the unit normal vector to the bounding plane Π, −→n and −→τ denote the

unit normal and unit tangent vectors to the surface S, respectively, express equivalent

conditions. However condition (B.2) can be seen to be problematic in terms of numerical

implementation, as we now demonstrate.

Let X = X(t), Y = Y (t) denote two vector-valued functions in 3D that depend on a

single scalar number parameter t. We now show that if X ∥ Y , then dd t

⟨X

∥X∥ ,Y

∥Y ∥

⟩= 0.

Consider differentiation with respect to t of the normalized inner product⟨

X∥X∥ ,

Y∥Y ∥

⟩,

d

d t

⟨X

∥X∥,Y

∥Y ∥

⟩=

⟨d

d t

(X

∥X∥

),Y

∥Y ∥

⟩+

⟨d

d t

(Y

∥Y ∥

),X

∥X∥

⟩. (B.3)

Note that

∥X∥ =√

⟨X,X⟩, d

d t∥X∥ =

⟨X,X ′⟩∥X∥

,d

d t

(1

∥X∥

)= −⟨X,X ′⟩

∥X∥3,

97

Page 107: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

so that

d

d t

(X

∥X∥

)=X ′ ⟨X,X⟩ −X ⟨X,X ′⟩

∥X∥3=

X ′

∥X∥− X

∥X∥

⟨X

∥X∥,X ′

∥X∥

⟩.

Hence ⟨d

d t

(X

∥X∥

),Y

∥Y ∥

⟩=

⟨X ′

∥X∥,Y

∥Y ∥

⟩−⟨

X

∥X∥,Y

∥Y ∥

⟩⟨X

∥X∥,X ′

∥X∥

⟩=

⟨X ′

∥X∥,

[Y

∥Y ∥− X

∥X∥

⟨X

∥X∥,Y

∥Y ∥

⟩]⟩ . (B.4)

⟨d

d t

(Y

∥Y ∥

),X

∥X∥

⟩=

⟨Y ′

∥Y ∥,X

∥X∥

⟩−⟨

Y

∥Y ∥,X

∥X∥

⟩⟨Y

∥Y ∥,Y ′

∥Y ∥

⟩=

⟨Y ′

∥Y ∥,

[X

∥X∥− Y

∥Y ∥

⟨Y

∥Y ∥,X

∥X∥

⟩]⟩ . (B.5)

Substitution of expressions (B.4)-(B.5) into (B.3) gives

d

d t

⟨X

∥X∥,Y

∥Y ∥

⟩=

⟨X ′

∥X∥,

[Y

∥Y ∥− X

∥X∥

⟨X

∥X∥,Y

∥Y ∥

⟩]⟩+⟨

Y ′

∥Y ∥,

[X

∥X∥− Y

∥Y ∥

⟨Y

∥Y ∥,X

∥X∥

⟩]⟩ . (B.6)

Let us consider what happens when X ∥ Y . This implies that X∥X∥ = ± Y

∥Y ∥ , and thus

that [Y

∥Y ∥− X

∥X∥

⟨X

∥X∥,Y

∥Y ∥

⟩]= 0,

[X

∥X∥− Y

∥Y ∥

⟨Y

∥Y ∥,X

∥X∥

⟩]= 0. (B.7)

Henced

d t

⟨X

∥X∥,Y

∥Y ∥

⟩= 0, if X ∥ Y. (B.8)

Note that we can obtain the same result from the fact that⟨

X∥X∥ ,

Y∥Y ∥

⟩= ±1 if X ∥ Y .

Note now that condition (B.2) implies that −→τ ∥−→N , and thus from equation (B.8) we

obtain that the derivative of⟨−→τ ,−→N⟩ with respect to any variable equals zero. Suppose

condition (B.2) appears as one of the entries in function F . Then if initial conditions satisfy−→τ ∥ −→

N , we obtain a zero row in the Jacobian matrix. If initial conditions do not satisfy−→τ ∥

−→N , we obtain a zero row in the Jacobian matrix after some number of iterations as

soon as (B.2) is satisfied. Thus condition (B.2) is problematic for our computations. Note

that similar problem do not arise in implementing the equivalent condition (B.1), as we do

in our algorithm.

98

Page 108: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Appendix C

Source code in C

In this section we present the simulation parallel program written in ”C”. The program

consists of

Main program file: main.c (Listing C.1).

Header files: vars.inc.h (Listing C.2), f.inc.h (Listing C.3), inout.inc.h (Listing C.5), math.inc.h

(Listing C.7), share.inc.h (Listing C.9).

Source files: f.inc.c (Listing C.4), inout.inc.c (Listing C.6), math.inc.c (Listing C.8), share.inc.c

(Listing C.10).

These simulation program files are given below. Note that additional libraries from MAT-

LAB, MPI, UMFPACK, AMD, UFconfig are used.

Listing C.1: Code from the source file main.c ////////////////////////////////////////////////////////////////////////////////// main . c////////////////////////////////////////////////////////////////////////////////stat ic char sep [ ] =”##########################################” ;stat ic char sep1 [ ] =”*****************************************” ;stat ic char sep2 [ ] =”−−−−−−−−−−−−−−−−−−−−” ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include <s t d i o . h>#include <s t d l i b . h>#include <un i s td . h>#include <s t r i n g . h>#include <math . h>#include <time . h>#include <sys / s t a t . h>#include ”mpi . h”#include ”mat . h”#include”umfpack . h”#include”amd . h”#include”UFconfig . h”//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include ” vars . i nc . h”#include ” share . inc . h”#include ”math . inc . h”#include ” f . i nc . h”

99

Page 109: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

#include ” inout . inc . h”//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int FormF(mxArray * , void * ) ;int FormJ(mxArray * , void * ) ;//////////////////////////////////////////////////////////////////////////////////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// main func t ion o f program//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int main ( int argc , char *argv [ ] )

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−t ime t Time ;struct tm * TimeInfo ;int i ,* nnz d i sp l s , nnz , done=0, TimeIterNum , NewtonIterNum , s t a tu s ;int TimeIterNumberBegin=0; // beg in from t h i s number f o r time i t e r a t i o n sint MaxTimeIterNumber=50; // max number o f time i t e r a t i o n sint MaxNewtonIterNumber=10; // max number o f newton i t e r a t i o n sdouble NewtonEpsilon=1e−11;double norm value=0,normDX=0,normFX=0;char human time [BUFFSIZE ] , *DatePre f ix ;S i z e t S i z e ;Parms t Parms ;P lane t Planes [PLANES COUNT] ;So lLoc t OldTimeSolLoc , NewTimeSolLoc ;Segmentat ion t Segmentation ;AppCtx t CtxUser ; // user−de f ined con tex tCtxUser . S i z e=&S i z e ;CtxUser . Parms=&Parms ;CtxUser . Planes=Planes ;CtxUser . OldTimeSolLoc=&OldTimeSolLoc ;CtxUser . NewTimeSolLoc=&NewTimeSolLoc ;CtxUser . Segmentation=&Segmentation ;CtxUser . Zero=0;//1e−12//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// UMFPACK va r i a b l e s//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double Control [UMFPACKCONTROL] , In f o [UMFPACK INFO] ;void *Symbolic , *Numeric ;double s t a t s [ 2 ] , statsNewton [ 2 ] , statsTime [ 2 ] ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// MPI v a r i a b l e s//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int procs num , proc id , proc name len ;char proc name [MPI MAX PROCESSOR NAME] ;double StartWtime = 0 . 0 , EndWtime ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Matlab v a r i a b l e s//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−char *matinput ;char matoutput [BUFFSIZE ] ;char matDir [BUFFSIZE ] ;mxArray *pmxX=NULL, *pmxSize=NULL, *pmxParms=NULL, *pmxPlanes=NULL;double*pmxXData=NULL,* pmxSizeData=NULL,*pmxParmsData=NULL,* pmxPlanesData=NULL;mxArray *pmxFX=NULL, *pmxJFX=NULL, *pmxDX=NULL;double *pmxFXData=NULL, *pmxJFXData=NULL, *pmxDXData=NULL;long int *pmxJFXIr=NULL, *pmxJFXJc=NULL;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// i n i t i a t i n g MPI//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−MPI Init(&argc ,&argv ) ;MPI Comm size (MPICOMMWORLD,&procs num ) ;MPI Comm rank(MPICOMMWORLD,& proc id ) ;MPI Get processor name ( proc name ,&proc name len ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Read i n i t i a l data//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−OptionsGetInt ( argc , argv , ”−t ime beg in ” ,&TimeIterNumberBegin ) ;OptionsGetInt ( argc , argv , ”−time max” ,&MaxTimeIterNumber ) ;

100

Page 110: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

OptionsGetInt ( argc , argv , ”−newton max” ,&MaxNewtonIterNumber ) ;OptionsGetReal ( argc , argv , ”−newton eps ” ,&NewtonEpsilon ) ;OptionsGetReal ( argc , argv , ”−zero ” ,&CtxUser . Zero ) ;i f ( ! OptionsGetStr ( argc , argv , ”−f ” ,&matinput ) )

Pr in t f (MPICOMMWORLD, ”Error : Option −f must be de f ined .\n\n” ) ;done=1;

i f ( ! OptionsGetStr ( argc , argv , ”−da t e p r e f i x ” ,&DatePre f ix ) )

Pr in t f (MPICOMMWORLD, ”Error : Option −da t e p r e f i x must be de f ined .\n\n” ) ;done=1;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( ! done && proc id == ROOT ID)

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−StartWtime=MPI Wtime ( ) ;time(&Time ) ;TimeInfo=l o c a l t ime (&Time ) ;p r i n t f ( ”%s%s \n” , sep , sep ) ;p r i n t f ( ”Time Begin : %s ” , ct ime(&Time ) ) ;p r i n t f ( ”%s%s \n\n” , sep , sep ) ;f f l u s h ( stdout ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−done=LoadData (matinput ,&pmxX,&pmxSize ,&pmxParms,&pmxPlanes ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( ! done )

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−pmxSizeData=mxGetPr( pmxSize ) ; // s e t d i r e c t po in t e r to S i ze array datapmxParmsData=mxGetPr(pmxParms ) ; // s e t d i r e c t po in t e r to Parms array datapmxPlanesData=mxGetPr( pmxPlanes ) ; // s e t d i r e c t po in t e r to Planes array datapmxXData=mxGetPr(pmxX) ; // s e t d i r e c t po in t e r to X array data//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// order o f e lements in array S i ze ”N” ,”M” ,” es ” ,” gb”S i z e .N=( int ) pmxSizeData [ 0 ] ;S i z e .M=( int ) pmxSizeData [ 1 ] ;S i z e . e s=( int ) pmxSizeData [ 2 ] ;S i z e . gb=( int ) pmxSizeData [ 3 ] ;S i z e . esLength=S i z e . e s *4*( S i z e .N+2)*( S i z e .N+2);S i z e . gbLength=S i z e . gb *3*( S i z e .N+2)*( S i z e .M+2);S i z e . Length=S i z e . esLength+S i z e . gbLength ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// order o f e lements in array Parms ”m” ,” eps ” ,” dt ” ,”Lx” ,”Ly” ,”Lz”Parms .m=pmxParmsData [ 0 ] ;i f ( OptionsGetReal ( argc , argv , ”−m”,&Parms .m))

pmxParmsData [0 ]=Parms .m;Parms . eps=pmxParmsData [ 1 ] ;i f ( OptionsGetReal ( argc , argv , ”−eps ” ,&Parms . eps ) )

pmxParmsData [1 ]=Parms . eps ;Parms . dt=pmxParmsData [ 2 ] ;i f ( OptionsGetReal ( argc , argv , ”−dt” ,&Parms . dt ) )

pmxParmsData [2 ]=Parms . dt ;Parms . Lx=pmxParmsData [ 3 ] ;Parms . Ly=pmxParmsData [ 4 ] ;Parms . Lz=pmxParmsData [ 5 ] ;Parms . Teta=M PI−2.0* a s in (Parms .m/ 2 . 0 ) ;Parms . Phi=acos ( ( Parms .m*Parms .m−2)/((4−Parms .m*Parms .m) ) ) ;Parms . Ps i=acos(−Parms .m/( sq r t (3)* s q r t (4−Parms .m*Parms .m) ) ) ;Parms .Omega=acos(−Parms .m/ sq r t ( 3 ) ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// order o f e lements in array Planes N i , r 0 i f o r i =1 , . . . ,PLANES COUNTmemcpy( Planes , pmxPlanesData ,6*PLANES COUNT* s izeof (double ) ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// crea t e output d i r e c t o r ys p r i n t f (matDir , ”Output/%s output N=%03d M=%03d m=%.5 f d t=%.5f Lx=%.\

3 f Ly=%.3 f Lz=%.3 f ”, DatePref ix , S i z e .N, S i z e .M, Parms .m, Parms . dt , Parms . Lx

101

Page 111: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

,Parms . Ly , Parms . Lz ) ;i f (mkdir (matDir , S IRWXU | S IRGRP | S IXGRP | S IROTH |S IXOTH)==−1)

p r i n t f ( ”Error c r e a t e f o l d e r %s . [%s :%d ]\n” ,matDir , FILE , LINE ) ;f f l u s h ( stdout ) ;done=1;

MPI Bcast(&done , 1 , MPI INT , ROOT ID , MPICOMMWORLD) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Operation ”read i n i t data” i s f a i l e d//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( done )

mxDestroyArray ( pmxSize ) ;mxDestroyArray (pmxParms ) ;mxDestroyArray (pmxX) ;MPI Final ize ( ) ;return 0 ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Send i n i t i a l data to a l l p roces se s//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−MPI Bcast(&Size , SIZE COUNT, MPI INT , ROOT ID , MPICOMMWORLD) ;MPI Bcast(&Parms , PARMSCOUNT, MPI DOUBLE, ROOT ID , MPICOMMWORLD) ;MPI Bcast ( Planes , PLANES COUNT*6 , MPI DOUBLE, ROOT ID , MPICOMMWORLD) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// I n i t s t r u c t u r e Segmentation ( s p l i t t i n g o f data by proces se s )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Segmentation . counts = ( int *) mal loc ( procs num * s izeof ( int ) ) ;Segmentation . d i s p l s = ( int *) mal loc ( procs num * s izeof ( int ) ) ;Segmentation . nnz = ( int *) mal loc ( ( procs num+1) * s izeof ( int ) ) ;nn z d i s p l s = ( int *) mal loc ( ( procs num ) * s izeof ( int ) ) ;In i tSegmentat ion (&Segmentation , &Size , procs num , p ro c id ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−//Show some input parameters//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Pr in t f (MPICOMMWORLD, ” Input f i l e : %s \nOutput f o l d e r : %s \n” ,matinput , matDir ) ;P r i n t f (MPICOMMWORLD, ”−t ime beg in %d ; −time max %d ; −newton max %d ;\n”

, TimeIterNumberBegin , MaxTimeIterNumber , MaxNewtonIterNumber ) ;P r i n t f (MPICOMMWORLD, ”−newton eps %e ; −zero %e ;\n” , NewtonEpsilon

, CtxUser . Zero ) ;P r i n t f (MPICOMMWORLD, ”\n%s%s \n\n” , sep , sep ) ;P r i n t f (MPICOMMWORLD, ”N=%d , M=%d , Length=%d .\n” , S i z e .N, S i z e .M, S i z e . Length ) ;P r i n t f (MPICOMMWORLD, ”m=%.5f , dt=%.5f , eps=%e .\n” ,Parms .m, Parms . dt

,Parms . eps ) ;P r i n t f (MPICOMMWORLD, ”Lx=%.5f , Ly=%.5f , Lz=%e .\n” ,Parms . Lx , Parms . Ly

,Parms . Lz ) ;P r i n t f (MPICOMMWORLD, ”Teta=%.15f , Phi=%.15f , Ps i=%.15 f .\n” ,Parms . Teta

,Parms . Phi , Parms . Ps i ) ;for ( i =0; i<PLANES COUNT; i++)

Pr in t f (MPICOMMWORLD, ”Plane %d : N=(%f ,%f ,% f ) , r0=(%f ,%f ,% f )\n” , i+1, Planes [ i ] .N[ 0 ] , Planes [ i ] .N[ 1 ] , Planes [ i ] .N[ 2 ], Planes [ i ] . r0 [ 0 ] , Planes [ i ] . r0 [ 1 ] , Planes [ i ] . r0 [ 2 ] ) ;

Pr in t f (MPICOMMWORLD, ”\n%s%s \n\n” , sep , sep ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Show Segmentation//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Pr in t f (MPICOMMWORLD, ” Proce s s e s s t a tu s and segmentat ion :\n” ) ;Pr int fSynch (MPICOMMWORLD

, ”Process %d o f %d i s on %s ; counts [%d]=%d , d i s p l s [%d]=%d\n”, proc id , procs num , proc name , proc id , Segmentation . counts [ p r o c i d ]

, proc id , Segmentation . d i s p l s [ p r o c i d ] ) ;P r i n t f (MPICOMMWORLD, ”\n%s%s \n\n” , sep , sep ) ;P r i n t f (MPICOMMWORLD, ”Approximate number o f nonzero matrix e lements : %d\n”

, Segmentation . nnz [ procs num ] ) ;P r i n t f (MPICOMMWORLD, ”pid | ” ) ;Pr int fSynch (MPICOMMWORLD, ”%3d | ” , p ro c i d ) ;

102

Page 112: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Pr in t f (MPICOMMWORLD, ”\nnnz | ” ) ;Pr int fSynch (MPICOMMWORLD, ”%6d | ” , Segmentation . nnz [ p r o c i d ] ) ;P r i n t f (MPICOMMWORLD, ”\n” ) ;P r i n t f (MPICOMMWORLD, ”\n%s%s \n\n” , sep , sep ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Define s t r u c t u r e o f v a r i a b l e OldTimeSolLoc//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−OldTimeSolLoc . cx=S i z e . Length ;OldTimeSolLoc . dx=0;OldTimeSolLoc . x = (double *) mal loc (OldTimeSolLoc . cx * s izeof (double ) ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Define s t r u c t u r e o f v a r i a b l e s NewTimeSolLoc//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−NewTimeSolLoc . cx =S i z e . Length ;NewTimeSolLoc . dx =0;i f ( p ro c i d == ROOT ID)

NewTimeSolLoc . x=pmxXData ; else

NewTimeSolLoc . x = (double *) mal loc (NewTimeSolLoc . cx * s izeof (double ) ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Set NewTimeSolLoc and OldTimeSolLoc//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Recive NewTimeSolLoc from root procesesMPI Bcast (NewTimeSolLoc . x , S i z e . Length , MPI DOUBLE, ROOT ID, MPICOMMWORLD) ;// Update OldTimeSolLocmemcpy(OldTimeSolLoc . x , NewTimeSolLoc . x , OldTimeSolLoc . cx* s izeof (double ) ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Save input data//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( p ro c i d == ROOT ID)

s p r i n t f (matoutput , ”%s/output N=%03d M=%03d m=%.5 f d t=%.5f Lx=%.3f Ly=%.\3 f Lz=%.3f TimeI=%05d .mat”

,matDir , S i z e .N, S i z e .M, Parms .m, Parms . dt , Parms . Lx , Parms . Ly,Parms . Lz , TimeIterNumberBegin ) ;

SaveData (matoutput ,pmxX, pmxSize , pmxParms , pmxPlanes ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// I n i t i a l i z e arrays//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( p ro c i d == ROOT ID)

pmxFX=mxCreateDoubleMatrix ( S i z e . Length , 1 ,mxREAL) ;pmxJFX=mxCreateSparse ( S i z e . Length , S i z e . Length , Segmentation . nnz [ procs num ]

,mxREAL) ;pmxDX=mxCreateDoubleMatrix ( S i z e . Length , 1 ,mxREAL) ;pmxDXData=mxGetPr(pmxDX) ;

else pmxFX=mxCreateDoubleMatrix ( Segmentation . counts [ p r o c i d ] , 1 ,mxREAL) ;pmxJFX=mxCreateSparse ( S i z e . Length , Segmentation . counts [ p r o c i d ]

, Segmentation . nnz [ p r o c i d ] ,mxREAL) ;pmxFXData=mxGetPr(pmxFX) ;pmxJFXData=mxGetPr(pmxJFX) ;pmxJFXIr = mxGetIr (pmxJFX) ;pmxJFXJc = mxGetJc (pmxJFX) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−norm value=mpi norm(&NewTimeSolLoc . x [ Segmentation . d i s p l s [ p r o c i d ] ]

, Segmentation . counts [ p r o c i d ] , MPICOMMWORLD) ;P r i n t f (MPICOMMWORLD, ” | |X | | =%.15 f \n” , norm value ) ;FormF(pmxFX,&CtxUser ) ;normFX=mpi norm (pmxFXData , Segmentation . counts [ p r o c i d ] , MPICOMMWORLD) ;P r i n t f (MPICOMMWORLD, ” | |F(X) | | =%.15e\n” ,normFX ) ;P r i n t f (MPICOMMWORLD, ”\n%s%s \n” , sep , sep ) ;P r i n t f (MPICOMMWORLD, ”%s%s \n” , sep , sep ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// goto END ;double * vec to r ;vec to r=(double *) mal loc ( S i z e . Length * s izeof (double ) ) ;

103

Page 113: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−for (TimeIterNum=TimeIterNumberBegin+1;TimeIterNum<=MaxTimeIterNumber ;

TimeIterNum++)normDX=DBLMAX;umfpack t ic ( statsTime ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep1 ) ;P r i n t f (MPICOMMWORLD, ”TIME STEP %d :\n” ,TimeIterNum ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep1 ) ;// Update OldTimeSolLocmemcpy(OldTimeSolLoc . x , NewTimeSolLoc . x , OldTimeSolLoc . cx* s izeof (double ) ) ;// So lve non l inear system F( x )=0;for (NewtonIterNum=1;NewtonIterNum<=MaxNewtonIterNumber ; NewtonIterNum++)

umfpack t ic ( statsNewton ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep2 ) ;P r i n t f (MPICOMMWORLD, ”Newton i t e r a t i o n %d :\n” ,NewtonIterNum ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep2 ) ;// c a l c u l a t e F(X)umfpack t ic ( s t a t s ) ;FormF(pmxFX,&CtxUser ) ;umfpack toc ( s t a t s ) ;P r i n t f (MPICOMMWORLD, ”Time Ca l cu l a t i on F(X) : \ n” ) ;Sp l i tSecondsToStr ( s t a t s [ 0 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\ tWall c l o ck time : %s \n” , human time ) ;Sp l i tSecondsToStr ( s t a t s [ 1 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\tCPU time : %s \n\n” , human time ) ;// c a l c u l a t e J(X)umfpack t ic ( s t a t s ) ;nnz=FormJ(pmxJFX,&CtxUser ) ;umfpack toc ( s t a t s ) ;P r i n t f (MPICOMMWORLD, ”Time Ca l cu l a t i on JF(X) : \ n” ) ;Sp l i tSecondsToStr ( s t a t s [ 0 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\ tWall c l o ck time : %s \n” , human time ) ;Sp l i tSecondsToStr ( s t a t s [ 1 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\tCPU time : %s \n\n” , human time ) ;// Update array Segmentation . nnzMPI Allgather(&nnz , 1 ,MPI INT , Segmentation . nnz , 1 ,MPI INT ,MPICOMMWORLD) ;Segmentation . nnz [ procs num ]=0;for ( i =0; i<procs num ; i++)

nnz d i s p l s [ i ]=Segmentation . nnz [ procs num ] ;Segmentation . nnz [ procs num]+=Segmentation . nnz [ i ] ;

// send F an J to root processorMPI Gatherv (pmxFXData , Segmentation . counts [ p r o c i d ] , MPI DOUBLE

,pmxFXData , Segmentation . counts , Segmentation . d i s p l s,MPI DOUBLE, ROOT ID, MPICOMMWORLD) ;

MPI Gatherv (pmxJFXData , Segmentation . nnz [ p r o c i d ] , MPI DOUBLE,pmxJFXData , Segmentation . nnz , nn z d i s p l s

,MPI DOUBLE, ROOT ID, MPICOMMWORLD) ;MPI Gatherv (pmxJFXIr , Segmentation . nnz [ p r o c i d ] , MPI LONG

,pmxJFXIr , Segmentation . nnz , nn z d i s p l s,MPI LONG, ROOT ID, MPICOMMWORLD) ;

for ( i =0; i<Segmentation . counts [ p r o c i d ] ; i++)pmxJFXJc [ i ]+=nnz d i s p l s [ p r o c i d ] ;

MPI Gatherv (pmxJFXJc , Segmentation . counts [ p r o c i d ] , MPI LONG

,pmxJFXJc , Segmentation . counts , Segmentation . d i s p l s,MPI LONG, ROOT ID, MPICOMMWORLD) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( p r o c i d == ROOT ID)

pmxJFXJc [ S i z e . Length ]=Segmentation . nnz [ procs num ] ;// save matr ixes data/*mxArraySave (pmxFX, ”cFX.mat” , ”cFX”) ;mxArraySave (pmxJFX, ”cJFX.mat” , ”cJFX”) ;p r i n t f (”cFX.mat an cJFX.mat saved \n”) ;// *///−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// so l v e system J*d=Fumfpack t ic ( s t a t s ) ;umfpack d l de f au l t s ( Control ) ;

104

Page 114: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//Control [UMFPACK IRSTEP]=10;//Control [UMFPACKPRL] = 5 ;// umfpack d l r epo r t con t r o l ( Control ) ;s t a tu s=umfpack dl symbol ic ( S i z e . Length , S i z e . Length , pmxJFXJc , pmxJFXIr

,pmxJFXData,&Symbolic , Control , I n f o ) ;s t a tu s=umfpack dl numeric (pmxJFXJc , pmxJFXIr , pmxJFXData , Symbolic

,&Numeric , Control , I n f o ) ;umfpack d l f r e e symbo l i c (&Symbolic ) ;s t a tu s=umfpack d l so lve (UMFPACKA, pmxJFXJc , pmxJFXIr , pmxJFXData

,pmxDXData , pmxFXData , Numeric , Control , I n f o ) ;umfpack d l r epo r t i n f o ( Control , I n f o ) ;umfpack d l f r e e numer i c (&Numeric ) ;umfpack toc ( s t a t s ) ;p r i n t f ( ”Time Ca l cu la t i on Ax=b :\n” ) ;Sp l i tSecondsToStr ( s t a t s [ 0 ] , human time ) ;p r i n t f ( ”\ tWall c l o ck time : %s \n” , human time ) ;Sp l i tSecondsToStr ( s t a t s [ 1 ] , human time ) ;p r i n t f ( ”\tCPU time : %s \n\n” , human time ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e | |Ax−b | |memset ( vector , 0 , S i z e . Length* s izeof (double ) ) ;int p=0,k=0;for ( i =0; i<S i z e . Length ; i++)

for ( k=0;k<(pmxJFXJc [ i +1]−pmxJFXJc [ i ] ) ; k++)vec to r [ pmxJFXIr [ p]]+=pmxDXData [ i ]*pmxJFXData [ p ] ;p++;

for ( i =0; i<S i z e . Length ; i++)

vec to r [ i ]−=pmxFXData [ i ] ;norm value=norm( vector , S i z e . Length ) ;P r i n t f (MPICOMMWORLD, ” | |Ax−b | |=%.15 e\n\n” , norm value ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e | | d | |norm value=norm(pmxDXData , S i z e . Length ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ver i fy | | d | |i f ( norm value>=normDX)

Pr in t f (MPICOMMWORLD, ” | | d new | | >= | | d o ld | | \ n\n” ) ;done=1;

else //Update X = X − DXfor ( i =0; i<S i z e . Length ; i++)

pmxXData [ i ]−=pmxDXData [ i ] ;

normDX=norm value ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−MPI Bcast(&done , 1 , MPI INT , ROOT ID , MPICOMMWORLD) ;MPI Bcast(&normDX, 1 , MPI DOUBLE, ROOT ID , MPICOMMWORLD) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Print new Segmentation . nnzPr in t f (MPICOMMWORLD, ”Exact number o f nonzero matrix e lements : %d\n”

, Segmentation . nnz [ procs num ] ) ;P r i n t f (MPICOMMWORLD, ”pid | ” ) ;Pr int fSynch (MPICOMMWORLD, ”%3d | ” , p r o c i d ) ;P r i n t f (MPICOMMWORLD, ”\nnnz | ” ) ;Pr int fSynch (MPICOMMWORLD, ”%6d | ” , Segmentation . nnz [ p r o c i d ] ) ;P r i n t f (MPICOMMWORLD, ”\n\n” ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// update data in a l l pocessesMPI Bcast (NewTimeSolLoc . x , S i z e . Length ,MPI DOUBLE, ROOT ID,MPICOMMWORLD) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−norm value=mpi norm(&NewTimeSolLoc . x [ Segmentation . d i s p l s [ p r o c i d ] ]

, Segmentation . counts [ p r o c i d ] , MPICOMMWORLD) ;P r i n t f (MPICOMMWORLD, ” | |X | | =%.15 f \n” , norm value ) ;

105

Page 115: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

FormF(pmxFX,&CtxUser ) ;normFX=mpi norm (pmxFXData , Segmentation . counts [ p r o c i d ] , MPICOMMWORLD) ;P r i n t f (MPICOMMWORLD, ” | |F(X) | | =%.15e\n” ,normFX ) ;P r i n t f (MPICOMMWORLD, ” | | d | | =%.15e\n\n” ,normDX) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−umfpack toc ( statsNewton ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep2 ) ;P r i n t f (MPICOMMWORLD, ”Time f o r NEWTON i t e r a t i o n %d :\n” ,NewtonIterNum ) ;Spl i tSecondsToStr ( statsNewton [ 0 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\ tWall c l o ck time : %s \n” , human time ) ;Sp l i tSecondsToStr ( statsNewton [ 1 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\tCPU time : %s \n” , human time ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ver i fy convergencei f ( done | | normDX<=NewtonEpsilon | | normFX<=NewtonEpsilon )

break ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// ROOT ID process save data//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( p ro c i d == ROOT ID && ! done )

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−s p r i n t f (matoutput , ”%s /output N=%03d M=%03d m=%.5 f d t=%.5f Lx=%.3f Ly=%.\

3 f Lz=%.3f TimeI=%05d .mat”,matDir , S i z e .N, S i z e .M, Parms .m, Parms . dt , Parms . Lx , Parms . Ly

,Parms . Lz , TimeIterNum ) ;done=SaveData (matoutput ,pmxX, pmxSize , pmxParms , pmxPlanes ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−MPI Bcast(&done , 1 , MPI INT , ROOT ID , MPICOMMWORLD) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−umfpack toc ( statsTime ) ;P r i n t f (MPICOMMWORLD, ”%s \n” , sep1 ) ;P r i n t f (MPICOMMWORLD, ”Time f o r TIME i t e r a t i o n %d :\n” ,TimeIterNum ) ;Spl i tSecondsToStr ( statsTime [ 0 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\ tWall c l o ck time : %s \n” , human time ) ;Sp l i tSecondsToStr ( statsTime [ 1 ] , human time ) ;P r i n t f (MPICOMMWORLD, ”\tCPU time : %s \n” , human time ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( done ) break ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// f i n a l s e c t i on//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−END :

i f ( p ro c i d == ROOT ID)EndWtime = MPI Wtime ( ) ;time(&Time ) ;Sp l i tSecondsToStr (EndWtime−StartWtime , human time ) ;p r i n t f ( ”%s%s \n” , sep , sep ) ;p r i n t f ( ”%s%s \n” , sep , sep ) ;p r i n t f ( ” Ca l cu l a t i on took %s \n” , human time ) ;p r i n t f ( ”%s%s \n” , sep , sep ) ;p r i n t f ( ”Time End : %s” , ctime(&Time ) ) ;p r i n t f ( ”%s%s \n” , sep , sep ) ;f f l u s h ( stdout ) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Freeing work space .//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−f r e e ( vec to r ) ;f r e e ( Segmentation . counts ) ;f r e e ( Segmentation . d i s p l s ) ;f r e e ( nn z d i s p l s ) ;f r e e ( Segmentation . nnz ) ;f r e e ( OldTimeSolLoc . x ) ;

106

Page 116: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i f ( p ro c i d != ROOT ID)f r e e (NewTimeSolLoc . x ) ;

mxDestroyArray ( pmxSize ) ;mxDestroyArray (pmxParms ) ;mxDestroyArray (pmxX) ;mxDestroyArray (pmxFX) ;mxDestroyArray (pmxJFX) ;mxDestroyArray (pmxDX) ;// F ina l i z e MPIMPI Final ize ( ) ;return 0 ;

// end func t ion main ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Evaluate non l inear funct ion , F( x ) .

// Input Parameters :// snes − the SNES contex t// x − input vec to r// c t x − op t i ona l user−de f ined con tex t

// Output Parameter :// f − f unc t i on vec tor//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int FormF(mxArray * pmxFX, void * ctx )

AppCtx t *pCtxUser = (AppCtx t *) ctx ;So lLoc t *pOldTimeSolLoc=pCtxUser−>OldTimeSolLoc ;So lLoc t *pNewTimeSolLoc=pCtxUser−>NewTimeSolLoc ;Segmentat ion t *pSegmentation=pCtxUser−>Segmentation ;S i z e t * pSize=pCtxUser−>S i z e ;Parms t *pParms=pCtxUser−>Parms ;P lane t *pPlanes=pCtxUser−>Planes ;Po in t t Point ;int i , k ,STEP;double r e s [ 4 ] , *pmxFXData=mxGetPr(pmxFX) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i=pSegmentation−>begin ;while ( i<pSegmentation−>end ) //by rows

Point=Sp l i t Index ( i +1, pS ize ) ;F(&Point , pOldTimeSolLoc , pNewTimeSolLoc , pSize , pParms , pPlanes , r e s ) ;i f ( Point . s<=pSize−>es ) STEP=4;else STEP=3;for ( k=0;k<STEP; k++)

pmxFXData [ i+k−pSegmentation−>begin ]= r e s [ k ] ;i+=STEP;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−return 0 ;

// end func t ion FormF( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// FormJ − Evaluates Jacobian matrix .

// Input Parameters :// snes − the SNES contex t// x − input vec to r// c t x − op t i ona l user−de f ined con tex t

// Output Parameters :// A − Jacobian matrix// B − o p t i o n a l l y d i f f e r e n t precond i t i on ing matrix// f l a g − f l a g i n d i c a t i n g matrix s t r u c t u r e//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int FormJ(mxArray * pmxJFX, void * ctx )

AppCtx t *pCtxUser = (AppCtx t *) ctx ;So lLoc t *pOldTimeSolLoc=pCtxUser−>OldTimeSolLoc ;So lLoc t *pNewTimeSolLoc=pCtxUser−>NewTimeSolLoc ;Segmentat ion t *pSegmentation=pCtxUser−>Segmentation ;

107

Page 117: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

S i z e t * pSize=pCtxUser−>S i z e ;Parms t *pParms=pCtxUser−>Parms ;P lane t *pPlanes=pCtxUser−>Planes ;double Zero=pCtxUser−>Zero ;Po in t t Point ;int j , q , k , Index ,STEP, count eqs=0,nnz ;Po in t t eqs [MAXEQUATIONSNUM] ;double Fp [ 4 ] ,Fm[ 4 ] , r e s [ 4 ] , CurValue ;bool GoodSegmentation=f a l s e ;double *pmxJFXData=mxGetPr(pmxJFX) ;long int *pmxJFXIr = mxGetIr (pmxJFX) ,*pmxJFXJc = mxGetJc (pmxJFX) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// f i r s t entry to t h i s loop must beg in from ”Point . ind” equa l s to 1nnz=0;for ( j=pSegmentation−>begin ; j<pSegmentation−>end ; j++)//by columns

Point=Sp l i t Index ( j +1, pS ize ) ;i f ( Point . c==1)// ge t r e l e v an t equat ions

count eqs=GetEquations(&Point , pSize , eqs , MAXEQUATIONSNUM) ;i f ( count eqs==0)

p r i n t f ( ”Error : count eqs=0 f o r p ro c i d=%d . [%s :%d ]\n”, pSegmentation−>proc id , FILE , LINE ) ;

f f l u s h ( stdout ) ;return 0 ;

GoodSegmentation=true ;

else i f ( ! GoodSegmentation )p r i n t f ( ”Error [%d ] : bad Segmentation . [%s :%d ]\n” , pSegmentation−>proc id

, FILE , LINE ) ;f f l u s h ( stdout ) ;return 0 ;

CurValue=pNewTimeSolLoc−>x [ j ] ;pmxJFXJc [ j−pSegmentation−>begin ]=nnz ;for ( q=0;q<count eqs ; q++)// fo r each equat ion c a l c u l a t e d e r i v a t i v e

pNewTimeSolLoc−>x [ j ]=CurValue+pParms−>eps ;F(&eqs [ q ] , pOldTimeSolLoc , pNewTimeSolLoc , pSize , pParms , pPlanes , Fp ) ; //F( x+eps )pNewTimeSolLoc−>x [ j ]=CurValue−pParms−>eps ;F(&eqs [ q ] , pOldTimeSolLoc , pNewTimeSolLoc , pSize , pParms , pPlanes ,Fm) ; //F(x−eps )pNewTimeSolLoc−>x [ j ]=CurValue ;i f ( eqs [ q ] . s<=pSize−>es ) STEP=4;else STEP=3;Index=JoinIndex(&eqs [ q ] , pS ize )−1;for ( k=0;k<STEP; k++)

r e s [ k ]=(Fp [ k]−Fm[ k ] ) / ( 2 * pParms−>eps ) ;i f ( f abs ( r e s [ k])<=Zero ) r e s [ k ]=0;i f ( r e s [ k ] !=0)

pmxJFXIr [ nnz]= Index+k ;pmxJFXData [ nnz]= r e s [ k ] ;nnz++;

pmxJFXJc [ j−pSegmentation−>begin ]=nnz ;return nnz ;

//end func t ion FormJ ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Listing C.2: Code from the header file vars.inc.h #i f ! d e f i n ed (VARS INC H)#define VARS INC H//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#define ROOT ID 0#define BUFFSIZE 1024

108

Page 118: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

#define PLANES COUNT 5#define SIZE COUNT 7#define PARMSCOUNT 10#define MAXEQUATIONSNUM 50#define MAX(a , b) ( ( ( a ) > (b ) ) ? ( a ) : (b ) )#define ABS( a ) ( ( ( a ) > 0) ? ( a ) : (−a ) )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−typedef struct S i z e s

int N,M; //number o f inner po in t sint es ; //number o f e x t e r i o r su r f a c e sint gb ; //number o f gra in boundary su r f a c e sint esLength ; // es *4*(N+2)*(N+2);int gbLength ; //gb *3*(N+2)*(M+2);int Length ; // esLength+gbLength ; t o t a l number o f e lements

S i z e t ;

typedef struct Plane s double N[ 3 ] ; //normal vec to r o f p lanedouble r0 [ 3 ] ; //known poin t in p lane

Plane t ;

typedef struct Point s int s ; // sur face numberint i ; //row numberint j ; //column numberint c ; // coord inate number

Po int t ;

typedef struct Parms sdouble dt ; // time s t epdouble m; // r e l a t i v e sur face energydouble eps ; //used in c a l c u l a t i o n o f jacob iandouble Lx ;double Ly ;double Lz ;double Teta ; //pi−2*as in (m/2) ;double Phi ; //acos ((mˆ2−2)/(4−mˆ2) ) ;double Psi ; //acos (m/ s q r t (4−mˆ2)/ s q r t ( 3 ) ) ;double Omega ; //acos(−m/ s q r t ( 3 ) ) ;

Parms t ;

typedef struct So lLoc t double *x ; // s o l u t i onint cx ; // count o f e lementsint dx ; // disp lacement o f e lements

So lLoc t ;

typedef struct Segments s int * counts ;int * d i s p l s ;int *nnz ;int proc i d ;int procs num ;int l ength ;int begin ;int end ;

Segmentat ion t ; // Used in MPI Gatherv ( ) , MPI Scatterv ()

typedef struct AppCtx sS i z e t * S i z e ;Parms t *Parms ;P lane t *Planes ;So lLoc t *OldTimeSolLoc ;So lLoc t *NewTimeSolLoc ;Segmentat ion t *Segmentation ;double Zero ;

AppCtx t ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

109

Page 119: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

#endif Listing C.3: Code from the header file f.inc.h

#i f ! d e f i n ed (F INC H)#define F INC H//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include <s t d i o . h>#include <s tdboo l . h>#include <math . h>#include ” vars . i nc . h”#include ” share . inc . h”#include ”math . inc . h”//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void F( const Po int t * , const So lLoc t * , const So lLoc t * , const S i z e t *

, const Parms t * , const Plane t * , double * ) ;double CalcCornerFlux ( const Po int t * , const So lLoc t * , const S i z e t * ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#endif

Listing C.4: Code from the source file f.inc.c ////////////////////////////////////////////////////////////////////////////////// f . inc . c////////////////////////////////////////////////////////////////////////////////#include ” f . i nc . h”//////////////////////////////////////////////////////////////////////////////////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double FX(double x )

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double r e s =0;r e s=x*x−2;return r e s ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//end func t ion FX( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void F( const Po int t * pPoint , const So lLoc t *pOldTimeSolLoc

, const So lLoc t *pNewTimeSolLoc , const S i z e t * pSize, const Parms t *pParms , const Plane t *pPlanes , double * r e s )

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int k ,N,M, Index ,STEP, s1 , s2 , s3 ;double normal [ 3 ] , tmp [ 4 ] , Norma ;double dY [ 3 ] ;double Y[ 4 ] [ 3 ] [ 3 ] , Ya [ 4 ] ,Yb [ 4 ] , Yaa [ 4 ] , Ybb [ 4 ] ;double Ys1 [ 4 ] [ 3 ] [ 3 ] , Ys1a [ 4 ] , Ys1b [ 4 ] , Ys1aa [ 4 ] , Ys1bb [ 4 ] ;double Ys2 [ 4 ] [ 3 ] [ 3 ] , Ys2a [ 4 ] , Ys2b [ 4 ] ;double Ys3 [ 4 ] [ 3 ] [ 3 ] , Ys3a [ 4 ] , Ys3b [ 4 ] ;double tau s1 [ 3 ] , t au s2 [ 3 ] , t au s3 [ 3 ] ;Po in t t P;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s<=pSize−>es ) // e x t e r i o r su r f a c e s

N=pSize−>N;M=pSize−>N;STEP=4;

else i f ( pPoint−>s<=pSize−>es+pSize−>gb ) // grain boundariesN=pSize−>N;M=pSize−>M;STEP=3;

else p r i n t f ( ”Error : bad pPoint−>s (%d ) . [%s :%d ]\n” , pPoint−>s , FILE , LINE ) ;f f l u s h ( stdout ) ;return ;

110

Page 120: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// inner equa t ions//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f (2<=pPoint−>i && pPoint−>i<=N+1 && 2<=pPoint−>j && pPoint−>j<=M+1)

Sl i ceX ( pPoint , pNewTimeSolLoc , pSize ,Y) ;df ( pPoint ,Y, 3 , ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y, 3 , ’b ’ , pSize ,Yb ) ;d2f ( pPoint ,Y, 3 , ’ a ’ , pSize , Yaa ) ;d2f ( pPoint ,Y, 3 , ’b ’ , pSize ,Ybb ) ;n(Ya ,Yb, normal ) ;Index=JoinIndex ( pPoint , pS ize )−1;for ( k=0;k<3;k++)

dY[ k]=pOldTimeSolLoc−>x [ Index+k ] ; // ge t YkdY[ k ]=(Y[ k ] [ 1 ] [ 1 ] −dY[ k ] ) / pParms−>dt ;

i f ( pPoint−>s<=pSize−>es ) // e x t e r i o r su r f a c e s

r e s [0 ]= iprod (dY, normal ,3)+LH( pPoint ,Y, pSize ) ;r e s [3 ]=Y[ 3 ] [ 1 ] [ 1 ] −H( pPoint ,Y, pS ize ) ;

else r e s [0 ]= iprod (dY, normal ,3)−H( pPoint ,Y, pS ize ) ;

r e s [1 ]= iprod (Ya ,Yaa , 3 ) ;r e s [2 ]= iprod (Yb,Ybb , 3 ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// corner po in t I ˆ t//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i==1 && pPoint−>j==1)

i f ( pPoint−>s==1)// sur face 1P. s=1;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;df (&P, Ys1 , 3 , ’ a ’ , pSize , Ys1a ) ;P . s=2;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;P . s=3;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys3 ) ;df (&P, Ys3 , 3 , ’ a ’ , pSize , Ys3a ) ;P . s=4;S l i ceX(&P, pNewTimeSolLoc , pSize ,Y) ;df (&P,Y, 3 , ’b ’ , pSize ,Yb ) ;Norma=norm(Ys1a , 3 ) ;for ( k=0;k<=2;k++)Ys1a [ k]=Ys1a [ k ] /Norma ;Norma=norm(Ys2a , 3 ) ;for ( k=0;k<=2;k++)Ys2a [ k]=Ys2a [ k ] /Norma ;Norma=norm(Ys3a , 3 ) ;for ( k=0;k<=2;k++)Ys3a [ k]=Ys3a [ k ] /Norma ;Norma=norm(Yb , 3 ) ;for ( k=0;k<=2;k++)Yb[ k]=Yb[ k ] /Norma ;r e s [0 ]= iprod (Ys1a ,Yb,3)− cos (pParms−>Psi ) ;r e s [1 ]= iprod (Ys2a ,Yb,3)− cos (pParms−>Psi ) ;r e s [2 ]= iprod (Ys3a ,Yb,3)− cos (pParms−>Psi ) ;r e s [ 3 ]=0 ;P. s=1;for ( k=1;k<=3;k++)

P. s=k ;r e s [3]+=CalcCornerFlux(&P, pNewTimeSolLoc , pS ize ) ;

else // other su r f a c e s

P. s=1;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;S l i ceX ( pPoint , pNewTimeSolLoc , pSize ,Y) ;for ( k=0;k<STEP; k++)

r e s [ k]=Ys1 [ k ] [ 1 ] [ 1 ] −Y[ k ] [ 1 ] [ 1 ] ;

return ;

111

Page 121: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// boundary cond i t i ons f o r groove l i n e s//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−s1=0; s2=0; s3=0;// groove l i n e 1 ,2 ,4i f ( ( pPoint−>s==1 && pPoint−>j==1) | |

( pPoint−>s==4 && pPoint−>j==1) | |( pPoint−>s==2 && pPoint−>i ==1))

s1=1; s2=4; s3=2;// groove l i n e 2 ,3 ,5 else i f ( ( pPoint−>s==2 && pPoint−>j==1) | |

( pPoint−>s==5 && pPoint−>j==1) | |( pPoint−>s==3 && pPoint−>i ==1))

s1=2; s2=5; s3=3;// groove l i n e 3 ,1 ,6 else i f ( ( pPoint−>s==3 && pPoint−>j==1) | |

( pPoint−>s==6 && pPoint−>j==1) | |( pPoint−>s==1 && pPoint−>i ==1))

s1=3; s2=6; s3=1;// groove l i n e 4 ,5 ,6 else i f ( ( pPoint−>s==4 | | pPoint−>s==5 | | pPoint−>s==6) && pPoint−>i ==1)

s1=4; s2=5; s3=6;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( s1 !=0 && s2 !=0 && s3 !=0)

i f ( pPoint−>s==s1 )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( s1==4 && pPoint−>j==M+2)// corner po in t I ˆb

P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;df (&P, Ys1 , 3 , ’ a ’ , pSize , Ys1a ) ;P . s=s2 ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;P . s=s3 ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys3 ) ;df (&P, Ys3 , 3 , ’ a ’ , pSize , Ys3a ) ;Norma=norm(Ys1a , 3 ) ;for ( k=0;k<=2;k++)Ys1a [ k]=Ys1a [ k ] /Norma ;Norma=norm(Ys2a , 3 ) ;for ( k=0;k<=2;k++)Ys2a [ k]=Ys2a [ k ] /Norma ;Norma=norm(Ys3a , 3 ) ;for ( k=0;k<=2;k++)Ys3a [ k]=Ys3a [ k ] /Norma ;r e s [0 ]= iprod (Ys1a , Ys2a ,3)− cos ( 2 . 0 / 3 . 0*M PI ) ;r e s [1 ]= iprod (Ys1a , Ys3a ,3)− cos ( 2 . 0 / 3 . 0*M PI ) ;for ( k=0;k<=2;k++) tmp [ k]=Ys1 [ k ] [ 1 ] [ 1 ] − pPlanes [ 4 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 4 ] . N, 3 ) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− else i f ( pPoint−>i==N+2)// corner po in t s I I ˆ t , I I I ˆ t , IVˆ t

P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;i f ( s1==1)// I I ˆ t

df (&P, Ys1 , 3 , ’ a ’ , pSize , Ys1a ) ;r e s [0 ]= tprod (Ys1a , pPlanes [ 0 ] . N, pPlanes [ 1 ] .N) ;for ( k=0;k<=2;k++) tmp [ k]=Ys1 [ k ] [ 1 ] [ 1 ] − pPlanes [ 0 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 0 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Ys1 [ k ] [ 1 ] [ 1 ] − pPlanes [ 1 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 1 ] . N, 3 ) ;

else i f ( s1==2)// I I I ˆ tP. s=s2 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;df (&P, Ys2 , 3 , ’b ’ , pSize , Ys2b ) ;n (Ys2a , Ys2b , normal ) ;r e s [0 ]= iprod (Ys2a , Ys2b , 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 2 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Ys1 [ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;

112

Page 122: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

r e s [2 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ; else i f ( s1==3)//IVˆ t

P. s=s2 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;df (&P, Ys2 , 3 , ’b ’ , pSize , Ys2b ) ;n (Ys2a , Ys2b , normal ) ;r e s [0 ]= iprod (Ys2a , Ys2b , 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 3 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Ys1 [ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;

// cond i t i ons on Hr e s [ 3 ]=0 ;P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;r e s [3]+=CalcCornerFlux(&P, pNewTimeSolLoc , pS ize ) ;P . s=s3 ;P. i=pPoint−>j ;P . j=pPoint−>i ;r e s [3]+=CalcCornerFlux(&P, pNewTimeSolLoc , pS ize ) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− else i f ( s1==4)// groove l i n e 4 ,5 ,6

P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;df (&P, Ys1 , 3 , ’ a ’ , pSize , Ys1a ) ;df (&P, Ys1 , 3 , ’b ’ , pSize , Ys1b ) ;d2f (&P, Ys1 , 3 , ’b ’ , pSize , Ys1bb ) ;P . s=s2 ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;df (&P, Ys2 , 3 , ’b ’ , pSize , Ys2b ) ;P . s=s3 ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys3 ) ;df (&P, Ys3 , 3 , ’ a ’ , pSize , Ys3a ) ;df (&P, Ys3 , 3 , ’b ’ , pSize , Ys3b ) ;TauI (Ys1a , Ys1b , tau s1 ) ;TauI (Ys2a , Ys2b , tau s2 ) ;TauI (Ys3a , Ys3b , tau s3 ) ;Norma=norm( tau s1 , 3 ) ;for ( k=0;k<=2;k++) tau s1 [ k]= tau s1 [ k ] /Norma ;Norma=norm( tau s2 , 3 ) ;for ( k=0;k<=2;k++) tau s2 [ k]= tau s2 [ k ] /Norma ;Norma=norm( tau s3 , 3 ) ;for ( k=0;k<=2;k++) tau s3 [ k]= tau s3 [ k ] /Norma ;r e s [0 ]= iprod ( tau s1 , tau s2 ,3)− cos ( 2 . 0 / 3 . 0*M PI ) ;r e s [1 ]= iprod ( tau s1 , tau s3 ,3)− cos ( 2 . 0 / 3 . 0*M PI ) ;r e s [2 ]= iprod (Ys1b , Ys1bb , 3 ) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− else // groove l i n e s 1 ,2 ,4 ; 2 ,3 ,5 ; 3 ,1 ,6

P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;df (&P, Ys1 , 4 , ’ a ’ , pSize , Ys1a ) ;df (&P, Ys1 , 4 , ’b ’ , pSize , Ys1b ) ;d2f (&P, Ys1 , 3 , ’ a ’ , pSize , Ys1aa ) ;P . s=s2 ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys2 ) ;df (&P, Ys2 , 3 , ’ a ’ , pSize , Ys2a ) ;df (&P, Ys2 , 3 , ’b ’ , pSize , Ys2b ) ;P . s=s3 ;P. i=pPoint−>j ;P . j=pPoint−>i ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys3 ) ;df (&P, Ys3 , 4 , ’ a ’ , pSize , Ys3a ) ;df (&P, Ys3 , 4 , ’b ’ , pSize , Ys3b ) ;TauII (Ys1a , Ys1b , tau s1 ) ;TauII (Ys2a , Ys2b , tau s2 ) ;TauI (Ys3a , Ys3b , tau s3 ) ;Norma=norm( tau s1 , 3 ) ;for ( k=0;k<=2;k++) tau s1 [ k]= tau s1 [ k ] /Norma ;Norma=norm( tau s2 , 3 ) ;for ( k=0;k<=2;k++) tau s2 [ k]= tau s2 [ k ] /Norma ;Norma=norm( tau s3 , 3 ) ;

113

Page 123: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

for ( k=0;k<=2;k++) tau s3 [ k]= tau s3 [ k ] /Norma ;r e s [0 ]= iprod ( tau s2 , tau s1 ,3)− cos (M PI−pParms−>Teta / 2 . 0 ) ;r e s [1 ]= iprod ( tau s2 , tau s3 ,3)− cos (M PI−pParms−>Teta / 2 . 0 ) ;r e s [2 ]= iprod (Ys1a , Ys1aa , 3 ) ;

TauII (Ys1a , Ys1b , tau s1 ) ;TauI (Ys3a , Ys3b , tau s3 ) ;r e s [3]=(− iprod (Ys3b , Ys3b , 3 ) *Ys3a [ 3 ] + iprod (Ys3a , Ys3b , 3 ) *Ys3b [ 3 ] )

/norm( tau s3 ,3)+(− iprod (Ys1a , Ys1a , 3 ) *Ys1b [ 3 ] + iprod (Ys1a , Ys1b , 3 ) *Ys1a [ 3 ] )

/norm( tau s1 , 3 ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

else Sl i ceX ( pPoint , pNewTimeSolLoc , pSize ,Y) ;i f ( pPoint−>s<=pSize−>es && pPoint−>s==s3 )

P. s=s1 ;P. i=pPoint−>j ;P . j=pPoint−>i ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;

else P. s=s1 ;P. i=pPoint−>i ;P . j=pPoint−>j ;S l i ceX(&P, pNewTimeSolLoc , pSize , Ys1 ) ;

for ( k=0;k<STEP; k++)

r e s [ k]=Ys1 [ k ] [ 1 ] [ 1 ] −Y[ k ] [ 1 ] [ 1 ] ;

return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// boundary cond i t i ons f o r f r e e boundaries//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( ( pPoint−>i==N+2 && pPoint−>j>1) | | ( pPoint−>i>1 && pPoint−>j==M+2))

Sl i ceX ( pPoint , pNewTimeSolLoc , pSize ,Y) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i==N+2 && pPoint−>j==M+2)// po in t s CˆI ,Cˆ II ,Cˆ II I , I I ˆb , I I I ˆb , IVˆb

i f ( pPoint−>s==4)// I I ˆbfor ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 0 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 0 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 1 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 1 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 4 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 4 ] . N, 3 ) ;

else i f ( pPoint−>s==5)// I I I ˆbdf ( pPoint ,Y, 3 , ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y, 3 , ’b ’ , pSize ,Yb ) ;n(Ya ,Yb, normal ) ;for ( k=0;k<=2;k++) tmp [ k]=pPlanes [ 2 ] .N[ k]+pPlanes [ 4 ] .N[ k ] ;r e s [0 ]= iprod (tmp , normal , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 4 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 4 ] . N, 3 ) ;

else i f ( pPoint−>s==6)//IVˆbdf ( pPoint ,Y, 3 , ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y, 3 , ’b ’ , pSize ,Yb ) ;n(Ya ,Yb, normal ) ;for ( k=0;k<=2;k++) tmp [ k]=pPlanes [ 3 ] .N[ k]+pPlanes [ 4 ] .N[ k ] ;r e s [0 ]= iprod (tmp , normal , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 4 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 4 ] . N, 3 ) ;

else // corner po in t s CˆI ,Cˆ II ,Cˆ I I Idf ( pPoint ,Y, 3 , ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y, 3 , ’b ’ , pSize ,Yb ) ;n(Ya ,Yb, normal ) ;i f ( pPoint−>s==1)//Cˆ I

for ( k=0;k<=2;k++) tmp [ k]=pPlanes [ 0 ] .N[ k]+pPlanes [ 3 ] .N[ k ] ;

114

Page 124: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

r e s [0 ]= iprod (tmp , normal , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 0 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 0 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;

else i f ( pPoint−>s==2)//Cˆ I Ifor ( k=0;k<=2;k++) tmp [ k]=pPlanes [ 1 ] .N[ k]+pPlanes [ 2 ] .N[ k ] ;r e s [0 ]= iprod (tmp , normal , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 1 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 1 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;

else i f ( pPoint−>s==3)//Cˆ I I Ifor ( k=0;k<=2;k++) tmp [ k]=pPlanes [ 2 ] .N[ k]+pPlanes [ 3 ] .N[ k ] ;r e s [0 ]= iprod (tmp , normal , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;

r e s [3]=−CalcCornerFlux ( pPoint , pNewTimeSolLoc , pS ize ) ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− else i f ( pPoint−>i==N+2) // f r e e boundaries

df ( pPoint ,Y,STEP, ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y,STEP, ’b ’ , pSize ,Yb ) ;d2f ( pPoint ,Y, 3 , ’b ’ , pSize ,Ybb ) ;n(Ya ,Yb, normal ) ;i f ( pPoint−>s<=pSize−>es )

TauI (Ya ,Yb, tau s1 ) ;TauII (Ya ,Yb, tau s2 ) ;i f ( pPoint−>s==1)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 0 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 0 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 0 ] .N , 3 ) ;r e s [2 ]= iprod (Yb,Ybb , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 0 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 0 ] . N, 3 ) *Yb [ 3 ] ; else i f ( pPoint−>s==2)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 2 ] .N , 3 ) ;r e s [2 ]= iprod (Yb,Ybb , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 2 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 2 ] . N, 3 ) *Yb [ 3 ] ; else i f ( pPoint−>s==3)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 3 ] .N , 3 ) ;r e s [2 ]= iprod (Yb,Ybb , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 3 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 3 ] . N, 3 ) *Yb [ 3 ] ;

else r e s [0 ]= iprod (Yb,Ybb , 3 ) ;i f ( pPoint−>s==4)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 0 ] . r0 [ k ] ;r e s [1 ]= iprod (tmp , pPlanes [ 0 ] . N, 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 1 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 1 ] . N, 3 ) ;

else i f ( pPoint−>s==5)r e s [1 ]= iprod ( normal , pPlanes [ 2 ] .N , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;

else i f ( pPoint−>s==6)r e s [1 ]= iprod ( normal , pPlanes [ 3 ] .N , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;

115

Page 125: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− else // pPoint−>j==M+2// f r e e boundaries

df ( pPoint ,Y,STEP, ’ a ’ , pSize ,Ya ) ;df ( pPoint ,Y,STEP, ’b ’ , pSize ,Yb ) ;d2f ( pPoint ,Y, 3 , ’ a ’ , pSize , Yaa ) ;n(Ya ,Yb, normal ) ;i f ( pPoint−>s<=pSize−>es )

TauI (Ya ,Yb, tau s1 ) ;TauII (Ya ,Yb, tau s2 ) ;i f ( pPoint−>s==1)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 3 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 3 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 3 ] .N , 3 ) ;r e s [2 ]= iprod (Ya ,Yaa , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 3 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 3 ] . N, 3 ) *Yb [ 3 ] ; else i f ( pPoint−>s==2)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 1 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 1 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 1 ] .N , 3 ) ;r e s [2 ]= iprod (Ya ,Yaa , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 1 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 1 ] . N, 3 ) *Yb [ 3 ] ; else i f ( pPoint−>s==3)

for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 2 ] . r0 [ k ] ;r e s [0 ]= iprod (tmp , pPlanes [ 2 ] . N, 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 2 ] .N , 3 ) ;r e s [2 ]= iprod (Ya ,Yaa , 3 ) ;r e s [3 ]= iprod ( tau s1 , pPlanes [ 2 ] . N, 3 ) *Ya[3 ]+

iprod ( tau s2 , pPlanes [ 2 ] . N, 3 ) *Yb [ 3 ] ;

else r e s [0 ]= iprod (Ya ,Yaa , 3 ) ;r e s [1 ]= iprod ( normal , pPlanes [ 4 ] .N , 3 ) ;for ( k=0;k<=2;k++) tmp [ k]=Y[ k ] [ 1 ] [ 1 ] − pPlanes [ 4 ] . r0 [ k ] ;r e s [2 ]= iprod (tmp , pPlanes [ 4 ] . N, 3 ) ;

return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−p r i n t f ( ”Error . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// end func t ion F( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double CalcCornerFlux ( const Po int t * pPoint , const So lLoc t *pSolLoc

, const S i z e t * pSize )int N,M, coe f a lpha , c o e f b e t a ;Po in t t P,Q;double YP[ 4 ] [ 3 ] [ 3 ] , YPa [ 4 ] ,YPb [ 4 ] ;double YQ[ 4 ] [ 3 ] [ 3 ] ,YQa[ 4 ] ,YQb [ 4 ] ;double L , res , gP ,gQ ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s>pSize−>es )

p r i n t f ( ”Error CalcCornerFlux ( ) : only f o r e x t e r i o r su r f a c e s , po int \(%d,%d,%d) [%s :%d ]\n”

, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;f f l u s h ( stdout ) ;return 0 ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−N=pSize−>N;M=pSize−>N;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

116

Page 126: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i f ( ( pPoint−>i !=1 && pPoint−>i !=N+2) | | ( pPoint−>j !=1 && pPoint−>j !=M+2))p r i n t f ( ”Error CalcCornerFlux ( ) : bad indexes , po int (%d,%d,%d) [%s :%d ]\n”

, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;f f l u s h ( stdout ) ;return 0 ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i ==1)

co e f a l pha =1; else

co e f a l pha=−1;i f ( pPoint−>j==1)

c o e f b e t a =1; else

c o e f b e t a=−1;P. s=pPoint−>s ;P . i=pPoint−>i+co e f a l pha ;P. j=pPoint−>j ;Q. s=pPoint−>s ;Q. i=pPoint−>i ;Q. j=pPoint−>j+co e f b e t a ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Sl i ceX(&P, pSolLoc , pSize ,YP) ;df (&P,YP, 4 , ’ a ’ , pSize ,YPa ) ;df (&P,YP, 4 , ’b ’ , pSize ,YPb) ;S l i ceX(&Q, pSolLoc , pSize ,YQ) ;df (&Q,YQ,4 , ’ a ’ , pSize ,YQa) ;df (&Q,YQ,4 , ’b ’ , pSize ,YQb) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−gP=iprod (YPa,YPa, 3 )* iprod (YPb,YPb,3)−pow( iprod (YPa,YPb, 3 ) , 2 ) ;gQ=iprod (YQa,YQa, 3 ) * iprod (YQb,YQb,3)−pow( iprod (YQa,YQb, 3 ) , 2 ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−L=sq r t (gP)/norm(YPa,3)+ sq r t (gQ)/norm(YQb, 3 ) ;r e s=( co e f a l pha * YPa [ 3 ] / norm(YPa, 3 ) +co e f b e t a * YQb[ 3 ] / norm(YQb, 3 ) )*L ;return r e s ;

//end func t ion CalcCornerFlux ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Listing C.5: Code from the header file inout.inc.h #i f ! d e f i n ed (INTOUT INC H)#define INOUT INC H//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include <s t d i o . h>#include <s tdarg . h>#include <s tdboo l . h>#include <s t r i n g . h>#include <math . h>#include ” vars . i nc . h”#include ”mat . h”#include ”mpi . h”//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int LoadData ( const char * , mxArray ** , mxArray ** , mxArray ** , mxArray ** ) ;int SaveData ( const char * , mxArray * , mxArray * , mxArray * , mxArray * ) ;void Print fSynch (MPI Comm, const char * , . . . ) ;void Pr in t f (MPI Comm, const char * , . . . ) ;int mxArraySave (mxArray * , const char * , const char * ) ;// void matSaveVector ( doub le * , Segmentat ion t * , in t , const char * , const char * ) ;// i n t matSavePetscSparseMatrix (Mat , Segmentat ion t * , in t , const char * , const char * ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#endif

Listing C.6: Code from the source file inout.inc.c ////////////////////////////////////////////////////////////////////////////////

117

Page 127: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

// inout . inc . c////////////////////////////////////////////////////////////////////////////////#include ” inout . inc . h”////////////////////////////////////////////////////////////////////////////////int LoadData ( const char * matinput , mxArray **pmxX, mxArray **pmxSize

, mxArray **pmxParms , mxArray **pmxPlanes )MATFile * pmat f i l e=NULL;int e r r o r =0;i f ( ( pmat f i l e = matOpen(matinput , ” r ” ) ) == NULL) // open mat f i l e

p r i n t f ( ”Error opening f i l e %s . [%s :%d ]\n” , matinput , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

else // read S i zei f ( ! e r r o r )

*pmxSize = matGetVariable ( pmat f i l e , ” S i z e ” ) ;i f (* pmxSize == NULL)

p r i n t f ( ”Error read ing vec to r S i z e . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// read Parmsi f ( ! e r r o r )

*pmxParms = matGetVariable ( pmat f i l e , ”Parms” ) ;i f (*pmxParms == NULL)

p r i n t f ( ”Error read ing vec to r Parms . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// read Planesi f ( ! e r r o r )

*pmxPlanes = matGetVariable ( pmat f i l e , ”Planes ” ) ;i f (* pmxPlanes == NULL)

p r i n t f ( ”Error read ing vec to r Planes . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// read Xi f ( ! e r r o r )

*pmxX = matGetVariable ( pmat f i l e , ”X” ) ;i f (*pmxX == NULL)

p r i n t f ( ”Error read ing vec to r X. [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

i f ( matClose ( pmat f i l e ) != 0) // c l o s e mat f i l e

p r i n t f ( ”Error c l o s i n g f i l e %s . [%s :%d ]\n” ,matinput , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

return e r r o r ;

//end func t ion LoadData ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int SaveData ( const char * matoutput , mxArray *pmxX, mxArray *pmxSize

, mxArray *pmxParms , mxArray *pmxPlanes )MATFile * pmat f i l e=NULL;int e r r o r =0, s t a tu s ;i f ( ( pmat f i l e= matOpen(matoutput , ”w” ) ) == NULL) // open mat f i l e

p r i n t f ( ”Error c r e a t i n g f i l e %s . [%s :%d ]\n” ,matoutput , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

118

Page 128: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

else // save S i zei f ( pmxSize != NULL && ! e r r o r )

s t a tu s = matPutVariable ( pmat f i l e , ” S i z e ” , pmxSize ) ;i f ( s t a tu s != 0)

p r i n t f ( ”Error us ing matPutVariable ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// save Parmsi f (pmxParms != NULL && ! e r r o r )

s t a tu s = matPutVariable ( pmat f i l e , ”Parms” , pmxParms ) ;i f ( s t a tu s != 0)

p r i n t f ( ”Error us ing matPutVariable ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// save Planesi f ( pmxPlanes != NULL && ! e r r o r )

s t a tu s = matPutVariable ( pmat f i l e , ”Planes ” , pmxPlanes ) ;i f ( s t a tu s != 0)

p r i n t f ( ”Error matPutVariable ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

// save Xi f (pmxX != NULL && ! e r r o r )

s t a tu s = matPutVariable ( pmat f i l e , ”X” , pmxX) ;i f ( s t a tu s != 0)

p r i n t f ( ”Error us ing matPutVariable ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

i f ( matClose ( pmat f i l e ) != 0) // c l o s e mat f i l e

p r i n t f ( ”Error c l o s i n g f i l e %s . [%s :%d ]\n” ,matoutput , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

return e r r o r ;

//end func t ion SaveRes ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void Print fSynch (MPI Comm comm, const char * format , . . . )

v a l i s t args ;MPI Status s t a tu s ;const int Bu f f e rS i z e =1024;char Buf f e r [ Bu f f e r S i z e ] ;int rank , s i z e , i , tag ;tag=comm;//memset ( Buffer , ’\0 ’ , Bu f f e rS i z e ) ;MPI Comm size (comm,& s i z e ) ;MPI Comm rank(comm,&rank ) ;v a s t a r t ( args , format ) ;i f ( rank==0)

vp r i n t f ( format , args ) ;f f l u s h ( stdout ) ;for ( i =1; i<s i z e ; i++)

MPI Recv ( Buffer , Bu f f e rS i z e ,MPI CHAR, i , tag , comm,& s ta tu s ) ;p r i n t f ( ”%s ” , Buf f e r ) ;f f l u s h ( stdout ) ;

else

119

Page 129: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

v s p r i n t f ( Buf fer , format , args ) ;MPI Send ( Buffer , Bu f f e rS i z e ,MPI CHAR,0 , tag ,comm) ;

va end ( args ) ;//MPI Barrier (comm) ;

//end func t ion Print fSynch ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void Pr in t f (MPI Comm comm, const char * format , . . . )

v a l i s t args ;int rank ;MPI Comm rank(comm,&rank ) ;i f ( rank==0)

va s t a r t ( args , format ) ;v p r i n t f ( format , args ) ;f f l u s h ( stdout ) ;va end ( args ) ;

//MPI Barrier (comm) ;

//end func t ion Pr in t f ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int mxArraySave (mxArray * pmxData , const char * fname , const char * vname)

MATFile * pmat f i l e=NULL;int s tatus , e r r o r =0;i f ( ( pmat f i l e= matOpen( fname , ”w” ) ) == NULL) // open mat f i l e

p r i n t f ( ”Error c r e a t i n g f i l e %s . [%s :%d ]\n” , fname , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

else s t a tu s = matPutVariable ( pmat f i l e , vname , pmxData ) ;i f ( s t a tu s != 0)

p r i n t f ( ”Error matPutVariable ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

i f ( matClose ( pmat f i l e ) != 0) // c l o s e mat f i l e

p r i n t f ( ”Error c l o s i n g f i l e %s . [%s :%d ]\n” , fname , FILE , LINE ) ;f f l u s h ( stdout ) ;e r r o r =1;

return e r r o r ;

//end func t ion mxArraySave ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Listing C.7: Code from the header file math.inc.h #i f ! d e f i n ed (MATH INC H)#define MATH INC H//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include <s t d i o . h>#include <s t d l i b . h>#include <s tdboo l . h>#include <math . h>#include ”mat . h”#include ”mpi . h”#include ” vars . i nc . h”//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// void mpi norm(mxArray * , mxArray * , ) ;double mpi norm ( const double * , int , MPI Comm) ;double LH( const Po int t * ,double ( * ) [ 3 ] [ 3 ] , const S i z e t * ) ;double H( const Po int t * ,double ( * ) [ 3 ] [ 3 ] , const S i z e t * ) ;

120

Page 130: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

void d2f ( const Po int t * ,double ( * ) [ 3 ] [ 3 ] , int , char , const S i z e t * ,double * ) ;void df ( const Po int t * ,double ( * ) [ 3 ] [ 3 ] , int , char , const S i z e t * ,double * ) ;double iprod ( const double * , const double * , int ) ;void vprod ( const double * , const double * ,double * ) ;double tprod ( const double * , const double * , const double * ) ;double norm( const double * , int ) ;void n( const double * , const double * , double * ) ;void TauI ( const double * , const double * , double * ) ;void TauII ( const double * , const double * , double * ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#endif

Listing C.8: Code from the source file math.inc.c ////////////////////////////////////////////////////////////////////////////////// math . inc . h////////////////////////////////////////////////////////////////////////////////#include ”math . inc . h”//////////////////////////////////////////////////////////////////////////////////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double mpi norm ( const double *data , int n , MPI Comm comm)

double *tmp , InnerProd ;int s i z e , i ;MPI Comm size (comm,& s i z e ) ;tmp=(double *) mal loc ( s i z e * s izeof (double ) ) ;InnerProd=iprod ( data , data , n ) ;MPI Allgather(&InnerProd , 1 ,MPI DOUBLE, tmp , 1 ,MPI DOUBLE,comm) ;InnerProd=0;for ( i =0; i<s i z e ; i++)

InnerProd+=tmp [ i ] ;f r e e (tmp ) ;return s q r t ( InnerProd ) ;

//end func t ion mpi norm ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e Laplacian o f the mean curvature//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double LH( const Po int t * pPoint , double (*X) [ 3 ] [ 3 ] , const S i z e t * pSize )

double Xa [ 4 ] ,Xb [ 4 ] , Xaa [ 4 ] , Xab [ 4 ] , Xbb [ 4 ] , F [ 3 ] , normal [ 3 ] , tauI [ 3 ] , t au I I [ 3 ] ;double Ha ,Hb,Haa ,Hab ,Hbb ;double res , g , Xa Xa , Xa Xb , Xb Xb ;int k ;i f ( pPoint−>s>pSize−>es )

p r i n t f ( ”Error LH( ) : only f o r e x t e r i o r su r f a c e s , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return 0 ;

df ( pPoint ,X, 4 , ’ a ’ , pSize ,Xa ) ;df ( pPoint ,X, 4 , ’b ’ , pSize ,Xb ) ;d2f ( pPoint ,X, 4 , ’ a ’ , pSize , Xaa ) ;d2f ( pPoint ,X, 4 , ’b ’ , pSize ,Xbb ) ;d2f ( pPoint ,X, 4 , ’ c ’ , pSize ,Xab ) ;Ha=Xa [ 3 ] ; Hb=Xb [ 3 ] ; Haa=Xaa [ 3 ] ; Hab=Xab [ 3 ] ; Hbb=Xbb [ 3 ] ;Xa Xa=iprod (Xa ,Xa , 3 ) ;Xa Xb=iprod (Xa ,Xb , 3 ) ;Xb Xb=iprod (Xb,Xb , 3 ) ;g=Xa Xa*Xb Xb−Xa Xb*Xa Xb ;i f ( g==0)

p r i n t f ( ”Error LH( ) : g==0, po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return 0 ;

for ( k=0;k<3;k++)

121

Page 131: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

F[ k]=Xb Xb*Xaa [ k]−2*Xa Xb*Xab [ k]+Xa Xa*Xbb [ k ] ;n(Xa ,Xb, normal ) ;TauI (Xa ,Xb, tauI ) ;TauII (Xa ,Xb, t au I I ) ;r e s=( Xb Xb*Haa−2*Xa Xb*Hab+Xa Xa*Hbb )/ g +

( iprod (F , tauI , 3 )*Ha + iprod (F , tauI I , 3 )*Hb )/( g*g ) ;return r e s ;

//end func t ion LH( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e mean curvature//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double H( const Po int t * pPoint , double (*X) [ 3 ] [ 3 ] , const S i z e t * pSize )

double Xa [ 3 ] ,Xb [ 3 ] , Xaa [ 3 ] , Xab [ 3 ] , Xbb [ 3 ] , F [ 3 ] , normal [ 3 ] ;double res , g , Xa Xa , Xa Xb , Xb Xb ;int k ;df ( pPoint ,X, 3 , ’ a ’ , pSize ,Xa ) ;df ( pPoint ,X, 3 , ’b ’ , pSize ,Xb ) ;d2f ( pPoint ,X, 3 , ’ a ’ , pSize , Xaa ) ;d2f ( pPoint ,X, 3 , ’b ’ , pSize ,Xbb ) ;d2f ( pPoint ,X, 3 , ’ c ’ , pSize ,Xab ) ;Xa Xa=iprod (Xa ,Xa , 3 ) ;Xa Xb=iprod (Xa ,Xb , 3 ) ;Xb Xb=iprod (Xb,Xb , 3 ) ;g=Xa Xa*Xb Xb−Xa Xb*Xa Xb ;i f ( g==0)

p r i n t f ( ”Error H( ) : g==0, po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return 0 ;

for ( k=0;k<3;k++)

F[ k]=Xb Xb*Xaa [ k]−2*Xa Xb*Xab [ k]+Xa Xa*Xbb [ k ] ;n(Xa ,Xb, normal ) ;r e s =1.0/2.0* iprod (F , normal , 3 ) / g ;return r e s ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e second d e r i v a t i v e//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void d2f ( const Po int t * pPoint , double (*X) [ 3 ] [ 3 ] , int n , char d i r e c t i o n

, const S i z e t * pSize , double * r e s )int N,M, p , k , S i zeCoe f ;int IndA [ 4 ] , IndB [ 4 ] ;double Coef [ 4 ] ;const int aa=1, bb=1;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s<=pSize−>es )

N=pSize−>N;M=pSize−>N; else i f ( pPoint−>s<=pSize−>es+pSize−>gb )

N=pSize−>N;M=pSize−>M; else

p r i n t f ( ”Error df ( ) : s i s out o f range , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i<1 | | pPoint−>i>N+2 | | pPoint−>j<1 | | pPoint−>j>M+2)

p r i n t f ( ”Error df ( ) : i or j i s out o f range , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( d i r e c t i o n != ’ a ’ && d i r e c t i o n != ’b ’ && d i r e c t i o n != ’ c ’ )

p r i n t f ( ”Error df ( ) : d i r e c t i o n (%c ) i s wrong , po int (%d,%d,%d) [%s :%d ]\n”

122

Page 132: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

, d i r e c t i on , pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( d i r e c t i o n==’ c ’ )

SizeCoe f =4; else // d i r e c t i on==’a ’ | | d i r e c t i on==’b ’

SizeCoe f =3;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( d i r e c t i o n==’ a ’ )

IndA [0]= aa+1 ; IndA [1]= aa ; IndA [2 ]= aa−1; // alpha+1, alpha , alpha−1IndB [0 ]=bb ; IndB [1 ]=bb ; IndB [2 ]=bb ; // beta , beta , be ta

else i f ( d i r e c t i o n==’b ’ )IndA [0]= aa ; IndA [1 ]= aa ; IndA [2]= aa ; //alpha , alpha , a lphaIndB [0 ]=bb+1 ; IndB [1 ]=bb ; IndB [2 ]=bb−1; // be ta+1, beta , beta−1

else // d i r e c t i on==’c ’// alpha+1, alpha−1, a lpha+1, alpha−1IndA [0]= aa+1 ; IndA [1]= aa−1; IndA [2]= aa+1; IndA [3]= aa−1;// be ta+1 , be ta+1 , beta −1, beta−1IndB [0 ]=bb+1 ; IndB [1 ]=bb+1; IndB [2 ]=bb−1; IndB [3 ]=bb−1;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f (2<=pPoint−>i && pPoint−>i<=N+1 && 2<=pPoint−>j && pPoint−>j<=M+1)

i f ( d i r e c t i o n==’ c ’ )Coef [ 0 ]=1 . 0 / 4 . 0 ; Coef [1 ]= −1 .0/4 .0 ; Coef [2 ]= −1 .0/4 .0 ; Coef [ 3 ]=1 . 0 / 4 . 0 ;

else // d i r e c t i on==’a ’ | | d i r e c t i on==’b ’Coef [ 0 ]=1 . 0 ; Coef [1 ]=−2.0 ; Coef [ 2 ]=1 . 0 ;

else i f ( ( pPoint−>i==1 | | pPoint−>i==N+2)&&(pPoint−>j==1 | | pPoint−>j==M+2))

i f ( d i r e c t i o n==’ c ’ )Coef [ 0 ]=1 . 0 ; Coef [1 ]=−1.0 ; Coef [2 ]=−1.0 ; Coef [ 3 ]=1 . 0 ;

else // d i r e c t i on==’a ’ | | d i r e c t i on==’b ’Coef [ 0 ]=4 . 0 ; Coef [1 ]=−8.0 ; Coef [ 2 ]=4 . 0 ;

else i f ( pPoint−>j==1 | | pPoint−>j==M+2)

i f ( d i r e c t i o n==’ a ’ )Coef [ 0 ]=1 . 0 ; Coef [1 ]=−2.0 ; Coef [ 2 ]=1 . 0 ;

else i f ( d i r e c t i o n==’b ’ )Coef [ 0 ]=4 . 0 ; Coef [1 ]=−8.0 ; Coef [ 2 ]=4 . 0 ;

else // d i r e c t i on==’c ’Coef [ 0 ]=1 . 0 / 2 . 0 ; Coef [1 ]= −1 .0/2 .0 ; Coef [2 ]= −1 .0/2 .0 ; Coef [ 3 ]=1 . 0 / 2 . 0 ;

else i f ( pPoint−>i==1 | | pPoint−>i==N+2)

i f ( d i r e c t i o n==’ a ’ )Coef [ 0 ]=4 . 0 ; Coef [1 ]=−8.0 ; Coef [ 2 ]=4 . 0 ;

else i f ( d i r e c t i o n==’b ’ )Coef [ 0 ]=1 . 0 ; Coef [1 ]=−2.0 ; Coef [ 2 ]=1 . 0 ;

else // d i r e c t i on==’c ’Coef [ 0 ]=1 . 0 / 2 . 0 ; Coef [1 ]= −1 .0/2 .0 ; Coef [2 ]= −1 .0/2 .0 ; Coef [ 3 ]=1 . 0 / 2 . 0 ;

else

p r i n t f ( ”Error d2f ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−for ( k=0;k<n ; k++)

r e s [ k ]=0;for (p=0;p<SizeCoe f ; p++)

r e s [ k]+=Coef [ p ]*X[ k ] [ IndB [ p ] ] [ IndA [ p ] ] ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//end func t ion d2f ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e f i r s t d e r i v a t i v e

123

Page 133: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void df ( const Po int t * pPoint , double (*X) [ 3 ] [ 3 ] , int n , char d i r e c t i o n

, const S i z e t * pSize , double * r e s )int N,M, p , k ;int IndA [ 2 ] , IndB [ 2 ] ;double Coef [ 2 ] ;const int aa=1, bb=1, S izeCoe f =2;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s<=pSize−>es )

N=pSize−>N;M=pSize−>N; else i f ( pPoint−>s<=pSize−>es+pSize−>gb )

N=pSize−>N;M=pSize−>M; else

p r i n t f ( ”Error df ( ) : s i s out o f range , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i<1 | | pPoint−>i>N+2 | | pPoint−>j<1 | | pPoint−>j>M+2)

p r i n t f ( ”Error df ( ) : i or j i s out o f range , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( d i r e c t i o n != ’ a ’ && d i r e c t i o n != ’b ’ )

p r i n t f ( ”Error df ( ) : d i r e c t i o n (%c ) i s wrong , po int (%d,%d,%d) [%s :%d ]\n”, d i r e c t i on , pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( d i r e c t i o n==’ a ’ )

IndA [0]= aa+1 ; IndA [1]= aa−1; // alpha+1, alpha−1IndB [0 ]=bb ; IndB [1 ]=bb ; // beta , be ta

else // d i r e c t i on==’b ’IndA [0]= aa ; IndA [1 ]= aa ; //alpha , a lphaIndB [0 ]=bb+1 ; IndB [1 ]=bb−1; // be ta+1, beta−1

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f (2<=pPoint−>i && pPoint−>i<=N+1 && 2<=pPoint−>j && pPoint−>j<=M+1)

Coef [ 0 ]=1 . 0 / 2 . 0 ; Coef [1 ]= −1 .0/2 .0 ; else i f ( ( pPoint−>i==1 | | pPoint−>i==N+2)&&(pPoint−>j==1 | | pPoint−>j==M+2))

Coef [ 0 ]=1 . 0 ; Coef [1 ]=−1.0 ; else i f ( pPoint−>j==1 | | pPoint−>j==M+2)

i f ( d i r e c t i o n==’ a ’ )Coef [ 0 ]=1 . 0 / 2 . 0 ; Coef [1 ]= −1 .0/2 .0 ;

else // d i r e c t i on==’b ’Coef [ 0 ]=1 . 0 ; Coef [1 ]=−1.0 ;

else i f ( pPoint−>i==1 | | pPoint−>i==N+2)

i f ( d i r e c t i o n==’ a ’ )Coef [ 0 ]=1 . 0 ; Coef [1 ]=−1.0 ;

else // d i r e c t i on==’b ’Coef [ 0 ]=1 . 0 / 2 . 0 ; Coef [1 ]= −1 .0/2 .0 ;

else

p r i n t f ( ”Error df ( ) . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−for ( k=0;k<n ; k++)

r e s [ k ]=0;for (p=0;p<SizeCoe f ; p++)

r e s [ k]+=Coef [ p ]*X[ k ] [ IndB [ p ] ] [ IndA [ p ] ] ;

124

Page 134: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

// end func t ion d f ( )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e inner product//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double iprod ( const double * v , const double * u , int n)

double r e s =0.0 ;int i ;for ( i =0; i<n ; i++)

r e s+=v [ i ]*u [ i ] ;return r e s ;

//end func t ion iprod ()//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e vec to r product//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void vprod ( const double * v , const double * u , double * r e s )

r e s [0 ]=v [ 1 ] * u [ 2 ] − v [ 2 ] * u [ 1 ] ;r e s [1 ]=v [ 2 ] * u [ 0 ] − v [ 0 ] * u [ 2 ] ;r e s [2 ]=v [ 0 ] * u [ 1 ] − v [ 1 ] * u [ 0 ] ;

//end func t ion vprod ()//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e t r i p l e product//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double tprod ( const double * v , const double * u , const double * w)

double r e s =0;r e s=v [ 0 ] * ( u [ 1 ] *w[ 2 ] − u [ 2 ] *w[1 ] )+

v [ 1 ] * ( u [ 2 ] *w[ 0 ] − u [ 0 ] *w[2 ] )+v [ 2 ] * ( u [ 0 ] *w[ 1 ] − u [ 1 ] *w [ 0 ] ) ;

return r e s ;//end func t ion tprod ()//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e norm of vec tor//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−double norm( const double * v , int n)

double r e s =0;int i ;for ( i =0; i<n ; i++)

r e s+=v [ i ]* v [ i ] ;return s q r t ( r e s ) ;

//end func t ion norm()//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e normal//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void n( const double * Xa , const double *Xb, double * r e s )

double norma ;int k ;vprod (Xa , Xb, r e s ) ;norma=norm( res , 3 ) ;for ( k=0;k<3;k++)

r e s [ k]= r e s [ k ] / norma ;

//end func t ion n ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Ca l cu la t e TauI//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void TauI ( const double * Xa , const double *Xb, double * r e s )

double Xa Xb ,Xb Xb ;int k ;Xa Xb=iprod (Xa ,Xb , 3 ) ;Xb Xb=iprod (Xb,Xb , 3 ) ;for ( k=0;k<3;k++)

r e s [ k]=Xb[ k ]*Xa Xb−Xa [ k ]*Xb Xb ;

//end func t ion TauI ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

125

Page 135: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

// Ca l cu la t e TauII//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void TauII ( const double * Xa , const double *Xb, double * r e s )

double Xa Xa ,Xa Xb ;int k ;Xa Xa=iprod (Xa ,Xa , 3 ) ;Xa Xb=iprod (Xa ,Xb , 3 ) ;for ( k=0;k<3;k++)

r e s [ k]=Xa [ k ]*Xa Xb−Xb[ k ]*Xa Xa ;

//end func t ion TauII ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Listing C.9: Code from the header file share.inc.h #i f ! d e f i n ed (SHARE INC H)#define SHARE INC H//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#include <s t d i o . h>#include <s t d l i b . h>#include <s tdboo l . h>#include <s t r i n g . h>#include <time . h>

#include ” vars . i nc . h”

#define CALCGROOVE(X0 ,X1 ,X2 ,X3) ( (X0)*5 .0/16 .0+(X1)*15.0/16.0−(X2)*5 .0/16 .0+(X3) *1 . 0 / 16 . 0 )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int OptionsGetInt ( int , char ** , const char * , int * ) ;int OptionsGetReal ( int , char ** , const char * , double * ) ;int OptionsGetStr ( int , char ** , const char * , char ** ) ;void Sl i ceX ( const Po int t * , const So lLoc t * , const S i z e t * , double ( * ) [ 3 ] [ 3 ] ) ;int GetNeighbors ( const Po int t * , int , int , int ( * ) [ 3 ] , int ) ;int GetEquations ( const Po int t * , const S i z e t * , Po in t t * , int ) ;Po in t t Sp l i t Index ( int , const S i z e t * ) ;int JoinIndex ( const Po int t * , const S i z e t * ) ;void In i tSegmentat ion ( Segmentat ion t * , const S i z e t * , int , int ) ;void Spl i tSecondsToStr (double ,char * ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−#endif

Listing C.10: Code from the source file share.inc.c ////////////////////////////////////////////////////////////////////////////////// share . inc . c////////////////////////////////////////////////////////////////////////////////#include ” share . inc . h”//////////////////////////////////////////////////////////////////////////////////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int OptionsGetInt ( int argc , char *argv [ ] , const char * name , int * value )

int tmp ;char * endptr , * s t r ;i f ( OptionsGetStr ( argc , argv , name,& s t r ) )

tmp=s t r t o l ( s t r ,&endptr , 0 ) ;i f ( endptr [0]== ’ \0 ’ )

*( int *) va lue=tmp ;return 1 ;

else p r i n t f ( ”Error get opt ion ’%s ’\n” ,name ) ;

126

Page 136: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

return 0 ;// end func t ion OptionsGetInt ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int OptionsGetReal ( int argc , char *argv [ ] , const char * name , double * value )

double tmp ;char * endptr , * s t r ;i f ( OptionsGetStr ( argc , argv , name,& s t r ) )

tmp=s t r t od ( s t r ,&endptr ) ;i f ( endptr [0]== ’ \0 ’ )

*(double *) va lue=tmp ;return 1 ;

else p r i n t f ( ”Error get opt ion ’%s ’\n” ,name ) ;

return 0 ;

// end func t ion OptionsGetReal ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int OptionsGetStr ( int argc , char *argv [ ] , const char * name , char ** value )

int i =1, j =2;while ( i<argc && j<argc )

i f ( strcmp ( argv [ i ] , name)==0)* value=argv [ j ] ;return 1 ;

i++;j++;

return 0 ;

// end func t ion OptionsGetStr ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void Sl i ceX ( const Po int t * pPoint , const So lLoc t *pSolLoc , const S i z e t * pSize

, double (* r e s ) [ 3 ] [ 3 ] ) int k , aa , bb ,N, M, STEP, IndexP [ 4 ] ;Po in t t P;int ind alpha , ind beta , coe f a lpha , c o e f b e t a ;double *X=pSolLoc−>x ;double A[ 4 ] [ 4 ] ,B [ 4 ] [ 4 ] ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s<=pSize−>es ) // e x t e r i o r su r f a c e s

N=pSize−>N;M=pSize−>N;STEP=4;

else i f ( pPoint−>s<=pSize−>es+pSize−>gb ) // grain boundariesN=pSize−>N;M=pSize−>M;STEP=3;

else p r i n t f ( ”Error : bad pPoint−>s (%d ) . [%s :%d ]\n” , pPoint−>s , FILE , LINE ) ;f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i<1 | | pPoint−>i>N+2 | | pPoint−>j<1 | | pPoint−>j>M+2)

p r i n t f ( ”Error S l i ceX ( ) : i or j i s out o f range , po int (%d,%d,%d) [%s :%d ]\n”, pPoint−>s , pPoint−>i , pPoint−>j , FILE , LINE ) ;

f f l u s h ( stdout ) ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−P. s=pPoint−>s ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f (2<=pPoint−>i && pPoint−>i<=N+1 && 2<=pPoint−>j && pPoint−>j<=M+1)

for ( aa=−1;aa<=1;aa++)

127

Page 137: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

for (bb=−1;bb<=1;bb++)P. i=pPoint−>i+aa ;P. j=pPoint−>j+bb ;IndexP [0 ]= JoinIndex(&P, pSize )−1;for ( k=0;k<STEP; k++)

r e s [ k ] [ bb+1] [ aa+1]=X[ IndexP [0 ]+k ] ;

return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( ( pPoint−>i==1 | | pPoint−>i==N+2)&&(pPoint−>j==1 | | pPoint−>j==M+2))

i f ( pPoint−>i ==1)co e f a l pha =1;ind a lpha=0;

else //pPoint−>i==N+2co e f a l pha=−1;ind a lpha=1;

i f ( pPoint−>j==1)

c o e f b e t a =1;ind beta =0;

else //pPoint−>j==M+2c o e f b e t a=−1;ind beta =1;

for ( aa=0;aa<=1;aa++)

for (bb=0;bb<=1;bb++)P. i=pPoint−>i+aa−i nd a lpha ;P. j=pPoint−>j+bb−i nd beta ;IndexP [0 ]= JoinIndex(&P, pSize )−1;for ( k=0;k<STEP; k++)

r e s [ k ] [ 2 * bb ] [ 2 * aa]=X[ IndexP [0 ]+k ] ;

for ( aa=0;aa<=3;aa++)

for (bb=0;bb<=3;bb++)P. i=pPoint−>i+co e f a l pha *aa ;P. j=pPoint−>j+co e f b e t a *bb ;IndexP [ bb]=JoinIndex(&P, pSize )−1;

for ( k=0;k<STEP; k++)

A[ k ] [ aa ]=CALCGROOVE(X[ IndexP [0 ]+k ] ,X[ IndexP [1 ]+k ] ,X[ IndexP [2 ]+k ],X[ IndexP [3 ]+k ] ) ;

for (bb=0;bb<=3;bb++)

for ( aa=0;aa<=3;aa++)P. i=pPoint−>i+co e f a l pha *aa ;P. j=pPoint−>j+co e f b e t a *bb ;IndexP [ aa ]=JoinIndex(&P, pSize )−1;

for ( k=0;k<STEP; k++)

B[ k ] [ bb]=CALCGROOVE(X[ IndexP [0 ]+k ] ,X[ IndexP [1 ]+k ] ,X[ IndexP [2 ]+k ],X[ IndexP [3 ]+k ] ) ;

for ( k=0;k<STEP; k++)

r e s [ k ] [ 1 ] [ 0 ] =A[ k ] [0+ ind a lpha ] ;r e s [ k ] [ 1 ] [ 2 ] =A[ k ][1− i nd a lpha ] ;r e s [ k ] [ 0 ] [ 1 ] =B[ k ] [0+ ind beta ] ;r e s [ k ] [ 2 ] [ 1 ] =B[ k ][1− i nd beta ] ;r e s [ k ] [ 1 ] [ 1 ] = (CALCGROOVE(A[ k ] [ 0 ] ,A[ k ] [ 1 ] ,A[ k ] [ 2 ] ,A[ k ] [ 3 ] )+

CALCGROOVE(B[ k ] [ 0 ] ,B[ k ] [ 1 ] ,B[ k ] [ 2 ] ,B[ k ] [ 3 ] ) ) / 2 . 0 ;return ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>j==1 | | pPoint−>j==M+2)

i f ( pPoint−>j==1)

128

Page 138: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

c o e f b e t a =1;ind beta =0;

else //pPoint−>j==M+2c o e f b e t a=−1;ind beta =1;

for ( aa=−1;aa<=1;aa++)

for (bb=0;bb<=3;bb++)P. i=pPoint−>i+aa ;P. j=pPoint−>j+co e f b e t a *bb ;IndexP [ bb]=JoinIndex(&P, pSize )−1;

for ( k=0;k<STEP; k++)

r e s [ k ] [ 0 ] [ aa+1]=X[ IndexP[0+ ind beta ]+k ] ;r e s [ k ] [ 1 ] [ aa+1]=CALCGROOVE(X[ IndexP [0 ]+k ] ,X[ IndexP [1 ]+k ]

,X[ IndexP [2 ]+k ] ,X[ IndexP [3 ]+k ] ) ;r e s [ k ] [ 2 ] [ aa+1]=X[ IndexP[1− i nd beta ]+k ] ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>i==1 | | pPoint−>i==N+2)

i f ( pPoint−>i ==1)co e f a l pha =1;ind a lpha=0;

else //pPoint−>i==N+2co e f a l pha=−1;ind a lpha=1;

for (bb=−1;bb<=1;bb++)

for ( aa=0;aa<=3;aa++)P. i=pPoint−>i+co e f a l pha *aa ;P. j=pPoint−>j+bb ;IndexP [ aa ]=JoinIndex(&P, pSize )−1;

for ( k=0;k<STEP; k++)

r e s [ k ] [ bb+1][0]=X[ IndexP[0+ ind a lpha ]+k ] ;r e s [ k ] [ bb+1][1]=CALCGROOVE(X[ IndexP [0 ]+k ] ,X[ IndexP [1 ]+k ]

,X[ IndexP [2 ]+k ] ,X[ IndexP [3 ]+k ] ) ;r e s [ k ] [ bb+1][2]=X[ IndexP[1− i nd a lpha ]+k ] ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//end func t ion Sl iceX ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Get Neighbors//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int GetNeighbors ( const Po int t * pPoint , int N, int M, int (* r e s ) [ 3 ]

, int max count )int count=0,k , s1 , s2 , s3 ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f (max count<6)

p r i n t f ( ”Error max count<6. [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// fo r i n t e r i o r po in t si f ( pPoint−>i !=1 && pPoint−>i !=N+2 && pPoint−>j !=1 && pPoint−>j !=M+2)

r e s [ count ] [ 0 ]= pPoint−>s ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// fo r quadrup le po in t I ˆ t

129

Page 139: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i f ( pPoint−>i==1 && pPoint−>j==1)for ( k=1;k<=6;k++)

r e s [ count ] [ 0 ]= k ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;

return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// fo r f r e e boundariesi f ( ( pPoint−>i==N+2 && pPoint−>j>1) | | ( pPoint−>i>1 && pPoint−>j==M+2))

r e s [ count ] [ 0 ]= pPoint−>s ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// fo r groove l i n e s between grain boundariesi f ( pPoint−>i==1 && pPoint−>s>3)

for ( k=4;k<=6;k++)r e s [ count ] [ 0 ]= k ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;

return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// fo r o ther groove l i n e ss1=0; s2=0; s3=0;i f ( ( pPoint−>j==1 && ( pPoint−>s==1 | | pPoint−>s==4))

| | ( pPoint−>i==1 && pPoint−>s==2))// groove l i n e 1 ,2 ,4s1=1; s2=2; s3=4;

else i f ( ( pPoint−>j==1 && ( pPoint−>s==2 | | pPoint−>s==5))| | ( pPoint−>i==1 && pPoint−>s==3))// groove l i n e 2 ,3 ,5

s1=2; s2=3; s3=5; else i f ( ( pPoint−>j==1 && ( pPoint−>s==3 | | pPoint−>s==6))

| | ( pPoint−>i==1 && pPoint−>s==1))// groove l i n e 3 ,1 ,6s1=3; s2=1; s3=6;

i f ( s1 !=0 && s2 !=0 && s3 !=0)

i f ( pPoint−>j==1)r e s [ count ] [ 0 ]= s1 ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;r e s [ count ] [ 0 ]= s3 ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;count++;r e s [ count ] [ 0 ]= s2 ;r e s [ count ] [ 1 ]= pPoint−>j ;r e s [ count ] [ 2 ]= pPoint−>i ;count++;

else // pPoint−>i=1r e s [ count ] [ 0 ]= s1 ;r e s [ count ] [ 1 ]= pPoint−>j ;r e s [ count ] [ 2 ]= pPoint−>i ;count++;r e s [ count ] [ 0 ]= s3 ;r e s [ count ] [ 1 ]= pPoint−>j ;r e s [ count ] [ 2 ]= pPoint−>i ;count++;r e s [ count ] [ 0 ]= s2 ;r e s [ count ] [ 1 ]= pPoint−>i ;r e s [ count ] [ 2 ]= pPoint−>j ;

130

Page 140: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

count++;return count ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−p r i n t f ( ”Error in po int (%d,%d,%d) [%s :%d ]\n” , pPoint−>s , pPoint−>i , pPoint−>j

, FILE , LINE ) ;f f l u s h ( stdout ) ;return count ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

//end func t ion GetNeighbors ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int ComparePoints ( const void * elem1 , const void * elem2 )

Po int t *P1=(Po int t *) elem1 ,*P2=(Po int t *) elem2 ;int d i f ;d i f=P1−>s−P2−>s ;i f ( d i f ) return d i f ;d i f=P1−>i−P2−>i ;i f ( d i f ) return d i f ;d i f=P1−>j−P2−>j ;return d i f ;

//end func t ion comparator ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Get Equations//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int GetEquations ( const Po int t * pPoint , const S i z e t *pSize , Po in t t * r e s

, int max count )int count=0, i , j , k ,N,M;int iBegin , iEnd , jBegin , jEnd ;int ne ighbors [ 6 ] [ 3 ] , ne ighbors count ;const int boundary=4;Po in t t Point ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( pPoint−>s<=pSize−>es )

N=pSize−>N;M=pSize−>N; else

N=pSize−>N;M=pSize−>M;iBeg in=pPoint−>i −1;iEnd=pPoint−>i +1;jBeg in=pPoint−>j −1;jEnd=pPoint−>j +1;i f ( pPoint−>i<1+boundary && pPoint−>i>N+2−boundary )

iBeg in=1; iEnd=N+2; else i f ( pPoint−>i<1+boundary )

iBeg in=1; iEnd=boundary+1; else i f ( pPoint−>i>N+2−boundary )

iBeg in=N+2−boundary ; iEnd=N+2;i f ( pPoint−>j<1+boundary && pPoint−>j>M+2−boundary )

jBeg in=1; jEnd=M+2; else i f ( pPoint−>j<1+boundary )

jBeg in=1; jEnd=boundary+1; else i f ( pPoint−>j>M+2−boundary )

jBeg in=M+2−boundary ; jEnd=M+2;for ( i=iBeg in ; i<=iEnd ; i++)

for ( j=jBegin ; j<=jEnd ; j++)//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Point . s=pPoint−>s ;Point . i=i ;Point . j=j ;ne ighbors count=GetNeighbors(&Point ,N,M, neighbors , 6 ) ;for ( k=0;k<ne ighbors count ; k++)

r e s [ count ] . s=ne ighbors [ k ] [ 0 ] ;r e s [ count ] . i=ne ighbors [ k ] [ 1 ] ;

131

Page 141: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

r e s [ count ] . j=ne ighbors [ k ] [ 2 ] ;r e s [ count ] . c=0;count++;i f ( count>=max count )

p r i n t f ( ”Error : count=>max count . [%s :%d ]\n” , FILE , LINE ) ;break ;

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−i f ( count>=max count ) break ;

i f ( count>=max count ) break ;

qso r t ( res , count , s izeof ( Po in t t ) , ComparePoints ) ;return count ;

//end func t ion GetEquations ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// S p l i t t i n g i nd i c e s ( inve r s e func t i on to func t i on JoinIndex ( ) ; )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−Po int t Sp l i t Index ( int Index , const S i z e t * pSize )

Po int t Point ;int N=pSize−>N,M, d i v i s o r ;bool f l a g ; // true i f Index be longs to the gra in boundaryi f ( Index<=pSize−>esLength ) // e x t e r i o r su r f a c e sM=pSize−>N;f l a g=f a l s e ;d i v i s o r =4;

else // grain boundariesM=pSize−>M;Index=Index−pSize−>esLength ;f l a g=true ;d i v i s o r =3;

// c a l c u l a t e number o f su r f a c e sPoint . s=Index /( d i v i s o r *(N+2)*(M+2)) ;i f ( ( Index%(d i v i s o r *(N+2)*(M+2)))!=0)

Point . s++;Index−=(Point . s−1)* d i v i s o r *(N+2)*(M+2);// c a l c u l a t e f i r s t indexPoint . i=Index /( d i v i s o r *(M+2)) ;i f ( ( Index%(d i v i s o r *(M+2)))!=0)

Point . i++;Index−=d i v i s o r *( Point . i −1)*(M+2);// c a l c u l a t e second indexPoint . j=Index /( d i v i s o r ) ;i f ( ( Index%(d i v i s o r ) ) !=0)

Point . j++;// c a l c u l a t e t h i r d indexPoint . c=Index−d i v i s o r *( Point . j −1);// update sur face numberi f ( f l a g ) // grain boundaries

Point . s+=pSize−>es ;return Point ;

// end func t ion Sp l i t I nd e x ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// Joining i nd i c e s ( Algorithm 3)//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−int JoinIndex ( const Po int t * pPoint , const S i z e t * pSize )

int r e s =0,N=pSize−>N,M=pSize−>M;i f ( pPoint−>s<=pSize−>es )

r e s =4*(pPoint−>s−1)*(N+2)*(N+2)+4*( pPoint−>i −1)*(N+2)+4*( pPoint−>j −1)+1;

else

132

Page 142: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

r e s=pSize−>esLength ;r e s+= 3*( pPoint−>s−pSize−>es −1)*(N+2)*(M+2)+

3*( pPoint−>i −1)*(M+2)+3*( pPoint−>j −1)+1;

return r e s ;

// end func t ion JoinIndex ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−// S p l i t t i n g in to separa te core ( process )//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void In i tSegmentat ion ( Segmentat ion t * pSegmentation , const S i z e t * pSize

, int procs num , int proc id )int tmp , tmp2 , d i v i s o r , i , s i z e , pn , sum=0;const int mode=1; // 0 − equa l s p l i t t i n g ; 1 − s p l i t t i n g by my d e f i n i t i o ns i z e=pSize−>Length ;pn=procs num ;for ( i =0; i<procs num ; i++)

pSegmentation−>counts [ i ]= s i z e /pn ;i f ( i<s i z e%pn) pSegmentation−>counts [ i ]+=1; // may be problem herei f ( i == 0)

pSegmentation−>d i s p l s [ i ]=0; else

pSegmentation−>d i s p l s [ i ]=pSegmentation−>d i s p l s [ i−1]+pSegmentation−>counts [ i −1] ;i f (mode)

tmp=pSegmentation−>counts [ i ]+pSegmentation−>d i s p l s [ i ] ;i f (tmp<=pSize−>esLength )

d i v i s o r =4; else

d i v i s o r =3;tmp−=pSize−>esLength ;

switch (tmp%d i v i s o r )

case 0 :break ;

case 1 :pSegmentation−>counts [ i ]−−;break ;

case 2 :pSegmentation−>counts [ i ]++;i f ( d i v i s o r==4)

pSegmentation−>counts [ i ]++;break ;

case 3 :pSegmentation−>counts [ i ]++;break ;

default :p r i n t f ( ”Error . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;

pn−−; // update r e s i d ua l number o f proces se ss i z e−=pSegmentation−>counts [ i ] ; // update s i z esum+=pSegmentation−>counts [ i ] ;

i f (sum!=pSize−>Length )

p r i n t f ( ”Error . [%s :%d ]\n” , FILE , LINE ) ;f f l u s h ( stdout ) ;

i f (mode) // check cons i s t ency fo r my mode

for ( i =0; i<procs num ; i++)i f ( pSegmentation−>counts [ i ]<=0)

p r i n t f ( ”Error counts [%d]<=0. [%s :%d ]\n” , i , FILE , LINE ) ;f f l u s h ( stdout ) ;continue ;

i f ( pSegmentation−>d i s p l s [ i ]<=pSize−>esLength )

133

Page 143: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i f ( pSegmentation−>counts [ i ]+pSegmentation−>d i s p l s [ i ]<=pSize−>esLength )tmp=pSegmentation−>counts [ i ] ;tmp2=0;

else tmp=pSize−>esLength−pSegmentation−>d i s p l s [ i ] ;tmp2=pSegmentation−>counts [ i ]−tmp ;

else

tmp=0;tmp2=pSegmentation−>counts [ i ] ;

// Pe t s cPr in t f (PETSCCOMMWORLD,” i= %d , tmp=%d , tmp2=%d\n” , i , tmp , tmp2 ) ;i f ( ( tmp%4)!=0)

p r i n t f ( ”Error , d i v i d i ng by 4 , f o r index i=%d . [%s :%d ]\n”, i , FILE , LINE ) ;

p r i n t f ( ” esLength=%d , counts [%d]=%d , d i s p l s [%d]=%d\n” , pSize−>esLength, i , pSegmentation−>counts [ i ] , i , pSegmentation−>d i s p l s [ i ] ) ;

f f l u s h ( stdout ) ;i f ( ( tmp2%3)!=0)

p r i n t f ( ”Error , d i v i d i ng by 3 , f o r index i=%d . [%s :%d ]\n”, i , FILE , LINE ) ;

p r i n t f ( ” esLength=%d , counts [%d]=%d , d i s p l s [%d]=%d\n” , pSize−>esLength, i , pSegmentation−>counts [ i ] , i , pSegmentation−>d i s p l s [ i ] ) ;

f f l u s h ( stdout ) ;

pSegmentation−>proc i d =proc id ;pSegmentation−>procs num =procs num ;pSegmentation−>l ength =pSize−>Length ;pSegmentation−>begin =pSegmentation−>d i s p l s [ p r o c i d ] ;pSegmentation−>end=pSegmentation−>counts [ p r o c i d ]+pSegmentation−>d i s p l s [ p r o c i d ] ;int q , count eqs=0,STEP;Po in t t eqs [MAXEQUATIONSNUM] ;Po in t t Point ;pn=0;pSegmentation−>nnz [ procs num ]=0;pSegmentation−>nnz [ pn ]=0;for ( i =0; i<pSize−>Length ; i++)//by columns

i f ( i==pSegmentation−>d i s p l s [ pn]+pSegmentation−>counts [ pn ] ) pn++;pSegmentation−>nnz [ pn ]=0;

Point=Sp l i t Index ( i +1, pS ize ) ;i f ( Point . c==1)

count eqs=GetEquations(&Point , pSize , eqs , MAXEQUATIONSNUM) ;for ( q=0;q<count eqs ; q++)

i f ( eqs [ q ] . s<=pSize−>es ) STEP=4;else STEP=3;//STEP=1;pSegmentation−>nnz [ procs num]+=STEP;pSegmentation−>nnz [ pn]+=STEP;

//end func t ion Ini tSegmentat ion ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−void Spl i tSecondsToStr (double Seconds , char * r e s )

int Days , Hours , Mimutes ;Days=Seconds /86400;Seconds−=Days *86400;Hours=Seconds /3600 ;Seconds−=Hours *3600 ;Mimutes=Seconds /60 ;

134

Page 144: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Seconds−=Mimutes *60 ;i f (Days )

s p r i n t f ( res , ”%d days %d hours %d minutes %f seconds ” ,Days , Hours , Mimutes, Seconds ) ;

else i f ( Hours )s p r i n t f ( res , ”%d hours %d minutes %f seconds ” ,Hours , Mimutes , Seconds ) ;

else i f (Mimutes )s p r i n t f ( res , ”%d minutes %f seconds ” ,Mimutes , Seconds ) ;

else s p r i n t f ( res , ”%f seconds ” , Seconds ) ;

//end func t ion Sp l i tSecondsToStr ( ) ;//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−////−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

135

Page 145: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

Bibliography

[1] A.Averbuch, M.Israeli, and I.Ravve. Electromigration of intergranular voids in metalfilms for microelectronic interconnects. J.Computational Physics, 186:481–502, 2003.

[2] A.Novick-Cohen, O.Zelekman-Smirin, and A.Vilenkin. The effects of grain grooves ongrain boundary migration in nano films. Acta Materialia, 58:813–822, 2010.

[3] A.Pressley. Elementary differential geometry. London: Springer, 2001.

[4] A.Vilenkin and A.Novick-Cohen. Grain boundary migration in thin films: the effectsof grain groves in nano films. AES–ATEMA’ 2007 International Conference, August6–10, 2007, pages 127-134.

[5] C.Herring. In structure and properties of solid surfaces. Editors: R.Gomer, C.S.Smith.University of Chicago Press, Chicago, 1952.

[6] C.Herring. Surface tension as a motivation for sintering. Pages 143-179, in The Physicsof Powder Metallurgy. Editor: W.E.Kingston. McGraw-Hill, New York, 1951.

[7] C.Herring. Effect of change of scale on sintering phenomena. Appl. Phys., 21:301–303,1950.

[8] C.S.Smith. Grains, phases, and interfaces: An interpretation of microstructure. Insti-tute of Metals Division Lecture, New York Meeting, February 1948.

[9] D.Brandon and W.D.Kaplan. Microstructural characterization of materials. 2nd edi-tion, Wiley, 2008.

[10] D.J.Srolovitz and S.A.Safran. Capillary instabilities in thin films. I.Energetics. Journalof Applied Physics, 60:247–254, 1986.

[11] D.Kincaid and W.Cheney. Numerical Analysis: Mathematics of Scientific Computing.2nd edition, California: Brooks/Cole Publishing Company, 1996.

[12] Manfredo P. do Carmo. Differential Geometry of Curves and Surfaces. New Jersey:Prentice-Hall, 1976.

[13] E.Isaacson and H.B.Keller. Analysis of Numerical Methods. Dover Publications, Inc.,New York, 1994.

[14] F.Y.Genin, W.W.Mullins, and P.Wynblatt. Capillary instabilities in thin films: Amodel of thermal pitting at grain boundary vertices. Acta. Metall. Mater., 40(12):3239–3248, 1092.

136

Page 146: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

[15] G.Gottstein, A.D.Rollett, and L.S.Shvindlerman. On the validity of the von Neumann-Mullins relation. Scripta Materialia, 51:611–616, 2004.

[16] G.Gottstein and L.S.Shvindlerman. Grain Boundary Migration in Metals: Thermody-namics, Kinetics, Applications. 2nd edition, CRC Press, 2010.

[17] G.H.Golub and C.F.Van Loan. Matrix Computations. 3d edition, Johns HopkinsUniversity Press, Baltimore, 1996.

[18] H.J.Frost, C.V.Thompson, and D.T.Walton. Simulation of thin film grain structures-i.grain growth stagnation. Acta. Metall. Mater., 38(8):1455–1462, 1090.

[19] J.Kanel, A.Novick-Cohen, and A.Vilenkin. A traveling wave solution for coupled sur-face and grain boundary motion. Acta. Mater., 51:1981–1989, 2003.

[20] J.Kanel, A.Novick-Cohen, and A.Vilenkin. Coupled surface and grain boundary mo-tion: a traveling wave solution. Nonlinear Analysis, 59:1267–1292, 2004.

[21] J.Kanel, A.Novick-Cohen, and A.Vilenkin. Coupled surface and grain boundary mo-tion: nonclassical traveling wave solutions. Adv. Diff. Eqns., 9:299–327, 2004.

[22] J.Kanel, A.Novick-Cohen, and A.Vilenkin. Numerical analysis of a three-dimensionalradially symmetric grain attached to a free crystal surface. Acta Materialia, 54:2589–2595, 2006.

[23] J.Nocedal and S.J.Wright. Numerical Optimization. Springer Science + Business Me-dia, Inc., New York, 1999.

[24] J.Stoer and R.Bulirsch. Introduction to Numerical Analysis. 2nd edition, Texts inapplied mathematics 12. New York : Springer–Verlag, 1993.

[25] J.W.Barrett, H.Garcke, and R.Nurnberg. Finite element approximation of coupledsurface and grain boundary motion with applications to thermal grooving and sintering.Universitat Regensburg, Mathematik. Preprint 11/2009.

[26] J.W.Barrett, H.Garcke, and R.Nurnberg. Parametric approximation of surface clustersdriven by isotropic and anisotropic surface energies. Universitat Regensburg, Mathe-matik. Preprint 04/2009.

[27] K.Deckelnick, G.Dziuk, and C.M.Elliott. Computation of geometric partial differentialequations and mean curvature flow. Acta Numerica, 14:139–232, 2005.

[28] L.Bronsard and B.Wetton. A numerical method for tracking curve networks movingwith curvature motion. J.Computational Physics, 120:66–87, 1995.

[29] Message Passing Interface Forum. MPI:A Message-Passing Interface Standard, Version2.2, September 4, 2009. http://www.mpi-forum.org/.

[30] Donghong Min and Harris Wong. A model of migrating grain-boundary grooves withapplication to two mobility-measurement methods. Acta Materialia, 50:51555169, 2002.

[31] M.Khenner, A.Averbuch, M.Israeli, and M.Nathan. Numerical simulation of grain-boundary grooving by level set method. J.Computational Physics, 170:764–784, 2001.

137

Page 147: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

[32] M.O.Orlandi, P.R.Bueno, E.R.Leite, and E.Longo. Nonohmic behavior of sno2 .mno2 -based ceramics. Materials Research, 6:279–283, 2003.

[33] M.Upmanyu, R.W.Smith, and D.J.Srolovitz. Atomistic simulation of curvature drivengrain boundary migration. Interface Science, pages 41–58, 1998.

[34] R.Finn. Equilibrium Capillary Surfaces. Springer–Verlag, New York, 1986.

[35] R.W.Balluffi, S.M.Allen, and W.C.Carter. Kinetics of materials. Wiley Interscience,2005.

[36] S.Balay, K.Buschelman, V.Eijkhout, W.Gropp, D.Kaushik, M.Knepley, L.CurfmanMcInnes, B.Smith, and H.Zhang. PETSc Users Manual, Version 3.0.0. Mathemat-ics and Computer Science Division, Argonne National Laboratory, December 2008.http://www.mcs.anl.gov/petsc/petsc-as/.

[37] S.Gallot, D.Hulin, and J.Lafontaine. Riemannian geometry. Springer, Berlin, 2004.

[38] T.A.Davis. UMFPACK User Guide, Version 5.4.0. Dept.of Computerand Infor-mation Science and Engineering, Univ. of Florida, Gainesville, FL, May 20, 2009.http://www.cise.ufl.edu/research/sparse/umfpack/.

[39] U.M.Asher and L.R.Petzold. Computer Methods for Ordinary Differential Equationsand Differential - Algebraic Equations. Society for Industrial and Applied Mathematics,Philadelphia, 1998.

[40] W.W.Mullins. Two - dimensional motion of idealized grain boundaries. Appl. Phys.,28(8):900–904, 1956.

[41] W.W.Mullins. Theory of thermal grooving. Appl. Phys., 28:333–339, 1957.

[42] W.W.Mullins. The effect of thermal grooving on grain boundary motion. Acta. Metal.,6:414–427, 1958.

[43] W.W.Mullins. Flattening of a nearly plane solid surface due to capillarity. Appl. Phys.,30:77–83, 1959.

[44] W.W.Mullins. Capillarity-induced surface morphologies. Interface Science, 9:9–20,2001.

[45] Z.Pan. Simulation and Investigation for Coupled Surface and Grain Boundary Motion.Ph.D. Thesies, University of British Columbia, Vancouver, 2008.

[46] Z.Pan and B.Wetton. Numerical methods for coupled surface and grain boundarymotion. European Journal of Applied Mathematics, 19:311–327, 2008.

138

Page 148: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i

גרעינים5ביני במערכת של -דיפוזיה על פני משטח ותנועת פני

'ודים דרקץ

Page 149: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

ii

גרעינים5ביני במערכת של -דיפוזיה על פני משטח ותנועת פני

חיבור על מחקר

לשם מילוי חלקי של הדרישות לקבלת התואר מגיסטר למדעים במתמטיקה שימושית

'ודים דרקץ

מכון טכנולוגי לישראל-הוגש לסנט הטכניון 2010 מרץ חיפה ע" תשאדר

Page 150: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

iii

פקולטהב ארקדי וילנקין 'ודר כהן-איימי נוביק' חקר נעשה בהנחיית פרופהמ .טכניון, למתמטיקה

אני מודה לבית הספר ללימודים מוסמכים על התמיכה הכספית הנדיבה

.בהשתלמותי

לארץ יהודיתה סוכנותהשל קרן על שם סלים ורחל בניןלרוצה להודות אני . מלגהה קבלת עלישראל

קבלת מענק ש ראסל ברי עבור ''למכון לננוטכנולוגיה ע צה להודותאני גם רו

.NANCO שימוש במחשבל 50%של

על תמיכה וילנקין ארקדי'דר ולכהן-איימי נוביק' פרופלאני מאוד מודה . עבודה זוי סבלנות והדרכה בכל שלבועל , שלהםמקצועית ואישית

אורי'פרופל ,ש טאוב'' עיםמרכז המחשב מויילאן ' דר לרוצה גם להודות אני

אוניברסיטת סן מע תהשלמ' פרופ ואת, בריטיש קולומביה תאוניברסיטמ אשר .אלגוריתמים נומרייםיהם בקשר להערות התעניינותם ועלקרנגי מלון על

, על עידודיוליה יאשתול, במיוחד להורי אנטולי ולריסה, יתמשפחלאני מודה . והבנה במהלך מחקר זה,תמיכה

Page 151: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

i

תקציר מורחב

ביישומים מהווים תהליכים מאוד מכריעיםביני -דיפוזיה על פני משטח ותנועת פני

החומר שלסטרוקטורה-המיקרו תהליכים האלה משפיעים על .טכנולוגיים מודרניים רבים

, חשמליותה, מכניותהתכונות הקביעת בסטרוקטורה חשובים -והמאפיינים של המיקרו

.רביםחומרים ב'ווכ אופטיותה ,מגנטיותה

ה של שיכבה דקה של החומר בין שני גבישים תנוע (ביני-תנועת פני חוקרים במחקר זה אנו

. במצב צבירה מוצקירב גביש בשכבות דקות של חומר )"grain boundary"הידוע בשם

5של זו אפילו מערכתפני שמ .גבישים 5 בעלת מסוימת מאודבגיאומטריה מתבוננים אנו

מערכת ל זוהבעיה את להפחית מאפשרת ה סימטריה מניחיםאנו ,עדיין די מסובכת גבישים

אנחנו מניחים שכל הגבישים, ל"בכל המערכות הנ . בלבדגבישי 3 המכילה יותרפשוטה

, ותשונאוריינטציות בעליהם, םגבישי של אותם םיהסריג אבל מאותו חומר מורכביםהם

איזוטרופיהמקרה ב רק מתמקדיםאנו , לשם הפשטות .ביני-ישנו פן, בין כל גביש וגבישו

נקראוגז סביבתי גביש בין פני משטח . המדידהתכונות החומר אינן תלויות בכיווןשבו

."exterior surface " אוימשטח חיצונ

, חיצונייםהמשטחים הו ביני-פניה משטחים ה שלמוצמדתתנועה אנחנו לוקחים בחשבון

מתרחשת ו שכיחה זאת תופעהה ".thermal groove" ראתהמתחברים לאורך מסילה הנק

)חיצונייםהו ,ביני-פניה (יםמשטחהכל .רכב סופי של חומר מוחתך בכל מסוימתבמידה

קיים סוגים שונים שלת מיםמשטחהשפה כל ועל , מוגדרותתנועה ה תו על פי משוואיםנע

.שפהתנאי

5 -ים וחיצונים משטחי3, יניב-משטחים פני 3 נויש, גבישים 3 בעלתבמערכת שלנו

כמו כן אנחנו מניחים סימטריה .אנחנו מניחים שמישורי סימטריה נייחים .מישורי סימטריה

שני משטחים חיצונים מתחברים לאורכה עקומה ש.יחס למישורי סימטריהבשל המערכת

מה עקו ".triple junction line"הידוע בשם קו צומת משולשת נקראתביני-ןמשטח פ עם

או פנימיקו צומת משולשת נקראתמתחברים ביני-ני פיםמשטחשלושה שלאורכה

"internal triple junction line".

Page 152: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

ii

סימטריה מישורימ אחד עם מתחברביני-ןמשטח פ משטח חיצוני אועקומה שלאורכה

."exterior free boundary" או באנגלית שפה חופשית חיצוניתנקראת

אוצומת מרובע נקודת ניקרא צומת משולשתיוקוארבעה נפגשים שבוקודקוד כמו כן

"quadruple junction".ים אחרים הנקראים נקודות קודקוד םי כמו כן במערכת קיימ

. "corner points " אופינתיות

שטח מה של ליחידת שטח כיחס בין האנרגיה החופשית גדרומה m יקאליספי פרמטר נויש

משפיע על mיחס .חיצוניהמשטח השלליחידת שטח אנרגיה החופשית ובין הביני -פני

0 בין לקבל ערכים יכול m הפרמטר הבתיאורי. הגבישיםבין ביני-פניתנועה האופי של ה

,0עבור אבל המודל המתמטי שלנו תקף רק , 2 -ל 3m ∈ .בפרט ,חומרים רביםב

,10, מתכותה במרבית3

m

ידוע .עבור המודל אינו מהווה אילוץ רצינישתנאי זהכך , ∋

0mכאשר כי אנו אנליטיבאופן כמו כן . נעלמת"thermal grooves" של תופעהה ,=

. m כפונקציה של פרמטרצומת מרובע בנקודת צומת משולשת ויקובין זוויות חישבנו

מינימיזציה של אנרגיה חופשית בסביבה של כתיביםמלערכתנו הערכים של הזוויות האלו

.צומת מרובענקודת

לפינע ביני-ןמשטח פ כל .מורכבת משני סוגי תנועהשלנו מערכת השל השתנות בזמן

ידי המשוואה הדיפרנציאלית החלקית-המתוארת על, ממוצעתהומיות עקמתתנוע

nV AH= )1(

מסמן את העקמומיות H,ביני-ןפהמשטח ה של תהנורמאלי מסמן את המהירותnVכאשר

תלוי ה ,"reduced mobility"שם מקדם קינטי הידוע בינוה A -ו, והממוצעת של

ידי -עלהמתוארת , באמצעות דיפוזיה על פני משטחכל משטח חיצוני נע .מאפייני החומרב

הדיפרנציאלית החלקיתהמשוואה

n sV B H= − ∆ )2(

Page 153: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

iii

כאשר s

surface"שם מקדם קינטי הידוע ב ינוה B -ו, בלטרמי- לפלסאופרטורה ינוה ∆

diffusion coefficient", 1(-)2( משוואותשה לב מושי .מאפייני החומרבתלוי ה(

, תו מהירויות משיקילהגדירבמקום .משטחיםה של תהנורמאלי רק את המהירות מתארות

ת אחידה של ודרש רשנ אנו, ינוהד. יםשטחמהשל ציה אפרמטריזה על תנאיםש ודרנ אנחנו

.המשטחים

:אנחנו דורשים קו צומת משולשת כללאורך .תנאי שפה במערכת שלנו מאוד מורכבים

מאזן , יישארו קשורים ביני-ןמשטח פ המשטחים החיצוניים ושני תנאי התמדה המבטיח ש

קו צומת לאורך . שטף המסהמאזןו, רציפות הפוטנציאל הכימי ,)חוק יונג (כוחות מכניים

יישארו ביני-ני פיםמשטחהשתנאי התמדה המבטיח : פנימי אנחנו דורשיםמשולשת

למשטחים חיצוניםתלאורך שפה חופשית חיצונית המתייחס .ת מכנייםומאזן כוחו קשורים

לאורך שפה חופשית .סימטרית שיקוף ו, שטף המסההעדר , תנאי התמדה:אנחנו דורשים

.סימטרית שיקוףו, תנאי התמדה: אנחנו דורשיםביני-ני פיםמשטחל תחיצונית המתייחס

ונקודות פינתיות מרובעצומת תנאי שפה נוספים בנקודת ורשיםכמו כן אנו ד

אנו, ותר יבצורה מתמאטית המצורפיםתנאים הו )1(-)2( משוואותה אתכתובלכדי

)נסמן . יםשטחמהשל ציה אפרמטריזמגדירים ), ,X tα β בתלת מימדפרמטרימשטח כ .

0 -כמו כן אנחנו מניחים ש , 1α β≤ 0 - ו≥ t T≤ 0T עבור ≥ ניתן להגדירבהתאם .נתון <

nV,H,sH∆לדוגמא . התחלהתנאי ושפהה תנאי ו,n tV X n=

n כאשר,

ווקטורי היחידה

שני שלפרמטריהייצוג את הנסמןאם . שפהחלק מתנאי כעת נדגים.למשטח ינורמאלה

1 צוניים באמצעות חייםמשטח 2,X Xביני-ןמשטח פ שלפרמטריהייצוג ה את ונסמן

עבור נקודה המוגדרים לעיל לרשום את ארבעת חוקי השימור יתןאז נ, 3X באמצעות

:באמצעות המשוואות הבאות, צומת משולשתהקו ה על הנמצאתכלשהי

1 2 3X X X= = )3(

1 2 3 0mτ τ τ+ + = )4(

1 2H H= )5(

1 1 2 2, , 0s sH Hτ τ∇ + ∇ = )6(

Page 154: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

iv

כאשר , 1, 2,3i iτ קו צומת ניצבים ל, מייצגים את ווקטורי היחידה המשיקים למשטחים ∋

ניתן, השים לב שבאופן דומנ. גרדיאנט משטחיינו ה ∇s, ממנופנימהופונים משולשת

. הנזכרים למעלהם המצורפיםלכתוב את שאר התנאי

תנאי שפה ותנאי , המתארות השתנות בזמן של המערכת שלנושלב את המשוואות אם נ

שנוכל כדי .)PDAE (תואלגברי תות חלקיודיפרנציאלי ותמשווא מערכתהתחלה נקבל

.לציהתוכנת סימו ואלגוריתםבונים אנונומרי באופן את מערכת המשוואותלפתור

. שלנו מבוסס על שיטת הפרשים סופיים נומריהאלגוריתם ה

תול מערכת משוואש דיסקרטיזציה בצענראשון בשלב. נתאר את האלגוריתם

מתקבלתעקב כך ,β - וαמשתנים שני הלפי מרחבב תואלגברי תות חלקיודיפרנציאלי

שיטת אוילר בנעזר זו דרךב. )ODAE (תואלגברי תרגילות ודיפרנציאלי ואתמערכת משו

ת ו למערכת המשוואקירוב של סתום ייצוג נותנתה) backwards Euler(האחורית

תת לא ליניאריוו מערכת משוואיםקבלמ משלב זה.תואלגברי התהרגילות ודיפרנציאליה

1kY יחסית למשתנה הבאבאופןהמשתנה את מערכת משוואות ואת לתאר ניתן.+

.1

1, , 0k k

k

k

k

Y YF Y t

t

++ −

= ∆ )7(

עבור )7( תלא ליניאריוה ואותומשהמערכת את הmax max

1, , T Tk N N= ∈… ℕ אנחנו פותרים

שיטת נדגיש גם ש. תנאי התחלהעל ידי קבענ 0Y -ש לב שים ליש. בעזרת שיטת ניוטון

.ימטריצת יעקובשל הלא טריוויאלי דורשת חישובניוטון

להשתמש בטכניקת זמן חישוב החלטנו הרבה וזיכרון דורשת הרבהשיטת ניוטוןמכיוון ש

מטריצת יעקובי חילקנו את החישוב של ,לדוגמה, זה לצורך חישוב מקבילי.חישוב מקבילי

.הסימולציה חלוקה זו מקצרת זמן הרצה של תוכנת.י מחשבים שוניםבין כמה מעבדי

כאשר החלק הלא מקבילי, MATLAB - וC הת התכנושפהשתמשנו בכתיבת התוכנה ל

בהסתמך C - ניכתב בשל חישובים והחלק המקביליMATLAB - ניכתב בשל חישובים

Page 155: Surface evolution and grain boundary migration in a system ...amync/mamarim/MSc_Thesis_Vadim_Derkach.pdfSurface evolution and grain boundary migration in a system of 5 grains. Research

v

UMFPACK בחבילה כמו כן השתמשנו .MPI הידוע בשםממשק העברת הודעותעל

Axליניאריות המשוואות המערכת ה אתכדי לפתור b=ניוטון מאיטרציות המתקבלת.

מודל על סמך . גבישים) 3 -עם הורדה בפועל ל (5 חקרנו מערכת של זובתזה ,לסיכום

בנינו מודל מתמטי ,ביני-תנועת פניבין דיפוזיה על פני משטח ובין שקישרקלי פיסי

השתנות בזמן של האת מתארה) תות חלקיודיפרנציאלי תואלגברי ותמשווא מערכת(

כמוםייקלפיסי תהליכים חקרל כמודל זהניתן להשתמש במודל .גבישים 3מערכת בעלת

."thermal grooves" התפתחות בזמן של

תקף שלנו שהמודל מצאנוו, צומת מרובעה תערכי הזויות בנקודאת חישבנו באופן אנליטי

,0 עבוררק 3m ∈ . ודעיכתה סהמכמו כן הוכחנו שמערכת שלנו מקיימת חוק שימור

וכתבנו ,של המודל המתמטינומרי הצגנו אלגוריתם לפתרון , בנוסף. האנרגיה חופשית

בדקנו כמו כן.MATLAB - וCה כנות התושפהמבוססת על הסימולאציה תוכנית

.נומריווידאנו את ההתאמה שלהם לאלגוריתם ה, שפההניסוחים שונים של תנאי

.MPI ממשק העברת הודעותפן מקבילי בעזרת נומריים ביצענו באוחלק מהחישובים ה

.נומריותהצגנו מבחר תוצאות , סוףב

גבישים בתלת 3 המכילה ה הראשון בגיאומטרייהמציאותמודל המודל זה הינו , לערכתנו

מחקרים עתידיים עבורשימושיהיה מחקר זה ימקווים ש אנו. ות דקות בשכב עבורמימד

. שכבות דקות תכונות שלעל