Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change solver in mixed Poisson #3558

Closed
wants to merge 3 commits into from
Closed
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
20 changes: 18 additions & 2 deletions python/demo/demo_mixed-poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@
from basix.ufl import element, mixed_element
from dolfinx import default_real_type, fem, io, mesh
from dolfinx.fem.petsc import LinearProblem
from ufl import Measure, SpatialCoordinate, TestFunctions, TrialFunctions, div, exp, inner
from ufl import (
Measure,
SpatialCoordinate,
TestFunctions,
TrialFunctions,
div,
exp,
inner,
)

msh = mesh.create_unit_square(MPI.COMM_WORLD, 32, 32, mesh.CellType.quadrilateral)

Expand Down Expand Up @@ -169,14 +177,22 @@ def f2(x):

bcs = [bc_top, bc_bottom]

# We choose the direct solver based on the integer type used in PETSc,
# as MUMPS has issues with 64-bit integers.
if PETSc.IntType == np.int32:
direct_solver = "mumps"
else:
direct_solver = "superlu_dist"

problem = LinearProblem(
a,
L,
bcs=bcs,
petsc_options={
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_mat_solver_type": "superlu_dist",
"pc_factor_mat_solver_type": direct_solver,
"ksp_error_if_not_converged": True,
},
)
try:
Expand Down
Loading