def test_no_dynamics_2d(self): g_list = setup_grids.setup_2d() for g in g_list: discr = biot.Biot() bound_faces = g.get_all_boundary_faces() bound = bc.BoundaryCondition( g, bound_faces.ravel("F"), ["dir"] * bound_faces.size ) mu = np.ones(g.num_cells) c = tensor.FourthOrderTensor(g.dim, mu, mu) k = tensor.SecondOrderTensor(g.dim, np.ones(g.num_cells)) bound_val = np.zeros(g.num_faces) param = Parameters(g) param.set_bc("flow", bound) param.set_bc("mechanics", bound) param.set_tensor("flow", k) param.set_tensor("mechanics", c) param.set_bc_val("mechanics", np.tile(bound_val, g.dim)) param.set_bc_val("flow", bound_val) param.porosity = np.ones(g.num_cells) param.biot_alpha = 1 data = {"param": param, "inverter": "python", "dt": 1} A, b = discr.matrix_rhs(g, data) sol = np.linalg.solve(A.todense(), b) self.assertTrue(np.isclose(sol, np.zeros(g.num_cells * (g.dim + 1))).all())
def test_no_dynamics_2d(self): g_list = setup_grids.setup_2d() for g in g_list: discr = biot.Biot() bound_faces = g.get_all_boundary_faces() bound = bc.BoundaryCondition(g, bound_faces.ravel('F'), ['dir'] * bound_faces.size) mu = np.ones(g.num_cells) c = tensor.FourthOrderTensor(g.dim, mu, mu) k = tensor.SecondOrderTensor(g.dim, np.ones(g.num_cells)) bound_val = np.zeros(g.num_faces) param = Parameters(g) param.set_bc('flow', bound) param.set_bc('mechanics', bound) param.set_tensor('flow', k) param.set_tensor('mechanics', c) param.set_bc_val('mechanics', np.tile(bound_val, g.dim)) param.set_bc_val('flow', bound_val) param.porosity = np.ones(g.num_cells) param.biot_alpha = 1 data = {'param': param, 'inverter': 'python', 'dt': 1} A, b = discr.matrix_rhs(g, data) sol = np.linalg.solve(A.todense(), b) assert np.isclose(sol, np.zeros(g.num_cells * (g.dim + 1))).all()
def setup_stiffness(g, mu=1, l=1): mu = np.ones(g.num_cells) * mu l = np.ones(g.num_cells) * l return tensor.FourthOrderTensor(g.dim, mu, l)