Module scheme

Abstract class to define the API for an SPH scheme. The idea is that one can define a scheme and thereafter one simply instantiates a suitable scheme, gives it a bunch of particles and runs the application.

class pysph.sph.scheme.AdamiHuAdamsScheme(fluids, solids, dim, rho0, c0, nu, h0, gx=0.0, gy=0.0, gz=0.0, p0=0.0, gamma=7.0, tdamp=0.0, alpha=0.0)[source]

Bases: pysph.sph.scheme.TVFScheme

This is a scheme similiar to that in the paper:

Adami, S., Hu, X., Adams, N. A generalized wall boundary condition for smoothed particle hydrodynamics. Journal of Computational Physics 2012;231(21):7057-7075.

The major difference is in how the equations are integrated. The paper has a different scheme that does not quite fit in with how things are done in PySPH readily so we simply use the WCSPHStep which works well.

configure_solver(kernel=None, integrator_cls=None, extra_steppers=None, **kw)[source]

Configure the solver to be generated.

Parameters:
  • kernel (Kernel instance.) – Kernel to use, if none is passed a default one is used.
  • integrator_cls (pysph.sph.integrator.Integrator) – Integrator class to use, use sensible default if none is passed.
  • extra_steppers (dict) – Additional integration stepper instances as a dict.
  • **kw

    Any additional keyword args are passed to the solver instance.

class pysph.sph.scheme.Scheme(fluids, solids, dim)[source]

Bases: object

An API for an SPH scheme.

Parameters:
  • fluids (list) – List of names of fluid particle arrays.
  • solids (list) – List of names of solid particle arrays (or boundaries).
  • dim (int) – Dimensionality of the problem.
attributes_changed()[source]

Overload this to compute any properties that depend on others.

This is automatically called when configure is called.

configure(**kw)[source]

Configure the scheme with given parameters.

Overload this to do any scheme specific stuff.

configure_solver(kernel=None, integrator_cls=None, extra_steppers=None, **kw)[source]

Configure the solver to be generated.

Parameters:
  • kernel (Kernel instance.) – Kernel to use, if none is passed a default one is used.
  • integrator_cls (pysph.sph.integrator.Integrator) – Integrator class to use, use sensible default if none is passed.
  • extra_steppers (dict) – Additional integration stepper instances as a dict.
  • **kw

    Any additional keyword args are passed to the solver instance.

setup_properties(particles, clean=True)[source]

Setup the particle arrays so they have the right set of properties for this scheme.

Parameters:
  • particles (list) – List of particle arrays.
  • clean (bool) – If True, removes any unnecessary properties.