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

Test for 3D Netgen hierarchies and other new features #3764

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Add test for DG facets

72779ed
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Draft

Test for 3D Netgen hierarchies and other new features #3764

Add test for DG facets
72779ed
Select commit
Loading
Failed to load commit list.
GitHub Actions / Firedrake real failed Sep 12, 2024 in 0s

8064 tests run, 7273 passed, 786 skipped, 5 failed.

Annotations

Check failure on line 430 in tests/regression/test_netgen.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_netgen.test_netgen_dg_labels_2D

AttributeError: 'MeshTopology' object has no attribute 'labels'. Did you mean: 'layers'?
Raw output
def test_netgen_dg_labels_2D():
        from netgen.occ import WorkPlane, OCCGeometry, Glue
        wp = WorkPlane()
        inner = wp.Rectangle(1,1).Face()
        inner.name = "inner"
        inner.col = (1,0,0)
        outer = wp.Rectangle(2,2).Face()
        outer.name = "outer"
        outer.col = (0,1,0)
        outer = outer - inner
        shape = Glue([inner, outer])
        shape.edges.name = "rect"
        geo = OCCGeometry(shape, dim=2)
        ngmesh = geo.GenerateMesh(maxh=0.1)
        mesh = Mesh(ngmesh)
        R = FunctionSpace(mesh, "R", 0)
        u = Function(R).assign(1)
>       assert(abs(assemble(u*dx(mesh.labels[(2, "inner")]))-1) < 1e-10)

tests/regression/test_netgen.py:430: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 603)
name = 'labels'

    def __getattr__(self, name):
>       val = getattr(self._topology, name)
E       AttributeError: 'MeshTopology' object has no attribute 'labels'. Did you mean: 'layers'?

firedrake/mesh.py:2735: AttributeError

Check failure on line 451 in tests/regression/test_netgen.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_netgen.test_netgen_dg_labels_3D

AttributeError: 'MeshTopology' object has no attribute 'labels'. Did you mean: 'layers'?
Raw output
def test_netgen_dg_labels_3D():
        from netgen.occ import Box, OCCGeometry, Glue
        inner = Box((0,0,0), (1,1,1))
        inner.name = "inner"
        inner.col = (1,0,0)
        outer = Box((0,0,0), (2,2,2))
        outer.name = "outer"
        outer.col = (0,1,0)
        outer = outer - inner
        shape = Glue([inner, outer])
        shape.edges.name = "rect"
        geo = OCCGeometry(shape)
    
        ngmesh = geo.GenerateMesh(maxh=0.1)
        mesh = Mesh(ngmesh)
    
        R = FunctionSpace(mesh, "R", 0)
        u = Function(R).assign(1)
>       assert(abs(assemble(u*dx(mesh.labels[(3, "inner")]))-1) < 1e-10)

tests/regression/test_netgen.py:451: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 607)
name = 'labels'

    def __getattr__(self, name):
>       val = getattr(self._topology, name)
E       AttributeError: 'MeshTopology' object has no attribute 'labels'. Did you mean: 'layers'?

firedrake/mesh.py:2735: AttributeError

Check failure on line 458 in tests/regression/test_netgen.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_netgen.test_netgen_dg_labels_facets

NameError: name 'X' is not defined
Raw output
def test_netgen_dg_labels_facets():
        from netgen.occ import Rectangle, OCCGeometry, Glue
        outer = Rectangle(1, 1).Face()
        outer.edges.name="outer"
>       outer.edges.Max(X).name = "r"
E       NameError: name 'X' is not defined

tests/regression/test_netgen.py:458: NameError

Check failure on line 59 in tests/multigrid/test_netgen_gmg.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_netgen_gmg.test_netgen_mg_sphere

NotImplementedError: Netgen hierachies are only implemented for 2D meshes.
Raw output
@pytest.mark.skipcomplex
    def test_netgen_mg_sphere():
        ngmesh = create_netgen_mesh_sphere()
        mesh = Mesh(ngmesh)
>       nh = MeshHierarchy(mesh, 2, netgen_flags={"degree": 3, "nested": True})

tests/multigrid/test_netgen_gmg.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
firedrake/mg/mesh.py:129: in MeshHierarchy
    return NetgenHierarchy(mesh, refinement_levels, flags=netgen_flags)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

mesh = Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), 5317)
levs = 2, flags = {'degree': 3, 'nested': True}

    def NetgenHierarchy(mesh, levs, flags):
        '''
        This function creates a Firedrake mesh hierarchy from Netgen/NGSolve meshes.
    
        :arg mesh: the Netgen/NGSolve mesh
        :arg levs: the number of levels in the hierarchy
        :arg netgen_flags: either a bool or a dictionray containing options for Netgen.
        If not False the hierachy is constructed using ngsPETSc, if None hierarchy
        constructed in a standard manner. Netgen flags includes:
            -degree, either an integer denoting the degree of curvature of all levels of
            the mesh or a list of levs+1 integers denoting the degree of curvature of
            each level of the mesh.
            -tol, geometric tollerance adopted in snapToNetgenDMPlex.
            -refinement_type, the refinment type to be used: uniform (default), Alfeld
        '''
        if mesh.geometric_dimension() == 3:
