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
Ejemplo n.º 2
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=[
             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
Ejemplo n.º 4
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
Ejemplo n.º 5
0
    def get_equations(self):
        from pysph.sph.basic_equations import XSPHCorrection
        from pysph.sph.wc.basic import TaitEOS
        from pysph.sph.wc.viscosity import LaminarViscosity
        all = self.fluids

        equations = []

        eq0 = []
        for fluid in self.fluids:
            eq0.append(CRKSPHPreStep(dest=fluid, sources=all, dim=2))
        equations.append(Group(equations=eq0, real=False))

        eq1 = []
        for fluid in self.fluids:
            eq1.append(NumberDensity(dest=fluid, sources=all))
        equations.append(Group(equations=eq1, real=False))

        eq2 = []
        for fluid in self.fluids:
            eq2.extend([
                CRKSPH(dest=fluid, sources=all, dim=self.dim, tol=self.tol),
                SummationDensityCRKSPH(dest=fluid, sources=all)
            ])
        equations.append(Group(equations=eq2, real=False))

        eq3 = []
        for fluid in self.fluids:
            eq3.append(
                TaitEOS(dest=fluid, sources=None, rho0=self.rho0, c0=self.c0,
                        p0=self.p0, gamma=self.gamma))
        equations.append(Group(equations=eq3, real=False))

        eq4 = []
        for fluid in self.fluids:
            eq4.extend([
                CRKSPH(dest=fluid, sources=all, dim=self.dim, tol=self.tol),
                VelocityGradient(dest=fluid, sources=all, dim=self.dim)
            ])
        equations.append(Group(equations=eq4))

        eq5 = []
        for fluid in self.fluids:
            eq5.extend([
                CRKSPHSymmetric(dest=fluid, sources=all, dim=self.dim,
                                tol=self.tol),
                MomentumEquation(
                    dest=fluid, sources=all, dim=self.dim, gx=self.gx,
                    gy=self.gy, gz=self.gz, cl=self.cl, cq=self.cq,
                    eta_crit=self.eta_crit, eta_fold=self.eta_fold
                ),
                XSPHCorrection(dest=fluid, sources=all)
            ])

            if abs(self.nu) > 1e-14:
                eq5.append(LaminarViscosity(
                    dest=fluid, sources=self.fluids, nu=self.nu
                ))
        equations.append(Group(equations=eq5))
        return equations
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 8
0
    def get_equations(self):
        from pysph.sph.equation import Group
        from pysph.sph.basic_equations import (ContinuityEquation,
                                               MonaghanArtificialViscosity,
                                               XSPHCorrection,
                                               VelocityGradient2D)
        from pysph.sph.solid_mech.basic import (IsothermalEOS,
                                                MomentumEquationWithStress,
                                                HookesDeviatoricStressRate,
                                                MonaghanArtificialStress)

        equations = []
        g1 = []
        all = self.solids + self.elastic_solids
        for elastic_solid in self.elastic_solids:
            g1.append(
                # p
                IsothermalEOS(elastic_solid, sources=None))
            g1.append(
                # vi,j : requires properties v00, v01, v10, v11
                VelocityGradient2D(dest=elastic_solid, sources=all))
            g1.append(
                # rij : requires properties r00, r01, r02, r11, r12, r22,
                #                           s00, s01, s02, s11, s12, s22
                MonaghanArtificialStress(dest=elastic_solid,
                                         sources=None,
                                         eps=self.artificial_stress_eps))

        equations.append(Group(equations=g1))

        g2 = []
        for elastic_solid in self.elastic_solids:
            g2.append(ContinuityEquation(dest=elastic_solid, sources=all), )
            g2.append(
                # au, av
                MomentumEquationWithStress(dest=elastic_solid, sources=all), )
            g2.append(
                # au, av
                MonaghanArtificialViscosity(dest=elastic_solid,
                                            sources=all,
                                            alpha=self.alpha,
                                            beta=self.beta), )
            g2.append(
                # a_s00, a_s01, a_s11
                HookesDeviatoricStressRate(dest=elastic_solid, sources=None), )
            g2.append(
                # ax, ay, az
                XSPHCorrection(dest=elastic_solid,
                               sources=[elastic_solid],
                               eps=self.xsph_eps), )
        equations.append(Group(g2))

        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
Ejemplo n.º 10
0
    def create_equations(self):
        # Formulation for REF1
        # (using only first set of equations for simplicity)
        equations = [


            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density
            Group(equations=[
                VolumeFromMassDensity(dest='fluid', sources=None)
                ], ),
            
            # Equation of state is typically the Tait EOS with a suitable
            # exponent gamma
            Group(equations=[
                TaitEOSHGCorrectionVariableRho(dest='fluid', sources=None,  c0=c0, gamma=gamma),
                ], ),
            
            # The boundary conditions are imposed by extrapolating the fluid
            # pressure, taking into consideration the boundary acceleration
            Group(equations=[
                SolidWallPressureBC(dest='solid', sources=['fluid'], b=1.0, gy=gravity_y,
                                    rho0=rho0, p0=p0)
            ], ),

            # Main acceleration block
            Group(equations=[

                # Continuity equation
                ContinuityEquation(dest='fluid', sources=['fluid', 'solid']),

                # Pressure gradient with acceleration damping
                MomentumEquationPressureGradient(
                    dest='fluid', sources=['fluid', 'solid'], pb=0.0, gy=gravity_y,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='fluid', sources=['fluid', 'solid'], alpha=0.24, c0=c0),

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

        return equations
Ejemplo n.º 11
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
Ejemplo n.º 12
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
Ejemplo n.º 13
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
Ejemplo n.º 14
0
    def _get_external_flow_equations(self):

        from pysph.sph.basic_equations import XSPHCorrection
        from pysph.sph.wc.transport_velocity import (
            VolumeSummation, SolidWallNoSlipBC, SummationDensity,
            MomentumEquationArtificialViscosity,
            MomentumEquationViscosity
        )

        iom = self.inlet_outlet_manager
        fluids_with_io = self.fluids
        all_solids = self.solids + self.inviscid_solids
        if iom is not None:
            fluids_with_io = self.fluids + iom.get_io_names()
        all = fluids_with_io + all_solids

        edac_nu = self._get_edac_nu()
        equations = []
        # inlet-outlet
        if iom is not None:
            io_eqns = iom.get_equations(self, self.use_tvf)
            for grp in io_eqns:
                equations.append(grp)

        group1 = []
        for fluid in fluids_with_io:
            group1.append(SummationDensity(dest=fluid, sources=all))
        for solid in self.solids:
            group1.extend([
                SourceNumberDensity(dest=solid, sources=fluids_with_io),
                VolumeSummation(dest=solid, sources=all),
                SolidWallPressureBC(dest=solid, sources=fluids_with_io,
                                    gx=self.gx, gy=self.gy, gz=self.gz),
                SetWallVelocity(dest=solid, sources=fluids_with_io),
            ])
            if self.clamp_p:
                group1.append(
                    ClampWallPressure(dest=solid, sources=None)
                )

        for solid in self.inviscid_solids:
            group1.extend([
                SourceNumberDensity(dest=solid, sources=fluids_with_io),
                NoSlipVelocityExtrapolation(
                    dest=solid, sources=fluids_with_io),
                VolumeSummation(dest=solid, sources=all),
                SolidWallPressureBC(dest=solid, sources=fluids_with_io,
                                    gx=self.gx, gy=self.gy, gz=self.gz)
                ])

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

        group2 = []
        for fluid in self.fluids:
            group2.append(
                MomentumEquation(
                    dest=fluid, sources=all, gx=self.gx, gy=self.gy,
                    gz=self.gz, c0=self.c0, tdamp=self.tdamp
                )
            )
            if self.alpha > 0.0:
                sources = fluids_with_io + self.solids
                group2.append(
                    MomentumEquationArtificialViscosity(
                        dest=fluid, sources=sources, alpha=self.alpha,
                        c0=self.c0
                    )
                )
            if self.nu > 0.0:
                group2.append(
                    MomentumEquationViscosity(
                        dest=fluid, sources=fluids_with_io, nu=self.nu
                    )
                )
            if len(self.solids) > 0 and self.nu > 0.0:
                group2.append(
                    SolidWallNoSlipBC(
                        dest=fluid, sources=self.solids, nu=self.nu
                    )
                )
            group2.extend([
                EDACEquation(
                    dest=fluid, sources=all, nu=edac_nu, cs=self.c0,
                    rho0=self.rho0
                ),
                XSPHCorrection(dest=fluid, sources=[fluid],
                               eps=self.eps)
            ])
        equations.append(Group(equations=group2))

        # inlet-outlet
        if iom is not None:
            io_eqns = iom.get_equations_post_compute_acceleration()
            for grp in io_eqns:
                equations.append(grp)

        return equations
Ejemplo n.º 15
0
    def create_equations(self):
        equations = [

            # We first compute the mass and number density of the fluid
            # phase. This is used in all force computations henceforth. The
            # number density (1/volume) is explicitly set for the solid phase
            # and this isn't modified for the simulation.
            Group(equations=[
                SummationDensity(dest='fluid', sources=['fluid', 'wall'])
            ]),

            # Given the updated number density for the fluid, we can update
            # the fluid pressure. Additionally, we compute the gradient of the
            # color function with respect to the original smoothing
            # length. This will compute the interface normals. Also compute
            # the smoothed color based on the color index for a particle.
            Group(equations=[
                IsothermalEOS(
                    dest='fluid', sources=None, rho0=rho0, c0=c0, p0=p0),
                SmoothedColor(dest='fluid', sources=['fluid']),
            ]),

            #################################################################
            # Begin Surface tension formulation
            #################################################################
            # Scale the smoothing lengths to determine the interface
            # quantities. The NNPS need not be updated since the smoothing
            # length is decreased.
            Group(equations=[
                ScaleSmoothingLength(dest='fluid', sources=None, factor=0.8)
            ],
                  update_nnps=False),

            # Compute the gradient of the color function with respect to the
            # new smoothing length. At the end of this Group, we will have the
            # interface normals and the discretized dirac delta function for
            # the fluid-fluid interface.
            Group(equations=[
                ColorGradientUsingNumberDensity(dest='fluid',
                                                sources=['fluid', 'wall']),
            ], ),

            # Compute the interface curvature using the modified smoothing
            # length and interface normals computed in the previous Group.
            Group(equations=[
                InterfaceCurvatureFromNumberDensity(dest='fluid',
                                                    sources=['fluid']),
            ], ),

            # Now rescale the smoothing length to the original value for the
            # rest of the computations.
            Group(
                equations=[
                    ScaleSmoothingLength(dest='fluid',
                                         sources=None,
                                         factor=1.25)
                ],
                update_nnps=False,
            ),
            #################################################################
            # End Surface tension formulation
            #################################################################

            # Once the pressure for the fluid phase has been updated via the
            # state-equation, we can extrapolate the pressure to the wall
            # ghost particles. After this group, the density and pressure of
            # the boundary particles has been updated and can be used in the
            # integration equations.
            Group(equations=[
                SolidWallPressureBC(dest='wall',
                                    sources=['fluid'],
                                    p0=p0,
                                    rho0=rho0,
                                    gy=gy,
                                    b=1.0),
            ], ),

            # The main acceleration block
            Group(
                equations=[

                    # Body force due to gravity
                    BodyForce(dest='fluid', sources=None, fy=gy),

                    # Gradient of pressure for the fluid phase using the
                    # number density formulation. The no-penetration boundary
                    # condition is taken care of by using the boundary
                    # pressure and density.
                    PressureGradientUsingNumberDensity(
                        dest='fluid', sources=['fluid', 'wall']),

                    # Artificial viscosity for the fluid phase.
                    ClearyArtificialViscosity(dest='fluid',
                                              sources=['fluid', 'wall'],
                                              dim=dim,
                                              alpha=alpha),

                    # Surface tension force for the SY11 formulation
                    ShadlooYildizSurfaceTensionForce(dest='fluid',
                                                     sources=None,
                                                     sigma=sigma),

                    # XSPH Correction
                    XSPHCorrection(dest='fluid', sources=['fluid'], eps=0.1),
                ], )
        ]
        return equations
Ejemplo n.º 16
0
    def create_equations(self):
        # Formulation for REF1
        equations1 = [
            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density.
            Group(equations=[
                VolumeFromMassDensity(dest='fluid', sources=None)
            ], ),

            # 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),
            ], ),

            # The boundary conditions are imposed by extrapolating the fluid
            # pressure, taking into considering the bounday acceleration
            Group(equations=[
                SolidWallPressureBC(dest='solid', sources=['fluid'], b=1.0, gy=gy,
                                    rho0=rho0, p0=p0),
            ], ),

            # Main acceleration block
            Group(equations=[

                # Continuity equation
                ContinuityEquation(
                    dest='fluid', sources=[
                        'fluid', 'solid']),

                # Pressure gradient with acceleration damping.
                MomentumEquationPressureGradient(
                    dest='fluid', sources=['fluid', 'solid'], pb=0.0, gy=gy,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='fluid', sources=['fluid', 'solid'], alpha=0.24, c0=c0),

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

            ]),
        ]

        # Formulation for REF2. Note that for this formulation to work, the
        # boundary particles need to have a spacing different from the fluid
        # particles (usually determined by a factor beta). In the current
        # implementation, the value is taken as 1.0 which will mostly be
        # ineffective.
        equations2 = [
            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density.
            Group(equations=[
                VolumeFromMassDensity(dest='fluid', sources=None)
            ], ),

            # 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),
            ], ),

            # Main acceleration block
            Group(equations=[

                # The boundary conditions are imposed as a force or
                # accelerations on the fluid particles. Note that the
                # no-penetration condition is to be satisfied with this
                # equation. The subsequent equations therefore do not have
                # solid as the source. Note the difference between the
                # ghost-fluid formulations. K should be 0.01*co**2
                # according to REF2. We take it much smaller here on
                # account of the multiple layers of boundary particles
                MonaghanKajtarBoundaryForce(dest='fluid', sources=['solid'],
                                            K=0.02, beta=1.0, h=hdx * dx),

                # Continuity equation
                ContinuityEquation(dest='fluid', sources=['fluid', ]),

                # Pressure gradient with acceleration damping.
                MomentumEquationPressureGradient(
                    dest='fluid', sources=['fluid'], pb=0.0, gy=gy,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='fluid', sources=['fluid'], alpha=0.25, c0=c0),

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

            ]),
        ]

        # Formulation for REF3
        equations3 = [
            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density.
            Group(equations=[
                VolumeFromMassDensity(dest='fluid', sources=None)
            ], ),

            # Equation of state is typically the Tait EOS with a suitable
            # exponent gamma. The solid phase is treated just as a fluid and
            # the pressure and density operations is updated for this as well.
            Group(equations=[
                TaitEOS(
                    dest='fluid',
                    sources=None,
                    rho0=rho0,
                    c0=c0,
                    gamma=gamma),
                TaitEOS(
                    dest='solid',
                    sources=None,
                    rho0=rho0,
                    c0=c0,
                    gamma=gamma),
            ], ),

            # Main acceleration block. The boundary conditions are imposed by
            # peforming the continuity equation and gradient of pressure
            # calculation on the solid phase, taking contributions from the
            # fluid phase
            Group(equations=[

                # Continuity equation
                ContinuityEquation(
                    dest='fluid', sources=[
                        'fluid', 'solid']),
                ContinuityEquation(dest='solid', sources=['fluid']),

                # Pressure gradient with acceleration damping.
                MomentumEquationPressureGradient(
                    dest='fluid', sources=['fluid', 'solid'], pb=0.0, gy=gy,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='fluid', sources=['fluid', 'solid'], alpha=0.25, c0=c0),

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

            ]),
        ]

        if self.options.bc_type == 1:
            return equations1
        elif self.options.bc_type == 2:
            return equations2
        elif self.options.bc_type == 3:
            return equations3
    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
Ejemplo n.º 18
0
    def create_equations(self):
        equations = [

            # Properties computed set from the current state
            Group(
                equations=[
                    # p
                    IsothermalEOS(dest='solid',
                                  sources=None,
                                  rho0=rho0,
                                  c0=c0,
                                  p0=0.0),

                    # vi,j : requires properties v00, v01, v10, v11
                    VelocityGradient2D(dest='solid', sources=[
                        'solid',
                    ]),

                    # rij : requires properties r00, r01, r02, r11, r12, r22,
                    #                           s00, s01, s02, s11, s12, s22
                    MonaghanArtificialStress(dest='solid',
                                             sources=None,
                                             eps=0.3),
                ], ),

            # Acceleration variables are now computed
            Group(equations=[

                # arho
                ContinuityEquation(dest='solid', sources=[
                    'solid',
                ]),

                # au, av
                MomentumEquationWithStress(dest='solid',
                                           sources=[
                                               'solid',
                                           ],
                                           n=4,
                                           wdeltap=self.wdeltap),

                # au, av
                MonaghanArtificialViscosity(dest='solid',
                                            sources=[
                                                'solid',
                                            ],
                                            alpha=1.0,
                                            beta=1.0),

                # a_s00, a_s01, a_s11
                HookesDeviatoricStressRate(dest='solid',
                                           sources=None,
                                           shear_mod=G),

                # ax, ay, az
                XSPHCorrection(dest='solid', sources=[
                    'solid',
                ], eps=0.5),
            ])  # End Acceleration Group
        ]  # End Group list
        return equations
Ejemplo n.º 19
0
    def _get_external_flow_equations(self):

        from pysph.sph.basic_equations import XSPHCorrection
        from pysph.sph.wc.transport_velocity import (
            VolumeSummation, SolidWallNoSlipBC, SummationDensity,
            MomentumEquationArtificialViscosity, MomentumEquationViscosity)
        all_solids = self.solids + self.inviscid_solids
        all = self.fluids + all_solids

        edac_nu = self._get_edac_nu()
        equations = []
        group1 = []
        for fluid in self.fluids:
            group1.append(SummationDensity(dest=fluid, sources=all))
        for solid in self.solids:
            group1.extend([
                SourceNumberDensity(dest=solid, sources=self.fluids),
                VolumeSummation(dest=solid, sources=all),
                SolidWallPressureBC(dest=solid,
                                    sources=self.fluids,
                                    gx=self.gx,
                                    gy=self.gy,
                                    gz=self.gz),
                SetWallVelocity(dest=solid, sources=self.fluids),
            ])
            if self.clamp_p:
                group1.append(ClampWallPressure(dest=solid, sources=None))

        for solid in self.inviscid_solids:
            group1.extend([
                SourceNumberDensity(dest=solid, sources=self.fluids),
                NoSlipVelocityExtrapolation(dest=solid, sources=self.fluids),
                VolumeSummation(dest=solid, sources=all),
                SolidWallPressureBC(dest=solid,
                                    sources=self.fluids,
                                    gx=self.gx,
                                    gy=self.gy,
                                    gz=self.gz)
            ])

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

        group2 = []
        for fluid in self.fluids:
            group2.append(
                MomentumEquation(dest=fluid,
                                 sources=all,
                                 gx=self.gx,
                                 gy=self.gy,
                                 gz=self.gz,
                                 c0=self.c0,
                                 tdamp=self.tdamp))
            if self.alpha > 0.0:
                group2.append(
                    MomentumEquationArtificialViscosity(dest=fluid,
                                                        sources=all,
                                                        alpha=self.alpha,
                                                        c0=self.c0))
            if self.nu > 0.0:
                group2.append(
                    MomentumEquationViscosity(dest=fluid,
                                              sources=self.fluids,
                                              nu=self.nu))
            if len(self.solids) > 0 and self.nu > 0.0:
                group2.append(
                    SolidWallNoSlipBC(dest=fluid,
                                      sources=self.solids,
                                      nu=self.nu))
            group2.extend([
                EDACEquation(dest=fluid,
                             sources=all,
                             nu=edac_nu,
                             cs=self.c0,
                             rho0=self.rho0),
                XSPHCorrection(dest=fluid, sources=[fluid], eps=self.eps)
            ])
        equations.append(Group(equations=group2))

        return equations
        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)
    ],
          real=True),
]

