Skip to content

Commit 269d3ef

Browse files
Merge pull request #1369 from pmgbergen/name_unification
Unification of variable names throughout the code base
2 parents 34fc7d8 + 9befd80 commit 269d3ef

File tree

143 files changed

+2850
-2563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+2850
-2563
lines changed

src/porepy/applications/boundary_conditions/model_boundary_conditions.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ def bc_type_darcy_flux(self, sd: pp.Grid) -> pp.BoundaryCondition:
3535
# Define boundary condition on faces
3636
return pp.BoundaryCondition(sd, domain_sides.west + domain_sides.east, "dir")
3737

38-
def bc_values_pressure(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
38+
def bc_values_pressure(self, bg: pp.BoundaryGrid) -> np.ndarray:
3939
"""Boundary condition values for Darcy flux.
4040
4141
Dirichlet boundary conditions are defined on the west and east boundaries,
4242
with a constant value equal to the fluid's reference pressure (which will be 0
4343
by default).
4444
4545
Parameters:
46-
boundary_grid: Boundary grid for which to define boundary conditions.
46+
bg: Boundary grid for which to define boundary conditions.
4747
4848
Returns:
4949
Boundary condition values array.
5050
5151
"""
52-
domain_sides = self.domain_boundary_sides(boundary_grid)
53-
values = np.zeros(boundary_grid.num_cells)
52+
domain_sides = self.domain_boundary_sides(bg)
53+
values = np.zeros(bg.num_cells)
5454
values[domain_sides.west + domain_sides.east] = (
5555
self.reference_variable_values.pressure
5656
)
@@ -99,22 +99,22 @@ def bc_type_darcy_flux(self, sd: pp.Grid) -> pp.BoundaryCondition:
9999
# Define boundary condition on faces
100100
return pp.BoundaryCondition(sd, domain_sides.north + domain_sides.south, "dir")
101101

102-
def bc_values_pressure(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
102+
def bc_values_pressure(self, bg: pp.BoundaryGrid) -> np.ndarray:
103103
"""Boundary condition values for Darcy flux.
104104
105105
Dirichlet boundary conditions are defined on the north and south boundaries,
106106
with a constant value equal to the fluid's reference pressure (which will be 0
107107
by default).
108108
109109
Parameters:
110-
boundary_grid: Boundary grid for which to define boundary conditions.
110+
bg: Boundary grid for which to define boundary conditions.
111111
112112
Returns:
113113
Boundary condition values array.
114114
115115
"""
116-
domain_sides = self.domain_boundary_sides(boundary_grid)
117-
values = np.zeros(boundary_grid.num_cells)
116+
domain_sides = self.domain_boundary_sides(bg)
117+
values = np.zeros(bg.num_cells)
118118
values[domain_sides.north + domain_sides.south] = (
119119
self.reference_variable_values.pressure
120120
)
@@ -208,24 +208,24 @@ def bc_type_mechanics(self, sd: pp.Grid) -> pp.BoundaryConditionVectorial:
208208
bc.internal_to_dirichlet(sd)
209209
return bc
210210

211-
def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
211+
def bc_values_displacement(self, bg: pp.BoundaryGrid) -> np.ndarray:
212212
"""Boundary values for the mechanics problem as a numpy array.
213213
214214
Values for north and south faces are set to zero unless otherwise specified
215215
through items u_north and u_south in the parameter dictionary passed on model
216216
initialization.
217217
218218
Parameters:
219-
boundary_grid: Boundary grid for which boundary values are to be returned.
219+
bg: Boundary grid for which boundary values are to be returned.
220220
221221
Returns:
222222
Array of boundary values, with one value for each dimension of the
223223
domain, for each face in the subdomain.
224224
225225
"""
226-
sides = self.domain_boundary_sides(boundary_grid)
227-
values = np.zeros((self.nd, boundary_grid.num_cells))
228-
if boundary_grid.dim < self.nd - 1:
226+
domain_sides = self.domain_boundary_sides(bg)
227+
values = np.zeros((self.nd, bg.num_cells))
228+
if bg.dim < self.nd - 1:
229229
# No displacement is implemented on grids of co-dimension >= 2.
230230
return values.ravel("F")
231231

@@ -236,13 +236,17 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
236236
# Wrap as array for convert_units. Thus, the passed values can be scalar or
237237
# list. Then tile for correct broadcasting below.
238238
u_n = np.tile(
239-
self.params.get("u_north", np.zeros(self.nd)), (boundary_grid.num_cells, 1)
239+
self.params.get("u_north", np.zeros(self.nd)), (bg.num_cells, 1)
240240
).T
241241
u_s = np.tile(
242-
self.params.get("u_south", np.zeros(self.nd)), (boundary_grid.num_cells, 1)
242+
self.params.get("u_south", np.zeros(self.nd)), (bg.num_cells, 1)
243243
).T
244-
values[:, sides.north] = self.units.convert_units(u_n, "m")[:, sides.north]
245-
values[:, sides.south] = self.units.convert_units(u_s, "m")[:, sides.south]
244+
values[:, domain_sides.north] = self.units.convert_units(u_n, "m")[
245+
:, domain_sides.north
246+
]
247+
values[:, domain_sides.south] = self.units.convert_units(u_s, "m")[
248+
:, domain_sides.south
249+
]
246250
return values.ravel("F")
247251

248252

@@ -253,7 +257,7 @@ class TimeDependentMechanicalBCsDirNorthSouth(BoundaryConditionsMechanicsDirNort
253257
254258
"""
255259

256-
def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
260+
def bc_values_displacement(self, bg: pp.BoundaryGrid) -> np.ndarray:
257261
"""Displacement values.
258262
259263
Initial value is u_y = self.solid.fracture_gap +
@@ -265,15 +269,15 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
265269
defaulting to 0.
266270
267271
Parameters:
268-
boundary_grid: Boundary grid for which boundary values are to be returned.
272+
bg: Boundary grid for which boundary values are to be returned.
269273
270274
Returns:
271275
Array of boundary values, with one value for each dimension of the
272276
problem, for each face in the subdomain.
273277
274278
"""
275-
domain_sides = self.domain_boundary_sides(boundary_grid)
276-
values = np.zeros((self.nd, boundary_grid.num_cells))
279+
domain_sides = self.domain_boundary_sides(bg)
280+
values = np.zeros((self.nd, bg.num_cells))
277281
# Add fracture width on top if there is a fracture.
278282
if len(self.mdg.subdomains()) > 1:
279283
frac_val = (
@@ -283,6 +287,6 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
283287
frac_val = 0
284288
values[1, domain_sides.north] = frac_val
285289
if self.time_manager.time > 1e-5:
286-
return values.ravel("F") + super().bc_values_displacement(boundary_grid)
290+
return values.ravel("F") + super().bc_values_displacement(bg)
287291
else:
288292
return values.ravel("F")

src/porepy/applications/convergence_analysis.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ def __init__(
119119
120120
"""
121121

122-
# Initialize setup and retrieve spatial and temporal data
123-
setup: pp.PorePyModel = model_class(
122+
# Initialize model and retrieve spatial and temporal data
123+
model: pp.PorePyModel = model_class(
124124
deepcopy(model_params)
125125
) # make a deep copy of dictionary
126126
# The typing of PorePyModel was added to support linters as much as possible.
127127
# But the protocols do not contain all methods provided by SolutionStrategy.
128-
setup.prepare_simulation() # type: ignore[attr-defined]
128+
model.prepare_simulation() # type: ignore[attr-defined]
129129

130-
# Store initial setup
131-
self._init_setup = setup
132-
"""Initial setup containing the 'base-line' information."""
130+
# Store initial model
131+
self._init_model = model
132+
"""Initial model containing the 'base-line' information."""
133133

134134
# We need to know whether the model is time-dependent or not
135-
self._is_time_dependent: bool = setup._is_time_dependent()
135+
self._is_time_dependent: bool = model._is_time_dependent()
136136
"""Whether the model is time-dependent."""
137137

138138
if not self._is_time_dependent and self.temporal_refinement_rate > 1:
@@ -178,20 +178,20 @@ def run_analysis(self) -> list:
178178
"""
179179
convergence_results: list = []
180180
for level in range(self.levels):
181-
setup = self.model_class(deepcopy(self.model_params[level]))
182-
if not setup._is_time_dependent():
181+
model = self.model_class(deepcopy(self.model_params[level]))
182+
if not model._is_time_dependent():
183183
# Run stationary model
184-
pp.run_stationary_model(setup, deepcopy(self.model_params[level]))
184+
pp.run_stationary_model(model, deepcopy(self.model_params[level]))
185185
# Complement information in results
186-
setattr(setup.results[-1], "cell_diameter", setup.mdg.diameter())
186+
setattr(model.results[-1], "cell_diameter", model.mdg.diameter())
187187
else:
188188
# Run time-dependent model
189-
pp.run_time_dependent_model(setup)
189+
pp.run_time_dependent_model(model)
190190
# Complement information in results
191-
setattr(setup.results[-1], "cell_diameter", setup.mdg.diameter())
192-
setattr(setup.results[-1], "dt", setup.time_manager.dt)
191+
setattr(model.results[-1], "cell_diameter", model.mdg.diameter())
192+
setattr(model.results[-1], "dt", model.time_manager.dt)
193193

194-
convergence_results.append(setup.results[-1])
194+
convergence_results.append(model.results[-1])
195195
return convergence_results
196196

197197
def export_errors_to_txt(
@@ -377,7 +377,7 @@ def _get_list_of_meshing_arguments(self) -> list[dict[str, float]]:
377377
378378
"""
379379
# Retrieve initial meshing arguments
380-
init_mesh_args = deepcopy(self._init_setup.meshing_arguments())
380+
init_mesh_args = deepcopy(self._init_model.meshing_arguments())
381381

382382
# Prepare factors for the spatial analysis
383383
factors = 1 / (self.spatial_refinement_rate ** np.arange(self.levels))
@@ -405,7 +405,7 @@ def _get_list_of_time_managers(self) -> Union[list[pp.TimeManager], None]:
405405
return None
406406

407407
# Retrieve initial time manager
408-
init_time_manager: pp.TimeManager = self._init_setup.time_manager
408+
init_time_manager: pp.TimeManager = self._init_model.time_manager
409409

410410
# Sanity check
411411
if not init_time_manager.is_constant:

src/porepy/applications/md_grids/fracture_sets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def benchmark_2d_case_3(size: pp.number = 1) -> list[pp.LineFracture]:
132132
def benchmark_2d_case_4() -> list[pp.LineFracture]:
133133
"""Returns a fracture set that corresponds to Case 4 from the 2D flow benchmark [1].
134134
135-
The setup is composed of 64 fractures grouped in 13 different connected networks,
135+
The geometry is composed of 64 fractures grouped in 13 different connected networks,
136136
ranging from isolated fractures up to tens of fractures each.
137137
138138
References:

src/porepy/applications/md_grids/mdg_library.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def square_with_orthogonal_fractures(
141141
non_matching=False,
142142
)
143143

144-
intf_map: dict[
144+
interface_map: dict[
145145
pp.MortarGrid,
146146
Union[pp.MortarGrid, dict[mortar_grid.MortarSides, pp.Grid]],
147147
] = {}
@@ -161,11 +161,13 @@ def square_with_orthogonal_fractures(
161161
# they are the same, i.e., if the fractures are the same ones, we update
162162
# the interface map.
163163
if g_sec_old.frac_num == g_sec_new.frac_num:
164-
intf_map.update({intf_old: intf})
164+
interface_map.update({intf_old: intf})
165165

166166
# Finally replace the subdomains and interfaces in the original
167167
# mixed-dimensional grid.
168-
mdg.replace_subdomains_and_interfaces(sd_map=grid_map, intf_map=intf_map)
168+
mdg.replace_subdomains_and_interfaces(
169+
sd_map=grid_map, interface_map=interface_map
170+
)
169171

170172
return mdg, fracture_network
171173

0 commit comments

Comments
 (0)