Restricted Cofunction RHS #172
GitHub Actions / Firedrake real
failed
Dec 20, 2024 in 0s
8132 tests run, 7454 passed, 675 skipped, 3 failed.
Annotations
Check failure on line 230 in tests/firedrake/regression/test_interp_dual.py
github-actions / Firedrake real
test_interp_dual.test_solve_interp_u
petsc4py.PETSc.Error: error code -1
[0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
[0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
[0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
Raw output
> ???
petsc4py/PETSc/PETSc.pyx:348:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/petscsnes.pxi:367: in petsc4py.PETSc.SNES_Jacobian
???
firedrake/solving_utils.py:439: in form_jacobian
ctx._assemble_jac(ctx._jac)
firedrake/assemble.py:380: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:603: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:376: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:409: in base_form_assembly_visitor
assembler = TwoFormAssembler(form, bcs=self._bcs, form_compiler_parameters=self._form_compiler_params,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = FormSum([Form([Integral(Conj(IndexSum(Product(Indexed(Grad(Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTop...ent('Lagrange', triangle, 1), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 1650))))])
args = ()
kwargs = {'allocation_integral_types': ('interior_facet',), 'appctx': {'form_compiler_parameters': {'scalar_type': dtype('float...', triangle, 1), dim=2), 1650)), 3543)}, 'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('float64')}, ...}
def TwoFormAssembler(form, *args, **kwargs):
> assert isinstance(form, (ufl.form.Form, slate.TensorBase))
E AssertionError
firedrake/assemble.py:1228: AssertionError
The above exception was the direct cause of the following exception:
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 1650)
def test_solve_interp_u(mesh):
V1 = FunctionSpace(mesh, "CG", 1)
x, y = SpatialCoordinate(mesh)
w = TestFunction(V1)
u = Function(V1)
f = Function(V1).interpolate(cos(x)*sin(y))
# -- Exact solution
F = inner(grad(u), grad(w))*dx + inner(u, w)*dx - inner(f, w)*dx
solve(F == 0, u)
# -- Non mat-free case not supported yet => Need to be able to get the Interpolation matrix -- #
"""
# -- Solution where the source term is interpolated via `ufl.Interpolate`
u2 = Function(V1)
# Iu is the identity
Iu = Interpolate(u2, V1)
# This requires assembling the Jacobian of Iu
F2 = inner(grad(u), grad(w))*dx + inner(Iu, w)*dx - inner(f, w)*dx
solve(F2 == 0, u2)
"""
# -- Solution where u2 is interpolated via `ufl.Interpolate` (mat-free)
u2 = Function(V1)
# Iu is the identity
Iu = Interpolate(u2, V1)
# This requires assembling the action the Jacobian of Iu
F2 = inner(grad(u2), grad(w))*dx + inner(Iu, w)*dx - inner(f, w)*dx
> solve(F2 == 0, u2, solver_parameters={"mat_type": "matfree",
"ksp_type": "cg",
"pc_type": "none"})
tests/firedrake/regression/test_interp_dual.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:141: in solve
_solve_varproblem(*args, **kwargs)
firedrake/solving.py:195: in _solve_varproblem
solver.solve()
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:101: in wrapper
out = solve(self, **kwargs)
firedrake/variational_solver.py:325: in solve
self.snes.solve(None, work)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E petsc4py.PETSc.Error: error code -1
E [0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
E [0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
E [0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
petsc4py/PETSc/SNES.pyx:1724: Error
Check failure on line 190 in tests/firedrake/external_operators/test_external_operators.py
github-actions / Firedrake real
test_external_operators.test_solve[matrix-free]
petsc4py.PETSc.Error: error code -1
[0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
[0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
[0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
Raw output
> ???
petsc4py/PETSc/PETSc.pyx:348:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/petscsnes.pxi:367: in petsc4py.PETSc.SNES_Jacobian
???
firedrake/solving_utils.py:439: in form_jacobian
ctx._assemble_jac(ctx._jac)
firedrake/assemble.py:380: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:603: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:376: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:409: in base_form_assembly_visitor
assembler = TwoFormAssembler(form, bcs=self._bcs, form_compiler_parameters=self._form_compiler_params,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = FormSum([Form([Integral(Conj(IndexSum(Product(Indexed(Grad(Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTop...)), 1, None); derivatives=(1, 0); operator_data={'func': <function test_solve.<locals>.<lambda> at 0x7fd9b3310cc0>}))])
args = ()
kwargs = {'allocation_integral_types': ('interior_facet',), 'appctx': {'form_compiler_parameters': {'scalar_type': dtype('float...edrake.bcs.DirichletBC object at 0x7fd9b34a1730>,), 'form_compiler_parameters': {'scalar_type': dtype('float64')}, ...}
def TwoFormAssembler(form, *args, **kwargs):
> assert isinstance(form, (ufl.form.Form, slate.TensorBase))
E AssertionError
firedrake/assemble.py:1228: AssertionError
The above exception was the direct cause of the following exception:
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 32524)
solver_parameters = {'ksp_type': 'cg', 'mat_type': 'matfree', 'pc_type': 'none'}
def test_solve(mesh, solver_parameters):
V = FunctionSpace(mesh, "CG", 1)
v = TestFunction(V)
# Set Dirichlet boundary condition
bcs = DirichletBC(V, 0., "on_boundary")
# Set RHS
x, y = SpatialCoordinate(mesh)
f = Function(V).interpolate((2 * pi ** 2 + 1) * sin(pi * x) * sin(pi * y))
# Solve the Poisson problem without external operators:
# - Δu + u = f in Ω
# u = 0 on ∂Ω
# with f = (2 * π ** 2 + 1 ) * sin(pi * x) * sin(pi * y)
w = Function(V)
F = inner(grad(w), grad(v)) * dx + inner(w, v) * dx - inner(f, v) * dx
solve(F == 0, w, bcs=bcs, solver_parameters=solver_parameters)
# Solve the Poisson problem:
# - Δu + N(u, f) = 0 in Ω
# u = 0 on ∂Ω
# with N an ExternalOperator defined as N(u, f; v*) = u - f
u = Function(V)
pe = point_expr(lambda x, y: x - y, function_space=V)
N = pe(u, f)
F = inner(grad(u), grad(v)) * dx + inner(N, v) * dx
# When `solver_parameters` relies on a matrix-free solver, the external operator assembly
# calls the method of the external operator subclass associated with the assembly of the Jacobian action.
> solve(F == 0, u, bcs=bcs, solver_parameters=solver_parameters)
tests/firedrake/external_operators/test_external_operators.py:190:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:141: in solve
_solve_varproblem(*args, **kwargs)
firedrake/solving.py:195: in _solve_varproblem
solver.solve()
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:101: in wrapper
out = solve(self, **kwargs)
firedrake/variational_solver.py:325: in solve
self.snes.solve(None, work)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E petsc4py.PETSc.Error: error code -1
E [0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
E [0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
E [0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
petsc4py/PETSc/SNES.pyx:1724: Error
Check failure on line 362 in tests/firedrake/external_operators/test_external_operators.py
github-actions / Firedrake real
test_external_operators.test_translation_operator_matrix_free
petsc4py.PETSc.Error: error code -1
[0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
[0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
[0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
[0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
[0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
[0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
Raw output
> ???
petsc4py/PETSc/PETSc.pyx:348:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/PETSc.pyx:348: in petsc4py.PETSc.PetscPythonErrorHandler
???
petsc4py/PETSc/petscsnes.pxi:367: in petsc4py.PETSc.SNES_Jacobian
???
firedrake/solving_utils.py:439: in form_jacobian
ctx._assemble_jac(ctx._jac)
firedrake/assemble.py:380: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:603: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:376: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:409: in base_form_assembly_visitor
assembler = TwoFormAssembler(form, bcs=self._bcs, form_compiler_parameters=self._form_compiler_params,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = FormSum([Form([Integral(Conj(IndexSum(Product(Indexed(Grad(Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTop...orElement(FiniteElement('Lagrange', triangle, 1), dim=2), 32524)), 1, None); derivatives=(1, 0); operator_data=None))])
args = ()
kwargs = {'allocation_integral_types': ('interior_facet',), 'appctx': {'form_compiler_parameters': {'scalar_type': dtype('float...edrake.bcs.DirichletBC object at 0x7fd9b2e5ce90>,), 'form_compiler_parameters': {'scalar_type': dtype('float64')}, ...}
def TwoFormAssembler(form, *args, **kwargs):
> assert isinstance(form, (ufl.form.Form, slate.TensorBase))
E AssertionError
firedrake/assemble.py:1228: AssertionError
The above exception was the direct cause of the following exception:
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 32524)
def test_translation_operator_matrix_free(mesh):
class TranslationOperator(AbstractExternalOperator):
def __init__(self, *operands, function_space, **kwargs):
AbstractExternalOperator.__init__(self, *operands, function_space=function_space, **kwargs)
@assemble_method(0, (0,))
def assemble_N(self, *args, **kwargs):
u, f = self.ufl_operands
N = assemble(u - f)
return N
@assemble_method((1, 0), (0, None))
def assemble_Jacobian_action(self, *args, **kwargs):
w = self.argument_slots()[-1]
return w
# -- Test assembly of `N` and its Jacobian action -- #
V = FunctionSpace(mesh, "CG", 1)
x, y = SpatialCoordinate(mesh)
f = Function(V).interpolate((2 * pi ** 2 + 1) * sin(pi * x) * sin(pi * y))
u = Function(V)
v = TestFunction(V)
bcs = DirichletBC(V, 0, 'on_boundary')
# Solve with external operator
N = TranslationOperator(u, f, function_space=V)
F = (inner(grad(u), grad(v)) + inner(N, v)) * dx
> solve(F == 0, u, bcs=bcs, solver_parameters={"mat_type": "matfree",
"ksp_type": "cg",
"pc_type": "none"})
tests/firedrake/external_operators/test_external_operators.py:362:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:141: in solve
_solve_varproblem(*args, **kwargs)
firedrake/solving.py:195: in _solve_varproblem
solver.solve()
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:101: in wrapper
out = solve(self, **kwargs)
firedrake/variational_solver.py:325: in solve
self.snes.solve(None, work)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E petsc4py.PETSc.Error: error code -1
E [0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
E [0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
E [0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
E [0] SNESSolve() at /home/firedrake/petsc/src/snes/interface/snes.c:4839
E [0] SNESSolve_NEWTONLS() at /home/firedrake/petsc/src/snes/impls/ls/ls.c:218
E [0] SNESComputeJacobian() at /home/firedrake/petsc/src/snes/interface/snes.c:2967
petsc4py/PETSc/SNES.pyx:1724: Error
Loading