This file is indexed.

/usr/lib/python2.7/dist-packages/PySPH-1.0a4.dev0-py2.7-linux-x86_64.egg/pysph/examples/sphysics/dambreak_sphysics.py is in python-pysph 0~20160514.git91867dc-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
"""Dam break past an obstacle with data from SPHysics. (40 minutes)

For benchmarking, we use the input geometry and discretization as the
SPHYSICS Case 5
(https://wiki.manchester.ac.uk/sphysics/index.php/SPHYSICS_Home_Page)

We only require the INDAT and IPART files generated by SPHysics. These
define respectively, the numerical parameters and the initial particle
data used for the run. The rest of the problem is set-up in the usual
way.

"""
import os
import numpy

from pysph.sph.equation import Group
from pysph.base.kernels import CubicSpline
from pysph.sph.wc.basic import TaitEOS, TaitEOSHGCorrection, MomentumEquation
from pysph.sph.basic_equations import ContinuityEquation, XSPHCorrection

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

from pysph.tools.sphysics import sphysics2pysph

MY_DIR = os.path.dirname(__file__)
INDAT = os.path.join(MY_DIR, 'INDAT.gz')
IPART = os.path.join(MY_DIR, 'IPART.gz')

# problem dimensionality
dim = 3

# suggested initial time step and final time
dt = 1e-5
tf = 2.0

# physical constants for the run loaded from SPHysics INDAT
indat = numpy.loadtxt(INDAT)
H = float( indat[10] )
B = float( indat[11] )
gamma = float( indat[12] )
eps = float( indat[14] )
rho0 = float( indat[15] )
alpha = float( indat[16] )
beta = 0.0
c0 = numpy.sqrt( B*gamma/rho0 )

class DamBreak3DSPhysics(Application):
    def add_user_options(self, group):
        group.add_argument(
            "--test", action="store_true", dest="test", default=False,
            help="For use while testing of results, uses PEC integrator."
        )

    def create_particles(self):
         return sphysics2pysph(IPART, INDAT, vtk=False)

    def create_solver(self):
        kernel = CubicSpline(dim=3)

        if self.options.test:
            integrator = PECIntegrator(fluid=WCSPHStep(),boundary=WCSPHStep())
            adaptive, n_damp = False, 0
        else:
            integrator = EPECIntegrator(fluid=WCSPHStep(),boundary=WCSPHStep())
            adaptive, n_damp = True, 100

        solver = Solver(dim=dim, kernel=kernel, integrator=integrator,
                        adaptive_timestep=adaptive, tf=tf, dt=dt,
                        n_damp=n_damp)
        return solver

    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

if __name__ == '__main__':
    app = DamBreak3DSPhysics()
    app.run()