You are on page 1of 9

Fourth International Conference on Advanced COmputational Methods in ENgineering (ACOMEN 2008)

Editors: M. Hogge, R. Van Keer, L. Noels, L. Stainier, J.-P. Ponthot, J.-F. Remacle, E. Dick
University of Lige, Belgium, 26-28 May 2008

Finite element heterogeneous multiscale method and its
implementation package feHMM
J. Bu sa, Jr.
1
and V. Melicher
1
1
Department of Mathematical Analysis, Nfam2, Ghent University
Galglaan 2, 9000 Ghent, Belgium
e-mails: Jan.Busa@UGent.be, Valdemar.Melicher@UGent.be
Abstract
Mathematical modelling has to deal often with processes acting act on different space- or time-
scales. One usually tries to eliminate all the scales except that of the interest.
We consider a microscopically heterogeneous material and we employ the homogenisation the-
ory to analyse its macroscopic behaviour. The idea of homogenisation is to replace this microscopi-
cally heterogeneous material with a homogeneous one at the macroscopic scale. The Heterogeneous
multiscale method, introduced in [1], is a framework which allows to accomplish this on the y,
even without knowing governing equations at macroscopic level. This can be priceless for practi-
tioners.
We present here the feHMM library an implementation of nite element heterogeneous multi-
scale method for a widely used nite element package ALBERTA [2]. The feHMM can be used to
solve wide range of problems described by partial differential equations acting on multiple scales.
1 Introduction
Most of the problems we encounter in the modelling of real world are multiscale in their nature. We can
look at some material from the macroscopic point of view or look at its atomic structure. For example the
energy of atomic motion can be observed as the temperature of material at macroscopic level. Similarly
in ecological systems, the migration of species and life cycle are processes acting on different time
scales. Naturally, problems can be heterogeneous not only in time- or space-scale, but in both scales at
the same time.
In the next, we will analyse macroscopic behaviour of multiscale problems. How can we solve
multiscale problem?
One way is to forget about the micro scale and to develop an empirical macroscopic model. Problem
of such models is their accuracy, complete neglecting of micro scale information which can be some-
times of interest and their empirical nature. It is the only possibility in the case we have no micro model.
If one is available, it should be used at least to validate the empirical model.
Other possibility is to use the full micro scale solver. This incorporates usually all the physical
background of the problem and gives the best description of the phenomena. Commonly, it is too costly
to solve the full micro scale model. This ne level of information is often not necessary as well.
Classical multiscale modelling methods such as multi-grid, fast multipole method or adaptive mesh
renement try to resolve details of the solution on the micro scale level and so the cost of the methods is
the cost of full micro scale solver.
The purpose of new multiscale methods, is to resolve the macro scale behaviour of the multiscale
model with a cost that is less than the cost of full micro scale solver. Naturally, to achieve this, we may
not require to have all the information on micro-level and we have to use special properties of the micro
scale problem such as scale separation. For the overview of modern multiscale methods we refer reader
to [3] and references therein.
The article is divided into three main sections. First, in the second section, we introduce the nite el-
ement Heterogeneous multiscale method. In the third section, its implementation the package feHMM
is presented. We will focus on the feHMM from the point of view of a user. The fourth section is devoted
to numerical experiments.
2 Heterogeneous multiscale method
The Heterogeneous multiscale method (HMM), introduced in [1], is a very general framework for con-
structing algorithms, which converge in sublinear time when compared to the complexity of full ne
scale problem. This can not be done without exploiting some special features of the problem. We
suppose that the scales are separable.
However general the HMM is, it always consists of two steps. First one is to choose a macroscopic
solver. Certain knowledge of macro scale model is here necessary. Second one is to estimate missing
macroscopic data by solving the ne scale problem. The ne scale model and the corresponding macro
scale model are coupled via compression and reconstruction operators. For general discussion of these
issues and examples we refer reader to [1] or to a recent review article [3].
We are going to apply the HMM framework to the solution of variational problems with oscillat-
ing coefcients, particularly elliptic and parabolic ones. Moreover we suppose these problems to be
symmetric for the simplicity of explanation. Finite elements are natural for the space discretisation of
variational problems. Thus such an application of the HMM is often referred to as the nite element
HMM.
We make the following assumptions:
1. We have a microscopic variational problem
min
u
f(u), (1)
where u is a state variable dependent on multiple scales, e.g. for simplicity u = u(x,
x

) with
1. Here u(x, y) is periodic in y.
2. There exists a macroscopic variational model
min
U
F(U), (2)
which has a solution u
0
such that
u
_
x,
x

_
= u
0
(x) +O(). (3)
3. We have compression Qand reconstruction operators, the rst of them mapping micro to macro
states and the second other way around, such that Q = 1, where 1 is the identity operator.
We do not have to know the macroscopic model explicitly. The rst idea of the HMM is to approxi-
mate the macro problem as follows
F(U) min
Qu=U
f(u), (4)
leading to
min
U
F(U) min
U
min
Qu=U
f(u). (5)
It remains still quite abstract. We will explain the idea on the heat conductivity problem
(A

) = f in ,
u

= 0 on ,
(6)
where A

(x) = A
_
x,
x

_
. We suppose that A(x, y) is periodic in y with the period Y := [0, 1]
n
.
It is the classical result of the homogenisation theory [4, 5] that u

converges in a weak sense to a


u
0
(x) H
1
0
(), the solution of
(A
0
u
0
) = f in , (7)
where A
0
is given by
a
0
ij
=
_
Y
a
ij
+
n

k=1
a
ik

j
y
k
(x, y) dy, i, j = 1, . . . , n. (8)
Here,
j
denote the solutions to the cell problems
(A

j
) =
n

k=1
A

kj
y
k
in , j = 1, . . . , n, (9)
where
j
are periodic in y with period Y. There exist no explicit formulae for the homogenised heat
conductivity A
0
in general. Only in some special cases, e.g. for a layered material. In general, the cell
problems have to be solved numerically.
In the case of ne scale problem (6) we opt for nite element space discretisation, which is natural
for variational problems. The homogenised u
0
is the macro state variable we look for. It solves (7).
Thus nite elements are again a feasible choice.
Let T
H
be the macro triangulation of . The diameter H of the triangulation is chosen to resolve
well the macro scale properties of (6). We allow H . Let the macro nite element space be dened
as
P
k
0
(, T
H
) :=
_
U
H
H
1
0

