Exemplo n.º 1
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
Exemplo n.º 2
0
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='body', sources=None, gz=gz),
             RigidBodyCollision(dest='body', sources=['tank'], kn=1e4, en=1)
         ]),
         Group(equations=[RigidBodyMoments(dest='body', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='body', 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
Exemplo n.º 4
0
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='body', sources=None, gz=gz),
             RigidBodyCollision(
                 dest='body', sources=['tank'], k=1.0, d=2.0, eta=0.1, kt=0.1
             )]
         ),
         Group(equations=[RigidBodyMoments(dest='body', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='body', sources=None)]),
     ]
     return equations
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='ball', sources=None, gy=gz),
             RigidBodyCollision(dest='ball',
                                sources=['wall', 'ball', 'temp_wall'],
                                kn=self.kn,
                                gamma_n=self.gamma_n,
                                mu=0.3)
         ]),
         Group(equations=[RigidBodyMoments(dest='ball', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='ball', sources=None)]),
     ]
     return equations
Exemplo n.º 6
0
    def get_equations(self):
        equations = []
        g1 = []
        if self.boundaries is not None:
            all = self.rigid_bodies + self.boundaries
        else:
            all = self.rigid_bodies

        if self.child_rigid_bodies is not None:
            all = all + self.child_rigid_bodies

        for name in self.rigid_bodies:
            g1.append(
                BodyForce(dest=name,
                          sources=None,
                          gx=self.gx,
                          gy=self.gy,
                          gz=self.gz))
        equations.append(Group(equations=g1, real=False))

        g2 = []
        if self.child_rigid_bodies is not None:
            rigid_bodies = self.rigid_bodies + self.child_rigid_bodies
        else:
            rigid_bodies = self.rigid_bodies

        for name in rigid_bodies:
            g2.append(
                RigidBodyCollision(dest=name,
                                   sources=all,
                                   kn=self.kn,
                                   mu=self.mu,
                                   en=self.en))
        equations.append(Group(equations=g2, real=False))

        g3 = []
        for name in self.rigid_bodies:
            g3.append(SumUpExternalForces(dest=name, sources=None))
        equations.append(Group(equations=g3, real=False))

        g4 = []
        if self.child_rigid_bodies is not None:
            for name in self.child_rigid_bodies:
                g4.append(SumUpExternalForces(dest=name, sources=None))

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

        return equations
Exemplo n.º 7
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
Exemplo n.º 8
0
 def create_equations(self):
     eqns = self.scheme.get_equations()
     eqn1 = Group(equations=[
         BodyForce(dest='cube', sources=None, gy=-9.81),
         RigidBodyCollision(dest='cube', sources=['wall', 'cube'],
                            kn=1.0e5, en=0.8),
         LiuFluidForce(dest='fluid', sources=['cube'])], real=False)
     eqn2 = Group(equations=[
         GroupParticles('cube', xmin=0.0, xmax=4.0, periodic_in_x=True)],
         real=False)
     eqn3 = Group(equations=[
         RigidBodyMoments(dest='cube', sources=None)], real=False)
     eqn4 = Group(equations=[
         RigidBodyMotion(dest='cube', sources=None)], real=False)
     eqns.append(eqn1)
     eqns.append(eqn2)
     eqns.append(eqn3)
     eqns.append(eqn4)
     return eqns
Exemplo n.º 9
0
 def create_equations(self):
     equations = [
         Group(equations=[
             BodyForce(dest='ball', sources=None, gy=gz),
             RigidBodyCollision(
                 dest='ball',
                 sources=['ball'],
                 kn=1e5,
                 en=0.1,
                 mu=0.25),
             RigidBodyWallCollision(
                 dest='ball',
                 sources=['wall', 'temp_wall'],
                 kn=1e5,
                 en=0.2,
                 mu=0.25)
         ]),
         Group(equations=[RigidBodyMoments(dest='ball', sources=None)]),
         Group(equations=[RigidBodyMotion(dest='ball', sources=None)]),
     ]
     return equations
Exemplo n.º 10
0
 def create_equations(self):
     eqns = self.scheme.get_equations()
     eqn1 = Group(equations=[
         BodyForce(dest='obstacle', sources=None, gy=-9.81),
         RigidBodyCollision(dest='obstacle',
                            sources=['wall'],
                            kn=1.0e4,
                            en=0.8)
     ],
                  real=False)
     eqn2 = Group(
         equations=[LiuFluidForce(dest='fluid', sources=['obstacle'])])
     eqn3 = Group(
         equations=[RigidBodyMoments(dest='obstacle', sources=None)])
     eqn4 = Group(
         equations=[RigidBodyMotion(dest='obstacle', sources=None)])
     eqns.append(eqn1)
     eqns.append(eqn2)
     eqns.append(eqn3)
     eqns.append(eqn4)
     return eqns
Exemplo n.º 11
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
Exemplo n.º 12
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
Exemplo n.º 13
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