Underground explosion
Project of the course “INF431 : Concurrency” at École Polytechnique
The objective of this project is to simulate the explosion of a bomb in a heterogeneous ground to study the propagation of the acoustic wave. And the programming language we use is JAVA.
Mathematical Problem
We are interested in a simplified model and the problem turns into an acoustic wave equation problem.
Equation
where , is the pressure, is the speed of sound and is the signature of the source :
which means that it’s a punctual source at and the duration is . Here is the characteristic frequency of the explosion.
Initial Condition
As in the case of petroleum prospection, we consider the medium is at rest at the initial moment, i.e.
Boundary Condition
We consider two types of boundary conditions :

Neumann Boundary Condition for the ground surface

Zeroorder Absorbing Boundary Condition (article) for other boundaries
Numerical Scheme
The given subject propose a th order finite difference scheme which uses points to approach .
In order to simplify our problem, we consider the following second order scheme for the moment:
Equation
where
Initial Condition
Boundary Condition

Neumann Boundary Condition for the ground surface, ,

Zeroorder Absorbing Boundary Condition (article) for other boundaries
For example, ,
Data Structure and Parallelism
To calculate the solution with parallelism, we divide the Area into 8 SubAreas :
SubArea 0  SubArea 1  SubArea 2  SubArea 3 
SubArea 4  SubArea 5  SubArea 6  SubArea 7 
So each SubArea does the calculation locally. But from the finite difference method, we can find that in order to calculate at one point, we need and at the same point as well as in its neighbors or some boundary conditions.
That’s why we build the four following class which allow an efficient parallel calculation :

Area
Area contains the main function who initializes and launches the threads. We define all the parameters here as well as the functions to calculate the source .

SubArea
SubArea is derived from Thread and it calculates the solution in its own subarea. It uses Barrier to control the progress of threads.

UList
We use UList to store the solution. UList contains a list of double arrays and each double array corresponds to the solution in one subarea. UList also contains some methods which realise the communication between threads since all the threads share the instances of UList.

Barrier
We use Barrier class to realize the synchronization : each thread should wait for others before entering the next loop.
To sum up, the process of the calculation is :
Area

Define the parameters of equation and of parallelism

Open the files where we stock the snapshots and seismograms

Initialize
UList u0, u1
with zero 
Initialize and launch the instances of
SubArea
Each
SubArea
use a for loop to :
Calculate from
u0, u1
which represent , 
Use
Barrier
to synchronize 
Store the snapshots and seismograms

Update the references in
u0, u1

Use
Barrier
to synchronize


Wait all threads

Close the files
Experience
For now, we studied only the 2D problem :
The area is heterogeneous and the speed of sound is defined as :
The bomb explodes at and the parameters of its signature are .
The time step is and the space step is .
With this setting, the code takes about 28 seconds to calculate until over a computer with CPU i75500U @ 2.40 GHz.
Snapshots
The snapshots of solution for

From the gif above, we can see clearly the reflection of waves due to the Neumann boundary condition of the surface and the change of medium at .

Thanks to the absorbing boundary condition that we use, there is no reflection for the other three boundaries.
Seismograms
The seismograms for (left) and (right).
Conclusion
We have simulated a simple 2D problem by using JAVA Threads.
In the future, we can
 Simulate a 3D problem
 Use a high order scheme
 Use GPU to calculate
 etc.
At last, I’d like to thank my friend Kevin for his kind cooperation in this project.