>           raise NotImplementedError("Netgen hierachies are only implemented for 2D meshes.")
E           NotImplementedError: Netgen hierachies are only implemented for 2D meshes.

../firedrake_venv/src/ngsPETSc/ngsPETSc/utils/firedrake/hierarchies.py:115: NotImplementedError

Check failure on line 1 in tests/multigrid/test_netgen_gmg.py

See this annotation in the file changed.

@github-actions github-actions / Firedrake real

test_netgen_gmg.test_netgen_mg_sphere_parallel

subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', 'python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/multigrid/test_netgen_gmg.py::test_netgen_mg_sphere_parallel', ':', '-n', '2', 'python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/multigrid/test_netgen_gmg.py::test_netgen_mg_sphere_parallel', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.
Raw output
args = (), kwargs = {}

    def parallel_callback(*args, **kwargs):
>       subprocess.run(cmd, check=True)

../firedrake_venv/src/pytest-mpi/pytest_mpi.py:192: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

input = None, capture_output = False, timeout = None, check = True
popenargs = (['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', ...],)
kwargs = {}
process = <Popen: returncode: 1 args: ['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHI...>
stdout = None, stderr = None, retcode = 1

    def run(*popenargs,
            input=None, capture_output=False, timeout=None, check=False, **kwargs):
        """Run command with arguments and return a CompletedProcess instance.
    
        The returned instance will have attributes args, returncode, stdout and
        stderr. By default, stdout and stderr are not captured, and those attributes
        will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
        or pass capture_output=True to capture both.
    
        If check is True and the exit code was non-zero, it raises a
        CalledProcessError. The CalledProcessError object will have the return code
        in the returncode attribute, and output & stderr attributes if those streams
        were captured.
    
        If timeout is given, and the process takes too long, a TimeoutExpired
        exception will be raised.
    
        There is an optional argument "input", allowing you to
        pass bytes or a string to the subprocess's stdin.  If you use this argument
        you may not also use the Popen constructor's "stdin" argument, as
        it will be used internally.
    
        By default, all communication is in bytes, and therefore any "input" should
        be bytes, and the stdout and stderr will be bytes. If in text mode, any
        "input" should be a string, and stdout and stderr will be strings decoded
        according to locale encoding, or by "encoding" if set. Text mode is
        triggered by setting any of text, encoding, errors or universal_newlines.
    
        The other arguments are the same as for the Popen constructor.
        """
        if input is not None:
            if kwargs.get('stdin') is not None:
                raise ValueError('stdin and input arguments may not both be used.')
            kwargs['stdin'] = PIPE
    
        if capture_output:
            if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:
                raise ValueError('stdout and stderr arguments may not be used '
                                 'with capture_output.')
            kwargs['stdout'] = PIPE
            kwargs['stderr'] = PIPE
    
        with Popen(*popenargs, **kwargs) as process:
            try:
                stdout, stderr = process.communicate(input, timeout=timeout)
            except TimeoutExpired as exc:
                process.kill()
                if _mswindows:
                    # Windows accumulates the output in a single blocking
                    # read() call run on child threads, with the timeout
                    # being done in a join() on those threads.  communicate()
                    # _after_ kill() is required to collect that and add it
                    # to the exception.
                    exc.stdout, exc.stderr = process.communicate()
                else:
                    # POSIX _communicate already populated the output so
                    # far into the TimeoutExpired exception.
                    process.wait()
                raise
            except:  # Including KeyboardInterrupt, communicate handled that.
                process.kill()
                # We don't call process.wait() as .__exit__ does that for us.
                raise
            retcode = process.poll()
            if check and retcode:
>               raise CalledProcessError(retcode, process.args,
                                         output=stdout, stderr=stderr)
E               subprocess.CalledProcessError: Command '['mpiexec', '-n', '1', '-genv', '_PYTEST_MPI_CHILD_PROCESS', '1', 'python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/multigrid/test_netgen_gmg.py::test_netgen_mg_sphere_parallel', ':', '-n', '2', 'python', '-m', 'pytest', '--runxfail', '-s', '-q', '/__w/firedrake/firedrake/tests/multigrid/test_netgen_gmg.py::test_netgen_mg_sphere_parallel', '--tb=no', '--no-summary', '--no-header', '--disable-warnings', '--show-capture=no']' returned non-zero exit status 1.

/usr/lib/python3.12/subprocess.py:571: CalledProcessError