- Summary
- Introduction
- Higher order multiscale method
- Localized Orthogonal Decomposition Method
- Implementation of the Higher Order Multiscale Method in two dimensions
- References
Key:
- ✔️ Optimal convergence
- ✖️ No convergence whatsoever.
- ❓ Optimal convergence for a few mesh points, but then slows down.
Poisson Equation
| Method | p=1 |
p=2 |
p=3 |
|---|---|---|---|
| Constant/Smooth Coefficient | ✔️ | ✔️ | ✔️ |
| Oscillatory Coefficient | ✔️ | ✔️ | ✔️ |
| Random Coefficient | ✔️ | ✔️ | ✔️ |
Heat Equation
| Method | p=1 |
p=2 |
p=3 |
|---|---|---|---|
| Constant/Smooth Coefficient | ✔️ | ✔️ | ✔️ |
| Oscillatory Coefficient | ✔️ | ❓ | ❓ |
| Random Coefficient | ✔️ | ❓ | ❓ |
Wave Equation
| Method | p=1 |
p=2 |
p=3 |
|---|---|---|---|
| Constant/Smooth Coefficient | ✔️ | ✔️ | ✔️ |
| Oscillatory Coefficient (Without well-prepared initial data) | ✖️ | ✖️ | ✖️ |
| Oscillatory Coefficient (With well-prepared initial data) | ✔️ | ❓ | ❓ |
| Random Coefficient | ✔️ | ❓ | ❓ |
This repository contains the source code to implement the Localized Orthogonal Decomposition method and the Higher order Multiscale Method to solve the Poisson problem
the heat equation supplemented with initial and boundary conditions
and the wave equation
Here
The implementation is based on the paper by Maier, R.. This method is local upto the patch of size
The new basis function then contains the fine scale information and can be used to find the numerical solution that contains the information on the fine scale. This needs to be computed once and can be used repeatedly, for example, to solve time dependent problems. For example, the following figure shows the multiscale basis function containing the fine scale information.
| Smooth Diffusion Coefficient | Oscillatory Coefficient |
|---|---|
![]() |
![]() |
The smooth diffusion coefficient does not contain any oscillations and hence the multiscale bases are smooth. If the diffusion coefficient is oscillatory, then the information is captured by the multiscale bases function. The diffusion coefficient for the oscillatory case here is assumed to be
whereas the constant diffusion is
Most of the current implementation relies on Gridap.jl for computing the fine scale stiffness matrix, load vector, the
The script HigherOrderMS/1d_Poisson_eq.jl contains the code to solve the one-dimensional Poisson problem using the Higher Order Multiscale method. I show the results three different diffusion coefficients:
where (N=8) in the coarse space. The fine-scale mesh size was taken to be equal to
| Smooth Diffusion Term | Oscillatory Diffusion Term | Random Diffusion Term |
|---|---|---|
![]() |
![]() |
![]() |
The script HigherOrderMS/1d_heat_equation.jl contains the code to solve the transient heat equation in 1D. The spatial part is handled using the finite element method (both traditional and multiscale) and the temporal part is discretized using the fourth order backward difference formula (BDF4). I use
and the (smooth) coefficient
In both cases, the right hand side
| Smooth Diffusion Term | Oscillatory Diffusion Term |
|---|---|
![]() |
![]() |
The script HigherOrderMS/1d_wave_equation.jl contains the code to solve the acoustic wave equation in 1D. The spatial part is handled using the multiscale finite element method and the temporal part is discretized using Crank Nicolson scheme. I check two different wave speeds
In both cases, I set the right hand side
| Smooth wave speed | Oscillatory wave speed |
|---|---|
![]() |
![]() |
All the rate of convergence examples can be found inside the folder HigherOrderMS/.
The script HigherOrderMS/1d_rate_of_convergence_Poisson.jl contains the code to study the convergence rates for the Poisson equation. To obtain the rate of convergence plots, we always assume that the exact solution is obtained by solving the problem using the traditional finite element method. This is because, in majority of the examples considered here, the exact solution is not known.
The following figure shows the rate of convergence of the multiscale method for the lowest order case (p=1 in the discontinuous space) and varying patch size,
with
The corresponding exact solution is
![]() |
|---|
We observe optimal convergence rates discussed in Maier, R., 2021 until the mesh size becomes too small. In that case a larger patch size (indicated by the parameter
![]() |
|---|
This is in line with the observation made in Maier, R., 2021. Similar observations can be made for the higher-order cases as well, (p=2) and (p=3).
(p=2) |
(p=3) |
|---|---|
![]() |
![]() |
We can solve the problem upto the coarse-mesh size
![]() |
|---|
Finally we can observe the same behaviour for the other choices of diffusion coefficients. The diffusion coefficients were chose identical to the ones discussed in the previous section. The right hand side data
| Oscillatory coefficient | Random coefficients |
|---|---|
![]() |
![]() |
I solve the following parabolic initial boundary value problem using the multiscale method (HigherOrderMS/rate_of_convergence_Heat_Equation.jl).
I take
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
Testing with the non-constant smooth diffusion coefficient:
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
The convergence seems to be optimal in all cases.
I test the above initial boundary value problem with the following oscillatory diffusion coefficient:
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
In case of p=1, the method seems to show optimal convergence rates for most values of p=2,3 the convergence rates deteriorate significantly. Not sure if this is expected for the highly oscillatory case. Let us now proceed to random coefficients.
Finally, I test the problem for random-coefficients which are piecewise-constant on the scale
(p=1) |
(p=2) |
|---|---|
![]() |
![]() |
(p=3) |
Random Diffusion Coefficient |
|---|---|
![]() |
![]() |
The method again shows optimal convergence for p=1 but seem to slightly deteriorate for p=2,3 as the mesh-size decreases. This can be seen in the case of the wave equation as well, which will be covered later.
We perform a few more tests for the heat equation. Consider the following problem
I take the diffusion coefficient
and solve the problem using the multiscale method using p=3. I take the coarse mesh size
-
Case 1:
$f(x,t) = \sin (\pi x) \sin(\pi t), , u_0(x) = 0.$ We observe that the convergence rates are suboptimal for the higher order multiscale method
(p=3)as$H \to 0$ . However, the rate seems to be optimal for the first two mesh sizes.(p=3)
L²Error = [6.904026225412479e-5, 9.994602736284981e-7, 3.897034713700309e-8, 3.802574439053447e-9, 9.080179587634707e-10, 1.3381403737114586e-10, 4.2318825691302157e-11, 3.8970415993978335e-11] log.(L²Error[2:end] ./ L²Error[1:end - 1]) ./ log(0.5) = [6.110144910356789, 4.680700536317692, 3.357328387207551, 2.0661837538612366, 2.7624913657642014, 1.66085796597924, 0.1189202627442888]
-
Case 2:
$f(x,t) = 0, , u_0(x) = \sin (\pi x).$ Again, we observe that the convergence rates are suboptimal for the higher order multiscale method
(p=3)as$H \to 0$ . However, the rate seems to be suboptimal earlier than observed in Case 1.(p=3)
The rate of convergence and the error magnitudes are as follows:
L²Error = [1.7875148956715388e-5, 3.524163429947011e-7, 2.3963586522072257e-8, 7.319979871768478e-9, 1.219071871938366e-9, 1.7618198430902445e-10, 4.3432779965066374e-11, 2.448469254518588e-11] log.(L²Error[2:end] ./ L²Error[1:end - 1]) ./ log(0.5) = [5.664530624433729, 3.8783650784416164, 1.7109322594020788, 2.586056497047787, 2.79064487191708, 2.0202102051473467, 0.8269042168959881]
I solve the following wave equation along with the prescribed initial and boundary conditions
using the multiscale method in space and Crank-Nicolson method in time. For the temporal discretization, I assume
| Constant Wave Speed | Smooth Wave Speed | Oscillatory Wave Speed |
|---|---|---|
![]() |
![]() |
![]() |
First, I assume that the wave speed (p=1,2,3):
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
I observe that for constant wave speed case, the method converges with the optimal convergence rates. I now solve the problem with the following data
Now I use a smooth, but non-constant wave speed
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
Now I solve the same problem keeping the initial and boundary data same, but with an oscillatory wave speed
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
However, if I consider this problem
with
and solve the problem till
(p=1) |
(p=2) |
(p=3) |
|---|---|---|
![]() |
![]() |
![]() |
Next, I show the rate of convergence results for a random piecewise-constant in a on the scale
| Random Wave Speed | (p=1) |
|---|---|
![]() |
![]() |
(p=2) |
(p=3) |
|---|---|
![]() |
![]() |
The errors and the convergence rates for p=3 and l=7,8 are as follows
L²Error, log.(L²Error[2:end]./L²Error[1:end-1])./log(0.5) =
2.813836726235343e-5, -
4.988827991816158e-7, 5.817693879953462
1.1127711098892783e-8, 5.486472153096103
1.7775346709062124e-9, 2.6462072647066717
4.0414836315938045e-10, 2.1369207902329976
1.3890518527993854e-10, 1.5407845490107315
1.556413958602914e-10, -0.16412536859864296H¹Error, log.(H¹Error[2:end]./H¹Error[1:end-1])./log(0.5) =
0.0005317826685733046, -
1.6555166712390332e-5, 5.005483314800532
6.961151076781885e-7, 4.57181184280305,
2.251135974344496e-7, 1.6286726840033017,
8.721593380331359e-8, 1.3679895663609516,
9.539812707649906e-8, -0.1293692120953031,
2.0509237859631738e-7, -1.104241033451946When we solve the wave equation with the randomness scale set to be
L²Error, log.(L²Error[2:end]./L²Error[1:end-1])./log(0.5)
2.4973677290913234e-5, -
5.646129507711419e-7, 5.4670022378419265
9.116253023241141e-8, 2.6307493483547644
1.2071136444360103e-8, 2.9168794615446694
1.605128486309087e-9, 2.9108008148523816
2.9510372535522345e-10, 2.443394747496892
7.85316512435051e-11, 1.909875995981362We observe that the rates are
L²Error, log.(L²Error[2:end]./L²Error[1:end-1])./log(0.5)
2.6780674534387508e-5, -
8.601669221126228e-7, 4.960431835339351
1.6739196120415372e-7, 2.361386407356178
2.537291230911504e-8, 2.7218692189626443
4.299557632978447e-9, 2.5610289832744635
7.310267033088037e-10, 2.556192221672045
8.419981395955944e-11, 3.1180351558689683Again, we observe that the rates are approx
The choice of the time-step method also seems to influence the convergence rates. We consider the Newmark-Beta method with
For a given time step value, the leap frog scheme saturates quickly compared to the Crank-Nicolson method as shown in the figure below
Finally, I solve the problem with the random wave-speed till final time p=1,3. The rate of convergence seem optimal for p=1, but seems to slow down for the p=3 case. The reference solution was obtained using the traditional finite element method on a very fine mesh
(p=1) |
(p=3) |
|---|---|
![]() |
![]() |
The convergence rates of the method for p=3 and l=8 is as follows:
L²Error, log.(L²Error[2:end]./L²Error[1:end-1])./log(0.5) =
2.2320485961861755e-5, -
4.961755800340794e-7, 5.491373894905659
4.8958170476893534e-8, 3.3412291808248495
9.246302547431055e-9, 2.4046011720596137
1.5101989685099656e-9, 2.614137932691149
2.9265375851543793e-10, 2.3674719246984544
1.3435020886818075e-10, 1.1231962428927407H¹Error, log.(H¹Error[2:end]./H¹Error[1:end-1])./log(0.5) =
0.00043096029006185364, -
1.8271795197744734e-5, 4.559864650964216
3.4454468429994438e-6, 2.4068553806810433
1.248128813801055e-6, 1.4649242634423194
4.295718221451051e-7, 1.5387955683444856
1.7287799305600616e-7, 1.3131451334069864
1.786421313606517e-7, -0.0473181398874861The localized orthogonal decomposition method implementation can be found inside the LOD/ folder. The program LOD/main.jl contains the code to check the rate of convergence of the LOD method. The file LOD/1dFunctions.jl contains the routines to compute the standard finite element basis along with the functions assemble the global matrices. The file LOD/1dFunctionsMultiScale contains the code to compute the multi-scale basis along with the function to compute the LOD/main.jl. The multiscale basis corresponding to
![]() |
![]() |
![]() |
|---|
For more details on the method, refer to Målqvist, A. et al.
🚧 The code is found in 2d_HigherOrderMS/ within the repository. Please note that the current implementation can change a lot, since its mostly Work in Progress. 🚧
Implementation in 2D involves a bit of geometrical pre-processing, which involves extracting the patch of all the elements in the coarse space along with the fine-scale elements present inside the patch. The central assumption in obtaining this information is that the fine-scale discretization is obtained from a uniform refinement of the coarse scale elements. Again, the implementation relies on Gridap.jl for computing the mesh connectivity, stiffness matrix, load vector, the
At this stage, the current implementation has only the patch computations coded up. That too just for triangles! The complication here is the map between the coarse scale and fine scale map. For simple meshes involving simplices and hexahedrons, this map can be computed by exploiting an underlying pattern. Ideally, we need the underlying refinement strategy to obtain this map. I hard coded this inside the function
get_coarse_to_fine_map(num_coarse_cells::Int64, num_fine_cells::Int64)which relies on two other function to obtain this map. This interface is subject to change in the future.
Obtaining the patch on the coarse scale is relatively straightforward. We can define a metric that defines the "distance" between the elements and then search the BruteTree built using the connectivity matrix of the fine scale mesh. The NearestNeighbors.jl package contains the interface to implement Brute Tree searching quite easily. This is not ideal, but it will have to do for now. The definition of the metric is as follows
struct ElemDist <: NearestNeighbors.Distances.Metric end
function NearestNeighbors.Distances.evaluate(::ElemDist, x::AbstractVector, y::AbstractVector)
dist = abs(x[1] - y[1])
for i=1:lastindex(x), j=1:lastindex(y)
dist = min(dist, abs(x[i]-y[j]))
end
dist+1
endThe method evaluate is extended to a user-defined DataType named ElemDist which accepts two vectors which are the local-to-global map of the elements in the fine-scale discretization, i.e., two rows of the finite element connectivity matrix. The method returns the distance between the elements which is defined as the minimum difference between all the elements of the input vectors. The result is an integer which is nothing but the patch size parameter ElemDist is less than or equal to
We then extract the patch elements and then compute the element-patch wise DiscreteModel. Then, the next step, which is the trickiest, is to obtain the fine scale discretization on the patch. A quick glance would just tell us that collecting the coarse scale elements and then applying the coarse-to-fine map will do it. But this does not give us information about which fine scale nodes lie on the boundary of the coarse-scale patch. However, to construct the discrete models in Gridap, we need the local ordering along with the nodal coordinates, which we do not have directly. I build a dictionary that contains this local-to-global mapping and then obtain the fine-scale DiscreteModel. Then I extract the local boundary and interior from the DiscreteModel and then convert back to indices in the global sense.
l=2 patch of coarse-scale elements 10,400 |
|---|
![]() |
l=3 patch of coarse-scale elements 10,400 |
|---|
![]() |
The next step is to solve the saddle point problems on the meshes and then obtain the multiscale bases!
Multiscale Bases Function (p=1) with a random Diffusion Coefficient |
|---|
![]() |
For the discontinuous (p=1), I took the scaled monomials
upto order
|
|
|---|
![]() |
Once the basis-functions are computed, we can use the method to solve the Poisson problem. Below, I show the rate of convergence of the lowest order multiscale method (p=0) along with the solution profile. I use the example
with
| Poisson Equation Solution |
|---|
![]() |
| Convergence rates | |
|---|---|
![]() |
![]() |
The rates of convergence seem to be optimal as most of the rates are parallel to the reference lines. The slow-down in the convergence rates is expected in the higher order method due to the presence of growth term associated with the patch size (See Maier, R.). For the p=1 case in the above figure, a much smaller find scale parameter needs to be used, in this case,
- Målqvist, A. and Peterseim, D., 2020. Numerical homogenization by localized orthogonal decomposition. Society for Industrial and Applied Mathematics.
- Maier, R., 2021. A high-order approach to elliptic multiscale problems with general unstructured coefficients. SIAM Journal on Numerical Analysis, 59(2), pp.1067-1089.
- Abdulle, A. and Henning, P., 2017. Localized orthogonal decomposition method for the wave equation with a continuum of scales. Mathematics of Computation, 86(304), pp.549-587.






























































