Hello,
I would like to implement an DG interior penalty for convection diffusion
equation and I need to determine the inflow and outflow boundary
and the inflow and outflow facets.
I have implemented the following
omega_outflow = MeshFunction("uint", mesh, mesh.topology().dim()-1)
a = Constant((1.0, 1.0)) n = FacetNormal(mesh)
omega_outflow.set_all(0)
class Boundary_Outflow(SubDomain):
def __init__(self, n, a):
SubDomain.__init__(self)
self.n = n
self.a = a
def inside(self, x, on_boundary):
tol = 1E-14
print 'x', x[0], x[1]
return on_boundary and dot(self.n(x), self.a(x)) < tol
outflow = Boundary_Outflow(n,a)
outflow.mark(omega_outflow, 1)
plot(omega_outflow)
but I got the following error message
Expecting dim to match the geometric dimension, got dim=1 and gdim=2.
Traceback (most recent call last):
File "theta_dg_convection_diffusion.py", line 199, in <module>
outflow.mark(omega_outflow, 1)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/cpp/mesh.py", line 5106, in mark
self._mark(*args)
File "theta_dg_convection_diffusion.py", line 196, in inside
return on_boundary and dot(self.n(x), self.n(x)) < tol
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/exproperators.py", line 295, in _call
return _eval(self, arg, mapping, component)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/exproperators.py", line 281, in _eval
f = expand_derivatives(self, dim)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/algorithms/ad.py", line 81, in expand_derivatives
"got dim=%r and gdim=%r." % (dim, gdim))
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/assertions.py", line 37, in ufl_assert
if not condition: error(*message)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/log.py", line 154, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Expecting dim to match the geometric dimension, got dim=1 and gdim=2.
and I do not understand what is the problem.
Thank you very much in advance,
Fotini