Spurious artifacts in parallel IO or Paraview plotting
Issue #843
closed
Running the following snippet with mpirun -n 4
from dolfin import *
def solve_(mesh):
RT = FiniteElement("RT", mesh.ufl_cell(), 1)
DG = FiniteElement("DG", mesh.ufl_cell(), 0)
W = FunctionSpace(mesh, RT * DG)
(sigma, u) = TrialFunctions(W)
(tau, v) = TestFunctions(W)
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)",
degree=2, mpi_comm=mesh.mpi_comm())
a = (dot(sigma, tau) + div(tau)*u + div(sigma)*v)*dx
L = - f*v*dx
class BoundarySource(Expression):
def __init__(self, mesh, **kwargs):
self.mesh = mesh
def eval_cell(self, values, x, ufc_cell):
cell = Cell(self.mesh, ufc_cell.index)
n = cell.normal(ufc_cell.local_facet)
g = sin(5*x[0])
values[0] = g*n[0]
values[1] = g*n[1]
def value_shape(self):
return (2,)
G = BoundarySource(mesh, degree=2)
def boundary(x):
return x[1] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS
bc = DirichletBC(W.sub(0), G, boundary)
w = Function(W)
solve(a == L, w, bc)
return w
if __name__ == "__main__":
rank = MPI.rank(mpi_comm_world())
# Save parellel solution
mesh = UnitSquareMesh(32, 32)
w = solve_(mesh)
XDMFFile(mesh.mpi_comm(), "w4.xdmf").write(w.sub(0))
File("w4.pvd") << w.sub(0, deepcopy=True)
# Save sequential solution
if rank == 0:
mesh = UnitSquareMesh(mpi_comm_self(), 32, 32)
w = solve_(mesh)
XDMFFile(mesh.mpi_comm(), "w0.xdmf").write(w.sub(0))
File("w0.pvd") << w.sub(0, deepcopy=True)
and comparing parallel and sequential plots in Paraview 5.2.0 shows spurious artifacts on partition boundaries in parallel solution (see attached images). This might be a deficiency in Paraview.
Comments (2)
-
reporter -
reporter - changed status to closed
Will be resolved by
#844for XDMF and probably won't fix for VTK. - Log in to comment
This is cause probably by an interpolation of RT function, which is discontinuous, onto continuous P1 function.