Module solver
Module solver tools
- class pysph.solver.tools.DensityCorrection(app, arr_names, corr='shepard', freq=10, kernel=None)[source]
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]
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.
xi (ndarray) – Positions to remesh the properties onto. If not specified they are taken from the particle arrays at the time of construction.
yi (ndarray) – Positions to remesh the properties onto. If not specified they are taken from the particle arrays at the time of construction.
zi (ndarray) – 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]
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.