Table Of Contents

Previous topic

measures Package

Next topic

ogl Package

This Page

ode Package

ode Package

ode_solver Module

class pyparticles.ode.ode_solver.OdeSolver(force, p_set, dt)

Bases: object

Base abstract class for defining the integration method of the ordinary differential equation like Runge Kutta or Euler method, the user must overide the method __step__

Example (Euler method):

import numpy as np
import pyparticles.ode.ode_solver as os

class EulerSolver( os.OdeSolver ) :
   def __init__( self , force , p_set , dt ):
       super(EulerSolver,self).__init__( force , p_set , dt )
   
def __step__( self , dt ):

   self.force.update_force( self.pset )
   
   self.pset.V[:] = self.pset.V + self.force.A * dt
   self.pset.X[:] = self.pset.X + self.pset.V * dt
   
   self.pset.update_boundary() 

Constructor:

Parameters:
  • force – the force model
  • p_set – the particle set
  • dt – delta time
del_steps()
dt

get and set the delta time of the step

force

get and set the used force model

get_dt()
get_force()
get_pset()
get_sim_time()
get_steps()
get_time()
pset
set_dt(dt)
set_force(force)
set_pset(p_set)
set_time(t0)
sim_time

get the reference to the SimTime object, used for storing and sharing the current simulation time

step(dt=None)

Perform an integration step. If the dt is not given (reccomended) it uses the stored dt. You must alway use this method for executing a step.

steps_cnt

return the count of the performed steps

time

get and set the current simulation time

update_force()

ode_solver_constrained Module

class pyparticles.ode.ode_solver_constrained.OdeSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver.OdeSolver

get_x_constraint()

returns a reference to the current positionals constraints

set_x_constraint(xc)

set the new positionals contraints

x_constraint

get and set the current positionals constraints

sim_time Module

class pyparticles.ode.sim_time.SimTime(controller)

Bases: object

Class used for storing the current simulation time:

Constructor

Parameters:controller – a reference to the object that control the simulation time
controller

get the reference to the time controller

get_controller()

Get a reference to the simulation time controller, normally an ODE solver

:returns the reference to the ODE solver object

get_time()

get the current time

set_time(t)

set the current time

time

get and set the current simulation time

euler_solver Module

class pyparticles.ode.euler_solver.EulerSolver(force, p_set, dt)

Bases: pyparticles.ode.ode_solver.OdeSolver

euler_solver_constrained Module

class pyparticles.ode.euler_solver_constrained.EulerSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver_constrained.OdeSolverConstrained

get_x_constraint()
set_x_constraint(xc)
x_constraint

get and set the current positionals constraints

leapfrog_solver Module

class pyparticles.ode.leapfrog_solver.LeapfrogSolver(force, p_set, dt)

Bases: pyparticles.ode.ode_solver.OdeSolver

leapfrog_solver_constrained Module

class pyparticles.ode.leapfrog_solver_constrained.LeapfrogSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver_constrained.OdeSolverConstrained

get_x_constraint()
set_x_constraint(xc)
x_constraint

get and set the current positionals constraints

midpoint_solver Module

class pyparticles.ode.midpoint_solver.MidpointSolver(force, p_set, dt)

Bases: pyparticles.ode.ode_solver.OdeSolver

midpoint_solver_constrained Module

class pyparticles.ode.midpoint_solver_constrained.MidpointSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver_constrained.OdeSolverConstrained

get_x_constraint()
set_x_constraint(xc)
x_constraint

get and set the current positionals constraints

runge_kutta_solver Module

class pyparticles.ode.runge_kutta_solver.RungeKuttaSolver(force, p_set, dt)

Bases: pyparticles.ode.ode_solver.OdeSolver

runge_kutta_solver_constrained Module

class pyparticles.ode.runge_kutta_solver_constrained.RungeKuttaSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver_constrained.OdeSolverConstrained

get_x_constraint()
set_x_constraint(xc)
x_constraint

get and set the current positionals constraints

stormer_verlet_solver Module

class pyparticles.ode.stormer_verlet_solver.StormerVerletSolver(force, p_set, dt)

Bases: pyparticles.ode.ode_solver.OdeSolver

stormer_verlet_solver_constrained Module

class pyparticles.ode.stormer_verlet_solver_constrained.StormerVerletSolverConstrained(force, p_set, dt, x_constraint=None, v_constraint=None)

Bases: pyparticles.ode.ode_solver_constrained.OdeSolverConstrained

get_x_constraint()
set_x_constraint(xc)
x_constraint

get and set the current positionals constraints