-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmomentum_balance_neumann.py
More file actions
39 lines (29 loc) · 1.11 KB
/
Copy pathmomentum_balance_neumann.py
File metadata and controls
39 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import porepy as pp
import numpy as np
from model import BaseModel
class BoundaryConditions:
def bc_type_mechanics(self, sd: pp.Grid) -> pp.BoundaryConditionVectorial:
""""""
# Fetch boundary sides and assign type of boundary condition for the different
# sides
bounds = self.domain_boundary_sides(sd)
bc = pp.BoundaryConditionVectorial(
sd,
bounds.west,
"dir",
)
return bc
def bc_values_displacement(self, bg: pp.BoundaryGrid) -> np.ndarray:
values = np.zeros((self.nd, bg.num_cells))
bounds = self.domain_boundary_sides(bg)
displacement_values = np.zeros((self.nd, bg.num_cells))
values[0][bounds.west] += np.ones(len(displacement_values[0][bounds.west]))
return values.ravel("F")
class Model(BoundaryConditions, BaseModel): ...
params = {"folder_name": "west_dirichlet_all_neumann", "grid_type": "simplex"}
params = {
"folder_name": "west_dirichlet_all_other_neumann_cartesian",
"grid_type": "cartesian",
}
model = Model(params)
pp.run_time_dependent_model(model, params)