PySPH: A Python framework for SPH Prabhu Ramachandran - - PowerPoint PPT Presentation

pysph a python framework for sph
SMART_READER_LITE
LIVE PREVIEW

PySPH: A Python framework for SPH Prabhu Ramachandran - - PowerPoint PPT Presentation

PySPH: A Python framework for SPH Prabhu Ramachandran Chandrashekhar P . Kaushik Department of Aerospace Engineering and Department of Computer Science and Engineering IIT Bombay SciPy 2010 Austin, TX, June 30 July 1, 2010 Outline


slide-1
SLIDE 1

PySPH: A Python framework for SPH

Prabhu Ramachandran Chandrashekhar P . Kaushik

Department of Aerospace Engineering and Department of Computer Science and Engineering IIT Bombay

SciPy 2010 Austin, TX, June 30 – July 1, 2010

slide-2
SLIDE 2

Outline Introduction PySPH Architecture

slide-3
SLIDE 3

Outline Introduction PySPH Architecture

slide-4
SLIDE 4

SPH examples

slide-5
SLIDE 5

SPH examples

slide-6
SLIDE 6

3D

slide-7
SLIDE 7

Parallel?

slide-8
SLIDE 8

Smoothed Particle Hydrodynamics

◮ Particle based, Lagrangian ◮ Gingold and Monaghan (1977),

Lucy (1977)

◮ PDEs ◮ Complex problems ◮ Moving geometries ◮ Free surface problems ◮ . . .

slide-9
SLIDE 9

Smoothed Particle Hydrodynamics

◮ Particle based, Lagrangian ◮ Gingold and Monaghan (1977),

Lucy (1977)

◮ PDEs ◮ Complex problems ◮ Moving geometries ◮ Free surface problems ◮ . . .

slide-10
SLIDE 10

SPH basics

◮ The SPH approximation

f(r) =

  • f(r ′)W(r − r ′, h)dr ′

◮ W(r − r ′, h): kernel, compact support ◮ h: size of the kernel

slide-11
SLIDE 11

SPH basics

slide-12
SLIDE 12

SPH basics

neighbors kh Nearest

slide-13
SLIDE 13

SPH basics . . .

◮ Derivatives: transferred to the kernel ◮ Lagrangian ◮ PDE → ODE

slide-14
SLIDE 14

Scale-up for larger problems requires parallelization

slide-15
SLIDE 15

Motivation Reproducible and open research

slide-16
SLIDE 16

Outline Introduction PySPH Architecture

slide-17
SLIDE 17

PySPH

◮ SPH + Parallel + Python ◮ pysph.googlecode.com ◮ Open Source (BSD)

slide-18
SLIDE 18

Requirements and installation

◮ Python, setuptools ◮ numpy, Cython-0.12,

mpi4py-1.2

◮ Mayavi-3.x (optional) ◮ Standard Python package

install

slide-19
SLIDE 19

High-level solver outline

slide-20
SLIDE 20

Serial Dam break

solver = FSFSolver ( time_step =0.0001 , total_simulation_time =10. , kernel=CubicSpline2D ( ) ) # create the two e n t i t i e s . dam_wall = Solid (name= ’ dam_wall ’ ) dam_fluid = Fluid (name= ’ dam_fluid ’ ) # The p a r t i c l e s f o r the wall . rg = RectangleGenerator ( . . . ) dam_wall . add_particles ( rg . g e t _ p a r t i c l e s ( ) ) solver . add_entity ( dam_wall )

slide-21
SLIDE 21

Serial Dam break . . .

# P a r t i c l e s f o r the l e f t column of f l u i d . rg = RectangleGenerator ( . . . ) dam_fluid . add_particles ( rg . g e t _ p a r t i c l e s ( solver . add_entity ( dam_fluid ) # s t a r t the solver . solver . solve ( )

slide-22
SLIDE 22

Parallel Dam break

solver = ParallelFSFSolver ( time_step =0.0001 , total_simulation_time =10. , kernel=CubicSpline2D ( ) ) # Load p a r t i c l e s in proc with rank 0.

slide-23
SLIDE 23

Outline Introduction PySPH Architecture

slide-24
SLIDE 24

Software architecture

◮ Particle kernel ◮ SPH kernel ◮ Solver framework ◮ Serial and Parallel solvers

slide-25
SLIDE 25

Software architecture

Solver Framework

NNPS SPH Cell Manager Particle Arrays

Solvers

(Python & Cython) (Cython) (Cython) (Cython) (Cython)

C−Arrays

(Cython)

slide-26
SLIDE 26

Particle kernel

◮ C-arrays: numpy-like but faster and

resizable

◮ ParticleArray: arrays of properties ◮ NNPS (Nearest Neighbor Particle

Search)

◮ Cell, CellManager ◮ Caching

slide-27
SLIDE 27

SPH kernel

◮ SPH particle interaction: interaction

between 2 SPH particles

◮ SPH summation: interaction of all

particles

slide-28
SLIDE 28

Solver framework

◮ Entities (made of particles) ◮ Solver components (do various things) ◮ Component manager (checks

property requirements)

◮ Integrator ◮ Basic Solver

slide-29
SLIDE 29

Parallel solver

◮ Parallel cell manager ◮ Parallel solver components

slide-30
SLIDE 30

Parallel solver

CellManager Processor 1 Processor 2 Particles Solver components Particles Solver components Parallel case ParallelCellManager ParallelCellManager Serial case Particles Solver components

slide-31
SLIDE 31

Challenges

◮ Particles move all over ◮ Fixed partitioning will not work ◮ Scale up ◮ Automatic load balancing?

slide-32
SLIDE 32

Terminology: Cell Cells Particles

slide-33
SLIDE 33

Terminology: Region

Region 2 P1 P2 Region 1

slide-34
SLIDE 34

P2

O (−1,−1,0) (1,1,0) (1,−1,0) (2,0,0)

P1 P3 P4

Terminology: Domain decomposition

slide-35
SLIDE 35

Approach

◮ Domain decomposition: Cells ◮ Cells: dynamically created/destroyed ◮ Processors manage Regions ◮ Cells moved to balance load

slide-36
SLIDE 36

Load Balancing

Donate Cells

◮ Boundary cells ◮ Cells with least number of local

neighbors

slide-37
SLIDE 37

Load balancing

slide-38
SLIDE 38

Efficiency

slide-39
SLIDE 39

Efficiency

slide-40
SLIDE 40

Current capabilities

◮ Fully automatic, load balanced,

parallel framework

◮ Relatively easy to script ◮ Good performance ◮ Relatively easy to extend ◮ Free surface flows

slide-41
SLIDE 41

Immediate improvements

◮ Solver framework redesign ◮ More documentation ◮ Reduce dependency on TVTK for

easier installation

◮ Improved testing on various platforms ◮ Gas dynamics (coming soon) ◮ Solid mechanics (next year)

slide-42
SLIDE 42

Thank you!