jorgensd / dolfinx-tutorial

A reimplementation of the Springer book: https://github.com/hplgit/fenics-tutorial/, covering new topics as well as transitioning from dolfin to dolfinx
https://jorgensd.github.io/dolfinx-tutorial/
103 stars 60 forks source link

Failed to create HDF5 file #102

Closed wnstss closed 1 year ago

wnstss commented 1 year ago

Hello, Everyone,

I am new to dolfinx. When I excuted the diffusion_code.py in chapter2, I found there were some problems about xdmf as follows. And the Diffusion_Gaussian_function_error.md is also attached.

RuntimeError Traceback (most recent call last) Cell In [1], line 31 28 boundary_facets = mesh.locate_entities_boundary( 29 domain, fdim, lambda x: np.full(x.shape[1], True, dtype=bool)) 30 bc = fem.dirichletbc(PETSc.ScalarType(0), fem.locate_dofs_topological(V, fdim, boundary_facets), V) ---> 31 xdmf = io.XDMFFile(domain.comm, "diffusion.xdmf", "w") 32 xdmf.write_mesh(domain) 34 # Define solution variable, and interpolate initial solution for visualization in Paraview

Could anyone give me some help?

Best regards,

Lei

Diffusion_Gaussian_function_error.md

jorgensd commented 1 year ago

How did you install DOLFINx? What system are you running this on? Is there already a diffusion.xdmf and diffusion.h5 file on your system? If so try removing them and rerunning the program

wnstss commented 1 year ago

Hi, jorgensd,

Thank you very much for your quick reply. I used Docker destop to run Fenicsx . Althought the diffusion.xdmf and diffusion.h5 file were deleted, the same error occured.

Could you give me some more advice?

Thank you very much.

Best regards,

Lei

jorgensd commented 1 year ago

What underlying system are you running docker on? Which docker image are you using? Could you provide the exact commands you are running, and what output ls -l gives in the current directory you are running the code from.

wnstss commented 1 year ago

Hi, jorgensd,

The messages are shown as follows.

ls -l

total 548 -rw-r--r-- 1 root root 959 Nov 4 02:06 20221104_test.ipynb -rw-r--r-- 1 root root 26466 Nov 7 05:24 20221107.ipynb -rw-r--r-- 1 root root 4640 Nov 7 07:54 Deflection_of_a_membrane.ipynb -rw-r--r-- 1 root root 7665 Nov 7 08:19 Diffusion_Gaussian_function_error.ipynb -rw-r--r-- 1 root root 29384 Nov 7 06:00 Untitled.ipynb -rw-r--r-- 1 root root 4640 Nov 7 06:01 Untitled1.ipynb -rw-r--r-- 1 root root 8485 Nov 7 06:15 Untitled2.ipynb -rw-r--r-- 1 root root 8580 Nov 7 06:20 Untitled3.ipynb -rw-r--r-- 1 root root 14208 Nov 7 07:54 Untitled4.ipynb -rw-r--r-- 1 root root 8321 Nov 7 07:17 Untitled5.ipynb -rw-r--r-- 1 root root 8078 Nov 7 08:21 Untitled6.ipynb -rw-r--r-- 1 root root 189984 Nov 7 10:54 diffusion.h5 -rw-r--r-- 1 root root 1037 Nov 7 10:54 diffusion.xdmf -rw-r--r-- 1 root root 189984 Nov 7 10:53 diffusion1107.h5 -rw-r--r-- 1 root root 1049 Nov 7 08:19 diffusion1107.xdmf -rw-r--r-- 1 root root 8321 Nov 7 07:54 heat_code1107.ipynb -rw-rw-r-- 1 root root 222 Nov 7 07:54 requirements.txt

print_screen1107

Thank you very much.

Lei

wnstss commented 1 year ago

Hi, jorgensd,

Thank you very much. I made some mistakens in inputting the code (dolfinx-tutorial/chapter2/diffusion_code.htm). Now I got the expected results.

Best regarads,

Lei