| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Nice. Make it the default, compute in geometry preprocessing when necessary, no opt-in |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Proposed Changes
This PR adds an opt-in option, CACHE_LSQ_METRICS (default NO), caches the factorized metric terms of the (weighted or unweighted) least-squares gradients. The LSQ normal matrix A depends only on the node coordinates and on the weighting, yet it is currently re-assembled and re-factorized on every gradient evaluation, every nonlinear iteration. With the option enabled:
Saved operations (per node per gradient evaluation, 3D, k edge-neighbors, N variables)
Eliminated from every evaluation after the first:
What remains is the RHS accumulation (~4N flops per node per edge) and one S*b product (18N flops per node). For the N=6 compressible primitives this roughly halves the gradient-kernel flops; for scalar solvers (N=1-2, e.g. SA) where the assembly dominates it is a ~4-5x reduction. Measured end-to-end (serial, linear-solver work held fixed): ~3.3% of total wall time on an inviscid ONERA M6 (57.5k nodes, tets, one gradient set per iteration) and ~6% on a 2D RANS-SA case (three LSQ gradient sets per iteration). Cases dominated by the linear solver will see proportionally less.
Memory footprint
The cache adds nDim*(nDim+1)/2 su2doubles per node per weighting used (48 B/node per weighting in 3D, 24 B/node in 2D; at most two weightings), allocated lazily per grid level and shared by all solvers. For reference, every solver already allocates an nDim*nDim Rmatrix scratch (72 B/node in 3D), so for a typical RANS case the addition is small compared to the existing gradient machinery and negligible compared to overall solver memory.
Validation
With the option enabled, results are identical to develop (to output precision) for:
config_template.cfg documents the new option. Default behavior (CACHE_LSQ_METRICS= NO) is bit-identical to current develop.