Unexpected asymmetry of solution of Poisson equation
Dear all, I'm solving Poisson equation and I found some irregularity. Here the code: from firedrake import * mesh = UnitSquareMesh(8, 8, quadrilateral=True) V = FunctionSpace(mesh, "CG", 1) W = FunctionSpace(mesh, "DG", 0) w = Function(W) w.interpolate(Expression(1)) #Initial material distribution bc0 = DirichletBC(V, Expression(("0")), 1) bc1 = DirichletBC(V, Expression(("0")), 2) bc2 = DirichletBC(V, Expression(("0")), 3) bc3 = DirichletBC(V, Expression(("0")), 4) bcs = [bc0, bc1, bc2, bc3] u = TrialFunction(V) v = TestFunction(V) f = Function(V) f.interpolate(Expression("1")) L = f * v * dx rhs = assemble(L) a = (w * dot(grad(u), grad(v))) * dx frm = assemble(a, bcs = bcs) sol = Function(V) solve(frm, sol, rhs, solver_parameters = {'ksp_type': 'preonly', 'pc_type': 'lu'}) File("u.pvd") << sol The asymmetry of solution (see the figure attached) is clearly visible: for example, upper left element is not the same as upper right. I'm wondering what causes this and can this be remedied? Also, I'm getting exactly same result (with the same asymmetry) on triangular, not quadrilateral mesh. Why solutions of triangular and quadrilateral meshes are the same? Sincerely, George
The asymmetry of solution (see the figure attached) is clearly visible: for example, upper left element is not the same as upper right.
Looking at your image, I think they are the same. What you see is a visualisation artefact of Paraview: the interior of quadrilaterals isn't calculated through bilinear interpolation, but quadrilaterals are split into two triangles along one of the diagonals, and then the interior of each triangle is filled using linear interpolation. ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of George Ovchinnikov <lives9@gmail.com> Sent: 01 August 2016 11:08:17 To: firedrake Subject: [firedrake] Unexpected asymmetry of solution of Poisson equation Dear all, I'm solving Poisson equation and I found some irregularity. Here the code: from firedrake import * mesh = UnitSquareMesh(8, 8, quadrilateral=True) V = FunctionSpace(mesh, "CG", 1) W = FunctionSpace(mesh, "DG", 0) w = Function(W) w.interpolate(Expression(1)) #Initial material distribution bc0 = DirichletBC(V, Expression(("0")), 1) bc1 = DirichletBC(V, Expression(("0")), 2) bc2 = DirichletBC(V, Expression(("0")), 3) bc3 = DirichletBC(V, Expression(("0")), 4) bcs = [bc0, bc1, bc2, bc3] u = TrialFunction(V) v = TestFunction(V) f = Function(V) f.interpolate(Expression("1")) L = f * v * dx rhs = assemble(L) a = (w * dot(grad(u), grad(v))) * dx frm = assemble(a, bcs = bcs) sol = Function(V) solve(frm, sol, rhs, solver_parameters = {'ksp_type': 'preonly', 'pc_type': 'lu'}) File("u.pvd") << sol The asymmetry of solution (see the figure attached) is clearly visible: for example, upper left element is not the same as upper right. I'm wondering what causes this and can this be remedied? Also, I'm getting exactly same result (with the same asymmetry) on triangular, not quadrilateral mesh. Why solutions of triangular and quadrilateral meshes are the same? Sincerely, George
participants (2)
- 
                
                George Ovchinnikov
- 
                
                Homolya, Miklós