- attached dbc_test.py
ufl - dolfin DirichletBC value inconsistency
The script below creates two Dirichlet boundary conditions, one using ufl, and the other a dolfin Expression. Comparison of the two gives that the ufl based boundary condition is off by around 10^-7. Can the precision of the ufl expression based Dirichlet boundary conditions be improved?
Cheers, Gabriel
from dolfin import *
mesh = UnitSquareMesh(2, 2) V = FunctionSpace(mesh, "CG", 1)
t = Constant(1.0)
u_ufl = triangle.x[1]t u_exp = Expression("x[1]t", t = t)
bc_ufl = DirichletBC(V, u_ufl, "near(x[0], 1.0)") bc_exp = DirichletBC(V, u_exp, "near(x[0], 1.0)")
vals_exp = bc_exp.get_boundary_values().values() vals_ufl = bc_ufl.get_boundary_values().values()
print "Boundary values of the ufl expression", vals_exp print "Boundary values of the Expression", vals_ufl assert(vals_exp == vals_ufl)
Comments (4)
-
reporter -
reporter Cutting and pasting the script cause some * to be deleted. Please test with the attached file.
-
- changed status to resolved
This is not a bug report. Use fenicsproject.org/qa and repose the question.
-
- changed status to invalid
- Log in to comment