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]: test_vector_function.py (0.6.0) fails with PETSc 3.19 #2736

Closed
drew-parsons opened this issue Jul 25, 2023 · 1 comment
Closed

[BUG]: test_vector_function.py (0.6.0) fails with PETSc 3.19 #2736

drew-parsons opened this issue Jul 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@drew-parsons
Copy link
Contributor

drew-parsons commented Jul 25, 2023

How to reproduce the bug

The python unit test python/test/unit/fem/test_vector_function.py fails after building dolfinx 0.6.0 against PETSc 3.19

Minimal Example (Python)

pytest-3 -v python/test/unit/fem/test_vector_function.py

Output (Python)

$ pytest-3 -v python/test/unit/fem/test_vector_function.py 
================================================================================================================================== test session starts ===================================================================================================================================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0 -- /usr/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/projects/fenics/build/fenics-dolfinx/.hypothesis/examples')
rootdir: /projects/fenics/build/fenics-dolfinx/python
configfile: setup.cfg
plugins: xvfb-2.0.0, remotedata-0.4.0, asyncio-0.20.3, arraydiff-0.5.0, hypothesis-6.82.0, filter-subpackage-0.1.2, flaky-3.7.0, mock-3.11.1, mpi-0.6, astropy-header-0.2.2, cov-4.1.0, openfiles-0.5.0, astropy-0.10.0, doctestplus-0.13.0
asyncio: mode=Mode.STRICT
collected 10 items                                                                                                                                                                                                                                                                       

python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[1-RT] FAILED                                                                                                                                                                                            [ 10%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[2-RT] FAILED                                                                                                                                                                                            [ 20%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[3-RT] FAILED                                                                                                                                                                                            [ 30%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[4-RT] FAILED                                                                                                                                                                                            [ 40%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[5-RT] FAILED                                                                                                                                                                                            [ 50%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[1-RT] FAILED                                                                                                                                                                                         [ 60%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[2-RT] FAILED                                                                                                                                                                                         [ 70%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[3-RT] FAILED                                                                                                                                                                                         [ 80%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[4-RT] FAILED                                                                                                                                                                                         [ 90%]
python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[5-RT] FAILED                                                                                                                                                                                         [100%]

======================================================================================================================================== FAILURES ========================================================================================================================================
___________________________________________________________________________________________________________________________ test_div_conforming_triangle[1-RT] ___________________________________________________________________________________________________________________________

space_type = 'RT', order = 1

    @pytest.mark.skip_in_parallel
    @pytest.mark.parametrize('space_type', ["RT"])
    @pytest.mark.parametrize('order', [1, 2, 3, 4, 5])
    def test_div_conforming_triangle(space_type, order):
        """Checks that the vectors in div conforming spaces on a triangle are correctly oriented"""
        # Create simple triangle mesh
        def perform_test(points, cells):
            domain = ufl.Mesh(ufl.VectorElement("Lagrange", "triangle", 1))
            mesh = create_mesh(MPI.COMM_WORLD, cells, points, domain)
            V = FunctionSpace(mesh, (space_type, order))
            f = Function(V)
            output = []
            for dof in range(len(f.vector[:])):
                f.vector[:] = np.zeros(len(f.vector[:]))
                f.vector[dof] = 1
                points = np.array([[.5, .5, 0], [.5, .5, 0]])
                cells = np.array([0, 1])
                result = f.eval(points, cells)
                normal = np.array([-1., 1.])
                output.append(result.dot(normal))
            return output
    
        points = np.array([[0, 0], [1, 0], [1, 1], [0, 1]])
        cells = np.array([[0, 1, 2], [2, 3, 0]])
    
>       result = perform_test(points, cells)

python/test/unit/fem/test_vector_function.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
python/test/unit/fem/test_vector_function.py:31: in perform_test
    f.vector[:] = np.zeros(len(f.vector[:]))
petsc4py/PETSc/Vec.pyx:107: in petsc4py.PETSc.Vec.__getitem__
    ???
petsc4py/PETSc/petscvec.pxi:436: in petsc4py.PETSc.vec_getitem
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   petsc4py.PETSc.Error: error code 73
E   [0] VecGetValues() at ./src/vec/vec/interface/rvector.c:924
E   [0] Object is in wrong state
E   [0] Not for unassembled vector, did you call VecAssemblyBegin()/VecAssemblyEnd()?

petsc4py/PETSc/petscvec.pxi:388: Error
...etc
================================================================================================================================ short test summary info =================================================================================================================================
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[1-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[2-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[3-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[4-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_triangle[5-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[1-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[2-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[3-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[4-RT] - petsc4py.PETSc.Error: error code 73
FAILED python/test/unit/fem/test_vector_function.py::test_div_conforming_tetrahedron[5-RT] - petsc4py.PETSc.Error: error code 73
=================================================================================================================================== 10 failed in 1.91s ===================================================================================================================================

Version

0.6.0

Installation

Testing debian 0.6.0 source patched for gcc 13 (fenics-dolfinx 1:0.6.0-6).

Additional information

There is PETSc 3.19 failure in legacy dolfin, reported at https://bitbucket.org/fenics-project/dolfin/issues/1138/ (test_snes_set_from_options)

The failure is with dolfinx 0.6.0. I understand dolfinx main branch is passing tests with PETSc 3.19. Would this issue have been fixed in #2560 ? It's not obvious that that PR is directly relevant though.

@drew-parsons drew-parsons added the bug Something isn't working label Jul 25, 2023
@garth-wells
Copy link
Member

The fix is in #2611.

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

No branches or pull requests

2 participants