Skip to content

FEniCS-style bcs

FEniCS-style bcs #7157

GitHub Actions / Firedrake real failed Feb 3, 2025 in 0s

8079 tests run, 7364 passed, 713 skipped, 2 failed.

Annotations

Check failure on line 150 in tests/firedrake/slate/test_slate_hybridization.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_slate_hybridization.test_slate_hybridization_wrong_option

petsc4py.PETSc.Error: error code -1
Raw output
setup_poisson = (Form([Integral(Sum(Sum(Product(Indexed(Argument(WithGeometry(MixedFunctionSpace(IndexedProxyFunctionSpace(<firedrake....index=1, component=None), name='None_None'), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 5237)))
petsc_raises = <class 'conftest._petsc_raises'>

    def test_slate_hybridization_wrong_option(setup_poisson, petsc_raises):
        a, L, W = setup_poisson
    
        w = Function(W)
        params = {'mat_type': 'matfree',
                  'ksp_type': 'preonly',
                  'pc_type': 'python',
                  'pc_python_type': 'firedrake.HybridizationPC',
                  'hybridization': {'ksp_type': 'preonly',
                                    'pc_type': 'lu',
                                    'localsolve': {'ksp_type': 'preonly',
                                                   'pc_type': 'fieldsplit',
                                                   'pc_fieldsplit_type': 'frog'}}}
        problem = LinearVariationalProblem(a, L, w)
        solver = LinearVariationalSolver(problem, solver_parameters=params)
    
        with petsc_raises(ValueError):
>           solver.solve()

tests/firedrake/slate/test_slate_hybridization.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
firedrake/adjoint_utils/variational_solver.py:104: in wrapper
    out = solve(self, **kwargs)
firedrake/variational_solver.py:330: in solve
    self.snes.solve(None, work)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   petsc4py.PETSc.Error: error code -1

petsc4py/PETSc/SNES.pyx:1724: Error

Check failure on line 45 in tests/firedrake/slate/test_slac_parallel.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_slac_parallel.test_parallel_kernel_on_sphere

ValueError: Not an UFL type: <class 'firedrake.slate.slate.Mul'>
Raw output
@pytest.mark.parallel(nprocs=4)
    def test_parallel_kernel_on_sphere():
        """Tests that Slate can construct the operators
        in parallel (primarily tests that generated code is
        consistent across all processes).
    
        This is a basic projection problem on a spherical
        domain.
        """
        mesh = UnitIcosahedralSphereMesh(refinement_level=1)
        mesh.init_cell_orientations(SpatialCoordinate(mesh))
        x, y, z = SpatialCoordinate(mesh)
        V = FunctionSpace(mesh, "CG", 1)
        U = FunctionSpace(mesh, "DG", 0)
    
        expr = Function(U).interpolate(x*y*z)
    
        # Obtain coordinate field and construct Jacobian
        X = Function(V).interpolate(x)
        Y = Function(V).interpolate(y)
        Z = Function(V).interpolate(z)
        nflat = Function(VectorFunctionSpace(mesh, "DG", 0))
        nflat.project(as_vector([x, y, z]))
        J = as_tensor([[X.dx(0), X.dx(1), X.dx(2)],
                       [Y.dx(0), Y.dx(1), Y.dx(2)],
                       [Z.dx(0), Z.dx(1), Z.dx(2)]])
        dJ = as_tensor([[X*nflat[0], X*nflat[1], X*nflat[2]],
                        [Y*nflat[0], Y*nflat[1], Y*nflat[2]],
                        [Z*nflat[0], Z*nflat[1], Z*nflat[2]]])
    
        detJ = det(J + dJ)
        u = TrialFunction(U)
        v = TestFunction(U)
        bilinear_f = inner(detJ * u, v) * dx
        linear_f = inner(expr * detJ, v) * dx
    
        A = assemble(Tensor(bilinear_f))
        b = assemble(Tensor(linear_f))
    
        x = Function(U)
>       solve(A, x, b)

tests/firedrake/slate/test_slac_parallel.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
firedrake/adjoint_utils/solving.py:57: in wrapper
    output = solve(*args, **kwargs)
firedrake/solving.py:147: in solve
    return _la_solve(*args, **kwargs)
firedrake/solving.py:259: in _la_solve
    ctx = solving_utils._SNESContext(lvp,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
    ???
firedrake/solving_utils.py:236: in __init__
    self.F = ufl.replace(self.F, {self._x: ufl.zero(self._x.ufl_shape)})
../firedrake_venv/src/ufl/ufl/algorithms/replace.py:90: in replace
    if has_exact_type(e, CoefficientDerivative):
../firedrake_venv/src/ufl/ufl/algorithms/analysis.py:154: in has_exact_type
    return any(o._ufl_typecode_ == tc for e in iter_expressions(a) for o in traversal(e))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = Mul(Matrix(Form([Integral(Product(Product(Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0...us Lagrange', triangle, 0), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=3), 99)), 570)))

    def iter_expressions(a):
        """Handle Form, Integral and any Expr the same way when inspecting expressions.
    
        Returns an iterable over Expr instances:
        - a is an Expr: (a,)
        - a is an Integral:  the integrand expression of a
        - a is a  Form:      all integrand expressions of all integrals
        - a is a  FormSum:   the components of a
        - a is an Action:    the left and right component of a
        - a is an Adjoint:   the underlying form of a
        """
        if isinstance(a, Form):
            return (itg.integrand() for itg in a.integrals())
        elif isinstance(a, Integral):
            return (a.integrand(),)
        elif isinstance(a, (FormSum, Adjoint, Action)):
            return tuple(e for op in a.ufl_operands for e in iter_expressions(op))
        elif isinstance(a, (Expr, BaseForm)):
            return (a,)
>       raise ValueError(f"Not an UFL type: {type(a)}")
E       ValueError: Not an UFL type: <class 'firedrake.slate.slate.Mul'>

../firedrake_venv/src/ufl/ufl/algorithms/traversal.py:37: ValueError