Skip to content

Implement factorization reuse for lock exchange (#464) - #526

Open
Aditi-Naiknaware wants to merge 1 commit into
csrc-sdsu:mainfrom
Aditi-Naiknaware:issue-464-factorise-lock-exchange
Open

Aditi-Naiknaware wants to merge 1 commit into
csrc-sdsu:mainfrom
Aditi-Naiknaware:issue-464-factorise-lock-exchange

Conversation

@Aditi-Naiknaware

Copy link
Copy Markdown

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Example
  • Documentation

Description

This PR updates the C++ lock_exchange.cpp example to reuse the factorization of the pressure Poisson matrix across time steps.

The pressure matrix remains unchanged during the simulation while the right-hand side changes at each time step. The matrix is now factorized once before the time-stepping loop using Armadillo's spsolve_factoriser, and the stored factorization is reused for subsequent pressure solves.

Because the pressure Laplacian uses pure Neumann boundary conditions and is singular to working precision, allow_ugly is enabled for the SuperLU factorization.

The existing Eigen solver path is left unchanged.

Related Issues & Documents

QA Instructions, Screenshots, Recordings

Built the C++ project successfully and ran the existing C++ test suite.

  • 7/7 C++ tests passed.
  • Ran the default lock_exchange example before and after the change. The reported numerical results were unchanged.
  • Tested the higher-resolution configuration described in Add factorise to lock_exchange.cpp example #464 (b=50, d=5, m=800, n=160, dt=0.1). The simulation completed successfully.

To test the change, build the C++ examples and run the lock_exchange executable.

Keep-open request

  • I am requesting maintainer review for keep-open.

Reason:

I am actively working on the contribution associated with #464 and would appreciate maintainer review and feedback.

Added/updated tests?

  • Yes
  • No, and this is why: This change optimizes an existing example without changing its numerical method. I validated the change using the existing C++ test suite, the default lock_exchange simulation, and the higher-resolution configuration described in Add factorise to lock_exchange.cpp example #464.
  • I need help with writing tests

Read Contributing Guide and Code of Conduct

[optional] Are there any post deployment tasks we need to perform?

None.

[optional] What gif best describes this PR or how it makes you feel?

This branch has not been deployed

No deployments
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.

Add factorise to lock_exchange.cpp example

1 participant