Пример #1
0
 def test_p_less_than_1_error(self):
     """Tests that exception is thrown when initializing with p < 1."""
     with self.assertRaises(ValueError):
         ElementLinePp(0)
Пример #2
0
        ElementTriP2(),
    ),
    (
        MeshLine().refined(5),
        MeshLine1DG,
        ElementLineP1(),
    ),
    (
        MeshHex().refined(3),
        MeshHex1DG,
        ElementHex1(),
    ),
    (
        MeshLine().refined(),
        MeshLine1DG,
        ElementLinePp(5),
    ),
])
def test_periodic_loading(m, mdgtype, e):
    def _sort(ix):
        # sort index arrays so that ix[0] matches
        return ix[np.argsort(np.sum(m.p, axis=0)[ix])]

    mp = mdgtype.periodic(m, _sort(m.nodes_satisfying(lambda x: x[0] == 0)),
                          _sort(m.nodes_satisfying(lambda x: x[0] == 1)))
    basis = Basis(mp, e)
    A = laplace.assemble(basis)
    M = mass.assemble(basis)

    @LinearForm
    def linf(v, w):