GitHub Actions / Firedrake complex
failed
Dec 16, 2024 in 0s
8138 tests run, 6663 passed, 1474 skipped, 1 failed.
Annotations
Check failure on line 50 in tests/firedrake/regression/test_fieldsplit_cofunction.py
github-actions / Firedrake complex
test_fieldsplit_cofunction
ufl.algorithms.check_arities.ArityMismatch: Failure to conjugate test function in complex Form
Raw output
def test_fieldsplit_cofunction():
"""
Test that fieldsplit preconditioners can be used
with a cofunction on the right hand side.
"""
mesh = fd.UnitSquareMesh(4, 4)
BDM = fd.FunctionSpace(mesh, "BDM", 1)
DG = fd.FunctionSpace(mesh, "DG", 0)
W = BDM*DG
u, p = fd.TrialFunctions(W)
v, q = fd.TestFunctions(W)
# simple wave equation scheme
a = (fd.dot(u, v) + fd.div(v)*p
- fd.div(u)*q + p*q)*fd.dx
x, y = fd.SpatialCoordinate(mesh)
f = fd.Function(W)
f.subfunctions[0].project(
fd.as_vector([0.01*y, 0]))
f.subfunctions[1].interpolate(
-10*fd.exp(-(pow(x - 0.5, 2) + pow(y - 0.5, 2)) / 0.02))
# compare to plain 1-form
L_check = fd.inner(f, fd.TestFunction(W))*fd.dx
L_cofun = f.riesz_representation()
# brute force schur complement solver
params = {
'ksp_converged_reason': None,
'ksp_type': 'preonly',
'pc_type': 'fieldsplit',
'pc_fieldsplit_type': 'schur',
'pc_fieldsplit_schur_fact_type': 'full',
'pc_fieldsplit_schur_precondition': 'full',
'fieldsplit': {
'ksp_type': 'preonly',
'pc_type': 'lu'
}
}
w_check = fd.Function(W)
problem_check = fd.LinearVariationalProblem(a, L_check, w_check)
> solver_check = fd.LinearVariationalSolver(problem_check,
solver_parameters=params)
tests/firedrake/regression/test_fieldsplit_cofunction.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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
???
/usr/lib/python3.12/contextlib.py:81: in inner
return func(*args, **kwds)
firedrake/adjoint_utils/variational_solver.py:44: in wrapper
init(self, problem, *args, **kwargs)
firedrake/variational_solver.py:243: in __init__
ctx.set_jacobian(self.snes)
firedrake/solving_utils.py:288: in set_jacobian
snes.setJacobian(self.form_jacobian, J=self._jac.petscmat,
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/solving_utils.py:493: in _jac
return self._assembler_jac.allocate()
firedrake/assemble.py:1316: in allocate
self._make_maps_and_regions())
firedrake/assemble.py:1345: in _make_maps_and_regions
elif any(local_kernel.indices == (None, None) for assembler in self._all_assemblers for local_kernel, _ in assembler.local_kernels):
firedrake/assemble.py:1345: in <genexpr>
elif any(local_kernel.indices == (None, None) for assembler in self._all_assemblers for local_kernel, _ in assembler.local_kernels):
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
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
???
pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
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
???
pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
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/tsfc_interface.py:220: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:95: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
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
???
pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
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
???
pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
tsfc/driver.py:68: in compile_form
fd = ufl_utils.compute_form_data(form, complex_mode=complex_mode)
tsfc/ufl_utils.py:56: in compute_form_data
fd = ufl_compute_form_data(
../firedrake_venv/src/ufl/ufl/algorithms/compute_form_data.py:427: in compute_form_data
check_form_arity(preprocessed_form, self.original_form.arguments(), complex_mode)
../firedrake_venv/src/ufl/ufl/algorithms/check_arities.py:213: in check_form_arity
check_integrand_arity(itg.integrand(), arguments, complex_mode)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expr = Product(Sum(Sum(Sum(Product(Indexed(ListTensor(Indexed(ComponentTensor(IndexSum(Product(Indexed(ComponentTensor(Produc...ectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 3106))), MultiIndex((FixedIndex(1), FixedIndex(0))))))))))
arguments = (Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f6680cba000>, FiniteElement('Brezzi-Dou...Marini', triangle, 1), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 3106)), 1, None))
complex_mode = True
def check_integrand_arity(expr, arguments, complex_mode=False):
"""Check the arity of an integrand."""
arguments = tuple(sorted(set(arguments), key=lambda x: (x.number(), x.part())))
rules = ArityChecker(arguments)
arg_tuples = map_expr_dag(rules, expr, compress=False)
args = tuple(a[0] for a in arg_tuples)
if args != arguments:
raise ArityMismatch(f"Integrand arguments {args} differ from form arguments {arguments}.")
if complex_mode:
# Check that the test function is conjugated and that any
# trial function is not conjugated. Further arguments are
# treated as trial funtions (i.e. no conjugation) but this
# might not be correct.
for arg, conj in arg_tuples:
if arg.number() == 0 and not conj:
> raise ArityMismatch("Failure to conjugate test function in complex Form")
E ufl.algorithms.check_arities.ArityMismatch: Failure to conjugate test function in complex Form
../firedrake_venv/src/ufl/ufl/algorithms/check_arities.py:205: ArityMismatch
Loading