# Module solver

# Module solver tools

class `pysph.solver.tools.``DensityCorrection`(app, arr_names, corr='shepard', freq=10, kernel=None)

  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) –

  `post_step`(solver)

    If overloaded, this is called automatically after each integrator step. The method is passed the solver instance.

class `pysph.solver.tools.``SimpleRemesher`(app, array_name, props, freq=100, xi=None, yi=None, zi=None, kernel=None, equations=None)

  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.

  `post_step`(solver)

    If overloaded, this is called automatically after each integrator step. The method is passed the solver instance.

class `pysph.solver.tools.``Tool`

  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)

    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.

  `post_step`(solver)

    If overloaded, this is called automatically after each integrator step. The method is passed the solver instance.

  `pre_step`(solver)

    If overloaded, this is called automatically before each integrator step. The method is passed the solver instance.

# Module boundary conditions