Module application¶
-
class
pysph.solver.application.
Application
(fname=None, domain=None)[source]¶ Bases:
object
Class used by any SPH application.
Constructor
Parameters: - fname (str) – file name to use.
- domain (pysph.nnps.DomainManager) – A domain manager to use. This is used for periodic domains etc.
-
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.
Parameters: - 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.
Examples
>>> def create_particles(): ... ... ... >>> solver = Solver(...) >>> equations = [...] >>> app = Application() >>> app.setup(solver=solver, equations=equations, ... particle_factory=create_particles) >>> app.run()