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.ADKEScheme(fluids, solids, dim, gamma=1.4, alpha=1.0, beta=2.0, k=1.0, eps=0.0, g1=0, g2=0, has_ghosts=False)[source]
- Parameters
fluids (list) – a list with names of fluid particle arrays
solids (list) – a list with names of solid (or boundary) particle arrays
dim (int) – dimensionality of the problem
gamma (double) – Gamma for equation of state
alpha (double) – artificial viscosity parameter
beta (double) – artificial viscosity parameter
k (double) – kernel scaling parameter
eps (double) – kernel scaling parameter
g1 (double) – artificial heat conduction parameter
g2 (double) – artificial heat conduction parameter
has_ghosts (bool) – if problem uses ghost particles (periodic or mirror)
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- 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]
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.
- 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_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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.GSPHScheme(fluids, solids, dim, gamma, kernel_factor, g1=0.0, g2=0.0, rsolver=2, interpolation=1, monotonicity=1, interface_zero=True, hybrid=False, blend_alpha=5.0, tf=1.0, niter=20, tol=1e-06, has_ghosts=False)[source]
- Parameters
fluids (list) – List of names of fluid particle arrays.
solids (list) – List of names of solid particle arrays (or boundaries), currently not supported
dim (int) – Dimensionality of the problem.
gamma (float) – Gamma for Equation of state.
kernel_factor (float) – Kernel scaling factor.
g1 (double) – ADKE style thermal conduction parameters
g2 (double) – ADKE style thermal conduction parameters
rsolver (int) – Riemann solver to use. See pysph.sph.gas_dynamics.gsph for valid options.
interpolation (int) – Kind of interpolation for the specific volume integrals.
monotonicity (int) – Type of monotonicity algorithm to use: 0 : First order GSPH 1 : I02 algorithm 2 : IwIn algorithm
interface_zero (bool) – Set Interface position s^*_{ij} = 0 for the Riemann problem.
hybrid (bool, double) – Hybrid scheme and blending alpha value
blend_alpha (bool, double) – Hybrid scheme and blending alpha value
tf (double) – Final time used for blending.
niter (int) – Max number of iterations for iterative Riemann solvers.
tol (double) – Tolerance for iterative Riemann solvers.
has_ghosts (bool) – if ghost particles (either mirror or periodic) is used
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.GasDScheme(fluids, solids, dim, gamma, kernel_factor, alpha1=1.0, alpha2=0.1, beta=2.0, adaptive_h_scheme='mpm', update_alpha1=False, update_alpha2=False, max_density_iterations=250, density_iteration_tolerance=0.001, has_ghosts=False)[source]
- Parameters
fluids (list) – List of names of fluid particle arrays.
solids (list) – List of names of solid particle arrays (or boundaries), currently not supported
dim (int) – Dimensionality of the problem.
gamma (float) – Gamma for Equation of state.
kernel_factor (float) – Kernel scaling factor.
alpha1 (float) – Artificial viscosity parameter.
alpha2 (float) – Artificial viscosity parameter.
beta (float) – Artificial viscosity parameter.
adaptive_h_scheme (str) – Adaptive h scheme to use. One of [‘mpm’, ‘gsph’]
update_alpha1 (bool) – Update the alpha1 parameter dynamically.
update_alpha2 (bool) – Update the alpha2 parameter dynamically.
max_density_iterations (int) – Maximum number of iterations to run for one density step
density_iteration_tolerance (float) – Maximum difference allowed in two successive density iterations
has_ghosts (bool) – if ghost particles (either mirror or periodic) is used
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.Scheme(fluids, solids, dim)[source]
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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.SchemeChooser(default, **schemes)[source]
- Parameters
default (str) – Name of the default scheme to use.
**schemes (kwargs) – The schemes to choose between.
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.TVFScheme(fluids, solids, dim, rho0, c0, nu, p0, pb, h0, gx=0.0, gy=0.0, gz=0.0, alpha=0.0, tdamp=0.0)[source]
- 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.
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.
- class pysph.sph.scheme.WCSPHScheme(fluids, solids, dim, rho0, c0, h0, hdx, gamma=7.0, gx=0.0, gy=0.0, gz=0.0, alpha=0.1, beta=0.0, delta=0.1, nu=0.0, tensile_correction=False, hg_correction=False, update_h=False, delta_sph=False, summation_density=False)[source]
- 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.
rho0 (float) – Reference density.
c0 (float) – Reference speed of sound.
gamma (float) – Gamma for the equation of state.
h0 (float) – Reference smoothing length.
hdx (float) – Ratio of h/dx.
gx (float) – Body force acceleration components.
gy (float) – Body force acceleration components.
gz (float) – Body force acceleration components.
alpha (float) – Coefficient for artificial viscosity.
beta (float) – Coefficient for artificial viscosity.
delta (float) – Coefficient used to control the intensity of diffusion of density
nu (float) – Real viscosity of the fluid, defaults to no viscosity.
tensile_correction (bool) – Use tensile correction.
hg_correction (bool) – Use the Hughes-Graham correction.
update_h (bool) – Update the smoothing length as per Ferrari et al.
delta_sph (bool) – Use the delta-SPH correction terms.
summation_density (bool) – Use summation density instead of continuity.
References
- Hughes2010
J. P. Hughes and D. I. Graham, “Comparison of incompressible and weakly-compressible SPH models for free-surface water flows”, Journal of Hydraulic Research, 48 (2010), pp. 105-117.
- Marrone2011
S. Marrone et al., “delta-SPH model for simulating violent impact flows”, Computer Methods in Applied Mechanics and Engineering, 200 (2011), pp 1526–1542.
- Cherfils2012
J. M. Cherfils et al., “JOSEPHINE: A parallel SPH code for free-surface flows”, Computer Physics Communications, 183 (2012), pp 1468–1480.
- 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 (extra arguments) – Any additional keyword args are passed to the solver instance.