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

BUG: Plotting broken for spherical meshes (maybe more) #3809

Open
JDBetteridge opened this issue Oct 18, 2024 · 0 comments
Open

BUG: Plotting broken for spherical meshes (maybe more) #3809

JDBetteridge opened this issue Oct 18, 2024 · 0 comments
Labels

Comments

@JDBetteridge
Copy link
Member

Describe the bug
There seems to have been some regression plotting functions on spherical meshes

Steps to Reproduce
Steps to reproduce the behavior:

from firedrake import *
from firedrake.pyplot import tripcolor
import matplotlib.pyplot as plt

mesh = UnitIcosahedralMesh(3)
V = FunctionSpace(V, "CG", 1)
f = Function(V)
tripcolor(f) # error here!
plt.show(f)

Expected behavior
I see a plot!

Error message
I was running in an interactive terminal so my traceback doesn't have line numbers.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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/jack/Documents/firedrake/firedrake/src/firedrake/firedrake/pyplot/mpl.py", line 274, in tripcolor
    return _plot_2d_field("tripcolor", function, *args, complex_component=complex_component, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jack/Documents/firedrake/firedrake/src/firedrake/firedrake/pyplot/mpl.py", line 219, in _plot_2d_field
    triangulation = function_plotter.triangulation
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FunctionPlotter' object has no attribute 'triangulation'

The same happens for UnitCubedSphereMesh too.

If I replace Function with Constant(0) I get a different error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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/jack/Documents/firedrake/firedrake/src/firedrake/firedrake/pyplot/mpl.py", line 274, in tripcolor
    return _plot_2d_field("tripcolor", function, *args, complex_component=complex_component, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jack/Documents/firedrake/firedrake/src/firedrake/firedrake/pyplot/mpl.py", line 219, in _plot_2d_field
    triangulation = function_plotter.triangulation
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FunctionPlotter' object has no attribute 'triangulation'

I'm 90% sure this used to work as this MFE was based off a previous script I was using!

Environment:

  • OS: Arch Linux
  • Python version: 3.12
  • Output of firedrake-status:
$ firedrake-status
/home/jack/Documents/firedrake/firedrake/bin/firedrake-status:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
 __import__('pkg_resources').require('firedrake==0.13.0+6189.gf2a0b1256')
Firedrake Configuration:
   package_manager: False
   minimal_petsc: False
   mpicc: /opt/mpich/bin/mpicc
   mpicxx: /opt/mpich/bin/mpicxx
   mpif90: /opt/mpich/bin/mpif90
   mpiexec: /opt/mpich/bin/mpiexec
   disable_ssh: False
   honour_petsc_dir: True
   with_parmetis: False
   slepc: False
   packages: ['git+ssh://github.com/firedrakeproject/gusto.git@main#egg=gusto', 'ngsPETSc']
   honour_pythonpath: False
   opencascade: False
   tinyasm: False
   torch: False
   petsc_int_type: int32
   cache_dir: /home/jack/Documents/firedrake/firedrake/.cache
   complex: False
   remove_build_files: False
   with_blas: None
   netgen: True
   jax: False
Additions:
   None
Environment:
   PYTHONPATH: None
   PETSC_ARCH: None
   PETSC_DIR: /opt/petsc/firedrake/full-opt
Unable to retrieve git information from .pytest_cache.
Status of components:
---------------------------------------------------------------------------
|Package             |Branch                        |Revision  |Modified  |
---------------------------------------------------------------------------
|FInAT               |master                        |e72e533   |False     |
|PyOP2               |master                        |b84b7708  |False     |
|fiat                |master                        |78fc962   |False     |
|firedrake           |master                        |5e0c48f32 |False     |
|gusto               |JDBetteridge/testing_tests    |e20ef0bc  |False     |
|gusto-docs          |JDBetteridge/keep_alive       |7cea67f   |False     |
|h5py                |firedrake                     |db2ab02f  |False     |
|libsupermesh        |master                        |c07de13   |False     |
|loopy               |main                          |d9876d83  |False     |
|pyadjoint           |master                        |19f8718   |False     |
|pytest-mpi          |main                          |f2566a1   |False     |
|tsfc                |master                        |9f42f95   |False     |
|ufl                 |master                        |c1a8afb1  |False     |
---------------------------------------------------------------------------
  • Any relevant environment variables or modifications [eg: PYOP2_DEBUG=1]

Additional Info
matplotlib==3.9.0
triplot works for plotting just the mesh and gives the expected outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant