Professional Documents
Culture Documents
1 Introduction
Multiphase flow in porous media has a relevant role on the analysis of many
industrial activities. The velocity, dispersion, and displacement of fluids in a porous
media are key parameters for processes such as pollutant transport, mobile reactive
beds, oil recovery, etc. The proper characterization of the porous media properties,
such as absolute and relative permeability, is crucial for this type of analysis. In order
to predict the behavior of these processes, the numerical simulations (at proper scales)
provide information of the flow almost impossible to obtain from other sources. This
topic is therefore an open challenge in the numerical methods community.
Smooth Particle Hydrodynamics (SPH) is a meshfree Lagrangian numerical method.
This method was first proposed for astrophysical problems [1] but nowadays it is
widely used in computational fluid dynamics [2]. SPH is a Lagrangian and meshless
method in which the fluid is discretized into a set of particles. Each of these particles
is a nodal point for which physical quantities (such as position, velocity, density, and
pressure) are computed as an interpolation of the values of the neighboring particles.
One of the drawbacks of this method is its computational time cost. This issue has
been overcome thanks to the parallelized SPH code named DualSPHysics [3] that
takes advantage of the rising new technology of the Graphic Processor Units (GPUs).
DualSPHysics allows the user to implement a whole new set of cases with the proper
resolution to obtain a good accuracy in its results.
The fluid transport in porous media is a cutting edge topic in the CFD community, so
a new set of equations should be implemented to satisfy all the peculiarities of these
simulations. In order to represent properly these cases, the implementation of two
phases with different properties (viscosity, density, wet ability) is needed.
2 DualSPHysics
3 Implementation on GPU
Big simulation can be achieved with the promising GPU technology for problems that
previously required high performance computing (HPC). Moreover, the coming out of
languages such as the Compute Unified Device Architecture (CUDA) made possible
programming GPUs for general purpose applications. In the particular case of SPH,
the first implementation of the method on GPUs were carried out by [6, 7].
The diffusion equation (5) was implemented in the DualSPHysics code which
governing equations are presented in (1-4):
Momentum
(1)
Continuity
(2)
Estate Equation
(3)
Displacement
(4)
Diffusion
(5)
The equation (5) was implemented using both C++ and CUDA programming
languages. The program can then be executed either on the CPU or on the GPU. The
code is organized in three main stages that are repeated each time step: 1 creating a
neighbor list; 2 computing particle interactions for momentum, concentration and
continuity conservation equations and 3 time integration. Following to [8], the
equation (5) was implemented in the most efficient option where all data is keeping in
the memory of the GPU where all process are parallelized and only output data
requires transfers from GPU to CPU. The diagram flow is showing in the Figure 1.
CPU-GPU GPU-CPU
Initial Data Neighbour System Save Data
Memory Memory
List Update (occasionally)
Transfer Transfer
Particle
Interaction
The system update can be parallelized esaly on GPU. Example pseudocode where the
cocentration value are update is shown below.
Different test with analytical solution were used to validate the implementation of
diffusion equation.
The first numerical simulation refers to a finite vertical strip of tracer within a
rectangular water tank. The width of the strip is equal to the size of the pollutant
particles. The tank is b = 0.4 m and h = 1 m and the length of the strip is equal to 0.11
m, located at X0 = 0.2 m and ranging from Z1 = 0.44 m to Z2 = 0.55 m.The pollutant
has an initial constant concentration C0 = 1 kg/m3 and the initial water concentration
is set equal to 0. The diffusion coefficient D is equal to 10-4 m2/s.
Referring to the z-position of the pollutant, the time evolution of the concentration
field along z coordinate using SPH models is compared with the following analytical
solution (Equation 7, 8) derived from the classical diffusion equation (Equation 6) as
a function of the length and the initial constant distribution of the contaminant
concentration:
(6)
(7)
(8)
Figure 2 shows the comparison between numerical and analytical results for the
proposed case. Numerical results show good agreement with the analytical solution.
1 1
0.9 0.9
0.8 0.8
0.7 0.7
C (kg/m^3)
C (kg/m^3)
0.6 0.6
0.5 0.5
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
0.4 0.45 0.5 0.55 0.6 0.4 0.45 0.5 0.55 0.6
Z(m) Z(m)
1 second 2 seconds
Fig. 2. Numerical and analytical solution comparison to 1 and 2 seconds.
The second test case is Poiseuille flow between stationary infinite plates at
and . The fluid is initially at rest and is driven by an applied body force F
parallel to the x-axis for . The series solution for the transient behavior is
(9)
0.000012
0.00001
0.000008
Vx (m/s)
0.000006
0.000004
0.000002
0
0 0.0002 0.0004 0.0006 0.0008 0.001
Y (m)
DualSPHysics t=0.01 DualSPHysics t=0.1
DualSPHysics t=0.5 Anlitycal Solution t=0.01
Anlitycal Solution t=0.1 Anlitycal Solution t=0.5
Fig. 3. Numerical and analytical solution comparison at 0.01, 0.1 and 0.5 seconds.
Results illustrate the pollutant dispersion in the porous media. These types of
simulations allow evaluate process where the flow and dispersion in porous media
take an important role. Numerical solutions at different times are showing in the
Figure 5.
The first possible step in incorporating some form of parallelism is to fully use the
cores and the memory available in a system. Most computer processors today possess
some degree of parallelism with the system memory available to each core
simultaneously, so with parallel computing the processing power of each core can be
assigned to creating multiple threads executing the code in parallel. The data are then
uploaded in the shared memory so they can be accessed and modified by each thread.
However, while using a massively parallel CPU system will significantly decrease the
computational time, its cost can be prohibitive. Obtaining the processors needed, as
well as sufficient space to store them is extremely expensive. The cost of connecting
the machines and their maintenance costs, especially the energy and the cooling
required are also quite significant [9].
GPUs are specialized hardware designed to process large quantities of data to be
displayed on computer screens in real time. The unique architecture of GPUs makes
them particularly suitable for computationally intensive simulations using Lagrangian
methods such as SPH. The large number of multi-processors on a GPU enables speed-
ups close to two orders of magnitude compared to a single CPU code [10].
Simulations were conducted using the CPU-GPU approach and were compared to a
CPU-only approach. The GPU was in general about 2 times faster than the CPU. A
small number of particles were however used for their simulations and a larger speed-
up was expected when the particle resolution is increased. Figure 6 shows the runtime
comparison for the simulation of dispersion in porous media using CPU and GPU
processors.
50
40
Time (min)
30
20
10
0
0.00E+00 4.00E+04 8.00E+04 1.20E+05 1.60E+05
Particles
Fig. 6. Computational time for different numbers of particles using different units of processing
6 Conclusions
A new tool called DualSPHysics has been developed to evaluate the transport of fluid
in porous media. DualSPHysics has shown good accuracy at a reasonable
computational time using GPU computing and provides reliable results according to
the validation. This new implementation allows the study of different options in order
to choose the most optimal approach in fields like pollutant transport, mobile reactive
beds, oil recovery, etc.
References