Hi~ It’s been a while since I posted.
The reason I left a post is a problem occurred while editing ‘The equations of linear elasticity(link)’ example code to 2D, edit the load condition code and relocation write_mesh
code line.
When the edited code was executed in a mesh domain with a smaller size(e.g., 500 X 500) execution and xdmf file results were obtained without any problems.
But I declared a mesh domain of 1,000 X 1,000 in the code and open the xdmf file in paraview, the following vtk time-out error occurred.
The dolfinx version is 0.5.2
The paraview version I am using(in ubuntu, linux) is 5.10.0-RC1.
The error is
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c714783800): Algorithm vtkFileSeriesReader(0x55c711138e70) returned failure for request: vtkInformation (0x55c70ebf2210)
Debug: Off
Modified Time: 1739747
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c714783800): Algorithm vtkFileSeriesReader(0x55c711138e70) returned failure for request: vtkInformation (0x55c70ebf2210)
Debug: Off
Modified Time: 1739747
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c714783800): Algorithm vtkFileSeriesReader(0x55c711138e70) returned failure for request: vtkInformation (0x55c70ebf2210)
Debug: Off
Modified Time: 1739747
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
ERROR: In ./VTK/Common/ExecutionModel/vtkExecutive.cxx, line 752
vtkPVCompositeDataPipeline (0x55c71a1d35b0): Algorithm vtkXdmfReader(0x55c7197f17b0) returned failure for request: vtkInformation (0x55c7147e6dd0)
Debug: Off
Modified Time: 1739634
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
The work code is
# import packages
import numpy as np
import ufl
from dolfinx import fem, mesh, io
from mpi4py import MPI
from petsc4py import PETSc
# scaled variable
_mu, lmd = PETSc.ScalarType(0.4), PETSc.ScalarType(0.6)
# input parameters
nelx = 1000 # no problem when set nelx = 500
nely = 1000 # no problem when set nely = 500
# function deblaration
sigma = lambda _u: 2.0*_mu*ufl.sym(ufl.grad(_u)) + lmd*ufl.tr(ufl.sym(ufl.grad(_u)))*ufl.Identity(len(_u))
psi = lambda _u: lmd/2*(ufl.tr(ufl.sym(ufl.grad(_u))) ** 2) + _mu*ufl.tr(ufl.sym(ufl.grad(_u))*ufl.sym(ufl.grad(_u)))
# set mesh & function space
msh = mesh.create_rectangle(MPI.COMM_WORLD, np.array([[0.0, 0.0], [nelx, nely]]), [nelx, nely], cell_type=mesh.CellType.quadrilateral)
U = fem.VectorFunctionSpace(msh, ("CG", 1))
D = fem.FunctionSpace(msh, ("DG", 0))
u, v = ufl.TrialFunction(U), ufl.TestFunction(U)
rho = fem.Function(D)
rho.vector.array = 1
# write mesh
with io.XDMFFile(MPI.COMM_WORLD, f"outfile/plot.xdmf", "w") as file:
file.write_mesh(msh)
# define support
def left_clamp(x):
return np.isclose(x[0], 0.0)
f_dim = msh.topology.dim - 1
bc_facets = mesh.locate_entities_boundary(msh, f_dim, left_clamp)
u_zero = np.array([0.0, 0.0], dtype=PETSc.ScalarType)
bc_l = fem.dirichletbc(u_zero, fem.locate_dofs_topological(U, f_dim, bc_facets), U)
bcs = [bc_l]
# define load
load_points = [(1, lambda x: np.logical_and(x[0] == nelx, x[1] <= 2))]
facet_indices, facet_markers = [], []
for (marker, locator) in load_points:
facets = mesh.locate_entities(msh, f_dim, locator)
facet_indices.append(facets)
facet_markers.append(np.full(len(facets), marker))
facet_indices = np.array(np.hstack(facet_indices), dtype=np.int32)
facet_markers = np.array(np.hstack(facet_markers), dtype=np.int32)
sorted_facets = np.argsort(facet_indices)
facet_tag = mesh.meshtags(msh, f_dim, facet_indices[sorted_facets], facet_markers[sorted_facets])
ds = ufl.Measure("ds", domain=msh, subdomain_data=facet_tag)
f = ufl.dot(v, fem.Constant(msh, (0.0, -1.0)))*ds(1)
# set linear problem
k = ufl.inner(rho ** 3.0*sigma(u), ufl.grad(v))*ufl.dx
problem = fem.petsc.LinearProblem(k, f, bcs=bcs, petsc_options={"ksp_type": "preonly", "pc_type": "lu", "pc_factor_mat_solver_type": "mumps"})
# solve problem
u_sln = problem.solve()
# write displacement
u_sln.name = "Deformation"
file.write_function(u_sln)
file.close()
There was no problem when the write_mesh
code line was executed as follows at the end line to solve the following error.
with io.XDMFFile(MPI.COMM_WORLD, f"outfile/plot.xdmf", "w") as file:
# write mesh
file.write_mesh(msh)
# write displacement
u_sln.name = "Deformation"
file.write_function(u_sln)
file.close()
In my opinion, I simply changed the location of write_mesh
, but I’m not sure why the vtk time-out error occurs.
Is this part a bug? Or is there a solution?
Thanks for reading the post.