Beispiel #1
0
 def create_equations(self):
     equations = [
         Group(
             equations=[RigidBodyMoments(dest='inner_core', sources=None)]),
         #Group(equations=[RigidBodyMoments(dest='outer_core', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='inner_core', sources=None)]
               ),
         #Group(equations=[RigidBodyMotion(dest='outer_core', sources=None)]),
         Group(equations=[RigidBodyMoments(dest='mantle', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='mantle', sources=None)]),
         # Equation of fluid body
         Group(equations=[
             ContinuityEquation(
                 dest='outer_core',
                 sources=['mantle', 'outer_core', 'inner_core'])
         ]),
         Group(equations=[
             MomentumEquation(
                 dest='outer_core',
                 sources=['mantle', 'outer_core', 'inner_core'],
                 alpha=0.1,
                 beta=0.0,
                 c0=101,
                 gy=0)
         ]),
     ]
     return equations
 def create_equations(self):
     equations = [
         Group(equations=[
             TaitEOS(dest='fluid', sources=None, rho0=self.ro, c0=self.co,
                     gamma=7.0),
             TaitEOS(dest='tank', sources=None, rho0=self.ro, c0=self.co,
                     gamma=7.0),
         ], real=False),
         Group(equations=[
             SummationDensityShepardFilter(
                 dest='fluid',
                 sources=['fluid', 'tank'], ),
             # SummationDensityShepardFilter(
             #     dest='tank',
             #     sources=['fluid', 'tank'], ),
             SummationDensity(
                 dest='tank',
                 sources=['fluid', 'tank'], ),
             MomentumEquation(dest='fluid', sources=['fluid', 'tank'],
                              alpha=self.alpha, beta=0.0, c0=self.co,
                              gy=-9.81),
             XSPHCorrection(dest='fluid', sources=['fluid', 'tank']),
         ]),
     ]
     return equations
Beispiel #3
0
 def create_equations(self):
     equations = [
         Group(equations=[
             TaitEOS(dest='fluid',
                     sources=None,
                     rho0=1000,
                     c0=self.co,
                     gamma=7.0),
             TaitEOS(dest='wall',
                     sources=None,
                     rho0=1000,
                     c0=self.co,
                     gamma=7.0),
         ],
               real=False),
         Group(equations=[
             ContinuityEquation(dest='fluid', sources=['fluid', 'wall']),
             ContinuityEquation(dest='wall', sources=['fluid', 'wall']),
             MomentumEquation(dest='fluid',
                              sources=['fluid', 'wall'],
                              alpha=self.alpha,
                              beta=0.0,
                              c0=self.co,
                              gy=-9.81),
             XSPHCorrection(dest='fluid', sources=['fluid']),
         ]),
     ]
     return equations
Beispiel #4
0
 def create_equations(self):
     equations = [
         Group(equations=[
             TaitEOS(dest='fluid', sources=None, rho0=self.ro, c0=self.co,
                     gamma=7.0),
             TaitEOS(dest='tank', sources=None, rho0=self.ro, c0=self.co,
                     gamma=7.0),
         ], real=False),
         Group(equations=[
             ContinuityEquation(
                 dest='fluid',
                 sources=['fluid', 'tank', 'cube'],),
             ContinuityEquation(
                 dest='tank',
                 sources=['fluid', 'tank', 'cube'], ),
             MomentumEquation(dest='fluid', sources=['fluid', 'tank'],
                              alpha=self.alpha, beta=0.0, c0=self.co,
                              gy=-9.81),
             SolidForceOnFluid(dest='fluid', sources=['cube']),
             XSPHCorrection(dest='fluid', sources=['fluid', 'tank']),
         ]),
         Group(equations=[
             BodyForce(dest='cube', sources=None, gy=-9.81),
             FluidForceOnSolid(dest='cube', sources=['fluid']),
             # RigidBodyCollision(
             #     dest='cube',
             #     sources=['tank'],
             #     kn=1e5,
             #     en=0.5, )
         ]),
         Group(equations=[RigidBodyMoments(dest='cube', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='cube', sources=None)]),
     ]
     return equations
    def create_equations(self):
        equations = [
            Group(equations=[
                LiuFluidForce(
                    dest='fluid',
                    sources=None,
                ),
                XSPHCorrection(dest='fluid', sources=[
                    'fluid',
                ]),
                TaitEOS(dest='fluid',
                        sources=None,
                        rho0=1000,
                        c0=1498,
                        gamma=7.0),
            ],
                  real=False),
            Group(equations=[
                ContinuityEquation(dest='fluid', sources=[
                    'fluid',
                ]),
                MomentumEquation(dest='fluid',
                                 sources=['fluid'],
                                 alpha=0.1,
                                 beta=0.0,
                                 c0=1498,
                                 gy=-9.81),
                XSPHCorrection(dest='fluid', sources=['fluid']),
            ]),
        ]

        return equations
Beispiel #6
0
    def create_equations(self):
        """Set up equations.

        Body force is necessary to reset fx,fy,fz, although
        not body force is applied.
        """
        equations = [
            Group(equations=[
                BodyForce(dest='ellipsoid', sources=None),
                NumberDensity(dest='ellipsoid', sources=['ellipsoid']),
                NumberDensity(dest='walls', sources=['walls'])
            ]),

            # Tait equation of state
            Group(equations=[
                TaitEOS(dest='fluid',
                        sources=None,
                        rho0=self.rho,
                        c0=self.co,
                        gamma=7.0),
                TaitEOSHGCorrection(dest='ellipsoid',
                                    sources=None,
                                    rho0=self.rho,
                                    c0=self.co,
                                    gamma=7.0),
                TaitEOSHGCorrection(dest='walls',
                                    sources=None,
                                    rho0=self.rho,
                                    c0=self.co,
                                    gamma=7.0),
            ],
                  real=False),
            Group(equations=[
                ContinuityEquation(dest='fluid',
                                   sources=['fluid', 'walls', 'ellipsoid']),
                ContinuityEquation(dest='ellipsoid', sources=['fluid']),
                ContinuityEquation(dest='walls', sources=['fluid']),
                LaminarViscosity(
                    dest='fluid', sources=['fluid', 'walls'], nu=self.nu),
                MomentumEquation(dest='fluid',
                                 sources=['fluid', 'walls'],
                                 alpha=self.alpha,
                                 beta=0.0,
                                 c0=self.co),
                ViscosityRigidBody(dest='fluid',
                                   sources=['ellipsoid'],
                                   nu=self.nu,
                                   rho0=self.rho),
                PressureRigidBody(dest='fluid',
                                  sources=['ellipsoid'],
                                  rho0=self.rho),
                XSPHCorrection(dest='fluid', sources=['fluid']),
            ]),
            Group(
                equations=[RigidBodyMoments(dest='ellipsoid', sources=None)]),
            Group(equations=[RigidBodyMotion(dest='ellipsoid', sources=None)]),
        ]
        return equations
Beispiel #7
0
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='ball', sources=None, gy=gz),
         ]),
         Group(equations=[
             TaitEOS(dest='fluid',
                     sources=None,
                     rho0=self.ro,
                     c0=self.co,
                     gamma=7.0),
             TaitEOS(dest='wall',
                     sources=None,
                     rho0=self.ro,
                     c0=self.co,
                     gamma=7.0),
             TaitEOS(dest='temp_wall',
                     sources=None,
                     rho0=self.ro,
                     c0=self.co,
                     gamma=7.0),
         ],
               real=False),
         Group(equations=[
             ContinuityEquation(
                 dest='fluid',
                 sources=['fluid', 'temp_wall', 'wall'],
             ),
             ContinuityEquation(
                 dest='temp_wall',
                 sources=['fluid', 'temp_wall', 'wall'],
             ),
             ContinuityEquation(
                 dest='wall',
                 sources=['fluid', 'temp_wall', 'wall'],
             ),
             MomentumEquation(dest='fluid',
                              sources=['fluid', 'wall', 'temp_wall'],
                              alpha=self.alpha,
                              beta=0.0,
                              c0=self.co,
                              gy=-9.81),
             SolidFluidForce(
                 dest='fluid',
                 sources=['ball'],
             ),
             XSPHCorrection(dest='fluid',
                            sources=['fluid', 'temp_wall', 'wall']),
         ]),
         Group(equations=[
             RigidBodyCollision(
                 dest='ball', sources=['ball', 'wall', 'temp_wall'], kn=1e5)
         ]),
         Group(equations=[RigidBodyMoments(dest='ball', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='ball', sources=None)]),
     ]
     return equations
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='cube', sources=None, gy=-9.81),
             SummationDensity(dest='cube', sources=['fluid', 'cube'])
         ],
               real=False),
         Group(equations=[
             TaitEOSHGCorrection(dest='cube',
                                 sources=None,
                                 rho0=self.solid_rho,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='fluid',
                                 sources=None,
                                 rho0=self.ro,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='tank',
                                 sources=None,
                                 rho0=self.ro,
                                 c0=self.co,
                                 gamma=7.0),
         ],
               real=False),
         Group(equations=[
             ContinuityEquation(
                 dest='fluid',
                 sources=['fluid', 'tank', 'cube'],
             ),
             ContinuityEquation(
                 dest='tank',
                 sources=['fluid', 'tank', 'cube'],
             ),
             MomentumEquation(dest='fluid',
                              sources=['fluid', 'tank', 'cube'],
                              alpha=self.alpha,
                              beta=0.0,
                              c0=self.co,
                              gy=-9.81),
             LiuFluidForce(
                 dest='fluid',
                 sources=['cube'],
             ),
             XSPHCorrection(dest='fluid', sources=['fluid', 'tank']),
         ]),
         Group(equations=[
             RigidBodyCollision(dest='cube', sources=['tank'], kn=1e5)
         ]),
         Group(equations=[RigidBodyMoments(dest='cube', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='cube', sources=None)]),
     ]
     return equations
Beispiel #9
0
    def create_equations(self):
        equations = [
            Group(equations=[
                BodyForce(dest='cube', sources=None, gy=-9.81),
            ],
                  real=False),
            Group(equations=[
                ContinuityEquation(dest='fluid',
                                   sources=['fluid', 'tank', 'cube']),
                ContinuityEquation(dest='tank',
                                   sources=['tank', 'fluid', 'cube'])
            ]),

            # Tait equation of state
            Group(equations=[
                TaitEOSHGCorrection(dest='fluid',
                                    sources=None,
                                    rho0=self.ro,
                                    c0=self.co,
                                    gamma=7.0),
                TaitEOSHGCorrection(dest='tank',
                                    sources=None,
                                    rho0=self.ro,
                                    c0=self.co,
                                    gamma=7.0),
            ],
                  real=False),
            Group(equations=[
                MomentumEquation(dest='fluid',
                                 sources=['fluid', 'tank'],
                                 alpha=self.alpha,
                                 beta=0.0,
                                 c0=self.co,
                                 gy=-9.81),
                AkinciRigidFluidCoupling(dest='fluid', sources=['cube']),
                XSPHCorrection(dest='fluid', sources=['fluid', 'tank']),
            ]),
            Group(equations=[
                RigidBodyCollision(
                    dest='cube', sources=['tank', 'cube'], kn=1e5)
            ]),
            Group(equations=[RigidBodyMoments(dest='cube', sources=None)]),
            Group(equations=[RigidBodyMotion(dest='cube', sources=None)]),
        ]
        return equations
Beispiel #10
0
 def create_equations(self):
     print("Create our own equations.")
     equations = [
         Group(equations=[
             TaitEOS(dest='fluid',
                     sources=None,
                     rho0=self.ro,
                     c0=self.co,
                     gamma=7.0),
         ],
               real=False),
         Group(equations=[
             ContinuityEquation(dest='fluid', sources=['fluid']),
             MomentumEquation(dest='fluid',
                              sources=['fluid'],
                              alpha=self.alpha,
                              beta=0.0,
                              c0=self.co),
             XSPHCorrection(dest='fluid', sources=['fluid']),
         ]),
     ]
     return equations
Beispiel #11
0
    def create_equations(self):
        equations = [

            # Equation of state
            Group(equations=[
                TaitEOS(dest='fluid',
                        sources=None,
                        rho0=rho0,
                        c0=c0,
                        gamma=gamma),
                TaitEOSHGCorrection(dest='boundary',
                                    sources=None,
                                    rho0=rho0,
                                    c0=c0,
                                    gamma=gamma),
            ],
                  real=False),

            # Continuity Momentum and XSPH equations
            Group(equations=[
                ContinuityEquation(dest='fluid', sources=['fluid', 'boundary'
                                                          ]),
                ContinuityEquation(dest='boundary', sources=['fluid']),
                MomentumEquation(dest='fluid',
                                 sources=['fluid', 'boundary'],
                                 c0=c0,
                                 alpha=alpha,
                                 beta=beta,
                                 gz=-9.81,
                                 tensile_correction=True),

                # Position step with XSPH
                XSPHCorrection(dest='fluid', sources=['fluid'], eps=eps)
            ])
        ]
        return equations
Beispiel #12
0
    def create_equations(self):
        h0 = dx * hdx
        co = 10.0 * self.geom.get_max_speed(g=9.81)

        gamma = 7.0
        alpha = 0.5
        beta = 0.0
        B = co * co * rho0 / gamma

        equations = [
            Group(equations=[
                BodyForce(dest='obstacle', sources=None, gz=-9.81),
                NumberDensity(dest='obstacle', sources=['obstacle']),
                NumberDensity(dest='boundary', sources=['boundary']),
            ], ),

            # Equation of state
            Group(equations=[
                TaitEOS(dest='fluid',
                        sources=None,
                        rho0=rho0,
                        c0=co,
                        gamma=gamma),
                TaitEOSHGCorrection(dest='boundary',
                                    sources=None,
                                    rho0=rho0,
                                    c0=co,
                                    gamma=gamma),
                TaitEOSHGCorrection(dest='obstacle',
                                    sources=None,
                                    rho0=rho0,
                                    c0=co,
                                    gamma=gamma),
            ],
                  real=False),

            # Continuity, momentum and xsph equations
            Group(equations=[
                ContinuityEquation(dest='fluid',
                                   sources=['fluid', 'boundary', 'obstacle']),
                ContinuityEquation(dest='boundary', sources=['fluid']),
                ContinuityEquation(dest='obstacle', sources=['fluid']),
                MomentumEquation(dest='fluid',
                                 sources=['fluid', 'boundary'],
                                 alpha=alpha,
                                 beta=beta,
                                 gz=-9.81,
                                 c0=co,
                                 tensile_correction=True),
                PressureRigidBody(dest='fluid',
                                  sources=['obstacle'],
                                  rho0=rho0),
                XSPHCorrection(dest='fluid', sources=['fluid']),
                RigidBodyCollision(dest='obstacle',
                                   sources=['boundary'],
                                   k=1.0,
                                   d=2.0,
                                   eta=0.1,
                                   kt=0.1),
            ]),
            Group(equations=[RigidBodyMoments(dest='obstacle', sources=None)]),
            Group(equations=[RigidBodyMotion(dest='obstacle', sources=None)]),
        ]
        return equations
    def get_equations(self):
        from pysph.sph.equation import Group
        from pysph.sph.wc.basic import (MomentumEquation, TaitEOS,
                                        TaitEOSHGCorrection,
                                        UpdateSmoothingLengthFerrari)
        from pysph.sph.wc.basic import (ContinuityEquationDeltaSPH,
                                        MomentumEquationDeltaSPH)
        from pysph.sph.basic_equations import \
            (ContinuityEquation, SummationDensity, XSPHCorrection)
        from pysph.sph.wc.viscosity import LaminarViscosity

        equations = []
        g1 = []
        all = self.fluids + self.solids

        if self.summation_density:
            g0 = []
            for name in self.fluids:
                g0.append(SummationDensity(dest=name, sources=all))
            equations.append(Group(equations=g0, real=False))

        for name in self.fluids:
            g1.append(
                TaitEOS(dest=name,
                        sources=None,
                        rho0=self.rho0,
                        c0=self.c0,
                        gamma=self.gamma))

        if self.hg_correction:
            # This correction applies only to solids.
            for name in self.solids:
                g1.append(
                    TaitEOSHGCorrection(dest=name,
                                        sources=None,
                                        rho0=self.rho0,
                                        c0=self.c0,
                                        gamma=self.gamma))

        equations.append(Group(equations=g1, real=False))

        g2 = []
        for name in self.solids:
            g2.append(ContinuityEquation(dest=name, sources=self.fluids))

        for name in self.fluids:
            if self.delta_sph:
                other = all[:]
                other.remove(name)
                g2.append(
                    ContinuityEquationDeltaSPH(dest=name,
                                               sources=[name],
                                               c0=self.c0,
                                               delta=self.delta))
                if len(other) > 0:
                    g2.append(ContinuityEquation(dest=name, sources=other))
                g2.append(
                    MomentumEquationDeltaSPH(
                        dest=name,
                        sources=[name],
                        rho0=self.rho0,
                        c0=self.c0,
                        alpha=self.alpha,
                        gx=self.gx,
                        gy=self.gy,
                        gz=self.gz,
                    ))
                if len(other) > 0:
                    g2.append(
                        MomentumEquation(
                            dest=name,
                            sources=other,
                            c0=self.c0,
                            alpha=self.alpha,
                            beta=self.beta,
                            gx=self.gx,
                            gy=self.gy,
                            gz=self.gz,
                            tensile_correction=self.tensile_correction))

                g2.append(XSPHCorrection(dest=name, sources=[name]))
            else:
                if not self.summation_density:
                    g2.append(ContinuityEquation(dest=name, sources=all))
                g2.extend([
                    MomentumEquation(
                        dest=name,
                        sources=all,
                        alpha=self.alpha,
                        beta=self.beta,
                        gx=self.gx,
                        gy=self.gy,
                        gz=self.gz,
                        c0=self.c0,
                        tensile_correction=self.tensile_correction),
                    XSPHCorrection(dest=name, sources=[name])
                ])

            if abs(self.nu) > 1e-14:
                eq = LaminarViscosity(dest=name,
                                      sources=self.fluids,
                                      nu=self.nu)
                g2.insert(-1, eq)
        equations.append(Group(equations=g2))

        if self.update_h:
            g3 = [
                UpdateSmoothingLengthFerrari(dest=x,
                                             sources=None,
                                             dim=self.dim,
                                             hdx=self.hdx) for x in self.fluids
            ]
            equations.append(Group(equations=g3, real=False))

        return equations
Beispiel #14
0
 def create_equations(self):
     equations = [
         Group(
             equations=[
                 BodyForce(dest='cube', sources=None, gy=-9.81),
                 BodyForce(dest='wood', sources=None, gy=-9.81),
                 BodyForce(dest='small_tank', sources=None, gy=-9.81),
                 BodyForce(dest='outside', sources=None, gy=-9.81),
                 SummationDensity(dest='cube', sources=['fluid', 'cube']),
                 SummationDensity(dest='wood', sources=['fluid', 'wood']),
                 SummationDensity(dest='small_tank',
                                  sources=['fluid', 'small_tank']),
                 SummationDensity(dest='outside',
                                  sources=['fluid', 'outside'])
                 # NumberDensity(dest='cube', sources=['cube']),
             ],
             real=False),
         Group(equations=[
             TaitEOSHGCorrection(dest='wood',
                                 sources=None,
                                 rho0=self.wood_rho,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='cube',
                                 sources=None,
                                 rho0=self.solid_rho,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='fluid',
                                 sources=None,
                                 rho0=self.ro,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='big_tank',
                                 sources=None,
                                 rho0=self.ro,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='small_tank',
                                 sources=None,
                                 rho0=self.wood_rho,
                                 c0=self.co,
                                 gamma=7.0),
             TaitEOSHGCorrection(dest='outside',
                                 sources=None,
                                 rho0=self.ro,
                                 c0=self.co,
                                 gamma=7.0),
         ],
               real=False),
         Group(equations=[
             ContinuityEquation(
                 dest='fluid',
                 sources=[
                     'fluid', 'small_tank', 'cube', 'wood', 'big_tank',
                     'outside'
                 ],
             ),
             ContinuityEquation(
                 dest='big_tank',
                 sources=[
                     'fluid', 'big_tank', 'cube', 'wood', 'small_tank',
                     'outside'
                 ],
             ),
             MomentumEquation(dest='fluid',
                              sources=['fluid', 'big_tank'],
                              alpha=self.alpha,
                              beta=0.0,
                              c0=self.co,
                              gy=-9.81),
             LiuFluidForce(
                 dest='fluid',
                 sources=['cube'],
             ),
             LiuFluidForce(
                 dest='fluid',
                 sources=['wood'],
             ),
             LiuFluidForce(
                 dest='fluid',
                 sources=['small_tank'],
             ),
             LiuFluidForce(
                 dest='fluid',
                 sources=['outside'],
             ),
             # PressureRigidBody(dest='fluid', sources=['cube'],
             #                   rho0=1500),
             XSPHCorrection(dest='fluid', sources=['fluid', 'big_tank']),
         ]),
         Group(equations=[
             RigidBodyCollision(
                 dest='cube',
                 sources=['big_tank', 'wood', 'small_tank', 'outside'],
                 kn=1e6)
         ]),
         Group(equations=[RigidBodyMoments(dest='cube', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='cube', sources=None)]),
         Group(equations=[
             RigidBodyCollision(
                 dest='wood',
                 sources=['big_tank', 'cube', 'small_tank', 'outside'],
                 kn=1e6)
         ]),
         Group(equations=[RigidBodyMoments(dest='wood', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='wood', sources=None)]),
         Group(equations=[
             RigidBodyCollision(
                 dest='small_tank',
                 sources=['big_tank', 'cube', 'wood', 'outside'],
                 kn=1e6)
         ]),
         Group(
             equations=[RigidBodyMoments(dest='small_tank', sources=None)]),
         Group(
             equations=[RigidBodyMotion(dest='small_tank', sources=None)]),
         Group(equations=[
             RigidBodyCollision(
                 dest='outside',
                 sources=['big_tank', 'cube', 'small_tank', 'wood'],
                 kn=1e6)
         ]),
         Group(equations=[RigidBodyMoments(dest='outside', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='outside', sources=None)]),
     ]
     return equations
Beispiel #15
0
    def create_equations(self):
        equations = [
            Group(equations=[
                BodyForce(dest='block', sources=None, gy=gy),
                NumberDensity(dest='block', sources=['block']),
                NumberDensity(dest='solid', sources=['solid']),
            ], ),

            # Equation of state is typically the Tait EOS with a suitable
            # exponent gamma
            Group(equations=[
                TaitEOS(dest='fluid',
                        sources=None,
                        rho0=rho0,
                        c0=c0,
                        gamma=gamma),
                TaitEOSHGCorrection(dest='solid',
                                    sources=None,
                                    rho0=rho0,
                                    c0=c0,
                                    gamma=gamma),
                TaitEOSHGCorrection(dest='block',
                                    sources=None,
                                    rho0=rho0,
                                    c0=c0,
                                    gamma=gamma),
            ], ),

            # Main acceleration block
            Group(equations=[

                # Continuity equation with dissipative corrections for fluid on fluid
                ContinuityEquationDeltaSPH(
                    dest='fluid', sources=['fluid'], c0=c0, delta=0.1),
                ContinuityEquation(dest='fluid', sources=['solid', 'block']),
                ContinuityEquation(dest='solid', sources=['fluid']),
                ContinuityEquation(dest='block', sources=['fluid']),

                # Momentum equation
                MomentumEquation(dest='fluid',
                                 sources=['fluid', 'solid', 'block'],
                                 alpha=alpha,
                                 beta=beta,
                                 gy=-9.81,
                                 c0=c0,
                                 tensile_correction=True),
                PressureRigidBody(dest='fluid',
                                  sources=['block', 'solid'],
                                  rho0=rho0),
                ViscosityRigidBody(
                    dest='fluid', sources=['block', 'solid'
                                           ], rho0=rho0, nu=nu),

                # Position step with XSPH
                XSPHCorrection(dest='fluid', sources=['fluid']),
                RigidBodyCollision(dest='block',
                                   sources=['solid'],
                                   k=1.0,
                                   d=2.0,
                                   eta=0.1,
                                   kt=0.1),
            ]),
            Group(equations=[RigidBodyMoments(dest='block', sources=None)]),
            Group(equations=[RigidBodyMotion(dest='block', sources=None)]),
        ]
        return equations
                            gamma=gamma),
    ],
          real=False),
    Group(equations=[

        # Continuity equation with dissipative corrections for fluid on fluid
        ContinuityEquationDeltaSPH(
            dest='fluid', sources=['fluid'], c0=co, delta=0.1),
        ContinuityEquation(dest='fluid', sources=['boundary']),
        ContinuityEquation(dest='boundary', sources=['fluid']),

        # Momentum equation
        MomentumEquation(dest='fluid',
                         sources=['fluid', 'boundary'],
                         alpha=alpha,
                         beta=beta,
                         gy=-9.81,
                         c0=co,
                         tensile_correction=True),

        # Position step with XSPH
        XSPHCorrection(dest='fluid', sources=['fluid'])
    ]),

    # smoothing length update
    Group(equations=[
        UpdateSmoothingLengthFerrari(dest='fluid',
                                     sources=None,
                                     hdx=1.2,
                                     dim=2)
    ],
    def create_equations(self):
        '''
        Set-up governing equations
        '''
        if self.PST == False:
            equations = [
                Group(equations=[
                    IsothermalEOS(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, p0=0.0),
                    GradientCorrectionPreStep(dest='fluid', sources=['fluid'], dim=2),
                ],real=False
                ),

                Group(equations=[
                    GradientCorrection(dest='fluid', sources=['fluid'], dim=2, tol=0.1), 
                    ContinuityEquationDeltaSPHPreStep(dest='fluid', sources=['fluid']),
                ],real=True
                ),

                Group(equations=[
                    ContinuityEquation(dest='fluid', sources=['fluid']),                 
                    ContinuityEquationDeltaSPH(dest='fluid', sources=['fluid'], c0=self.c0, delta=0.1), 
                    MomentumEquation(dest='fluid', sources=['fluid'], c0=self.c0, alpha=0.0, beta=0.0, gx=0.0, gy=0.0, gz=0.0, tensile_correction=False), 
                    #MomentumEquationDeltaSPH(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, alpha=0.0), 
                    #LaminarViscosityDeltaSPHPreStep(dest='fluid', sources=['fluid']),
                    LaminarViscosityDeltaSPH(dest='fluid', sources=['fluid'], dim=2, rho0=self.rho0, nu=self.nu), 
                    Spatial_Acceleration(dest='fluid', sources=['fluid']),                
                    #XSPHCorrection(dest='fluid', sources=['fluid'], eps=0.5),            
                ],real=True
                ),
            ]
    
        elif self.PST == True:
            equations = [
                Group(equations=[                
                    IsothermalEOS(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, p0=0.0),
                    GradientCorrectionPreStep(dest='fluid', sources=['fluid'], dim=2),
                    PST_PreStep_1(dest='fluid', sources=['fluid'], dim=2),
                    ######AverageSpacing(dest='fluid', sources=['fluid'], dim=2),            
                ],real=False
                ),

                Group(equations=[
                    GradientCorrection(dest='fluid', sources=['fluid'], dim=2, tol=0.1), 
                    ContinuityEquationDeltaSPHPreStep(dest='fluid', sources=['fluid']),
                    PST_PreStep_2(dest='fluid', sources=['fluid'], dim=2, H=self.h0),
                    PST(dest='fluid', sources=['fluid'], dim=2, H=self.h0, dt=self.dt, dx=self.dx, Uc0=self.PST_Uc0, Rh=self.PSR_Rh, saveAllDRh=True, R_coeff=self.PST_R_coeff, n_exp=self.PST_n_exp),            
                ],real=True
                ),

                Group(equations=[
                    ContinuityEquation(dest='fluid', sources=['fluid']),                 
                    ContinuityEquationDeltaSPH(dest='fluid', sources=['fluid'], c0=self.c0, delta=0.1), 
                    MomentumEquation(dest='fluid', sources=['fluid'], c0=self.c0, alpha=0.0, beta=0.0, gx=0.0, gy=0.0, gz=0.0, tensile_correction=False), 
                    #MomentumEquationDeltaSPH(dest='fluid', sources=['fluid'], rho0=self.rho0, c0=self.c0, alpha=0.0), 
                    #LaminarViscosityDeltaSPHPreStep(dest='fluid', sources=['fluid']),
                    LaminarViscosityDeltaSPH(dest='fluid', sources=['fluid'], dim=2, rho0=self.rho0, nu=self.nu), 
                    Spatial_Acceleration(dest='fluid', sources=['fluid']),                
                    #XSPHCorrection(dest='fluid', sources=['fluid'], eps=0.5),            
                ],real=True
                ),
            ]

        return equations