Skip to content

Commit b84bb3a

Browse files
MAINT: Make fracture axes scale with domain sizes
1 parent 80c8e18 commit b84bb3a

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

src/porepy/applications/md_grids/model_geometries.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ def fracture_params(self) -> dict:
350350
- major_axis_angles: Major axis angles of the fractures (default [0.0, 0.0])
351351
- num_points: Number of points to define each fracture (default [10, 10])
352352
353+
The fracture axes are scaled by the minimum of the domain sizes. For adjusting
354+
the fracture centers, the user should override the property
355+
:meth:`fracture_centers`.
356+
353357
Returns:
354358
A dictionary with fracture parameters.
355359
@@ -362,23 +366,27 @@ def fracture_params(self) -> dict:
362366
"dip_angles": np.array([np.pi / 2, np.pi / 2]),
363367
"major_axis_angles": np.array([0.0, 0.0]),
364368
}
365-
# Update with user-provided parameters, converting units as needed.
366-
units = ["-", "-", "m", "rad", "rad", "rad"]
367-
user_params = self.params.get("fracture_params", {})
368-
for key, unit in zip(default_params.keys(), units):
369-
if key in user_params:
370-
if unit == "m":
371-
default_params[key] = self.units.convert_units(
372-
user_params[key], "m"
373-
)
374-
else:
375-
default_params[key] = user_params[key]
369+
376370
if "fracture_minor_axes" not in default_params:
377371
default_params["fracture_minor_axes"] = default_params[
378372
"fracture_major_axes"
379373
]
380374
return default_params
381375

376+
@property
377+
def fracture_minor_axes(self) -> np.ndarray:
378+
params = self.fracture_params()
379+
# Scale minor axes by the minimum domain size.
380+
size = min(self.domain_sizes())
381+
return params["fracture_minor_axes"] * size
382+
383+
@property
384+
def fracture_major_axes(self) -> np.ndarray:
385+
params = self.fracture_params()
386+
# Scale major axes by the minimum domain size.
387+
size = min(self.domain_sizes())
388+
return params["fracture_major_axes"] * size
389+
382390
@property
383391
def fracture_centers(self) -> tuple[np.ndarray, np.ndarray]:
384392
dx, dy, dz = self.domain_sizes()
@@ -387,16 +395,17 @@ def fracture_centers(self) -> tuple[np.ndarray, np.ndarray]:
387395
return center_1, center_2
388396

389397
def set_fractures(self):
390-
"""Set the two elliptic fractures."""
398+
"""Set the elliptic fractures as defined in the fracture parameters and the
399+
fracture centers method."""
391400
self._fractures = []
392401
params = self.fracture_params()
393402
for i in range(params["num_fractures"]):
394403
f = pp.create_elliptic_fracture(
395404
center=self.fracture_centers[i],
396405
strike_angle=params["strike_angles"][i],
397406
dip_angle=params["dip_angles"][i],
398-
major_axis=params["fracture_major_axes"][i],
399-
minor_axis=params["fracture_minor_axes"][i],
407+
major_axis=self.fracture_major_axes[i],
408+
minor_axis=self.fracture_minor_axes[i],
400409
major_axis_angle=params["major_axis_angles"][i],
401410
num_points=params["num_points"][i],
402411
)

src/porepy/examples/geothermal_reservoir.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,11 @@ def before_nonlinear_loop(self) -> None:
272272
"""Hook called before the nonlinear solver loop.
273273
274274
Rediscretize flow problem at the onset of second time interval, when injection
275-
starts. The tailoring is done to recompute the Darcy flux discretization only at
276-
this specific time, since the discretization remains constant during the rest of
277-
the simulation. See also time dependency in :bc_type_darcy_flux.
275+
starts and the BC type changes from Neumann to Dirichlet.
276+
277+
The tailoring is done to recompute the Darcy flux discretization only at this
278+
specific time, since the discretization remains constant during the rest of the
279+
simulation. See also time dependency in :bc_type_darcy_flux.
278280
279281
NOTE: Strictly speaking, we could be even more conservative and ensure we don't
280282
rediscretize if the time step needs to be recomputed due to nonlinear solver
@@ -441,9 +443,11 @@ class ConstraintLineSearchNonlinearSolver(
441443
}
442444
)
443445
# Define domain sizes (x, y, z) and fracture size.
444-
size = 1e3 # [m]
445-
fracture_size = 1.5e2 # [m]
446-
domain_sizes = np.array([1.0 * size, 1.0 * size, 1.0 * size]) # [m]
446+
length_scale = 1e3 # [m]
447+
fracture_size = 0.15 # [-], fraction of length_scale
448+
domain_sizes = np.array(
449+
[1.0 * length_scale, 1.0 * length_scale, 1.0 * length_scale]
450+
) # [m]
447451
# Define model parameters. See file example_params.py and the mixins used to define
448452
# :class:`GeothermalReservoirWellBCs` for other options.
449453
model_params = {
@@ -474,8 +478,8 @@ class ConstraintLineSearchNonlinearSolver(
474478
# Set geometry and meshing related parameters.
475479
"grid_type": "simplex",
476480
"meshing_arguments": {
477-
"cell_size": size / 5.0,
478-
"cell_size_fracture": fracture_size / 2.5,
481+
"cell_size": length_scale / 5.0,
482+
"cell_size_fracture": fracture_size * length_scale / 2.5,
479483
},
480484
"fracture_params": { # Other options are available in the geometry mixin.
481485
"fracture_major_axes": np.array((fracture_size, fracture_size * 1.2)),

0 commit comments

Comments
 (0)