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

ENH: Improvements of model geometry settings for the 2d benchmark case 4 #1342

Merged
merged 2 commits into from
Feb 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions src/porepy/examples/flow_benchmark_2d_case_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

"""

from typing import Literal

import numpy as np

import porepy as pp
Expand All @@ -36,10 +38,47 @@ def set_fractures(self) -> None:
"""Setting a fracture list from the fracture set library."""
self._fractures = pp.applications.md_grids.fracture_sets.benchmark_2d_case_4()

@property
def domain(self) -> pp.Domain:
def set_domain(self) -> None:
"""Domain of the problem."""
return pp.Domain({"xmax": 700, "ymax": 600})
x_extent = self.units.convert_units(700, "m")
y_extent = self.units.convert_units(600, "m")
self._domain = pp.Domain(
{"xmin": 0, "xmax": x_extent, "ymin": 0, "ymax": y_extent}
)

def grid_type(self) -> Literal["simplex"]:
"""Set a simplex grid, which is the only grid type that can represent this
fracture geometry.

Returns:
str: Grid type.

"""
return "simplex"

def meshing_arguments(self) -> dict[str, float]:
"""Meshing arguments for mixed-dimensional grid generation.

Set a default cell size of 10 m. This will give a grid of about 23K cells in the
2d domain.

Note that due to complexities of this fracture network, it is not possible to
get Gmsh to create a grid with less than about 12K cells in the 2d domain. This
can be achieved by setting the cell size to 30 m (possibly also lower). Coarser
grids may be possible, but this will require interaction with Gmsh on a more
detailed lever than what is available through PorePy.

Returns:
Meshing arguments compatible with
:meth:`~porepy.grids.mdg_generation.create_mdg`.

"""
# Default value of 10, scaled by the length unit.
cell_size = self.units.convert_units(10, "m")
default_meshing_args: dict[str, float] = {"cell_size": cell_size}
# If meshing arguments are provided in the params, they should already be scaled
# by the length unit.
return self.params.get("meshing_arguments", default_meshing_args)


class BoundaryConditions(pp.PorePyModel):
Expand Down