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

Error when using project in mantle convection demo #240

Closed
ddundo opened this issue Nov 25, 2024 · 1 comment · Fixed by #258
Closed

Error when using project in mantle convection demo #240

ddundo opened this issue Nov 25, 2024 · 1 comment · Fixed by #258
Assignees
Labels
bug Something isn't working

Comments

@ddundo
Copy link
Member

ddundo commented Nov 25, 2024

Using transfer_method="project" (default) in the mantle convection demo raises an error:

Traceback (most recent call last):
  File "/home/firedrake/firedrake/src/goalie/demos/mantle_convection.py", line 185, in <module>
    solutions = mesh_seq.solve_forward()
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/goalie/goalie/mesh_seq.py", line 574, in solve_forward
    next(solver_gen)
  File "/home/firedrake/firedrake/src/goalie/goalie/mesh_seq.py", line 512, in _solve_forward
    field: self._transfer(
           ^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/goalie/goalie/mesh_seq.py", line 313, in _transfer
    return transfer(source, target_space, self._transfer_method, **transfer_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/animate/animate/interpolation.py", line 74, in transfer
    return _transfer_forward(source, target, transfer_method, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/animate/animate/interpolation.py", line 188, in _transfer_forward
    t.project(s, **kwargs)
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint_utils/function.py", line 47, in wrapper
    output = project(self, b, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/firedrake/firedrake/function.py", line 363, in project
    return projection.project(b, self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/adjoint_utils/projection.py", line 34, in wrapper
    output = project(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 113, in project
    ).project()
      ^^^^^^^^^
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 223, in project
    self.apply_massinv(self.target, self.rhs)
                                    ^^^^^^^^
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 286, in rhs
    self.mixed_mass.mult(u, v)
    ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/firedrake/firedrake/projection.py", line 280, in mixed_mass
    return assemble_mixed_mass_matrix(self.source.function_space(),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/supermeshing.py", line 192, in assemble_mixed_mass_matrix
    V_S_A = FunctionSpace(reference_mesh, V_A.ufl_element())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/functionspace.py", line 104, in FunctionSpace
    element = make_scalar_element(mesh, family, degree, vfamily, vdegree, variant)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/firedrake/firedrake/src/firedrake/firedrake/functionspace.py", line 56, in make_scalar_element
    return family.reconstruct(cell=cell)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/FInAT/finat/ufl/finiteelement.py", line 214, in reconstruct
    return FiniteElement(family, cell, degree, quad_scheme=quad_scheme, variant=variant)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/FInAT/finat/ufl/finiteelement.py", line 145, in __init__
    ) = canonical_element_description(family, cell, degree, form_degree)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/FInAT/finat/ufl/elementlist.py", line 466, in canonical_element_description
    raise ValueError(f"Cellname '{cellname}' invalid for '{family}' finite element.")
ValueError: Cellname 'triangle' invalid for 'Q' finite element.
@ddundo ddundo added the bug Something isn't working label Nov 25, 2024
@ddundo
Copy link
Member Author

ddundo commented Dec 13, 2024

The cause is that we are using a quadrilateral mesh UnitSquareMesh(32, 32, quadrilateral=True). Since I'm not familiar with the theory, I don't know if this is actually a bug - but either way, it's not on our side. So I'll just open a PR that doesn't use a quadrilateral mesh

@stephankramer maybe this is of interest to you since the code is from your paper? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant