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 :

  1. Neumann Boundary Condition for the ground surface

  2. Zero-order 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

  1. Neumann Boundary Condition for the ground surface, ,

  2. Zero-order 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 :

  1. 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 .

  2. SubArea

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

  3. 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.

  4. 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

  1. Define the parameters of equation and of parallelism

  2. Open the files where we stock the snapshots and seismograms

  3. Initialize UList u0, u1 with zero

  4. Initialize and launch the instances of SubArea

    Each SubArea use a for loop to :

    1. Calculate from u0, u1 which represent ,

    2. Use Barrier to synchronize

    3. Store the snapshots and seismograms

    4. Update the references in u0, u1

    5. Use Barrier to synchronize

  5. Wait all threads

  6. 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 i7-5500U @ 2.40 GHz.

Snapshots

The snapshots of solution for

Snapshots

Seismograms

The seismograms for (left) and (right).

SeismogramVertical SeismogramSurface

Conclusion

We have simulated a simple 2D problem by using JAVA Threads.

In the future, we can

At last, I’d like to thank my friend Kevin for his kind cooperation in this project.

Code

GitHub Repository