<jupyter_start><jupyter_text>PySPH Tutorial: without built-in schemes*<NAME>*----- Recap- Looked at creating a simple problem- Saw how to use schemes and solve the elliptical drop example.- Looked at simple post-processing of the data. Schemes provide convenient pre-built particle interactions.So how do you do your own thing without schemes.Let us now do it in a more low-level way.  To do this one needs the following methods:- `create_particles(self)`- `create_equations(self)`- `create_solver(self)`<jupyter_code>import numpy as np

from pysph.solver.application import Application
from pysph.base.utils import get_particle_array_wcsph

class EllipticalDrop(Application):
    def create_particles(self):
        # ...
        pass
        
    def create_equations(self):
        pass
    
    def create_solver(self):
        pass

    
if __name__ == '__main__':
    app = EllipticalDrop()
    app.run()<jupyter_output><empty_output><jupyter_text>Exercise- Create an `ed_no_scheme.py` which uses this skeleton, copy over your completed `create_particles` method- Don't execute the example yet.Now, let us flesh out the other methods.  Add this code:<jupyter_code>from pysph.sph.equation import Group
from pysph.sph.basic_equations import XSPHCorrection, ContinuityEquation
from pysph.sph.wc.basic import TaitEOS, MomentumEquation

class EllipticalDrop(Application):
    def create_equations(self):
        equations = [
            Group(
                equations=[
                    TaitEOS(dest='fluid', sources=None, rho0=1.0,
                            c0=1400, gamma=7.0),
                ],
                real=False
            ),

            Group(
                equations=[
                    ContinuityEquation(dest='fluid',  sources=['fluid']),

                    MomentumEquation(dest='fluid', sources=['fluid'],
                                     alpha=0.1, beta=0.0, c0=1400),

                    XSPHCorrection(dest='fluid', sources=['fluid']),
                ]
            ),
        ]
        return equations<jupyter_output><empty_output><jupyter_text>- Note that the `Group` allows one to group a set of equations together.- All equations in a group are completed first before going on to the next group.- Explore the different equations.- Note that we return a list of equations.Next we create the solver:<jupyter_code>from pysph.base.kernels import CubicSpline

from pysph.solver.application import Application
from pysph.solver.solver import Solver
from pysph.sph.integrator import PECIntegrator
from pysph.sph.integrator_step import WCSPHStep

class EllipticalDrop(Application):
    def create_solver(self):
        kernel = CubicSpline(dim=2)

        # Note that fluid is the name of the fluid particle array.
        integrator = PECIntegrator(fluid=WCSPHStep())

        dt = 5e-6
        tf = 0.0076
        solver = Solver(
            kernel=kernel, dim=2, integrator=integrator,
            dt=dt, tf=tf
        )
        return solver<jupyter_output><empty_output><jupyter_text>Let us understand the above a bit.<jupyter_code>from pysph.sph.integrator import EPECIntegrator
EPECIntegrator??<jupyter_output><empty_output><jupyter_text>Exercise- Now put everything together and get it working.  SolutionIf you are stuck, look at the solution below.<jupyter_code>%load solutions/ed_no_scheme.py<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup