예제 #1
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
예제 #2
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
예제 #3
0
    def test_continuity_equation(self):
        from pysph.sph.basic_equations import ContinuityEquation
        e = ContinuityEquation(dest='fluid', sources=['fluid'])
        # Call the loop code.

        d_arho = [0.0, 0.0, 0.0]
        s_m = [0.0, 0.0]
        r = e.loop(d_idx=0,
                   d_arho=d_arho,
                   s_idx=0,
                   s_m=s_m,
                   DWIJ=[0, 0, 0],
                   VIJ=[0, 0, 0])
        self.assertEqual(d_arho[0], 0.0)
        self.assertEqual(d_arho[1], 0.0)
        # Now call with specific arguments.
        s_m = [1, 1]
        r = e.loop(d_idx=0,
                   d_arho=d_arho,
                   s_idx=0,
                   s_m=s_m,
                   DWIJ=[1, 1, 1],
                   VIJ=[1, 1, 1])
        self.assertEqual(d_arho[0], 3.0)
        self.assertEqual(d_arho[1], 0.0)
예제 #4
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
예제 #5
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
예제 #7
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=[
                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
예제 #9
0
    def test_continuity_equation(self):
        from pysph.sph.basic_equations import ContinuityEquation
        e = ContinuityEquation(dest='fluid', sources=['fluid'])
        # Call the loop code.

        d_arho = [0.0, 0.0, 0.0]
        s_m = [0.0, 0.0]
        r = e.loop(d_idx=0, d_arho=d_arho, s_idx=0, s_m=s_m,
                   DWIJ=[0,0,0], VIJ=[0,0,0])
        self.assertEqual(d_arho[0], 0.0)
        self.assertEqual(d_arho[1], 0.0)
        # Now call with specific arguments.
        s_m = [1, 1]
        r = e.loop(d_idx=0, d_arho=d_arho, s_idx=0, s_m=s_m,
                   DWIJ=[1,1,1], VIJ=[1,1,1])
        self.assertEqual(d_arho[0], 3.0)
        self.assertEqual(d_arho[1], 0.0)
예제 #10
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
예제 #11
0
파일: basic.py 프로젝트: yang7857854/pysph
    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
예제 #12
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
예제 #13
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
    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
예제 #15
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
예제 #16
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
예제 #17
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
예제 #18
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
    # Equation of state
    Group(equations=[
        TaitEOS(dest='fluid', sources=None, rho0=ro, c0=co, gamma=gamma),
        TaitEOSHGCorrection(dest='boundary',
                            sources=None,
                            rho0=ro,
                            c0=co,
                            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'])
    ]),
예제 #21
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
예제 #22
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