Skip to content

Optimisation: exploiting symmetry of binary diffusion coefficients#595

Merged
baperry2 merged 49 commits intoAMReX-Combustion:developmentfrom
ITV-RWTH:push_branch
Jul 22, 2025
Merged

Optimisation: exploiting symmetry of binary diffusion coefficients#595
baperry2 merged 49 commits intoAMReX-Combustion:developmentfrom
ITV-RWTH:push_branch

Conversation

@ThomasHowarth
Copy link
Copy Markdown
Contributor

@ThomasHowarth ThomasHowarth commented Jul 15, 2025

This pull request changes how diffusion coefficients are evaluated to exploit the symmetric nature of the D_ij matrix. The NUM_SPECIES^2 loops and arrays are now over a size NUM_SPECIES*(NUM_SPECIES+1)/2, which roughly halves the computational cost of evaluating diffusion coefficients.

Here is a tiny profile from the 2D flamesheet case in LMeX with the original implementation:
image

With the new implementation:
image

There's also a small tweak in the NASA polynomial computations that reuses the T2 and T3 values in computing the polynomial.

JustinFreiberger and others added 30 commits January 29, 2025 10:48
Instead of evaluation T2= T*T and T3=T*T*T do T3=T2*T
Co-authored-by: Terence Lehmann <[email protected]>
Copy link
Copy Markdown
Contributor

@baperry2 baperry2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this is a pretty solid performance gain.

But before merging we also need the qss mechanisms to be regenerated: https://amrex-combustion.github.io/PelePhysics/Ceptr.html#batched-generation-of-pele-compatible-mechanisms

Copy link
Copy Markdown
Contributor

@baperry2 baperry2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I get 0 diffs for TranEval for both LiDryer and CH4_lean_qss.

But it seems some extraneous changes came when regenerating the qss mechs due to the sympy stuff. I'll don't get those diffs when I regenerate so I'll push my versions. I think part but not all of the variability comes from us not being strict enough about the sympy version in pyproject.toml.

@baperry2 baperry2 merged commit 037c048 into AMReX-Combustion:development Jul 22, 2025
9 checks passed
@ThomasHowarth ThomasHowarth deleted the push_branch branch August 5, 2025 08:06
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.

4 participants