Module application

class pysph.solver.application.Application(fname=None, domain=None)[source]

Bases: object

Class used by any SPH application.

Constructor

fname : str
file name to use.
domain : pysph.nnps.DomainManager
A domain manager to use. This is used for periodic domains etc.
add_option(opt)[source]

Add an Option/OptionGroup or their list to OptionParser

dump_code(file)[source]

Dump the generated code to given file.

run()[source]

Run the application.

setup(solver, equations, nnps=None, inlet_outlet_factory=None, particle_factory=None, *args, **kwargs)[source]

Setup the application’s solver.

This will parse the command line arguments (if this is not called from within an IPython notebook or shell) and then using those parameters and any additional parameters and call the solver’s setup method.

solver: pysph.solver.solver.Solver
The solver instance.
equations: list
A list of Groups/Equations.
nnps: pysph.base.nnps.NNPS
Optional NNPS instance. If None is given a default NNPS is created.
inlet_outlet_factory: callable or None
The inlet_outlet_factory is passed a dictionary of the particle arrays. The factory should return a list of inlets and outlets.
particle_factory : callable or None
If supplied, particles will be created for the solver using the particle arrays returned by the callable. Else particles for the solver need to be set before calling this method
args:
extra positional arguments passed on to the particle_factory.
kwargs:
extra keyword arguments passed to the particle_factory.
>>> def create_particles():
...    ...
...
>>> solver = Solver(...)
>>> equations = [...]
>>> app = Application()
>>> app.setup(solver=solver, equations=equations,
...           particle_factory=create_particles)
>>> app.run()

Previous topic

PySPH Reference Documentation

Next topic

Module carray

This Page