Closed Yinshaninfuture closed 1 year ago
Are you sure that you are running v0.6.0? It works for me. The error it shows seems related to the changes made in 0.7.0. Anyway, if you write
omega = Constant(msh, PETSc.ScalarType(1))
k0 = Constant(msh, PETSc.ScalarType(1))
instead of
omega = Constant(V, PETSc.ScalarType(1))
k0 = Constant(V, PETSc.ScalarType(1))
it shoul work fine. The migration to v0.7.0 will be not straightforward, since a lot of fundamental stuff has changed.
I run it on the FEniCS 0.6.0, but I got this error. Traceback (most recent call last): File "/mnt/c/Users/u0143102/Desktop/amls/autogen_LC_PML-main/helmholtz_with_PML.py", line 57, in
LAMBDA_PML, detJ, omega, k0, msh, cell_tags, facet_tags = PML_Functions(CAD_name, mesh_size_max, Num_layers, d_PML)
File "/mnt/c/Users/u0143102/Desktop/amls/autogen_LC_PML-main/autogen_LC_PML.py", line 169, in PML_Functions
omega = Constant(V, PETSc.ScalarType(1))
File "/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/function.py", line 42, in init
super().init(domain, c.shape)
File "/usr/lib/python3/dist-packages/ufl/constant.py", line 26, in init
self._ufl_domain = as_domain(domain)
File "/usr/lib/python3/dist-packages/ufl/domain.py", line 272, in as_domain
return extract_unique_domain(domain)
File "/usr/lib/python3/dist-packages/ufl/domain.py", line 345, in extract_unique_domain
domains = extract_domains(expr)
File "/usr/lib/python3/dist-packages/ufl/domain.py", line 338, in extract_domains
for t in traverse_unique_terminals(expr):
File "/usr/lib/python3/dist-packages/ufl/corealg/traversal.py", line 134, in traverse_unique_terminals
for op in unique_pre_traversal(expr, visited=visited):
File "/usr/lib/python3/dist-packages/ufl/corealg/traversal.py", line 70, in unique_pre_traversal
visited.add(expr)
TypeError: unhashable type: 'FunctionSpace'