Module solver¶
Module solver tools¶
-
class
pysph.solver.tools.
DensityCorrection
(app, arr_names, corr='shepard', freq=10, kernel=None)[source]¶ Bases:
pysph.solver.tools.Tool
A tool to reinitialize the density of the fluid particles
Parameters: - app (pysph.solver.application.Application.) – The application instance.
- arr_names (array) – Names of the particle arrays whose densities needs to be reinitialized.
- corr (str) – Name of the density reinitialization operation. corr=’shepard’ for using zeroth order shepard filter
- freq (int) – Frequency of reinitialization.
- kernel (any kernel from pysph.base.kernels) –
-
class
pysph.solver.tools.
SimpleRemesher
(app, array_name, props, freq=100, xi=None, yi=None, zi=None, kernel=None, equations=None)[source]¶ Bases:
pysph.solver.tools.Tool
A simple tool to periodically remesh a given array of particles onto an initial set of points.
Constructor.
Parameters: - app (pysph.solver.application.Application) – The application instance.
- array_name (str) – Name of the particle array that needs to be remeshed.
- props (list(str)) – List of properties to interpolate.
- freq (int) – Frequency of remeshing operation.
- yi, zi (xi,) – Positions to remesh the properties onto. If not specified they are taken from the particle arrays at the time of construction.
- kernel (any kernel from pysph.base.kernels) –
- equations (list or None) – Equations to use for the interpolation, passed to the interpolator.
-
class
pysph.solver.tools.
Tool
[source]¶ Bases:
object
A tool is typically an object that can be used to perform a specific task on the solver’s pre_step/post_step or post_stage callbacks. This can be used for a variety of things. For example, one could save a plot, print debug statistics or perform remeshing etc.
To create a new tool, simply subclass this class and overload any of its desired methods.
-
post_stage
(current_time, dt, stage)[source]¶ If overloaded, this is called automatically after each integrator stage, i.e. if the integrator is a two stage integrator it will be called after the first and second stages.
The method is passed (current_time, dt, stage). See the the Integrator.one_timestep methods for examples of how this is called.
-
Module simple_inlet_outlet¶
Simple Inlet and Outlet support for PySPH. The inlet and outlets are axis aligned.
The Inlet lets a user stack a given set of inlet particles along a particular coordinate axis. As the particles move they are copied over to a specified destination particle array. The particles are also wrapped back into the inlet.
The Outlet lets a user specify a region where any particles enter will be added to a specified “outlet” particle array and removed from the source array. When outlet particles leave the outlet region (specified with a bounding box) they are removed from the simulation.
-
class
pysph.sph.simple_inlet_outlet.
SimpleInlet
(inlet_pa, dest_pa, spacing, n=5, axis='x', xmin=-1.0, xmax=1.0, ymin=-1.0, ymax=1.0, zmin=-1.0, zmax=1.0)[source]¶ Bases:
object
This inlet has particles stacked along a particular axis (defaults to ‘x’). These particles can move along any direction and as they flow out of the domain they are copied into the destination particle array at each timestep.
Inlet particles are stacked by subtracting the spacing amount from the existing inlet array. These are copied when the inlet is created. The particles that cross the inlet domain are copied over to the destination particle array and moved back to the other side of the inlet.
The motion of the particles can be along any direction required. One can set the ‘u’ velocity to have a parabolic profile in the ‘y’ direction if so desired.
Constructor.
Note that the inlet must be defined such that the spacing times the number of stacks of particles is equal to the length of the domain in the stacked direction. For example, if particles are stacked along the ‘x’ axis and n=5 with spacing 0.1, then xmax - xmin should be 0.5.
Parameters: - inlet_pa (ParticleArray) – Particle array for the inlet particles.
- dest_pa (ParticleArray) – Particle array for the destination into which inlet flows.
- spacing (float) – Spacing of particles in the inlet domain.
- n (int) – Total number of copies of the initial particles.
- axis (str) – Axis along which to stack particles, one of ‘x’, ‘y’, ‘z’.
- xmax, ymin, ymax, zmin, zmax (xmin,) – Domain of the outlet.
-
class
pysph.sph.simple_inlet_outlet.
SimpleOutlet
(outlet_pa, source_pa, xmin=-1.0, xmax=1.0, ymin=-1.0, ymax=1.0, zmin=-1.0, zmax=1.0, callback=None)[source]¶ Bases:
object
This outlet simply moves the particles that comes into it from the source and removes any that leave the box.
Constructor.
Note that the callback argument can be used to set the properties of any particles that exit into the outlet.
Parameters: - outlet_pa (ParticleArray) – Particle array for the outlet particles.
- source_pa (ParticleArray) – Particle array from which the particles flow in.
- xmax, ymin, ymax, zmin, zmax (xmin,) – Domain of the outlet.
- callback (callable) – Called on update, passed (outlet_pa, new_props) where new_props is a dictionary with the new particle properties. This is called before the particles are removed and added to the outlet. This can be used to change the properties of the particles going into the outlet.