コード例 #1
0
    def bc(t):
        #bc_v = [DirichletBC(W.sub(0), (.0, .0), boundaries, 4)]
        v1 = DirichletBC(W.sub(0), (1.e-4 * 2.0, 0.0), boundaries, 1)
        v2 = DirichletBC(W.sub(0), (0.0, 0.0), boundaries, 2)
        v4 = DirichletBC(W.sub(0), (0.0, 0.0), boundaries, 4)
        bc_v = [v1, v2, v4]

        return BlockDirichletBC([bc_v, None])
 def bc(t):
     p5 = DirichletBC(C.sub(0),
                      exact_solution_expression1,
                      boundaries,
                      1,
                      method="geometric")
     return BlockDirichletBC([p5])
コード例 #3
0
ファイル: test_utils.py プロジェクト: prklVIP/multiphenics
 def _get_bc_2(block_V):
     on_boundary = OnBoundary()
     shape_2 = block_V[1].ufl_element().value_shape()
     if len(shape_2) is 0:
         bc2_fun = Constant(11.)
     elif len(shape_2) is 1 and shape_2[0] is 2:
         bc2_fun = Constant((11., 12.))
     elif len(shape_2) is 1 and shape_2[0] is 3:
         bc2_fun = Constant((11., 12., 13.))
     elif len(shape_2) is 2:
         bc2_fun = Constant(((11., 12.), (13., 14.)))
     return DirichletBC(block_V.sub(1), bc2_fun, on_boundary)
コード例 #4
0
ファイル: test_utils.py プロジェクト: prklVIP/multiphenics
 def _get_bc_1(block_V):
     on_boundary = OnBoundary()
     shape_1 = block_V[0].ufl_element().value_shape()
     if len(shape_1) is 0:
         bc1_fun = Constant(1.)
     elif len(shape_1) is 1 and shape_1[0] is 2:
         bc1_fun = Constant((1., 2.))
     elif len(shape_1) is 1 and shape_1[0] is 3:
         bc1_fun = Constant((1., 2., 3.))
     elif len(shape_1) is 2:
         bc1_fun = Constant(((1., 2.), (3., 4.)))
     return DirichletBC(block_V.sub(0), bc1_fun, on_boundary)
コード例 #5
0
ファイル: bcs.py プロジェクト: casfeq/Geomec3D
	def addPressureBC(self, mark, value):
		if self.split:
			self.pDirichlet.append(DirichletBC(self.space.Q, value, self.grid.boundaries, mark))
		else:
			self.dirichlet.append(DirichletBC(self.space.mixedSpace.sub(1), value, self.grid.boundaries, mark))
コード例 #6
0
ファイル: bcs.py プロジェクト: casfeq/Geomec3D
	def addPressureHomogeneousBC(self, mark):
		if self.split:
			self.pDirichlet.append(DirichletBC(self.space.Q, Constant(0.), self.grid.boundaries, mark))
		else:
			self.dirichlet.append(DirichletBC(self.space.mixedSpace.sub(1), Constant(0.), self.grid.boundaries, mark))
コード例 #7
0
ファイル: bcs.py プロジェクト: casfeq/Geomec3D
	def addDisplacementBC(self, mark, value, direction):
		if self.split:
			self.uDirichlet.append(DirichletBC(self.space.W.sub(direction), value, self.grid.boundaries, mark))
		else:
			self.dirichlet.append(DirichletBC(self.space.mixedSpace.sub(0).sub(direction), value, self.grid.boundaries, mark))
コード例 #8
0
ファイル: bcs.py プロジェクト: casfeq/Geomec3D
	def addDisplacementHomogeneousBC(self, mark, direction):
		if self.split:
			self.uDirichlet.append(DirichletBC(self.space.W.sub(direction), Constant(0.), self.grid.boundaries, mark))
		else:
			self.dirichlet.append(DirichletBC(self.space.mixedSpace.sub(0).sub(direction), Constant(0.), self.grid.boundaries, mark))
