Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 42 additions & 30 deletions src/underworld3/cython/petsc_generic_snes_solvers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from petsc4py import PETSc

import underworld3
import underworld3 as uw
from underworld3.utilities._jitextension import getext
from underworld3.utilities._jitextension import getext, JITCallbackSet
import underworld3.timing as timing

from underworld3.utilities._api_tools import uw_object
Expand Down Expand Up @@ -1542,15 +1542,19 @@ class SNES_Scalar(SolverBaseClass):
print(f"Scalar SNES: Jacobians complete, now compile", flush=True)

prim_field_list = [self.u]
_getext_result = getext(self.mesh,
tuple(fns_residual),
tuple(fns_jacobian),
[x.fn for x in self.essential_bcs],
tuple(fns_bd_residual),
tuple(fns_bd_jacobian),
primary_field_list=prim_field_list,
verbose=verbose,
debug=debug,)
_getext_result = getext(
self.mesh,
JITCallbackSet(
residual=tuple(fns_residual),
bcs=tuple(x.fn for x in self.essential_bcs),
jacobian=tuple(fns_jacobian),
bd_residual=tuple(fns_bd_residual),
bd_jacobian=tuple(fns_bd_jacobian),
),
prim_field_list,
verbose=verbose,
debug=debug,
)
self.compiled_extensions = _getext_result.ptrobj
self.ext_dict = _getext_result.fn_dicts
self.constants_manifest = _getext_result.constants_manifest
Expand Down Expand Up @@ -2291,15 +2295,19 @@ class SNES_Vector(SolverBaseClass):
# note also that the order here is important.

prim_field_list = [self.u,]
_getext_result = getext(self.mesh,
tuple(fns_residual),
tuple(fns_jacobian),
[x.fn for x in self.essential_bcs],
tuple(fns_bd_residual),
tuple(fns_bd_jacobian),
primary_field_list=prim_field_list,
verbose=verbose,
debug=debug,)
_getext_result = getext(
self.mesh,
JITCallbackSet(
residual=tuple(fns_residual),
bcs=tuple(x.fn for x in self.essential_bcs),
jacobian=tuple(fns_jacobian),
bd_residual=tuple(fns_bd_residual),
bd_jacobian=tuple(fns_bd_jacobian),
),
prim_field_list,
verbose=verbose,
debug=debug,
)
self.compiled_extensions = _getext_result.ptrobj
self.ext_dict = _getext_result.fn_dicts
self.constants_manifest = _getext_result.constants_manifest
Expand Down Expand Up @@ -3669,17 +3677,21 @@ class SNES_Stokes_SaddlePt(SolverBaseClass):
print(f"Stokes: Jacobians complete, now compile", flush=True)

prim_field_list = [self.u, self.p]
_getext_result = getext(self.mesh,
tuple(fns_residual),
tuple(fns_jacobian),
[x.fn for x in self.essential_bcs],
tuple(fns_bd_residual),
tuple(fns_bd_jacobian),
primary_field_list=prim_field_list,
verbose=verbose,
debug=debug,
debug_name=debug_name,
cache=False)
_getext_result = getext(
self.mesh,
JITCallbackSet(
residual=tuple(fns_residual),
bcs=tuple(x.fn for x in self.essential_bcs),
jacobian=tuple(fns_jacobian),
bd_residual=tuple(fns_bd_residual),
bd_jacobian=tuple(fns_bd_jacobian),
),
prim_field_list,
verbose=verbose,
debug=debug,
debug_name=debug_name,
cache=False,
)
self.compiled_extensions = _getext_result.ptrobj
self.ext_dict = _getext_result.fn_dicts
self.constants_manifest = _getext_result.constants_manifest
Expand Down
12 changes: 7 additions & 5 deletions src/underworld3/cython/petsc_maths.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sympy

import underworld3
import underworld3.timing as timing
from underworld3.utilities._jitextension import getext
from underworld3.utilities._jitextension import getext, JITCallbackSet

from petsc4py import PETSc

Expand Down Expand Up @@ -89,7 +89,8 @@ class Integral:
self.dm = self.mesh.dm # .clone()
mesh=self.mesh

_getext_result = getext(self.mesh, [self.fn,], [], [], [], [], self.mesh.vars.values(), verbose=verbose)
_getext_result = getext(self.mesh, JITCallbackSet(residual=(self.fn,)),
self.mesh.vars.values(), verbose=verbose)
cdef PtrContainer ext = _getext_result.ptrobj

# Pull out vec for variables, and go ahead with the integral
Expand Down Expand Up @@ -273,7 +274,8 @@ class CellWiseIntegral:
elif isinstance(self.fn, sympy.vector.Dyadic):
raise RuntimeError("Integral evaluation for Dyadic integrands not supported.")

cdef PtrContainer ext = getext(self.mesh, [self.fn,], [], [], [], [], self.mesh.vars.values()).ptrobj
cdef PtrContainer ext = getext(self.mesh, JITCallbackSet(residual=(self.fn,)),
self.mesh.vars.values()).ptrobj

# Pull out vec for variables, and go ahead with the integral
self.mesh.update_lvec()
Expand Down Expand Up @@ -388,8 +390,8 @@ class BdIntegral:

# Compile integrand using the boundary residual slot (includes petsc_n[] in signature)
_getext_result = getext(
self.mesh, [], [], [], [self.fn,], [], self.mesh.vars.values(), verbose=verbose
)
self.mesh, JITCallbackSet(bd_residual=(self.fn,)),
self.mesh.vars.values(), verbose=verbose)
cdef PtrContainer ext = _getext_result.ptrobj

# Prepare the solution vector
Expand Down
Loading
Loading