old release and new release for ubuntu
Hello,
I implemented SUPG for convection-
I need to compute a local minimum ...
In the previous version of FEnics everything was ok, now I try to compile it in the new one and there is an error message.
Here is my code
from dolfin import *
NUM_CELL = 64
mesh = UnitSquare(
h = CellSize(mesh)
# Create FunctionSpaces
V = FunctionSpace(mesh, "CG", 1)
W = FunctionSpace(mesh, "DG", 0)
# Boundaries case
def right(x, on_boundary): return x[0] > (1.0 - DOLFIN_EPS)
def left(x, on_boundary): return x[0] < DOLFIN_EPS
def bottom_center(x, on_boundary):
return x[1] < DOLFIN_EPS and (x[0] > 1./3. - DOLFIN_EPS and x[0] < 2./3.0 + DOLFIN_EPS)
def bottom_lr(x, on_boundary):
return x[1] < DOLFIN_EPS and (x[0] < 1./3. + DOLFIN_EPS or x[0] > 2./3.0 - DOLFIN_EPS)
def top(x, on_boundary):
return x[1] > 1.0 - DOLFIN_EPS
g0 = Constant(0.0)
g1 = Constant(1.0)
# No-slip boundary condition for velocity
bc0 = DirichletBC(V, g1, bottom_center)
bc1 = DirichletBC(V, g0, bottom_lr)
bc3 = DirichletBC(V, g0, top)
bc4 = DirichletBC(V, g0, right)
# Collect boundary conditions
bcs = [bc0, bc1, bc4, bc3]
# Parameters
epsilon = Constant(0.00001)
c = Constant(0.0)
f = Constant(0.0)
b = Expression(
uh = TrialFunction(V)
vh = TestFunction(V)
wh = TestFunction(W)
bb = assemble(
bF = Function(W,bb)
min_par = min(((sqrt(
#######
a1 = epsilon*
a2 = h/(2.*sqrt(
a = a1 + a2
L = f*vh*dx + h/(2.*sqrt(
# Compute solution
uh = Function(V)
solve(a == L, uh, bcs)
and here is the error message
UFL conditions cannot be evaluated as bool in a Python context.
Traceback (most recent call last):
File "supg_ex2.py", line 58, in <module>
min_par = min(((sqrt(
File "/usr/lib/
error("UFL conditions cannot be evaluated as bool in a Python context.")
File "/usr/lib/
raise self._exception
ufl.log.
What should I change?
Thank you in advance
Fotini
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 Fotini Karakatsani for more information if necessary.