def test_lump_init(ctx_factory):
    '\n    Simple test to check that Lump initializer\n    creates the expected solution field.\n    '
    cl_ctx = ctx_factory()
    queue = cl.CommandQueue(cl_ctx)
    actx = PyOpenCLArrayContext(queue)
    dim = 2
    nel_1d = 4
    from meshmode.mesh.generation import generate_regular_rect_mesh
    mesh = generate_regular_rect_mesh(a=[(0.0,), ((- 5.0),)], b=[(10.0,), (5.0,)], n=((nel_1d,) * dim))
    order = 3
    logger.info(f'Number of elements: {mesh.nelements}')
    discr = EagerDGDiscretization(actx, mesh, order=order)
    nodes = thaw(actx, discr.nodes())
    center = np.zeros(shape=(dim,))
    velocity = np.zeros(shape=(dim,))
    center[0] = 5
    velocity[0] = 1
    lump = Lump(center=center, velocity=velocity)
    lump_soln = lump(0, nodes)
    cv = split_conserved(dim, lump_soln)
    p = (0.4 * (cv.energy - ((0.5 * np.dot(cv.momentum, cv.momentum)) / cv.mass)))
    exp_p = 1.0
    errmax = discr.norm((p - exp_p), np.inf)
    logger.info(f'lump_soln = {lump_soln}')
    logger.info(f'pressure = {p}')
    assert (errmax < 1e-15)
Simple test to check that Lump initializer
creates the expected solution field.
def test_lump_init(ctx_factory):
    '\n    Simple test to check that Lump initializer\n    creates the expected solution field.\n    '
    cl_ctx = ctx_factory()
    queue = cl.CommandQueue(cl_ctx)
    actx = PyOpenCLArrayContext(queue)
    dim = 2
    nel_1d = 4
    from meshmode.mesh.generation import generate_regular_rect_mesh
    mesh = generate_regular_rect_mesh(a=[(0.0,), ((- 5.0),)], b=[(10.0,), (5.0,)], n=((nel_1d,) * dim))
    order = 3
    logger.info(f'Number of elements: {mesh.nelements}')
    discr = EagerDGDiscretization(actx, mesh, order=order)
    nodes = thaw(actx, discr.nodes())
    center = np.zeros(shape=(dim,))
    velocity = np.zeros(shape=(dim,))
    center[0] = 5
    velocity[0] = 1
    lump = Lump(center=center, velocity=velocity)
    lump_soln = lump(0, nodes)
    cv = split_conserved(dim, lump_soln)
    p = (0.4 * (cv.energy - ((0.5 * np.dot(cv.momentum, cv.momentum)) / cv.mass)))
    exp_p = 1.0
    errmax = discr.norm((p - exp_p), np.inf)
    logger.info(f'lump_soln = {lump_soln}')
    logger.info(f'pressure = {p}')
    assert (errmax < 1e-15)