amg preconditioner
Hi
i would like to set boundary condition in a rectangular mesh, with 2 subdoimain that are circles. I want to two Dirichlet boundary condition on the border of each circle.
i got an error mesage: unknown preconditioner `amg`
the code is:
I use windows 7.
Has everyone a tip for this problem.
Thanx Sven
from dolfin import *
import numpy as np
not_working_
# Create rectangular mesh
mesh = Rectangle(0.0, 0.0, 1.4, 0.8, 60, 20)
# Define a circular hole
center = Point(0.1, 0.1)
center2 = Point(0.6, 0.6)
radius = 0.05
class Hole(SubDomain):
def inside(self, x, on_boundary):
r = sqrt((x[0] - center[0])**2 + (x[1] - center[1])**2)
return r < 1.5*radius # slightly larger
def snap(self, x):
r = sqrt((x[0] - center[0])**2 + (x[1] - center[1])**2)
if r < 1.5*radius:
x[0] = center[0] + (radius / r)*(x[0] - center[0])
x[1] = center[1] + (radius / r)*(x[1] - center[1])
class Hole2(SubDomain):
def inside(self, x, on_boundary):
r = sqrt((x[0] - center2[0])**2 + (x[1] - center2[0])**2)
return r < 1.5*radius # slightly larger
def snap(self, x):
r = sqrt((x[0] - center2[0])**2 + (x[1] - center2[1])**2)
if r < 1.5*radius:
x[0] = center2[0] + (radius / r)*(x[0] - center2[0])
x[1] = center2[1] + (radius / r)*(x[1] - center2[1])
# Mark hole and extract submesh
hole = Hole()
hole2 = Hole2()
sub_domains = MeshFunction(
sub_domains.
hole.mark(
hole2.mark(
mesh = SubMesh(mesh, sub_domains, 0)
mesh.snap_
mesh.snap_
# Refine and snap mesh
plot(mesh, title="Mesh 0")
num_refinements = 3
for i in range(num_
# Mark cells for refinement
markers = MeshFunction(
markers.
for cell in cells(mesh):
if cell.midpoint(
# Refine mesh
mesh = refine(mesh, markers)
# Snap boundary
mesh.
mesh.
# Plot mesh
#plot(mesh, title=("Mesh %d" % (i + 1)))
#interactive()
# Initialize mesh function for interior domains
boundaries = CellFunction(
boundaries.
hole.mark(
hole2.mark(
h = CellSize(mesh)
# Create mesh and define function space
V = FunctionSpace(mesh, "CG", 1)
R = FunctionSpace(mesh, "R", 0)
W = V * R
# Define input data
a0 = Constant(1.0)
a1 = Constant(0.01)
g_L = Expression("- 10*exp(- pow(x[1] - 0.5, 2))")
g_R = Constant("1.0")
f = Constant(1.0)
# Define function space and basis functions
V = FunctionSpace(mesh, "CG", 2)
u = TrialFunction(V)
v = TestFunction(V)
# Define Dirichlet boundary conditions at top and bottom boundaries
bcs = [DirichletBC(V, 1.0, boundaries, 1),
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Sven Fanghänel for more information if necessary.