Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CellVolume for Expressions on non-simplex geometries #550

Open
jorgensd opened this issue Jan 2, 2023 · 0 comments
Open

Support CellVolume for Expressions on non-simplex geometries #550

jorgensd opened this issue Jan 2, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jorgensd
Copy link
Sponsor Member

jorgensd commented Jan 2, 2023

MWE.

import ufl
import numpy as np

cmap = ufl.VectorElement("Lagrange", ufl.quadrilateral, 1)
mesh = ufl.Mesh(cmap)
el = ufl.FiniteElement("Lagrange", mesh.ufl_cell(), 1)

elmVol_ufl = ufl.CellVolume(mesh)
expressions = [(elmVol_ufl, np.array([[0.5, 0.5]]))]

returns

WARNING:py.warnings:/root/shared/ufl/ufl/algorithms/apply_geometry_lowering.py:193: UserWarning: Only know how to compute the cell volume of an affine cell.
  warnings.warn("Only know how to compute the cell volume of an affine cell.")

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/shared/ffcx/ffcx/__main__.py", line 12, in <module>
    sys.exit(main())
  File "/root/shared/ffcx/ffcx/main.py", line 67, in main
    code_h, code_c = compiler.compile_ufl_objects(
  File "/root/shared/ffcx/ffcx/compiler.py", line 107, in compile_ufl_objects
    code = generate_code(ir, options)
  File "/root/shared/ffcx/ffcx/codegeneration/codegeneration.py", line 52, in generate_code
    code_expressions = [expression_generator(expression_ir, options) for expression_ir in ir.expressions]
  File "/root/shared/ffcx/ffcx/codegeneration/codegeneration.py", line 52, in <listcomp>
    code_expressions = [expression_generator(expression_ir, options) for expression_ir in ir.expressions]
  File "/root/shared/ffcx/ffcx/codegeneration/expressions.py", line 43, in generator
    parts = eg.generate()
  File "/root/shared/ffcx/ffcx/codegeneration/expressions.py", line 159, in generate
    parts += self.generate_piecewise_partition()
  File "/root/shared/ffcx/ffcx/codegeneration/expressions.py", line 273, in generate_piecewise_partition
    parts = self.generate_partition(arraysymbol, F, "piecewise")
  File "/root/shared/ffcx/ffcx/codegeneration/expressions.py", line 460, in generate_partition
    vaccess = self.backend.access.get(mt.terminal, mt, tabledata, 0)
  File "/root/shared/ffcx/ffcx/codegeneration/access.py", line 64, in get
    raise RuntimeError(f"Not handled: {type(e)}")
RuntimeError: Not handled: <class 'ufl.geometry.CellVolume'>

related to FEniCS/ufl#140 and vaguely to: #501

@jorgensd jorgensd added bug Something isn't working enhancement New feature or request labels Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant