Measure 'vertex'

Hello, When I want to use Measure('dP') for bc Neumann at some points, I get the error:

Traceback (most recent call last):
  File "/mnt/h/sou/dP.py", line 49, in <module>
    problem = LinearProblem(a, L, [], u_solution)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/fem/petsc.py", line 766, in __init__
    self._L = _create_form(
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 249, in form
    return _create_form(form)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 244, in _create_form
    return _form(form)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 186, in _form
    ufcx_form, module, code = jit.ffcx_jit(
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/jit.py", line 51, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/jit.py", line 201, in ffcx_jit
    r = ffcx.codegeneration.jit.compile_forms([ufl_object], options=p_ffcx, **p_jit)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/codegeneration/jit.py", line 276, in compile_forms
    raise e
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/codegeneration/jit.py", line 256, in compile_forms
    impl = _compile_objects(
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/codegeneration/jit.py", line 383, in _compile_objects
    _, code_body = ffcx.compiler.compile_ufl_objects(
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/compiler.py", line 113, in compile_ufl_objects
    ir = compute_ir(analysis, _object_names, _prefix, options, visualise)
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/ir/representation.py", line 238, in compute_ir
    ir_forms = [
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/ir/representation.py", line 239, in <listcomp>
    _compute_form_ir(
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/ffcx/ir/representation.py", line 700, in _compute_form_ir
    ir["subdomain_ids"][integral_type] += subdomain_ids
KeyError: 'vertex'
Exception ignored in: <function LinearProblem.__del__ at 0x7f5104a32e60>
Traceback (most recent call last):
  File "/home/anton/miniconda3/envs/arccon-env/lib/python3.10/site-packages/dolfinx/fem/petsc.py", line 805, in __del__
    self._solver.destroy()
AttributeError: 'LinearProblem' object has no attribute '_solver'

Sample code:

mesh, ct, ft = read_from_msh('data/test2.msh', comm)

V = functionspace(mesh, ('Lagrange', 1))
sou = locate_sou(V, (0.5, 0.5, 0.5), 0, 1)  # indices of entities (dim=0)

dx = Measure('dx', domain=mesh, subdomain_data=ct)
ds = Measure('ds', domain=mesh, subdomain_data=ft)
dP = Measure('dP', domain=mesh, subdomain_data=sou)

u = TrialFunction(V)
v = TestFunction(V)

f = Constant(mesh, default_scalar_type(0))
g = Constant(mesh, default_scalar_type(1))

F = inner(grad(u), grad(v)) * dx - f * v * dx + inner(g, v) * dP
a = lhs(F)
L = rhs(F)

u_solution = Function(V)
problem = LinearProblem(a, L, [], u_solution)
problem.solve()

F without inner(g, v) * dP works.

See GitHub - scientificcomputing/scifem: Scientific finite element toolbox , demos about point sources.

1 Like