def m_linear(integrator_type, mesh, subdomains, boundaries, t_start, dt, T, solution0, \
                 alpha_0, K_0, mu_l_0, lmbda_l_0, Ks_0, \
                 alpha_1, K_1, mu_l_1, lmbda_l_1, Ks_1, \
                 alpha, K, mu_l, lmbda_l, Ks, \
                 cf_0, phi_0, rho_0, mu_0, k_0,\
                 cf_1, phi_1, rho_1, mu_1, k_1,\
                 cf, phi, rho, mu, k, \
                 pressure_freeze):
    # Create mesh and define function space
    parameters["ghost_mode"] = "shared_facet" # required by dS

    dx = Measure('dx', domain=mesh, subdomain_data=subdomains)
    ds = Measure('ds', domain=mesh, subdomain_data=boundaries)
    dS = Measure('dS', domain=mesh, subdomain_data=boundaries)

    C = VectorFunctionSpace(mesh, "CG", 2)
    C = BlockFunctionSpace([C])
    TM = TensorFunctionSpace(mesh, 'DG', 0)
    PM = FunctionSpace(mesh, 'DG', 0)
    n = FacetNormal(mesh)
    vc = CellVolume(mesh)
    fc = FacetArea(mesh)

    h = vc/fc
    h_avg = (vc('+') + vc('-'))/(2*avg(fc))

    monitor_dt = dt

    f_stress_x = Constant(-1.e3)
    f_stress_y = Constant(-20.0e6)

    f = Constant((0.0, 0.0)) #sink/source for displacement

    I = Identity(mesh.topology().dim())

    # Define variational problem
    psiu, = BlockTestFunction(C)
    block_u = BlockTrialFunction(C)
    u, = block_split(block_u)
    w = BlockFunction(C)

    theta = -1.0

    a_time = inner(-alpha*pressure_freeze*I,sym(grad(psiu)))*dx #quasi static

    a = inner(2*mu_l*strain(u)+lmbda_l*div(u)*I, sym(grad(psiu)))*dx

    rhs_a = inner(f,psiu)*dx \
        + dot(f_stress_y*n,psiu)*ds(2)


    r_u = [a]

    #DirichletBC
    bcd1 = DirichletBC(C.sub(0).sub(0), 0.0, boundaries, 1) # No normal displacement for solid on left side
    bcd3 = DirichletBC(C.sub(0).sub(0), 0.0, boundaries, 3) # No normal displacement for solid on right side
    bcd4 = DirichletBC(C.sub(0).sub(1), 0.0, boundaries, 4) # No normal displacement for solid on bottom side
    bcs = BlockDirichletBC([bcd1,bcd3,bcd4])

    AA = block_assemble([r_u])
    FF = block_assemble([rhs_a - a_time])
    bcs.apply(AA)
    bcs.apply(FF)

    block_solve(AA, w.block_vector(), FF, "mumps")

    export_solution = w

    return export_solution, T
コード例 #10
0
    init_scalar_parameter(rho, rho_values[0], 500, subdomains)
    init_scalar_parameter(vis, vis_values[0], 500, subdomains)
    init_scalar_parameter(ct, ct_values[0], 500, subdomains)

    init_scalar_parameter(rho, rho_values[1], 501, subdomains)
    init_scalar_parameter(vis, vis_values[1], 501, subdomains)
    init_scalar_parameter(ct, ct_values[1], 501, subdomains)

    init_from_file_parameter_scalar_to_tensor(k, "data/het_0.csv")

    T = 500.0
    t = 0.0
    dt = 20.0

    bcd1 = DirichletBC(W.sub(0).sub(0), Constant(0.0), boundaries,
                       1)  # No normal displacement for solid on left side
    bcd3 = DirichletBC(W.sub(0).sub(0), Constant(0.0), boundaries,
                       3)  # No normal displacement for solid on right side
    bcd4 = DirichletBC(W.sub(0).sub(1), Constant(0.0), boundaries,
                       4)  # No normal displacement for solid on bottom side
    bcs = BlockDirichletBC([[bcd1, bcd3, bcd4], []])

    a = inner(2 * mu_l * strain(u) + lmbda_l * div(u) * I, sym(grad(v))) * dx

    b = inner(-alpha * p * I, sym(grad(v))) * dx

    c = rho * alpha * div(u) * q * dx

    d = (rho * ct * p * q * dx +
         dt * dot(rho * k / vis * grad(p), grad(q)) * dx - dt *
         dot(avg_w(rho * k / vis * grad(p), weight_e(k, n)), jump(q, n)) * dS -