Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pysph/base/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ class TestQuinticSpline1D(TestCubicSpline1D):
def test_simple(self):
self.check_kernel_at_origin(0.55)

def test_normalization(self):
"""" Added in response to issue #421. """
kh = self.wrapper.radius_scale
# Full domain [-3h, 3h] must integrate to 1.0
r = self.check_kernel_moment_1d(-kh, kh, 1.0, 0, xj=0)
self.assertAlmostEqual(r, 1.0, 8)
# Non-unit h
r = self.check_kernel_moment_1d(-kh, kh, 0.5, 0, xj=0)
self.assertAlmostEqual(r, 1.0, 8)


class TestQuinticSpline2D(TestCubicSpline2D):
kernel_factory = staticmethod(lambda: QuinticSpline(dim=2))
Expand Down
16 changes: 10 additions & 6 deletions pysph/examples/gas_dynamics/riemann_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
from pysph.sph.gas_dynamics.magma2 import MAGMA2Scheme
from pysph.examples.gas_dynamics.riemann_2d_config import R2DConfig

# current case from the al possible unique cases
case = 3

# config for current case
config = R2DConfig(case)
config = None
gamma = 1.4
gamma1 = gamma - 1
kernel_factor = 1.5
Expand All @@ -31,11 +28,15 @@

class Riemann2D(Application):
def initialize(self):
# square domain
self.dt = dt
self.tf = config.endtime

def add_user_options(self, group):
group.add_argument(
"--case", action="store", type=int,
dest="case", default=3,
choices=[2, 3, 4, 5, 6, 8, 12],
help="Riemann 2D case number, one of 2, 3, 4, 5, 6, 8, 12"
)
group.add_argument(
"--dscheme", choices=["constant_mass", "constant_volume"],
dest="dscheme", default="constant_volume",
Expand All @@ -48,6 +49,9 @@ def add_user_options(self, group):
)

def consume_user_options(self):
global config
config = R2DConfig(self.options.case)
self.tf = config.endtime
self.nx = self.options.nparticles
self.ny = self.nx
self.dx = (config.xmax - config.xmin) / self.nx
Expand Down