BUG: MismatchingDomainErrors can occur when using R spaces with Submesh
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Ejecuta el ejemplo mínimo del issue para reproducir el fallo. Empieza siguiendo firedrake/assemble.py a través de firedrake/tsfc_interface.py hasta tsfc/driver.py, especialmente validate_domains en el traceback. Se considera terminado cuando la R-space, Submesh y la forma div se ensamblan y resuelven sin MismatchingDomainError, con una prueba de regresión que cubra el ejemplo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
MismatchingDomainErrors can occur when using R spaces with Submesh. Peculiarly, this only started happening once I began using the div operator in my forms. See MFE below. If you comment out the line involving div, the error no longer occurs.
from firedrake import *
# Create the unlabelled mesh
mesh = UnitSquareMesh(4, 4)
x_sc, y_sc = SpatialCoordinate(mesh)
# Create the left-half submesh and measures
DG0 = FunctionSpace(mesh, "DG", 0)
tag_L = Function(DG0).interpolate(conditional(lt(x_sc, 0.5), 1, 0))
label_L = 1
mesh = RelabeledMesh(mesh, [tag_L], [label_L])
mesh_L = Submesh(mesh, 2, label_L)
dx_M = Measure("dx", domain=mesh)
dx_L = Measure("dx", domain=mesh_L, intersect_measures=[dx(domain=mesh)])
# Function spaces
CG_L = FunctionSpace(mesh_L, "CG", 1)
BDM = FunctionSpace(mesh, "BDM", 1)
R = FunctionSpace(mesh, "R", 0)
S = CG_L * BDM * R
# Variational problem
sln = Function(S)
u, tau, l = split(sln)
v, sigma, r = TestFunctions(S)
res = u * v * dx_L \
+ dot(tau, sigma) * dx_M \
+ l * r * dx_M \
+ div(tau) * div(sigma) * dx_M # To make the error go away, comment out this line,
# OR, get rid of the CG space,
# OR, get rid of the R space.
u, tau, l = sln.subfunctions
u.interpolate(1) # Make the residual nonzero so it does a solve
# Below solve fails
NonlinearVariationalSolver(NonlinearVariationalProblem(res, sln)).solve()
This fails with the message:
Traceback (most recent call last):
File "petsc4py/PETSc/libpetsc4py.pyx", line 1541, in petsc4py.PETSc.PCSetUp_Python
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/preconditioners/base.py", line 214, in setUp
super().setUp(pc)
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/preconditioners/base.py", line 54, in setUp
self.initialize(pc)
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/preconditioners/assembled.py", line 54, in initialize
self.P = form_assembler.allocate()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/assemble.py", line 1382, in allocate
self._make_maps_and_regions())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/assemble.py", line 1415, in _make_maps_and_regions
elif any(local_kernel.indices == (None, None) for assembler in self._all_assemblers for local_kernel, _ in assembler.local_kernels):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/assemble.py", line 1415, in <genexpr>
elif any(local_kernel.indices == (None, None) for assembler in self._all_assemblers for local_kernel, _ in assembler.local_kernels):
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/functools.py", line 995, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/assemble.py", line 1110, in local_kernels
kernels = tsfc_interface.compile_form(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/pyop2/caching.py", line 583, in wrapper
value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/pyop2/caching.py", line 583, in wrapper
value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/tsfc_interface.py", line 251, in compile_form
tsfc_kernel = TSFCKernel(
^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/tsfc_interface.py", line 111, in __init__
tree = tsfc_compile_form(form, prefix=name, parameters=parameters,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/pyop2/caching.py", line 583, in wrapper
value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/pyop2/caching.py", line 583, in wrapper
value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/tsfc/driver.py", line 96, in compile_form
validate_domains(form_data.preprocessed_form)
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/tsfc/driver.py", line 202, in validate_domains
raise MismatchingDomainError("Argument or Coefficient domain not found in integral. "
tsfc.exceptions.MismatchingDomainError: Argument or Coefficient domain not found in integral. Possibly, the form contains coefficients on different meshes and requires measure intersection, for example: Measure("dx", argument_mesh, intersect_measures=[Measure("dx", coefficient_mesh)]).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/baierreinio/Downloads/test.py", line 43, in <module>
NonlinearVariationalSolver(NonlinearVariationalProblem(res, sln)).solve()
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/adjoint_utils/variational_solver.py", line 108, in wrapper
out = solve(self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/scratch/baierreinio/firedrake_dev_aaron_submesh/firedrake/firedrake/variational_solver.py", line 398, in solve
self.snes.solve(None, work)
File "petsc4py/PETSc/SNES.pyx", line 1740, in petsc4py.PETSc.SNES.solve
petsc4py.PETSc.Error: error code 101
[0] SNESSolve() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/snes/interface/snes.c:4875
[0] SNESSolve_NEWTONLS() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/snes/impls/ls/ls.c:220
[0] KSPSolve() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/ksp/interface/itfunc.c:1092
[0] KSPSolve_Private() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/ksp/interface/itfunc.c:840
[0] KSPSetUpOnBlocks() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/ksp/interface/itfunc.c:219
[0] PCSetUpOnBlocks() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/pc/interface/precon.c:1154
[0] PCSetUpOnBlocks_FieldSplit_Schur() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:1115
[0] KSPSetUp() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/ksp/interface/itfunc.c:428
[0] PCSetUp() at /scratch/baierreinio/firedrake_dev_aaron_submesh/petsc/src/ksp/pc/interface/precon.c:1117
- Lenguaje dominante
- Python
- Estrellas
- 684
- Forks
- 204
- Merge medio
- 4 d 14 h
- PR fusionados (30 d)
- 46
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firedrakeproject/firedrake
-
BUG: NonlinearVariationalSolver errors with adj_kwargsPosiblemente ocupada @dham la tomó hace 151 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
firedrakeproject/firedrake#5186 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
firedrakeproject/firedrake#5091 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
firedrakeproject/firedrake#3556 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
firedrakeproject/firedrake#5644 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Function.assign on a subset fails with a Constant, a Real Function or abs in the expressionPosiblemente ocupada @connorjward la tomó hace 2 días. Abierto
firedrakeproject/firedrake#5643 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de firedrakeproject/firedrake
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
datamodel-code-generator/datamodel-code-generator#6906 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
UKGovernmentBEIS/optstop#12 ·
-
bug good first issue severity: low
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
TMHSDigital/Awesome-Ads#37 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
smokin-salmon/smoked-salmon#1095 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Sienna-Platform/SiennaSchemas#130 ·
Los mantenedores suelen responder en 3 días