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

Enable use of different Jacobian implementations with 1D solver #1836

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

speth
Copy link
Member

@speth speth commented Jan 2, 2025

Changes proposed in this pull request

  • Generalize PreconditionerBase (now renamed SystemJacobian) to be able represent both preconditioners ($M = I - \gamma J$) and the matrices needed for the pseudo-transient solver used by Sim1D ($M = J - \alpha \Delta t^{-1}$)
  • Refactor the MultiJac to be a derived class of PreconditionerBase and avoid direct inheritance from BandMatrix
  • Add methods to OneDim to allow setting the implementation of SystemJacobian to use
  • Introduce a SystemJacobian implementation that uses Eigen's sparse direct LU factorization
  • Improve selection of perturbations used when computing the finite difference Jacobian used by OneDim. The new perturbation sizes are based on those used by SUNDIALS, and generally improve the quality of the Jacobian (reducing the number of residual and Jacobian evaluations required to converge).

If applicable, fill in the issue number this pull request is fixing

This is preliminary work toward several planned improvements:

If applicable, provide an example illustrating new features this pull request is introducing

Besides supporting these other improvements, using the sparse LU solver provided by Eigen along with the improved Jacobian perturbations provides some significant speedups to the 1D solver. Using the Blanquart et al (2018) mechanism from here (194 species, 1156 reactions), I get the following timings for a laminar flame speed calculation:

  • Windows, using SUNDIALS to provide the banded solver:
    • baseline: 154.9 s
    • new Jacobian perturbations: 104.1 s (-34%)
    • sparse: 84.3 s (-46%)
  • Windows, using OpenBLAS to provide the banded solver (forced single threaded):
    • baseline: 105.5
    • new Jacobian perturbations: 99.1 s (-6%)
    • sparse: 84.3 s (-20%)
  • Linux, using MKL to provide the banded solver:
    • baseline (32 processors): 210.3 s wall time, 2064 s user CPU
    • banded, new Jacobian perturbations (1 processor): 190.4 s wall time (-9.4%)
    • sparse: 157.6 s wall time (-25%)

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant