Skip to content

Merge Jacobian coloring into PETSc solver#3161

Merged
ZedThree merged 18 commits into
nextfrom
petsc-solver-merge
Nov 3, 2025
Merged

Merge Jacobian coloring into PETSc solver#3161
ZedThree merged 18 commits into
nextfrom
petsc-solver-merge

Conversation

@bendudson
Copy link
Copy Markdown
Contributor

@bendudson bendudson commented Aug 15, 2025

Takes the coloring code from the snes/beuler solver, and merges it into the petsc solver. This uses the PETSc TS interface, enabling use of many time-integration algorithms, including sundials/cvode.

PETSc TS manual: https://petsc.org/release/manual/ts/

Use with e.g. solver:type=petsc solver:ts_type=beuler

Other ts_type choices include bdf, pseudo (https://petsc.org/release/manualpages/TS/TSPSEUDO/)
See list of methods here: https://petsc.org/release/overview/integrator_table/#integrator-table

Other solver settings include:

use e.g. petsc:ts_monitor, petsc:snes_monitor to print diagnostics; petsc:help to print the available PETSc options.

The combination of bdf method and STRUMPACK direct solver seems to be quite effective:

[solver]
type = petsc
ts_type = bdf
ksp_type = preonly
pc_type = lu

[petsc]
pc_factor_mat_solver_type = strumpack

That solves in 2 1/2 minutes a 2D transport problem that took CVODE (without preconditioning) 2 1/2 hours.

If PETSc is compiled with sundials (configure flag --download-sundials) then the Jacobian coloring and PETSc preconditioners can be used with CVODE (2.5.0):

[solver]
type = petsc
ts_type = sundials   # Use the CVODE solver through PETSc
pc_type = lu             # Jacobian coloring, then form preconditioner using LU
start_timestep = 0.01 # Otherwise fails on first step

[petsc]
pc_factor_mat_solver_type = strumpack

This solved the same 2D transport problem in 1 1/2 minutes.

There are many (many!) settings to try and tune.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants