@@ -35,22 +35,22 @@ def bc_type_darcy_flux(self, sd: pp.Grid) -> pp.BoundaryCondition:
35
35
# Define boundary condition on faces
36
36
return pp .BoundaryCondition (sd , domain_sides .west + domain_sides .east , "dir" )
37
37
38
- def bc_values_pressure (self , boundary_grid : pp .BoundaryGrid ) -> np .ndarray :
38
+ def bc_values_pressure (self , bg : pp .BoundaryGrid ) -> np .ndarray :
39
39
"""Boundary condition values for Darcy flux.
40
40
41
41
Dirichlet boundary conditions are defined on the west and east boundaries,
42
42
with a constant value equal to the fluid's reference pressure (which will be 0
43
43
by default).
44
44
45
45
Parameters:
46
- boundary_grid : Boundary grid for which to define boundary conditions.
46
+ bg : Boundary grid for which to define boundary conditions.
47
47
48
48
Returns:
49
49
Boundary condition values array.
50
50
51
51
"""
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 )
54
54
values [domain_sides .west + domain_sides .east ] = (
55
55
self .reference_variable_values .pressure
56
56
)
@@ -99,22 +99,22 @@ def bc_type_darcy_flux(self, sd: pp.Grid) -> pp.BoundaryCondition:
99
99
# Define boundary condition on faces
100
100
return pp .BoundaryCondition (sd , domain_sides .north + domain_sides .south , "dir" )
101
101
102
- def bc_values_pressure (self , boundary_grid : pp .BoundaryGrid ) -> np .ndarray :
102
+ def bc_values_pressure (self , bg : pp .BoundaryGrid ) -> np .ndarray :
103
103
"""Boundary condition values for Darcy flux.
104
104
105
105
Dirichlet boundary conditions are defined on the north and south boundaries,
106
106
with a constant value equal to the fluid's reference pressure (which will be 0
107
107
by default).
108
108
109
109
Parameters:
110
- boundary_grid : Boundary grid for which to define boundary conditions.
110
+ bg : Boundary grid for which to define boundary conditions.
111
111
112
112
Returns:
113
113
Boundary condition values array.
114
114
115
115
"""
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 )
118
118
values [domain_sides .north + domain_sides .south ] = (
119
119
self .reference_variable_values .pressure
120
120
)
@@ -208,24 +208,24 @@ def bc_type_mechanics(self, sd: pp.Grid) -> pp.BoundaryConditionVectorial:
208
208
bc .internal_to_dirichlet (sd )
209
209
return bc
210
210
211
- def bc_values_displacement (self , boundary_grid : pp .BoundaryGrid ) -> np .ndarray :
211
+ def bc_values_displacement (self , bg : pp .BoundaryGrid ) -> np .ndarray :
212
212
"""Boundary values for the mechanics problem as a numpy array.
213
213
214
214
Values for north and south faces are set to zero unless otherwise specified
215
215
through items u_north and u_south in the parameter dictionary passed on model
216
216
initialization.
217
217
218
218
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.
220
220
221
221
Returns:
222
222
Array of boundary values, with one value for each dimension of the
223
223
domain, for each face in the subdomain.
224
224
225
225
"""
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 :
229
229
# No displacement is implemented on grids of co-dimension >= 2.
230
230
return values .ravel ("F" )
231
231
@@ -236,13 +236,17 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
236
236
# Wrap as array for convert_units. Thus, the passed values can be scalar or
237
237
# list. Then tile for correct broadcasting below.
238
238
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 )
240
240
).T
241
241
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 )
243
243
).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
+ ]
246
250
return values .ravel ("F" )
247
251
248
252
@@ -253,7 +257,7 @@ class TimeDependentMechanicalBCsDirNorthSouth(BoundaryConditionsMechanicsDirNort
253
257
254
258
"""
255
259
256
- def bc_values_displacement (self , boundary_grid : pp .BoundaryGrid ) -> np .ndarray :
260
+ def bc_values_displacement (self , bg : pp .BoundaryGrid ) -> np .ndarray :
257
261
"""Displacement values.
258
262
259
263
Initial value is u_y = self.solid.fracture_gap +
@@ -265,15 +269,15 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
265
269
defaulting to 0.
266
270
267
271
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.
269
273
270
274
Returns:
271
275
Array of boundary values, with one value for each dimension of the
272
276
problem, for each face in the subdomain.
273
277
274
278
"""
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 ))
277
281
# Add fracture width on top if there is a fracture.
278
282
if len (self .mdg .subdomains ()) > 1 :
279
283
frac_val = (
@@ -283,6 +287,6 @@ def bc_values_displacement(self, boundary_grid: pp.BoundaryGrid) -> np.ndarray:
283
287
frac_val = 0
284
288
values [1 , domain_sides .north ] = frac_val
285
289
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 )
287
291
else :
288
292
return values .ravel ("F" )
0 commit comments