Ksagiyam/submesh core #6596
8203 tests run, 3065 passed, 1317 skipped, 3821 failed.
Annotations
Check failure on line 82 in tests/regression/test_zero_forms.py
github-actions / Firedrake complex
test_zero_forms.test_math_functions[True-sqrt(f*f)--10-constant-tensor]
AttributeError: 'TensorElement' object has no attribute 'value_size'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38)
expr = 'sqrt(f*f)', value = -10, typ = 'constant', fs_type = 'tensor'
@pytest.mark.parametrize(['expr', 'value', 'typ', 'fs_type'],
itertools.product(['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)'],
[1, 10, 20, -1, -10, -20],
['function', 'constant'],
['scalar', 'vector', 'tensor']))
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'function':
family, degree = 'CG', 1
elif typ == 'constant':
family, degree = 'Real', 0
if fs_type == "vector":
V = VectorFunctionSpace(mesh, family, degree)
elif fs_type == "tensor":
V = TensorFunctionSpace(mesh, family, degree)
else:
V = FunctionSpace(mesh, family, degree)
f = Function(V)
f.assign(value)
if fs_type == "vector":
f = dot(f, f)
elif fs_type == "tensor":
f = inner(f, f)
> actual = assemble(eval(expr)*dx)
tests/regression/test_zero_forms.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:982: in assemble
self.execute_parloops(tensor)
firedrake/assemble.py:1003: in execute_parloops
for parloop in self.parloops(tensor):
firedrake/assemble.py:1015: in parloops
for local_kernel, subdomain_id in self.local_kernels:
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/tsfc_interface.py:232: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:97: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:77: in compile_form
kernel = compile_integral(integral_data, form_data, prefix, parameters, diagonal=diagonal, log=log)
../firedrake_venv/src/tsfc/tsfc/driver.py:138: in compile_integral
builder.set_coefficients()
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:383: in set_coefficients
self._coefficient(coeff, f"w_{k}")
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:95: in _coefficient
expr = prepare_coefficient(coefficient, name, self._domain_integral_type_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coefficient = Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38), TensorElement(FiniteElement('Real', quadrilateral, 0), shape=(2, 2), symmetry={})), 0)
name = 'w_0'
domain_integral_type_map = {Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38): 'cell'}
def prepare_coefficient(coefficient, name, domain_integral_type_map):
"""Bridges the kernel interface and the GEM abstraction for
Coefficients.
Parameters
----------
coefficient : ufl.Coefficient
UFL Coefficient.
name : str
Unique name to refer to the Coefficient in the kernel.
domain_integral_type_map : dict
Map from domain to integral_type.
Returns
-------
gem.Node
GEM expression referring to the Coefficient values.
"""
if coefficient.ufl_element().family() == 'Real':
# Constant
> value_size = coefficient.ufl_element().value_size
E AttributeError: 'TensorElement' object has no attribute 'value_size'
../firedrake_venv/src/tsfc/tsfc/kernel_interface/common.py:485: AttributeError
Check failure on line 16 in tests/equation_bcs/test_bcs_reconstruct.py
github-actions / Firedrake complex
test_bcs_reconstruct.test_bc_on_sub_sub_domain
AttributeError: 'VectorElement' object has no attribute 'value_shape'
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)]))
tests/equation_bcs/test_bcs_reconstruct.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = ListTensor(Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.1415926535897...lCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)), MultiIndex((FixedIndex(1),))))))))
element = VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'VectorElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-0-coords-FunctionSpace(RTCE2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 41)
vertexcoords = array([], shape=(0, 2), dtype=float64)
vfs = ('RTCE', 2, <cyfunction FunctionSpace at 0x7f3f2ff9f370>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_0', count=0)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 41)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 51 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matrix[False-linear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
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/equation_bcs/test_equation_bcs.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:51: in linear_poisson
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2) * cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 42)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 42)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 22 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matrix[False-nonlinear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
eq_type = 'nonlinear', 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))
elif eq_type == "nonlinear":
for mesh_num in mesh_sizes:
> err.append(nonlinear_poisson(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:229:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:22: in nonlinear_poisson
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2) * cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 46)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 46)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-0-coords-FunctionSpace(RTCF2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 44)
vertexcoords = array([], shape=(0, 2), dtype=float64)
vfs = ('RTCF', 2, <cyfunction FunctionSpace at 0x7f3f2ff9f370>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_3', count=3)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 44)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 109 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matrix[True-linear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
eq_type = 'linear', with_bbc = True
@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))
tests/equation_bcs/test_equation_bcs.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:109: in linear_poisson_bbc
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2)*cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 51)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 51)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 80 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matrix[True-nonlinear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
eq_type = 'nonlinear', with_bbc = True
@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))
tests/equation_bcs/test_equation_bcs.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:80: in nonlinear_poisson_bbc
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2)*cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 55)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 55)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-1-coords-VectorFunctionSpace(CG2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 47)
vertexcoords = array([[0.59762701, 0.93037873]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f3f2ff9f510>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_6', count=6)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 47)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 51 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matfree[False]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
with_bbc = False
@pytest.mark.parametrize("with_bbc", [False, True])
def test_EquationBC_poisson_matfree(with_bbc):
eq_type = "linear"
mat_type = "matfree"
porder = 3
# Test standard poisson with EquationBCs
# matfree
solver_parameters = {'mat_type': mat_type,
'ksp_type': 'gmres',
'pc_type': 'none',
'ksp_atol': 1e-10,
'ksp_rtol': 1e-10,
'ksp_max_it': 200000,
'ksp_divtol': 1e8}
err = []
mesh_sizes = [8, 16]
if with_bbc:
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:
if eq_type == "linear":
for mesh_num in mesh_sizes:
> err.append(linear_poisson(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:261:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:51: in linear_poisson
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2) * cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 60)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 60)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-1-coords-FunctionSpace(RTCE2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 54)
vertexcoords = array([[0.59762701, 0.93037873]])
vfs = ('RTCE', 2, <cyfunction FunctionSpace at 0x7f3f2ff9f370>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_9', count=9)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 54)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 109 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_poisson_matfree[True]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
with_bbc = True
@pytest.mark.parametrize("with_bbc", [False, True])
def test_EquationBC_poisson_matfree(with_bbc):
eq_type = "linear"
mat_type = "matfree"
porder = 3
# Test standard poisson with EquationBCs
# matfree
solver_parameters = {'mat_type': mat_type,
'ksp_type': 'gmres',
'pc_type': 'none',
'ksp_atol': 1e-10,
'ksp_rtol': 1e-10,
'ksp_max_it': 200000,
'ksp_divtol': 1e8}
err = []
mesh_sizes = [8, 16]
if with_bbc:
if eq_type == "linear":
for mesh_num in mesh_sizes:
> err.append(linear_poisson_bbc(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:109: in linear_poisson_bbc
f.interpolate(- 8.0 * pi * pi * cos(x * pi * 2)*cos(y * pi * 2))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Product(IntValue(2), Product(FloatValue(3.141592653589793), Indexe...alCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 64)), MultiIndex((FixedIndex(1),)))))))
element = FiniteElement('Lagrange', triangle, 3)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 64)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-1-coords-FunctionSpace(RTCF2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 57)
vertexcoords = array([[0.59762701, 0.93037873]])
vfs = ('RTCF', 2, <cyfunction FunctionSpace at 0x7f3f2ff9f370>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_12', count=12)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 57)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 82 in tests/regression/test_zero_forms.py
github-actions / Firedrake complex
test_zero_forms.test_math_functions[False-tanh(f)-1-constant-scalar]
AttributeError: 'FiniteElement' object has no attribute 'value_size'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f)', value = 1, typ = 'constant', fs_type = 'scalar'
@pytest.mark.parametrize(['expr', 'value', 'typ', 'fs_type'],
itertools.product(['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)'],
[1, 10, 20, -1, -10, -20],
['function', 'constant'],
['scalar', 'vector', 'tensor']))
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'function':
family, degree = 'CG', 1
elif typ == 'constant':
family, degree = 'Real', 0
if fs_type == "vector":
V = VectorFunctionSpace(mesh, family, degree)
elif fs_type == "tensor":
V = TensorFunctionSpace(mesh, family, degree)
else:
V = FunctionSpace(mesh, family, degree)
f = Function(V)
f.assign(value)
if fs_type == "vector":
f = dot(f, f)
elif fs_type == "tensor":
f = inner(f, f)
> actual = assemble(eval(expr)*dx)
tests/regression/test_zero_forms.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:982: in assemble
self.execute_parloops(tensor)
firedrake/assemble.py:1003: in execute_parloops
for parloop in self.parloops(tensor):
firedrake/assemble.py:1015: in parloops
for local_kernel, subdomain_id in self.local_kernels:
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/tsfc_interface.py:232: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:97: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:77: in compile_form
kernel = compile_integral(integral_data, form_data, prefix, parameters, diagonal=diagonal, log=log)
../firedrake_venv/src/tsfc/tsfc/driver.py:138: in compile_integral
builder.set_coefficients()
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:383: in set_coefficients
self._coefficient(coeff, f"w_{k}")
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:95: in _coefficient
expr = prepare_coefficient(coefficient, name, self._domain_integral_type_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coefficient = Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), FiniteElement('Real', triangle, 0)), 0)
name = 'w_0'
domain_integral_type_map = {Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38): 'cell'}
def prepare_coefficient(coefficient, name, domain_integral_type_map):
"""Bridges the kernel interface and the GEM abstraction for
Coefficients.
Parameters
----------
coefficient : ufl.Coefficient
UFL Coefficient.
name : str
Unique name to refer to the Coefficient in the kernel.
domain_integral_type_map : dict
Map from domain to integral_type.
Returns
-------
gem.Node
GEM expression referring to the Coefficient values.
"""
if coefficient.ufl_element().family() == 'Real':
# Constant
> value_size = coefficient.ufl_element().value_size
E AttributeError: 'FiniteElement' object has no attribute 'value_size'
../firedrake_venv/src/tsfc/tsfc/kernel_interface/common.py:485: AttributeError
Check failure on line 56 in tests/regression/test_assemble_baseform.py
github-actions / Firedrake complex
test_assemble_baseform.test_zero_form[tcg1]
failed on setup with "AttributeError: 'TensorElement' object has no attribute 'value_shape'"
Raw output
fs = WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f5a61d37ad0>, TensorElement(FiniteElement('Lagran...le, 1), shape=(2, 2), symmetry={}), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38))
@pytest.fixture
def f(fs):
f = Function(fs, name="f")
f_split = f.subfunctions
x = SpatialCoordinate(fs.mesh())[0]
# NOTE: interpolation of UFL expressions into mixed
# function spaces is not yet implemented
for fi in f_split:
fs_i = fi.function_space()
if fs_i.rank == 1:
fi.interpolate(as_vector((x,) * fs_i.value_size))
elif fs_i.rank == 2:
> fi.interpolate(as_tensor([[x for i in range(fs_i.mesh().geometric_dimension())]
for j in range(fs_i.rank)]))
tests/regression/test_assemble_baseform.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = ListTensor(ListTensor(Indexed(SpatialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)...tialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)), MultiIndex((FixedIndex(0),)))))
element = TensorElement(FiniteElement('Lagrange', triangle, 1), shape=(2, 2), symmetry={})
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'TensorElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 176 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_mixedpoisson_matrix[linear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
eq_type = 'linear'
@pytest.mark.skipmumps
@pytest.mark.parametrize("eq_type", ["linear", "nonlinear"])
def test_EquationBC_mixedpoisson_matrix(eq_type):
mat_type = "aij"
porder = 2
# Mixed poisson with EquationBCs
# aij
solver_parameters = {"mat_type": mat_type,
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_mat_solver_type": DEFAULT_DIRECT_SOLVER}
err = []
mesh_sizes = [16, 32]
if eq_type == "linear":
for i, mesh_num in enumerate(mesh_sizes):
> err.append(linear_poisson_mixed(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:286:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:176: in linear_poisson_mixed
f = Function(DG).interpolate(-8 * pi * pi * cos(2 * pi * x + pi / 3) * cos(2 * pi * y))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Sum(FloatValue(1.0471975511965976), Product(FloatValue(6.283185307...ialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 68)), MultiIndex((FixedIndex(1),))))))
element = FiniteElement('Discontinuous Lagrange', triangle, 2)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 68)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 82 in tests/regression/test_zero_forms.py
github-actions / Firedrake complex
test_zero_forms.test_math_functions[False-tanh(f)-1-constant-vector]
AttributeError: 'VectorElement' object has no attribute 'value_size'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f)', value = 1, typ = 'constant', fs_type = 'vector'
@pytest.mark.parametrize(['expr', 'value', 'typ', 'fs_type'],
itertools.product(['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)'],
[1, 10, 20, -1, -10, -20],
['function', 'constant'],
['scalar', 'vector', 'tensor']))
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'function':
family, degree = 'CG', 1
elif typ == 'constant':
family, degree = 'Real', 0
if fs_type == "vector":
V = VectorFunctionSpace(mesh, family, degree)
elif fs_type == "tensor":
V = TensorFunctionSpace(mesh, family, degree)
else:
V = FunctionSpace(mesh, family, degree)
f = Function(V)
f.assign(value)
if fs_type == "vector":
f = dot(f, f)
elif fs_type == "tensor":
f = inner(f, f)
> actual = assemble(eval(expr)*dx)
tests/regression/test_zero_forms.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:982: in assemble
self.execute_parloops(tensor)
firedrake/assemble.py:1003: in execute_parloops
for parloop in self.parloops(tensor):
firedrake/assemble.py:1015: in parloops
for local_kernel, subdomain_id in self.local_kernels:
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/tsfc_interface.py:232: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:97: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:77: in compile_form
kernel = compile_integral(integral_data, form_data, prefix, parameters, diagonal=diagonal, log=log)
../firedrake_venv/src/tsfc/tsfc/driver.py:138: in compile_integral
builder.set_coefficients()
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:383: in set_coefficients
self._coefficient(coeff, f"w_{k}")
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:95: in _coefficient
expr = prepare_coefficient(coefficient, name, self._domain_integral_type_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coefficient = Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), VectorElement(FiniteElement('Real', triangle, 0), dim=2)), 0)
name = 'w_0'
domain_integral_type_map = {Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38): 'cell'}
def prepare_coefficient(coefficient, name, domain_integral_type_map):
"""Bridges the kernel interface and the GEM abstraction for
Coefficients.
Parameters
----------
coefficient : ufl.Coefficient
UFL Coefficient.
name : str
Unique name to refer to the Coefficient in the kernel.
domain_integral_type_map : dict
Map from domain to integral_type.
Returns
-------
gem.Node
GEM expression referring to the Coefficient values.
"""
if coefficient.ufl_element().family() == 'Real':
# Constant
> value_size = coefficient.ufl_element().value_size
E AttributeError: 'VectorElement' object has no attribute 'value_size'
../firedrake_venv/src/tsfc/tsfc/kernel_interface/common.py:485: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-100-coords-VectorFunctionSpace(CG2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 60)
vertexcoords = array([[ 0.59762701, 0.93037873],
[ 0.70552675, 0.58976637],
[ 0.3473096 , 0.79178823],
[ 0.37... 1.38874478],
[ 0.97910159, 0.48091762],
[-0.04517074, 0.00871296],
[-0.38394168, 0.36883325]])
vfs = ('CG', 2, <cyfunction VectorFunctionSpace at 0x7f3f2ff9f510>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_15', count=15)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 60)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 56 in tests/regression/test_assemble_baseform.py
github-actions / Firedrake complex
test_assemble_baseform.test_preprocess_form[tcg1]
failed on setup with "AttributeError: 'TensorElement' object has no attribute 'value_shape'"
Raw output
fs = WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f5a61d37ad0>, TensorElement(FiniteElement('Lagran...le, 1), shape=(2, 2), symmetry={}), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38))
@pytest.fixture
def f(fs):
f = Function(fs, name="f")
f_split = f.subfunctions
x = SpatialCoordinate(fs.mesh())[0]
# NOTE: interpolation of UFL expressions into mixed
# function spaces is not yet implemented
for fi in f_split:
fs_i = fi.function_space()
if fs_i.rank == 1:
fi.interpolate(as_vector((x,) * fs_i.value_size))
elif fs_i.rank == 2:
> fi.interpolate(as_tensor([[x for i in range(fs_i.mesh().geometric_dimension())]
for j in range(fs_i.rank)]))
tests/regression/test_assemble_baseform.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = ListTensor(ListTensor(Indexed(SpatialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)...tialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)), MultiIndex((FixedIndex(0),)))))
element = TensorElement(FiniteElement('Lagrange', triangle, 1), shape=(2, 2), symmetry={})
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'TensorElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 82 in tests/regression/test_zero_forms.py
github-actions / Firedrake complex
test_zero_forms.test_math_functions[False-tanh(f)-1-constant-tensor]
AttributeError: 'TensorElement' object has no attribute 'value_size'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
expr = 'tanh(f)', value = 1, typ = 'constant', fs_type = 'tensor'
@pytest.mark.parametrize(['expr', 'value', 'typ', 'fs_type'],
itertools.product(['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)'],
[1, 10, 20, -1, -10, -20],
['function', 'constant'],
['scalar', 'vector', 'tensor']))
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'function':
family, degree = 'CG', 1
elif typ == 'constant':
family, degree = 'Real', 0
if fs_type == "vector":
V = VectorFunctionSpace(mesh, family, degree)
elif fs_type == "tensor":
V = TensorFunctionSpace(mesh, family, degree)
else:
V = FunctionSpace(mesh, family, degree)
f = Function(V)
f.assign(value)
if fs_type == "vector":
f = dot(f, f)
elif fs_type == "tensor":
f = inner(f, f)
> actual = assemble(eval(expr)*dx)
tests/regression/test_zero_forms.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:982: in assemble
self.execute_parloops(tensor)
firedrake/assemble.py:1003: in execute_parloops
for parloop in self.parloops(tensor):
firedrake/assemble.py:1015: in parloops
for local_kernel, subdomain_id in self.local_kernels:
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/tsfc_interface.py:232: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:97: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:77: in compile_form
kernel = compile_integral(integral_data, form_data, prefix, parameters, diagonal=diagonal, log=log)
../firedrake_venv/src/tsfc/tsfc/driver.py:138: in compile_integral
builder.set_coefficients()
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:383: in set_coefficients
self._coefficient(coeff, f"w_{k}")
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:95: in _coefficient
expr = prepare_coefficient(coefficient, name, self._domain_integral_type_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coefficient = Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38), TensorElement(FiniteElement('Real', triangle, 0), shape=(2, 2), symmetry={})), 0)
name = 'w_0'
domain_integral_type_map = {Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38): 'cell'}
def prepare_coefficient(coefficient, name, domain_integral_type_map):
"""Bridges the kernel interface and the GEM abstraction for
Coefficients.
Parameters
----------
coefficient : ufl.Coefficient
UFL Coefficient.
name : str
Unique name to refer to the Coefficient in the kernel.
domain_integral_type_map : dict
Map from domain to integral_type.
Returns
-------
gem.Node
GEM expression referring to the Coefficient values.
"""
if coefficient.ufl_element().family() == 'Real':
# Constant
> value_size = coefficient.ufl_element().value_size
E AttributeError: 'TensorElement' object has no attribute 'value_size'
../firedrake_venv/src/tsfc/tsfc/kernel_interface/common.py:485: AttributeError
Check failure on line 144 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_mixedpoisson_matrix[nonlinear]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
eq_type = 'nonlinear'
@pytest.mark.skipmumps
@pytest.mark.parametrize("eq_type", ["linear", "nonlinear"])
def test_EquationBC_mixedpoisson_matrix(eq_type):
mat_type = "aij"
porder = 2
# Mixed poisson with EquationBCs
# aij
solver_parameters = {"mat_type": mat_type,
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_mat_solver_type": DEFAULT_DIRECT_SOLVER}
err = []
mesh_sizes = [16, 32]
if eq_type == "linear":
for i, mesh_num in enumerate(mesh_sizes):
err.append(linear_poisson_mixed(solver_parameters, mesh_num, porder))
elif eq_type == "nonlinear":
for i, mesh_num in enumerate(mesh_sizes):
> err.append(nonlinear_poisson_mixed(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:289:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:144: in nonlinear_poisson_mixed
f = Function(DG).interpolate(-8 * pi * pi * cos(2 * pi * x + pi / 3) * cos(2 * pi * y))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Sum(FloatValue(1.0471975511965976), Product(FloatValue(6.283185307...ialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 72)), MultiIndex((FixedIndex(1),))))))
element = FiniteElement('Discontinuous Lagrange', triangle, 2)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 72)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 218 in tests/vertexonly/test_interpolation_from_parent.py
github-actions / Firedrake complex
test_interpolation_from_parent.test_vector_function_interpolation[squarequads-mesh-100-coords-FunctionSpace(RTCE2)]
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
parentmesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 67)
vertexcoords = array([[ 0.59762701, 0.93037873],
[ 0.70552675, 0.58976637],
[ 0.3473096 , 0.79178823],
[ 0.37... 1.38874478],
[ 0.97910159, 0.48091762],
[-0.04517074, 0.00871296],
[-0.38394168, 0.36883325]])
vfs = ('RTCE', 2, <cyfunction FunctionSpace at 0x7f3f2ff9f370>)
def test_vector_function_interpolation(parentmesh, vertexcoords, vfs):
if parentmesh.name == "immersedsphere":
vertexcoords = immersed_sphere_vertexcoords(parentmesh, vertexcoords)
vfs_fam, vfs_deg, vfs_typ = vfs
> vm = VertexOnlyMesh(parentmesh, vertexcoords, missing_points_behaviour=None)
tests/vertexonly/test_interpolation_from_parent.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/mesh.py:3376: in VertexOnlyMesh
swarm, input_ordering_swarm, n_missing_points = _pic_swarm_in_mesh(
firedrake/mesh.py:3597: in _pic_swarm_in_mesh
) = _parent_mesh_embedding(
firedrake/mesh.py:4153: in _parent_mesh_embedding
visible_ranks = assemble(visible_ranks).dat.data_ro_with_halos.real
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Constant([0.+0.j], name='constant_18', count=18)
element = FiniteElement('DQ', quadrilateral, 0)
domain = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 67)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 176 in tests/equation_bcs/test_equation_bcs.py
github-actions / Firedrake complex
test_equation_bcs.test_EquationBC_mixedpoisson_matrix_fieldsplit
AttributeError: 'FiniteElement' object has no attribute 'value_shape'
Raw output
def test_EquationBC_mixedpoisson_matrix_fieldsplit():
mat_type = "aij"
eq_type = "linear"
porder = 2
# Mixed poisson with EquationBCs
# aij with fieldsplit pc
solver_parameters = {"mat_type": mat_type,
"ksp_type": "fgmres",
"ksp_rtol": 1.e-8,
"ksp_max_it": 200,
"pc_type": "fieldsplit",
"pc_fieldsplit_type": "schur",
"pc_fieldsplit_schur_fact_type": "full",
"fieldsplit_0_ksp_type": "preonly",
"fieldsplit_0_pc_type": "lu",
"fieldsplit_1_ksp_type": "cg",
"fieldsplit_1_pc_type": "none"}
err = []
mesh_sizes = [16, 32]
if eq_type == "linear":
for i, mesh_num in enumerate(mesh_sizes):
> err.append(linear_poisson_mixed(solver_parameters, mesh_num, porder))
tests/equation_bcs/test_equation_bcs.py:316:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/equation_bcs/test_equation_bcs.py:176: in linear_poisson_mixed
f = Function(DG).interpolate(-8 * pi * pi * cos(2 * pi * x + pi / 3) * cos(2 * pi * y))
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = Product(Product(FloatValue(-78.95683520871486), Cos(Sum(FloatValue(1.0471975511965976), Product(FloatValue(6.283185307...ialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 77)), MultiIndex((FixedIndex(1),))))))
element = FiniteElement('Discontinuous Lagrange', triangle, 2)
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 77)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'FiniteElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 56 in tests/regression/test_assemble_baseform.py
github-actions / Firedrake complex
test_assemble_baseform.test_tensor_copy[tcg1]
failed on setup with "AttributeError: 'TensorElement' object has no attribute 'value_shape'"
Raw output
fs = WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f5a61d37ad0>, TensorElement(FiniteElement('Lagran...le, 1), shape=(2, 2), symmetry={}), name=None), Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38))
@pytest.fixture
def f(fs):
f = Function(fs, name="f")
f_split = f.subfunctions
x = SpatialCoordinate(fs.mesh())[0]
# NOTE: interpolation of UFL expressions into mixed
# function spaces is not yet implemented
for fi in f_split:
fs_i = fi.function_space()
if fs_i.rank == 1:
fi.interpolate(as_vector((x,) * fs_i.value_size))
elif fs_i.rank == 2:
> fi.interpolate(as_tensor([[x for i in range(fs_i.mesh().geometric_dimension())]
for j in range(fs_i.rank)]))
tests/regression/test_assemble_baseform.py:56:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/function.py:413: in interpolate
return assemble(interp, tensor=self, ad_block_tag=ad_block_tag)
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:382: in assemble
result = BaseFormAssembler.base_form_postorder_traversal(self._form, visitor, visited)
firedrake/assemble.py:604: in base_form_postorder_traversal
visited[e] = visitor(e, *(visited[arg] for arg in operands))
firedrake/assemble.py:378: in visitor
return self.base_form_assembly_visitor(e, t, *operands)
firedrake/assemble.py:538: in base_form_assembly_visitor
interpolator = firedrake.Interpolator(expression, expr.function_space(), **interp_data)
../firedrake_venv/src/pyadjoint/pyadjoint/tape.py:110: in wrapper
return function(*args, **kwargs)
firedrake/interpolation.py:819: in __init__
self.callable, arguments = make_interpolator(expr, V, subset, access, bcs=bcs)
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/interpolation.py:998: in make_interpolator
loops.extend(_interpolator(V, tensor, expr, subset, arguments, access, bcs=bcs))
<decorator-gen-31>:2: in _interpolator
???
firedrake/utils.py:89: in wrapper
return f(*args, **kwargs)
firedrake/interpolation.py:1073: in _interpolator
kernel = compile_expression(cell_set.comm, expr, to_element, V.ufl_element(),
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_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/interpolation.py:1215: in compile_expression
return compile_expression_dual_evaluation(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:199: in compile_expression_dual_evaluation
expression = apply_mapping(expression, ufl_element, domain)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expression = ListTensor(ListTensor(Indexed(SpatialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)...tialCoordinate(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)), MultiIndex((FixedIndex(0),)))))
element = TensorElement(FiniteElement('Lagrange', triangle, 1), shape=(2, 2), symmetry={})
domain = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 38)
def apply_mapping(expression, element, domain):
"""Apply the inverse of the pullback for element to an expression.
:arg expression: An expression in physical space
:arg element: The element we're going to interpolate into, whose
value_shape must match the shape of the expression, and will
advertise the pullback to apply.
:arg domain: Optional domain to provide in case expression does
not contain a domain (used for constructing geometric quantities).
:returns: A new UFL expression with shape element.reference_value_shape
:raises NotImplementedError: If we don't know how to apply the
inverse of the pullback.
:raises ValueError: If we get shape mismatches.
The following is borrowed from the UFC documentation:
Let g be a field defined on a physical domain T with physical
coordinates x. Let T_0 be a reference domain with coordinates
X. Assume that F: T_0 -> T such that
x = F(X)
Let J be the Jacobian of F, i.e J = dx/dX and let K denote the
inverse of the Jacobian K = J^{-1}. Then we (currently) have the
following four types of mappings:
'identity' mapping for g:
G(X) = g(x)
For vector fields g:
'contravariant piola' mapping for g:
G(X) = det(J) K g(x) i.e G_i(X) = det(J) K_ij g_j(x)
'covariant piola' mapping for g:
G(X) = J^T g(x) i.e G_i(X) = J^T_ij g(x) = J_ji g_j(x)
'double covariant piola' mapping for g:
G(X) = J^T g(x) J i.e. G_il(X) = J_ji g_jk(x) J_kl
'double contravariant piola' mapping for g:
G(X) = det(J)^2 K g(x) K^T i.e. G_il(X)=(detJ)^2 K_ij g_jk K_lk
If 'contravariant piola' or 'covariant piola' (or their double
variants) are applied to a matrix-valued function, the appropriate
mappings are applied row-by-row.
"""
mesh = extract_unique_domain(expression)
if mesh is None:
mesh = domain
if domain is not None and mesh != domain:
raise NotImplementedError("Multiple domains not supported")
> if expression.ufl_shape != element.value_shape:
E AttributeError: 'TensorElement' object has no attribute 'value_shape'
../firedrake_venv/src/tsfc/tsfc/ufl_utils.py:428: AttributeError
Check failure on line 82 in tests/regression/test_zero_forms.py
github-actions / Firedrake complex
test_zero_forms.test_math_functions[True-sqrt(f*f)--20-constant-scalar]
AttributeError: 'FiniteElement' object has no attribute 'value_size'
Raw output
mesh = Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38)
expr = 'sqrt(f*f)', value = -20, typ = 'constant', fs_type = 'scalar'
@pytest.mark.parametrize(['expr', 'value', 'typ', 'fs_type'],
itertools.product(['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)'],
[1, 10, 20, -1, -10, -20],
['function', 'constant'],
['scalar', 'vector', 'tensor']))
def test_math_functions(mesh, expr, value, typ, fs_type):
if typ == 'function':
family, degree = 'CG', 1
elif typ == 'constant':
family, degree = 'Real', 0
if fs_type == "vector":
V = VectorFunctionSpace(mesh, family, degree)
elif fs_type == "tensor":
V = TensorFunctionSpace(mesh, family, degree)
else:
V = FunctionSpace(mesh, family, degree)
f = Function(V)
f.assign(value)
if fs_type == "vector":
f = dot(f, f)
elif fs_type == "tensor":
f = inner(f, f)
> actual = assemble(eval(expr)*dx)
tests/regression/test_zero_forms.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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/assembly.py:30: in wrapper
output = assemble(form, *args, **kwargs)
firedrake/assemble.py:134: in assemble
return get_assembler(expr, *args, **kwargs).assemble(tensor=tensor)
firedrake/assemble.py:982: in assemble
self.execute_parloops(tensor)
firedrake/assemble.py:1003: in execute_parloops
for parloop in self.parloops(tensor):
firedrake/assemble.py:1015: in parloops
for local_kernel, subdomain_id in self.local_kernels:
/usr/lib/python3.12/functools.py:995: in __get__
val = self.func(instance)
firedrake/assemble.py:1054: in local_kernels
kernels = tsfc_interface.compile_form(
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
firedrake/tsfc_interface.py:232: in compile_form
tsfc_kernel = TSFCKernel(
firedrake/tsfc_interface.py:97: in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
petsc4py/PETSc/Log.pyx:188: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
petsc4py/PETSc/Log.pyx:189: in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
???
../firedrake_venv/src/PyOP2/pyop2/caching.py:550: in wrapper
value = func(*args, **kwargs)
../firedrake_venv/src/tsfc/tsfc/driver.py:77: in compile_form
kernel = compile_integral(integral_data, form_data, prefix, parameters, diagonal=diagonal, log=log)
../firedrake_venv/src/tsfc/tsfc/driver.py:138: in compile_integral
builder.set_coefficients()
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:383: in set_coefficients
self._coefficient(coeff, f"w_{k}")
../firedrake_venv/src/tsfc/tsfc/kernel_interface/firedrake_loopy.py:95: in _coefficient
expr = prepare_coefficient(coefficient, name, self._domain_integral_type_map)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coefficient = Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38), FiniteElement('Real', quadrilateral, 0)), 0)
name = 'w_0'
domain_integral_type_map = {Mesh(VectorElement(FiniteElement('Q', quadrilateral, 1), dim=2), 38): 'cell'}
def prepare_coefficient(coefficient, name, domain_integral_type_map):
"""Bridges the kernel interface and the GEM abstraction for
Coefficients.
Parameters
----------
coefficient : ufl.Coefficient
UFL Coefficient.
name : str
Unique name to refer to the Coefficient in the kernel.
domain_integral_type_map : dict
Map from domain to integral_type.
Returns
-------
gem.Node
GEM expression referring to the Coefficient values.
"""
if coefficient.ufl_element().family() == 'Real':
# Constant
> value_size = coefficient.ufl_element().value_size
E AttributeError: 'FiniteElement' object has no attribute 'value_size'
../firedrake_venv/src/tsfc/tsfc/kernel_interface/common.py:485: AttributeError