pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overzealous warning in mdg_creation

IvarStefansson opened this issue · comments

The following warning is raised when a fracture touches the boundary:

warnings.warn(f"Found {sz} fractures outside the domain boundary")

I would assume this should not happen unless the fracture extends beyond the boundary.

(M)WE:

from typing import Any

import numpy as np
import porepy as pp
from porepy.applications.md_grids.domains import nd_cube_domain


class TwoFractures3d(pp.ModelGeometry):
    
    
    def set_domain(self) -> None:
        # Unit cube domain.
        self._domain = nd_cube_domain(3, 1.0)

    def set_fractures(self) -> None:
        pts = np.array(
            [[0, 0, 0.5, 0.5], [0.25, 0.75, 0.75, 0.25], [0.5, 0.5, 0.5, 0.5]]
        )
        self._fractures = [pp.PlaneFracture(pts)]

    def grid_type(self) -> str:
        return "cartesian"

    def meshing_arguments(self) -> float:
        cell_sizes = {
            "cell_size": 1 / 4,
        }
        return cell_sizes


model = TwoFractures3d()
model.params = {}
model.set_geometry()

A comparison of the behavior of FractureNetwork3d.impose_external_boundary with FractureNetwork2d.impose_external_boundary shows a different return value from the latter. The proper way to resolve this issue is to run a refactor that unifies the functional behavior of these functions.

Anecdotally, some profiling indicates that imposing external boundaries also takes (unexpectedly?) long time. We could have a look at this while we're at it.

Closed with #1105