Use of MeshFunction for BC yields singular matrix
Hello,
Below is a code that I slightly changed from the one Marie wrote in: https:/
The code solves a pure Neumann problem with mixed finite element. When I use MeshFunction to mark all the boundary facets and then apply the boundary condition with this MeshFunction instance, the resulting coefficient matrix of the system is singular. What is wrong here?
Allan
-------
from dolfin import *
# Create mesh
mesh = UnitSquare(32, 32)
# Define function spaces and mixed (product) space
BDM = FunctionSpace(mesh, "BDM", 1)
DG = FunctionSpace(mesh, "DG", 0)
R = FunctionSpace(mesh, "R", 0)
W = MixedFunctionSp
# Define trial and test functions
(sigma, u, c) = TrialFunctions(W)
(tau, v, d) = TestFunctions(W)
# Define source function
f = Expression(
# Define variational form
a = (dot(sigma, tau) + div(tau)*u + div(sigma)*v + c*v + d*u)*dx
L = - f*v*dx
# Define the boundary of the mesh
class Boundary(
def inside(self, x, on_boundary):
return on_boundary
# Define the boundary regions of the mesh
boundaries = MeshFunction(
Gamma = Boundary()
Gamma.mark(
# bc = DirichletBC(
# bc = DirichletBC(
bc = DirichletBC(
# Compute solution
problem = VariationalProb
w = Function(W)
w = problem.solve()
(sigma, u, c) = w.split()
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Marie Rognes
- Solved:
- Last query:
- Last reply: