subdomain marking problem
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
I tried to apply the protocol for marking cells using the based on the poisson problem with two materials example (http://
Thanks for your help
pete
from dolfin import *
import sys, math, numpy
import numpy as np
class Omega0(SubDomain):
def inside(self, x, on_boundary):
return True if x[1] <= 0.5 else False
class Omega1(SubDomain):
def inside(self, x, on_boundary):
return True if x[1] >= 0.5 else False
if(1):
nx = 4; ny = 6
mesh = UnitSquare(nx, ny)
#mesh = Mesh('nohole.xml')
mesh = Mesh('hole.xml')
# Define a MeshFunction over two subdomains
subdomains = MeshFunction(
# Mark subdomains with numbers 0 and 1
subdomain0 = Omega0()
subdomain0.
subdomain1 = Omega1()
subdomain1.
# Discontinuous basis is used for boundary condition
# LAter, continuous basis used for PDE solution
V0 = FunctionSpace(mesh, 'DG', 0)
k = Function(V0)
print 'mesh:', mesh
print 'subdomains:', subdomains
print 'k:', k
import numpy
help = numpy.asarray(
#print help
print "bad ", np.where(help>1)
k.vector()[:] = numpy.choose(help, k_values)