Restricted Cofunction RHS #125
8138 tests run, 5024 passed, 1486 skipped, 1628 failed.
Annotations
Check failure on line 189 in tests/firedrake/regression/test_vfs_component_bcs.py
github-actions / Firedrake complex
test_vfs_component_bcs.test_stokes_component_all
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
def test_stokes_component_all():
mesh = UnitSquareMesh(10, 10)
# Define function spaces
V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W = V * Q
# applyBcsComponentWise = True
bc0 = DirichletBC(W.sub(0).sub(0), 0, [3, 4])
bc1 = DirichletBC(W.sub(0).sub(1), 0, [3, 4])
bc2 = DirichletBC(W.sub(0).sub(0), 1, 1)
bc3 = DirichletBC(W.sub(0).sub(1), 0, 1)
bcs_cmp = [bc0, bc1, bc2, bc3]
bc0 = DirichletBC(W.sub(0), Constant((0.0, 0.0)), [3, 4])
bc1 = DirichletBC(W.sub(0), Constant((1.0, 0.0)), 1)
bcs_all = [bc0, bc1]
# Define variational problem
(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
f = Constant((0.0, 0.0))
a = inner(grad(u), grad(v))*dx + inner(p, div(v))*dx + inner(div(u), q)*dx
L = inner(f, v)*dx
params = {"mat_type": "aij",
"pc_type": "lu",
"pc_factor_mat_solver_type": DEFAULT_DIRECT_SOLVER,
"pc_factor_shift_type": "nonzero"}
Uall = Function(W)
> solve(a == L, Uall, bcs=bcs_all, solver_parameters=params)
tests/firedrake/regression/test_vfs_component_bcs.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Conj(IndexSum(IndexSum(Product(Indexed(ListTensor(ComponentTensor(Indexed(Grad(Argument(WithGeometry(Mi...ex(19),))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 40), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (<firedrake.bcs.DirichletBC object at 0x7f9f96577ec0>, <firedrake.bcs.DirichletBC object at 0x7f9f95ecccb0>), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False
bcs = (<firedrake.bcs.DirichletBC object at 0x7f9f96577ec0>, <firedrake.bcs.DirichletBC object at 0x7f9f95ecccb0>)
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(f + tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'f + tanh(f)', value = -10, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='constant_0', count=0), MultiIn... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(cos(f) + sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'cos(f) + sin(f)', value = -10, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Cos(IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='constant_1', count=1), Mul... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(cos(f)*cos(f) + sin(f)*sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'cos(f)*cos(f) + sin(f)*sin(f)', value = -10, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Product(Cos(IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='constant_2', count... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(tanh(f) + cos(f) + sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f) + cos(f) + sin(f)', value = -10, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Sum(Cos(IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='constant_3', count=3),... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(1.0/tanh(f) + 1.0/f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '1.0/tanh(f) + 1.0/f', value = -10, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Division(FloatValue(1.0), IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='cons... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(sqrt(f*f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'sqrt(f*f)', value = -10, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...(25),))))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-10)-expr=(1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)', value = -10, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Sum(Division(FloatValue(1.0), IndexSum(Product(Indexed(Constant([-10.+0.j -10.+0.j], name='... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'f', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...ex(31),))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(2*f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '2*f', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f)', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...x(37),)))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(2 * tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '2 * tanh(f)', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(f + tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'f + tanh(f)', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='constant_11', count=11), Multi... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(cos(f) + sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'cos(f) + sin(f)', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Cos(IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='constant_12', count=12), M... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(cos(f)*cos(f) + sin(f)*sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'cos(f)*cos(f) + sin(f)*sin(f)', value = -20, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Product(Cos(IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='constant_13', coun... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 46 in tests/firedrake/equation_bcs/test_bcs_reconstruct.py
github-actions / Firedrake complex
test_bcs_reconstruct.test_bc_on_sub_sub_domain
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
def test_bc_on_sub_sub_domain():
# Solve a vector poisson problem
mesh = UnitSquareMesh(50, 50)
V = VectorFunctionSpace(mesh, "CG", 1)
VV = MixedFunctionSpace([V, V])
x, y = SpatialCoordinate(mesh)
f = Function(V)
f.interpolate(as_vector([-8.0 * pi * pi * cos(x * pi * 2) * cos(y * pi * 2),
-8.0 * pi * pi * cos(x * pi * 2) * cos(y * pi * 2)]))
# interpolate the exact solution on gg[i][j]
gg = [[None, None], [None, None]]
for i in [0, 1]:
for j in [0, 1]:
gg[i][j] = Function(VV.sub(i).sub(j))
gg[i][j].interpolate(cos(2 * pi * x) * cos(2 * pi * y))
uu = Function(VV)
vv = TestFunction(VV)
F = 0
for u, v in zip(split(uu), split(vv)):
F += (- inner(grad(u), grad(v)) - inner(f, v)) * dx
bcs = [DirichletBC(VV.sub(0).sub(0), gg[0][0], 1),
DirichletBC(VV.sub(0).sub(1), gg[0][1], 2),
DirichletBC(VV.sub(1).sub(0), gg[1][0], 3),
DirichletBC(VV.sub(1).sub(1), gg[1][1], "on_boundary")]
parameters = {"mat_type": "nest",
"snes_type": "ksponly",
"ksp_type": "preonly",
"pc_type": "fieldsplit",
"pc_fieldsplit_type": "additive",
"fieldsplit_ksp_type": "preonly",
"fieldsplit_pc_type": "lu"}
> solve(F == 0, uu, bcs=bcs, solver_parameters=parameters)
tests/firedrake/equation_bcs/test_bcs_reconstruct.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:189: in _solve_varproblem
solver = vs.NonlinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Sum(Product(IntValue(-1), Conj(IndexSum(Product(Indexed(ListTensor(Indexed(Argument(WithGeometry(MixedF...x(27),)))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (<firedrake.bcs.DirichletBC object at 0x7fb501b99bb0>, <firedrake.bcs.DirichletBC object at 0x7fb501b45fd0>, <...firedrake.bcs.DirichletBC object at 0x7fb501b59580>), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False
bcs = (<firedrake.bcs.DirichletBC object at 0x7fb501b99bb0>, <firedrake.bcs.DirichletBC object at 0x7fb501b45fd0>, <firedrake.bcs.DirichletBC object at 0x7fb501b5b920>, <firedrake.bcs.DirichletBC object at 0x7fb501b59580>)
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(tanh(f) + cos(f) + sin(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f) + cos(f) + sin(f)', value = -20, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Sum(Cos(IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='constant_14', count=14... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(1.0/tanh(f) + 1.0/f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '1.0/tanh(f) + 1.0/f', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Division(FloatValue(1.0), IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='cons... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(sqrt(f*f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'sqrt(f*f)', value = -20, typ = 'Constant', fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...(58),))))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[vector-Constant-f=(-20)-expr=(1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)', value = -20, typ = 'Constant'
fs_type = 'vector'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Sum(Sum(Division(FloatValue(1.0), IndexSum(Product(Indexed(Constant([-20.+0.j -20.+0.j], name='... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[tensor-Function-f=(1)-expr=(f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'f', value = 1, typ = 'Function', fs_type = 'tensor'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...ex(67),))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[tensor-Function-f=(1)-expr=(2*f)]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '2*f', value = 1, typ = 'Function', fs_type = 'tensor'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[tensor-Function-f=(1)-expr=(tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f)', value = 1, typ = 'Function', fs_type = 'tensor'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb...x(79),)))))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 63 in tests/firedrake/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matrix[False-linear]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
eq_type = 'linear', with_bbc = False
@pytest.mark.parametrize("eq_type", ["linear", "nonlinear"])
@pytest.mark.parametrize("with_bbc", [False, True])
def test_EquationBC_poisson_matrix(eq_type, with_bbc):
mat_type = "aij"
porder = 3
# Test standard poisson with EquationBCs
# aij
solver_parameters = {'mat_type': mat_type,
'ksp_type': 'preonly',
'pc_type': 'lu'}
err = []
mesh_sizes = [8, 16]
if with_bbc:
# test bcs for bcs
if eq_type == "linear":
for mesh_num in mesh_sizes:
err.append(linear_poisson_bbc(solver_parameters, mesh_num, porder))
elif eq_type == "nonlinear":
for mesh_num in mesh_sizes:
err.append(nonlinear_poisson_bbc(solver_parameters, mesh_num, porder))
else:
# test bcs for bcs
if eq_type == "linear":
for mesh_num in mesh_sizes:
> err.append(linear_poisson(solver_parameters, mesh_num, porder))
tests/firedrake/equation_bcs/test_equation_bcs.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/firedrake/equation_bcs/test_equation_bcs.py:63: in linear_poisson
solve(a == L, u_, bcs=[bc1], solver_parameters=solver_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
???
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(IntValue(-1), Conj(IndexSum(Product(Indexed(Grad(Argument(WithGeometry(FunctionSpace(<firedrake... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 53), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (<firedrake.bcs.EquationBCSplit object at 0x7fb501b44bf0>,), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False
bcs = (<firedrake.bcs.EquationBCSplit object at 0x7fb501b44bf0>,)
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError
Check failure on line 64 in tests/firedrake/regression/test_scaled_mass.py
github-actions / Firedrake complex
test_scaled_mass.test_math_functions[tensor-Function-f=(1)-expr=(2 * tanh(f))]
TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = '2 * tanh(f)', value = 1, typ = 'Function', fs_type = 'tensor'
@pytest.mark.parametrize('expr',
['f',
'2*f',
'tanh(f)',
'2 * tanh(f)',
'f + tanh(f)',
'cos(f) + sin(f)',
'cos(f)*cos(f) + sin(f)*sin(f)',
'tanh(f) + cos(f) + sin(f)',
'1.0/tanh(f) + 1.0/f',
'sqrt(f*f)',
'1.0/tanh(sqrt(f*f)) + 1.0/f + sqrt(f*f)'],
ids=lambda x: 'expr=(%s)' % x)
@pytest.mark.parametrize('value',
[1, 10, 20, -1, -10, -20],
ids=lambda x: 'f=(%d)' % x)
@pytest.mark.parametrize('typ',
['Function', 'Constant'])
@pytest.mark.parametrize('fs_type',
['scalar', 'vector', 'tensor'])
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'Function':
if fs_type == 'vector':
V = VectorFunctionSpace(mesh, 'CG', 1)
elif fs_type == 'tensor':
V = TensorFunctionSpace(mesh, 'CG', 1)
else:
V = FunctionSpace(mesh, 'CG', 1)
f = Function(V)
f.assign(value)
if fs_type == 'vector':
f = dot(f, f)
elif fs_type == 'tensor':
f = inner(f, f)
elif typ == 'Constant':
if fs_type == 'vector':
f = Constant([value, value])
f = dot(f, f)
elif fs_type == 'tensor':
f = Constant([[value, value], [value, value]])
f = inner(f, f)
else:
f = Constant(value)
H = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(H)
v = TestFunction(H)
C = eval(expr)
a = (C)*inner(u, v) * dx
L = (C)*conj(v) * dx
actual = Function(H)
> solve(a == L, actual)
tests/firedrake/regression/test_scaled_mass.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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:172: in _solve_varproblem
solver = vs.LinearVariationalSolver(problem, solver_parameters=solver_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
???
/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:228: in __init__
ctx = solving_utils._SNESContext(problem,
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:222: in __init__
self._assemble_residual = get_assembler(self.F, bcs=self.bcs_F,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
form = Form([Integral(Product(Product(Coefficient(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7fcf6eb... 0, None)))), 'cell', Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), 'everywhere', {}, None)])
args = ()
kwargs = {'bcs': (), 'form_compiler_parameters': {'scalar_type': dtype('complex128')}}
is_base_form_preprocessed = False, bcs = ()
fc_params = {'scalar_type': dtype('complex128')}, mat_type = None
diagonal = False
def get_assembler(form, *args, **kwargs):
"""Create an assembler.
Notes
-----
See `assemble` for descriptions of the parameters. ``tensor`` should not be passed to this function.
"""
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
bcs = kwargs.get('bcs', None)
fc_params = kwargs.get('form_compiler_parameters', None)
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
mat_type = kwargs.get('mat_type', None)
# Preprocess the DAG and restructure the DAG
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)
if isinstance(form, (ufl.form.Form, slate.TensorBase)) and not BaseFormAssembler.base_form_operands(form):
diagonal = kwargs.pop('diagonal', False)
if len(form.arguments()) == 0:
return ZeroFormAssembler(form, form_compiler_parameters=fc_params)
elif len(form.arguments()) == 1 or diagonal:
> return OneFormAssembler(form, *args, bcs=bcs, form_compiler_parameters=fc_params,
E TypeError: firedrake.assemble.OneFormAssembler() got multiple values for keyword argument 'bcs'
firedrake/assemble.py:158: TypeError