U
H
[
K
P
k
(K) K T
H
_
, (10)
where P
k
(K) is the space of k
th
-order polynomials on the triangle K T
H
.
The variational formulation of (7) reads
_
A
0
u
0
,
_
= (f, ) H
1
0
(). (11)
The macro data, that have to be estimated using the ne scale problem (step 2 of the HMM) is the
stiffness matrix corresponding to (11)
M
H
ij
=
_
A
0

i
,
j
_
, (12)
where
i
are the basis functions of P
k
0
(, T
H
). Imagine, we would know the effective conductivity A
0
.
Then we could simply evaluate M
H
ij
by means of a numerical quadrature
M
H
ij

KT
H
[K[

x
l
K

l
A
0
(x
l
)
i
(x
l
)
j
(x
l
), (13)
where x
l
and
l
are the quadrature points and weights, respectively. An idea of HMM is to approximate
f
ij
= A
0
(x
l
)
i
(x
l
)
i
(x
l
) (14)
by an solution to a ne scale problem on a small domain I

(x
l
) around the quadrature point x
l
. This
idea is based on the homogenisation theorem, see for example [4], Th. 6.1. Let /
Y
(f) stand for the
Y cell average of a function f, i.e., /
Y
(f) =
1
|Y |
_
Y
fdy. The matrix A
0
is given by
A
0
= /
Y
(A

), R
n
, (15)
where w

is the solution of the auxiliary cell Problem 1.


Problem 1. Find w

such that w

y W
per
(Y ) and a
Y
(w

, v) = 0 for all v W
per
(Y ), where
the space W
per
(Y ) is dened as
W
per
(Y ) :=
_
v H
1
per
(Y ) :
_
Y
v = 0
_
. (16)
Here H
1
per
(Y ) is the closure of C

per
(Y ), i.e., the subset of Y-periodic functions of C

(R
N
), in H
1
-
norm. The bilinear form a
Y
(u, v) is dened as
a
Y
(u, v) :=
_
Y
A

uv dy, u, v W
per
(Y ). (17)
Moreover we have
/
Y
(w
Y
y) = 0. (18)
On the basis of this characterisation of A
0
, particularly from (15) we can write
A
0
(x
l
)U(x
l
) = /
Y
(A

u), (19)
where u = w

for = U(x
l
). Moreover the Y-periodicity of w
Y
y yields
U(x
l
) = /
Y
(u). (20)
In this way, the homogenisation theorem gives us the denition of the appropriate compression
operator Q. It is dened in the quadrature points by (20).
Consequently, the macro bilinear form can be dened by the HMM as
A(U
H
, V
H
) :=

KT
H
[K[

x
l
K

l
[I

(x
l
)[
(A

u, v)
I

(x
l
)
, (21)
where u, v are solutions of Problem 2 for = U
H
, = V
H
, respectively. The sublinear cost of the
HMM stems from the fact that we solve the microproblem only on the small sampling domain I

(x
l
)
around the quadrature point x
l
, not on the whole triangle K. Let us recall, that the convergence of the
HMM in H is robust in a sense that it does not depend on , see [1].
Problem 2. Find u such that u W
per
(I

(x
l
)) and
_
I

(x
l
)
uA

(v)
T
= 0 v W
per
(I

(x
l
)).
The obvious choice of I

(x
l
) in periodic case is I

(x
l
) = Y. The Dirichlet boundary condition is
implemented instead of the periodic one in Problem 2 [6] at present version of the package feHMM,
see Section 3. In [7] is studied how the choice of the boundary condition inuences the accuracy of
the solution. It appears that the periodic boundary condition is the best choice not only for periodic
materials, but also for materials with stochastic nature. The periodic one is scheduled for future versions
of the feHMM.
The HMM in the nite element context is extensively studied. The rst analytical results were
obtained in [6] for elliptic homogenisation problems, then for parabolic in [8]. A priori error analysis of
fully discrete HMM, i.e. where microproblems are also solved by nite element method, is to be found
in [9]. A pseudospectral solver for microproblem is employed in [10] to speed up the nite element
HMM. A discontinuous Galerkin HMM is analysed in [11]. An analytical framework for the numerical
homogenisation of monotone elliptic operators, which justies the HMM, was introduced in [12]. A
posteriori error estimates for the nite element HMM for elliptic homogenisation problems were given
in [13]. The author made this contribution after realising that the nite element HMM approximates the
two-scale homogenised equation in a variational sense.
3 feHMM
The idea behind the package feHMM was to develop an easy to use and in the same time exible and
robust implementation of the nite element HMM. Flexible in the sense that it can solve wide range
of problems occurring in practice and that it can be easily extended. Easy to use in the sense that
a practitioner can use it as a black-box without almost any knowledge of the HMM. At the present
stage black-box problems are many elliptic and parabolic equations with oscillating coefcients, see
limitations of the HMM [1]. The implementation of a simple homogenisation problem using the feHMM
for an Alberta experienced user is matter of hours or even minutes.
The package feHMM is C++ library based on Alberta nite element package [2]. This package is
what makes the feHMM robust and powerfull. For example, when one implements a problem, it is in
fact done automatically in all dimensions (1D, 2D, 3D). Only geometry dependent elements have to be
changed domain, boundary conditions, etc.
The Alberta is written in C. This allows for writing of very quick programs. However consequently,
to implement even a simple problem in Alberta can consume a signicant amount of time. We decided to
implement feHMM in C++. This way we can hide lot of programing details form the user. For example
initialisation of stiffness matrices is done by the package. Moreover, the code becomes more compact
and reusable. We refer the interested reader to special literature on C++ and C issues [14]. The feHMM
package is built to solve the problems where both the ne scale problem and the macro problem are
variational ones.
3.1 From the point of view of the user
We focus on the usage of the feHHM as a black-box solver. Conceptually, the nite element HMM
consists of a few main elements which have to be supplied by a user:
geometry, i.e. bounded domain ,
the bilinear form of microproblem,
right hand side at macro level, i.e., at the level of triangulation T
H
,
boundary conditions at the macro level.
We have to include initial condition at the macro level if a time-dependent problem is solved, etc. All
these informations are lled by the user in an interface object which is then sent as a parameter to the
constructor of the feHHM object. All the necessary initialisation is done automatically. The user can
then call the different functions of the main feHHM object, such as solve. Let us explain the particular
steps.
Geometry and parameters
The user provides the geometry information in exactly the same way as when using Alberta. It is
contained in a macro le holding mesh and boundary condition types.
For comfort, the user can set the parameters through an init le, again as in Alberta. All the provided
parameters for feHMM are lled into the interface object mentioned above, implemented as the C++
class CUserData.
Bilinear form, right hand side and boundary condition
The bilinear form (BF), the right hand side (RHS) and the boundary condition (BC) are implemented as
functions by the user. These are sent again through the CUserData class as pointers to the correspond-
ing functions.
All the necessary information for user is provided as parameters of these functions. For example the
function for the Dirichlet BC obtains the world coordinates.
3.2 Example
We will now explain the usage and the design of the package on the simple elliptic homogenisation
problem (6). What follows is actually the main code
CUserData MyData;
MyData.LoadUserDataFromFile("INIT/init.dat");
MyData.pBuildDynamic = &build; // user function to build the stiffness matrix
MyData.pSetUpRHS = &buildRHS; // user function to build the macro RHS
MyData.pExactSolution = &u; // user can support the exact solution for testing purposes
MyData.pDirBoundCond = &g; // the Dirichlet boundary condition
feHMM MyfeHMM(&MyData); // initialises the feHMM with the user data
MyfeHMM->Solve();
cout<<"L2error = "<<pMyfeHMM->L2Error()<<endl; // the L2 error between the computed and
// the exact solution
First, some parameters are loaded from the init le. Between them are the following ones:
The number of scales in data. It is two in the case of (6) with A

= A(x, y).
The space dimension, i.e. the dimension of .
The dimension of problem we have scalar problem so it is one. The feHMM supports mixed or
more dimensional problems.
Degrees of quadrature at different scales. At a certain scale the same quadrature is used for all the
components of the solution if this one is a multidimensional. It does not apply to the microscopic
level where the user has complete freedom, as we will see. We choose linear Lagrange nite
elements at both scales.
Scale-factors for different scales. Scale-factor s at a certain scale is the factor of the diameter H of
the mesh at the higher level such that the dimension of I

(x) is = sH. Here x is a quadrature


point for the bilinear form at the higher level.
Numbers of mesh renements at different scales, i.e., how ne meshes should be used to solve
approximating problems at different scales.
Degrees of nite elements at different scales. The feHMM supports only the Lagrange elements
at the moment.
The macro le name from which geometry should be loaded.
Information about the solver, which should be used to solve the resulting linear systems, e.g. type
(GMRES, CG, . . . ), accuracy, etc.
Then, the user provides the function build which tells the feHMM how to build the stiffness matrix
at the microscopic scale. For (6) it is implemented as follows
void build(const FE_SPACE
**
fe_space, DOF_MATRIX
***
matrix) {
MESH
*
pMesh=fe_space[0]->mesh;
dof_compress(pMesh);
static const EL_MATRIX_INFO
*
matrix_info= nil;
OPERATOR_INFO o_info = { nil };
o_info.row_fe_space = fe_space[0];
o_info.col_fe_space = fe_space[0];
o_info.init_element = init_element;
o_info.LALt = LALt;
o_info.LALt_pw_const = true; // pw const. assemblage is faster
o_info.LALt_symmetric = true; // symmetric assemblage is faster
o_info.use_get_bound = true; // Dirichlet boundary conditions!
o_info.user_data = MEM_ALLOC(1, struct op_info); // user data!
o_info.fill_flag = CALL_LEAF_EL|FILL_COORDS;
matrix_info = fill_matrix_info(&o_info, nil);
clear_dof_matrix(matrix[0][0]);
update_matrix(matrix[0][0], matrix_info); // the assembling of stiffness matrix
}
As an experienced user of the Alberta can see, this is completely standard code for Laplaces equa-
tion [2]. Only thing to realise is that the LALt function is implemented with multiscale heat conductiv-
ity A

. The user always obtains a two-dimensional array of stiffness matrices to ll. We have a scalar
problem, so the array contains only one element, here matrix[0][0]. The interface for one- and
multi-dimensional problems is unied.
The build function is called by the feHMM at every quadrature point of macro mesh. Particularly to
assemble the stiffness matrix corresponding to micro Problem 2 (with the Dirichlet boundary condition
as mentioned). Then nite element approximations of solutions to Problem 2 for all eligible nite
element functions from macro scale nite element space are computed. On basis of these, the macro
stiffness matrix M is computed according to (21).
Further, the function buildRHS is provided by user. The RHS vector is again lled the same way
as in Alberta. Since the source f(x) does not contain any high frequency components, the RHS vector
is lled only at macroscopic level.
All the other user inputs are well explained by the code itself.
4 Numerical experiments
Again, we consider (6) as an example. First, we look at one dimensional case. Let us have A

= A
_
x

_
,
where
A(y) = cos(2y) + 2, y Y = [0, 1] (22)
and f(x) = 1 in . The exact solution reads
u

=
_
x
0
t
A

(t)
dt +
_
1
0
t
A

(t)
dt
__
1
0
1
A

(t)
dt
_
1
_
x
0
1
A

(t)
dt (23)
Moreover, the homogenised solution is
u
0
=
x x
2
2

3
(24)
with the corresponding homogenised heat conductivity A
0
=

3.
Let us look at the convergence of the method. The results are presented in Figure 1 for = 2.510
7
.
They conrm the estimate of the nite element HMM with Dirichlet boundary condition used for micro
problems [6]
|u
0
U
H
|
L
2
()
C
_

+ +H
2
_
|f|
L
2
()
, (25)
where u
0
is the homogenised solution and U
H
its approximation obtained by the nite element HMM.
H is the diameter of macro mesh, is the edge length of cube I

(). This estimate is valid under the


assumption that microproblems are solved precisely. For periodic case was full discretisation studied in
[9], where the error of microproblem was estimated by O
_
(
h

)
2
_
. Here h is the diameter of the nite
element mesh used to solve the micro problems. We have = Hs, where the scale factor s = 0.064
was taken. The estimate (25) becomes
|u
0
U
H
|
L
2
()
C
_

H
+H +H
2
_
|f|
L
2
()
. (26)
The results conrm that the error drops quicker than lineary and slower than quadraticaly with H. Then,
when the = Hs becomes too small, the term O(

) occurs to be dominant, see the results for H =


1.95 10
3
, i.e. = 1.25 10
4
. Theoretically the best value of =

.
-8 -7 -6 -5
log(h)
-5
-4
-3
-2
-1
0
l
o
g
(
e
)
H=1.25E-01
H=3.13E-02
H=7.81E-03
H=1.95E-03
Figure 1: Convergence of the HMM; e = |u
0
U
H
|
L
2
()
0
0.2
0.4
0.6
0.8
1
x
0
0.2
0.4
0.6
0.8
1
y
0
0.02
0.04
0.06
0
0.2
0.4
0.6
0.8
1
x
0
0.2
0.4
0.6
0.8
1
y
0
0.02
0.04
0.06
Exact solution u

Approximate solution U
H
0
0.2
0.4
0.6
0.8
1
x
0
0.2
0.4
0.6
0.8
1
y
-0.002
0
0.002
0.004
Difference between the exact and the approximate solution
Figure 2: Performance of the HMM on two-dimensional problem
In Figure 2, the results are depicted for the two-dimensional
1
reformulation of (22). Here =
[0, 1]
2
, the homogeneous Dirichlet boundary conditions are prescribed on edges x
1
= 0 and x
1
= 1 and
the homogeneous Neumann boundary conditions are prescribed on the rest. u

is given by (23) where x


is substituted by x
1
. H = 6.47 10
3
, h = 4.19 10
5
and |u
0
U
H
|
L
2
()
= 3.71 10
2
for = 0.01.
References
[1] W. E and B. Engquist. The heterogeneous multi-scale methods. Comm. Math. Sci., 1:87132,
2003.
[2] A. Schmidt and K. Siebert. Design of Adaptive Finite Element Software, The Finite Element Tool-
box ALBERTA, volume 42 of Lecture Notes in Computational Science and Engineering. Springer,
2005.
[3] W. E, B. Engquist, X. T. Li, W. Q. Ren, and E. Vanden-Eijnden. Heterogeneous multiscale meth-
ods: A review. Commun. Comput. Phys., 2(3):367450, June 2007.
[4] D. Cioranescu and P. Donato. An Introduction to Homogenization. Oxford University Press, 1999.
[5] A. Bensoussan, J.L. Lions, and G.C. Papanicolaou. Asymptotic Analysis for Periodic Structures.
North-Holland Pub. Co., Amsterdam, 1978.
[6] W. N. E, P. G. Ming, and P. W. Zhang. Analysis of the heterogeneous multiscale method for elliptic
homogenization problems. J. Am. Math. Soc., 18(1):121156, 2005.
[7] Xingye Yue and Weinan E. The local microscale problem in the multiscale modeling of strongly
heterogeneous media: Effects of boundary conditions and cell size. J. Comput. Phys., 222(2):556
72, March 2007.
[8] P. B. Ming and P. W. Zhang. Analysis of the heterogeneous multiscale method for parabolic
homogenization problems. Math. Comput., 76(257):153177, 2006.
[9] Assyr Abdulle. On a priori error analysis of fully discrete heterogeneous multiscale fem. Multiscale
Model. Sim., 4(2):447459, 2005.
[10] Assyr Abdulle and Bjorn Engquist. Finite element heterogeneous multiscale methods with near
optimal computational complexity. Multiscale Model. Sim., 6(4):10591084, 2007.
[11] Shanqin Chen, Weinan E, and Chi-Wang Shu. The heterogeneous multiscale method based on the
discontinuous galerkin method for hyperbolic and parabolic problems. Multiscale Model. Sim.,
3(4):871894, 2005.
[12] Antoine Gloria. An analytical framework for the numerical homogenization of monotone elliptic
operators and quasiconvex energies. Multiscale Model. Sim., 5(3):9961043, 2006.
[13] Mario Ohlberger. A posteriori error estimates for the heterogeneous multiscale nite element
method for elliptic homogenization problems. Multiscale Model. Sim., 4(1):88114, 2005.
[14] Bruce Eckel. Thinking in C++. Prentice-Hall, Inc., 1995.
1
quasi-one-dimensional

You might also like