Thanks a lot Nate for the heads up!
So now this is how I am trying to do it:
# we already have ft instance computed as described in the tutorial shared above
bnd_tag = 6 # physical tag assigned to the boundary/edge we want to compute the integral on
arc_indices = ft.indices[ft.values == bnd_tag]
arc_tags = dolfinx.mesh.meshtags(model.mesh, 1, arc_indices, 6)
dS = ufl.Measure("dS", domain=model.mesh, subdomain_data=arc_tags)
print(dolfinx.fem.assemble.assemble_scalar(dS))
In the print statement, I used assemble_scalar as I could not find assemble() function itself. However, this too gives me the following error:
Traceback (most recent call last):
File “/install/miniconda3/envs/fenics/lib/python3.9/site-packages/IPython/core/interactiveshell.py”, line 3398, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in <cell line: 1>
dolfinx.cpp.fem.assemble_scalar(dS)
TypeError: assemble_scalar(): incompatible function arguments. The following argument types are supported:
1. (M: dolfinx::fem::Form, constants: numpy.ndarray[numpy.float64], coefficients: Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.float64]]) → float
2. (M: dolfinx::fem::Form, constants: numpy.ndarray[numpy.float32], coefficients: Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.float32]]) → float
3. (M: dolfinx::fem::Form<std::complex >, constants: numpy.ndarray[numpy.complex128], coefficients: Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.complex128]]) → complex
Invoked with: Measure(‘interior_facet’, subdomain_id=‘everywhere’, domain=Mesh(VectorElement(FiniteElement(‘Lagrange’, triangle, 1, variant=‘equispaced’), dim=2, variant=‘equispaced’), 0), subdomain_data=<dolfinx.mesh.MeshTagsMetaClass object at 0x7f132a6e71d0>)
Did you forget to #include <pybind11/stl.h>
? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.
Obviously assemble_scalar was a guess, trying assemble_vector also leads to some other error. I would appreciate if anyone could pull me out of this