# Setup the application and solver.  This also generates the particles.
app.setup(solver=solver,
          equations=equations,
Ejemplo n.º 21
0
    def create_equations(self):
        equations = [

            # Properties computed set from the current state
            Group(
                equations=[
                    # p
                    MieGruneisenEOS(dest='bar',
                                    sources=None,
                                    gamma=gamma,
                                    r0=r0,
                                    c0=C,
                                    S=S),

                    # vi,j : requires properties v00, v01, v10, v11
                    VelocityGradient2D(dest='bar', sources=[
                        'bar',
                    ]),

                    # rij : requires properties s00, s01, s11
                    VonMisesPlasticity2D(flow_stress=Yo,
                                         dest='bar',
                                         sources=None),
                ], ),

            # Acceleration variables are now computed
            Group(equations=[

                # arho
                ContinuityEquation(dest='bar', sources=['bar']),

                # au, av
                MomentumEquationWithStress(dest='bar', sources=['bar']),

                # au, av
                MonaghanArtificialViscosity(dest='bar',
                                            sources=['bar'],
                                            alpha=0.5,
                                            beta=0.5),

                # au av
                MonaghanBoundaryForce(dest='bar', sources=['plate'],
                                      deltap=dx),

                # ae
                EnergyEquationWithStress(dest='bar',
                                         sources=['bar'],
                                         alpha=0.5,
                                         beta=0.5,
                                         eta=0.01),

                # a_s00, a_s01, a_s11
                HookesDeviatoricStressRate(dest='bar', sources=None),

                # ax, ay, az
                XSPHCorrection(dest='bar', sources=[
                    'bar',
                ], eps=0.5),
            ])  # End Acceleration Group
        ]  # End Group list
        return equations
Ejemplo n.º 22
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
Ejemplo n.º 23
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
    def get_equations(self):
        from pysph.sph.equation import Group
        from pysph.sph.wc.basic import TaitEOS
        from pysph.sph.basic_equations import XSPHCorrection
        from pysph.sph.wc.transport_velocity import (
            ContinuityEquation, MomentumEquationPressureGradient,
            MomentumEquationViscosity, MomentumEquationArtificialViscosity,
            SolidWallPressureBC, SolidWallNoSlipBC, SetWallVelocity,
            VolumeSummation)

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

        g2 = []
        for fluid in self.fluids:
            g2.append(VolumeSummation(dest=fluid, sources=all))
            g2.append(
                TaitEOS(dest=fluid,
                        sources=None,
                        rho0=self.rho0,
                        c0=self.c0,
                        gamma=self.gamma,
                        p0=self.p0))
        for solid in self.solids:
            g2.append(VolumeSummation(dest=solid, sources=all))
            g2.append(SetWallVelocity(dest=solid, sources=self.fluids))

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

        g3 = []
        for solid in self.solids:
            g3.append(
                SolidWallPressureBC(dest=solid,
                                    sources=self.fluids,
                                    b=1.0,
                                    rho0=self.rho0,
                                    p0=self.B,
                                    gx=self.gx,
                                    gy=self.gy,
                                    gz=self.gz))

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

        g4 = []
        for fluid in self.fluids:
            g4.append(ContinuityEquation(dest=fluid, sources=all))
            g4.append(
                MomentumEquationPressureGradient(dest=fluid,
                                                 sources=all,
                                                 pb=0.0,
                                                 gx=self.gx,
                                                 gy=self.gy,
                                                 gz=self.gz,
                                                 tdamp=self.tdamp))
            if self.alpha > 0.0:
                g4.append(
                    MomentumEquationArtificialViscosity(dest=fluid,
                                                        sources=all,
                                                        c0=self.c0,
                                                        alpha=self.alpha))
            if self.nu > 0.0:
                g4.append(
                    MomentumEquationViscosity(dest=fluid,
                                              sources=self.fluids,
                                              nu=self.nu))
                if len(self.solids) > 0:
                    g4.append(
                        SolidWallNoSlipBC(dest=fluid,
                                          sources=self.solids,
                                          nu=self.nu))
            g4.append(XSPHCorrection(dest=fluid, sources=[fluid]))

        equations.append(Group(equations=g4))
        return equations
Ejemplo n.º 25
0
    def create_equations(self):
        # Formulation for REF1
        equations1 = [
            # Spoon Equations
            Group(
                equations=[
                    HarmonicOscilllator(dest='spoon',
                                        sources=None,
                                        A=0.5,
                                        omega=0.2),

                    # Translate acceleration to positions
                    XSPHCorrection(dest='spoon', sources=['spoon'], eps=0.0)
                ],
                real=False),

            # Water Faucet Equations
            Group(equations=[
                H2OFaucet(dest='tahini',
                          sources=None,
                          x=1.25,
                          y=tahiniH,
                          r=0.15,
                          fill_rate=7),
                DiffuseH2O(
                    dest='tahini', sources=['tahini'], diffusion_speed=0.1),
            ]),

            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density.
            Group(
                equations=[VolumeFromMassDensity(dest='tahini',
                                                 sources=None)], ),

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

            # The boundary conditions are imposed by extrapolating the tahini
            # pressure, taking into considering the bounday acceleration
            Group(equations=[
                SolidWallPressureBC(dest='bowl',
                                    sources=['tahini'],
                                    b=1.0,
                                    gy=gy,
                                    rho0=rho0,
                                    p0=p0),
                SolidWallPressureBC(dest='spoon',
                                    sources=['tahini'],
                                    b=1.0,
                                    gy=gy,
                                    rho0=rho0,
                                    p0=p0),
            ], ),

            # Main acceleration block
            Group(equations=[
                TahiniEquation(
                    dest='tahini', sources=['tahini'], sigma=dx / 1.122),

                # Continuity equation
                ContinuityEquation(dest='tahini',
                                   sources=['tahini', 'bowl', 'spoon']),

                # Pressure gradient with acceleration damping.
                MomentumEquationPressureGradient(
                    dest='tahini',
                    sources=['tahini', 'bowl', 'spoon'],
                    pb=0.0,
                    gy=gy,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='tahini',
                    sources=['tahini', 'bowl', 'spoon'],
                    alpha=1,
                    c0=c0),

                # Position step with XSPH
                XSPHCorrection(dest='tahini', sources=['tahini'], eps=0.0)
            ]),
        ]

        # Formulation for REF3
        equations3 = [
            # Spoon Equations
            Group(
                equations=[
                    HarmonicOscilllator(dest='spoon',
                                        sources=None,
                                        A=0.5,
                                        omega=0.2),

                    # Translate acceleration to positions
                    XSPHCorrection(dest='spoon', sources=['spoon'], eps=0.0)
                ],
                real=False),

            # Water Faucet Equations
            Group(equations=[
                H2OFaucet(dest='tahini',
                          sources=None,
                          x=Cx,
                          y=tahiniH,
                          r=0.15,
                          fill_rate=5),
                DiffuseH2O(
                    dest='tahini', sources=['tahini'], diffusion_speed=0.1),
            ]),

            # For the multi-phase formulation, we require an estimate of the
            # particle volume. This can be either defined from the particle
            # number density or simply as the ratio of mass to density.
            Group(
                equations=[VolumeFromMassDensity(dest='tahini',
                                                 sources=None)], ),

            # Equation of state is typically the Tait EOS with a suitable
            # exponent gamma. The solid phase is treated just as a fluid and
            # the pressure and density operations is updated for this as well.
            Group(equations=[
                TaitEOS(dest='tahini',
                        sources=None,
                        rho0=rho0,
                        c0=c0,
                        gamma=gamma),
                TaitEOS(dest='bowl',
                        sources=None,
                        rho0=rho0,
                        c0=c0,
                        gamma=gamma),
                TaitEOS(dest='spoon',
                        sources=None,
                        rho0=rho0,
                        c0=c0,
                        gamma=gamma),
            ], ),

            # Main acceleration block. The boundary conditions are imposed by
            # peforming the continuity equation and gradient of pressure
            # calculation on the bowl phase, taking contributions from the
            # tahini phase
            Group(equations=[
                TahiniEquation(
                    dest='tahini', sources=['tahini'], sigma=dx / 1.122),

                # Continuity equation
                ContinuityEquation(dest='tahini',
                                   sources=['tahini', 'bowl', 'spoon']),
                ContinuityEquation(dest='bowl', sources=['tahini']),
                ContinuityEquation(dest='spoon', sources=['tahini']),

                # Pressure gradient with acceleration damping.
                MomentumEquationPressureGradient(
                    dest='tahini',
                    sources=['tahini', 'bowl', 'spoon'],
                    pb=0.0,
                    gy=gy,
                    tdamp=tdamp),

                # artificial viscosity for stability
                MomentumEquationArtificialViscosity(
                    dest='tahini',
                    sources=['tahini', 'bowl', 'spoon'],
                    alpha=1,
                    c0=c0),

                # Position step with XSPH
                XSPHCorrection(dest='tahini', sources=['tahini'], eps=0.5)
            ]),
        ]

        if self.options.bc_type == 1:
            return equations1
        elif self.options.bc_type == 3:
            return equations3
Ejemplo n.º 26
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
Ejemplo n.º 27
0
    def create_equations(self):
        equations = [

            # update smoothing length
            # Group(
            #     equations = [
            #         UpdateSmoothingLengthFromVolume(dest='plate',      sources=['plate', 'projectile'], dim=dim, k=hdx),
            #         UpdateSmoothingLengthFromVolume(dest='projectile', sources=['plate', 'projectile'], dim=dim, k=hdx),
            #     ],
            #     update_nnps=True,
            # ),

            # compute properties from the current state
            Group(equations=[
                # EOS (compute the pressure using  one of the EOSs)

                # MieGruneisenEOS(dest='plate',      sources=None, gamma=gamma1, r0=ro1 , c0=C1, S=S1),
                # MieGruneisenEOS(dest='projectile', sources=None, gamma=gamma2, r0=ro2 , c0=C2, S=S2),
                StiffenedGasEOS(
                    dest='plate', sources=None, gamma=gamma1, r0=ro1, c0=C1),
                StiffenedGasEOS(dest='projectile',
                                sources=None,
                                gamma=gamma2,
                                r0=ro2,
                                c0=C2),

                # compute the velocity gradient tensor
                VelocityGradient3D(dest='plate', sources=['plate']),
                VelocityGradient3D(dest='projectile', sources=['projectile']),

                # # stress
                VonMisesPlasticity2D(
                    dest='plate', sources=None, flow_stress=Yo1),
                VonMisesPlasticity2D(
                    dest='projectile', sources=None, flow_stress=Yo2),

                # # artificial stress to avoid clumping
                MonaghanArtificialStress(dest='plate', sources=None, eps=0.3),
                MonaghanArtificialStress(
                    dest='projectile', sources=None, eps=0.3),
            ]),

            # accelerations (rho, u, v, ...)
            Group(equations=[

                # continuity equation
                ContinuityEquation(dest='plate',
                                   sources=['projectile', 'plate']),
                ContinuityEquation(dest='projectile',
                                   sources=['projectile', 'plate']),

                # momentum equation
                MomentumEquationWithStress(dest='projectile',
                                           sources=[
                                               'projectile',
                                               'plate',
                                           ]),
                MomentumEquationWithStress(dest='plate',
                                           sources=[
                                               'projectile',
                                               'plate',
                                           ]),

                # energy equation:
                EnergyEquationWithStress(dest='plate',
                                         sources=[
                                             'projectile',
                                             'plate',
                                         ],
                                         alpha=avisc_alpha,
                                         beta=avisc_beta,
                                         eta=avisc_eta),
                EnergyEquationWithStress(dest='projectile',
                                         sources=[
                                             'projectile',
                                             'plate',
                                         ],
                                         alpha=avisc_alpha,
                                         beta=avisc_beta,
                                         eta=avisc_eta),

                # avisc
                MonaghanArtificialViscosity(dest='plate',
                                            sources=['projectile', 'plate'],
                                            alpha=avisc_alpha,
                                            beta=avisc_beta),
                MonaghanArtificialViscosity(dest='projectile',
                                            sources=['projectile', 'plate'],
                                            alpha=avisc_alpha,
                                            beta=avisc_beta),

                # updates to the stress term
                HookesDeviatoricStressRate(
                    dest='plate', sources=None, shear_mod=1.),
                HookesDeviatoricStressRate(
                    dest='projectile', sources=None, shear_mod=1.),

                # position stepping
                XSPHCorrection(dest='plate', sources=['plate'], eps=xsph_eps),
                XSPHCorrection(
                    dest='projectile', sources=['projectile'], eps=xsph_eps),
            ]),
        ]  # End Group list

        return equations