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

Added global prom for maxwell equation #246

Merged
merged 5 commits into from
Nov 13, 2023
Merged

Added global prom for maxwell equation #246

merged 5 commits into from
Nov 13, 2023

Conversation

andersonw1
Copy link
Collaborator

@andersonw1 andersonw1 commented Nov 3, 2023

This PR adds a global prom example for the maxwell equation to libROM (based on MFEM ex3p).

Example runs
mpirun -np 8 maxwell_global_rom --offline -f 1.0 -id 0
mpirun -np 8 maxwell_global_rom --offline -f 1.1 -id 1
mpirun -np 8 maxwell_global_rom --offline -f 1.2 -id 2

Merge snapshots to make the basis
mpirun -np 8 maxwell_global_rom --merge -ns 3

Run full-order model
mpirun -np 8 maxwell_global_rom --fom -f 1.15

Use reduced-order model
mpirun -np 8 maxwell_global_rom --online -f 1.15

For this example:
Elapsed time for solving FOM: 4.906529e-01 second
Elapsed time for solving ROM: 1.010420e-04 second

Relative error of ROM solution = 0.00044228

Speedup: x4855.93

@andersonw1 andersonw1 changed the title Added global prom for maxwell equation (based on mfem ex3p) Added global prom for maxwell equation Nov 3, 2023
@andersonw1 andersonw1 added the RFR Ready for review label Nov 3, 2023
@siuwuncheung
Copy link
Member

There is a little red cross to the left of the commit number 34936f7, which indicates there are some failing checks. If you press it, you will see "CI / code-style (pull_request) Failing after 41s". That indicates some code styles need to be fixed, e.g. non-uniform indents, too-long lines. That's an automatic way to fix it through astyle. If you download from the source and build it, then in the parent directory of libROM just do ./scripts/stylize.sh -f ${PATH_TO_ASTYLE}

ran stylization and removed line of code initializing Hypre
// FOM solution: maxwell_global_rom -fom -f 1.15
//
// Online phase: maxwell_global_rom -online -f 1.15
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it also work in parallel, like poisson_global_rom?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tested in parallel and confirmed that it works, so you can copy the comment from the Poisson example:
// This example runs in parallel with MPI, by using the same number of MPI ranks
// in all phases (offline, merge, fom, online).

Changed saving mesh/sol files to calculate relative errors

Saved mesh/solution files are now in folders titled "maxwell" instead of "example3"
Copy link
Collaborator

@dylan-copeland dylan-copeland left a comment

Choose a reason for hiding this comment

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

Thanks @andersonw1!


// libROM stores the matrix row-wise, so wrapping as a DenseMatrix in MFEM means it is transposed.
DenseMatrix *reducedBasisT = new DenseMatrix(spatialbasis->getData(),
numColumnRB, numRowRB);
Copy link
Member

Choose a reason for hiding this comment

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

This seems unnecessary. The same object is defined in the global ROM for Poisson equation, both in C++ and Python side. Can @andersonw1 @dreamer2368 take care of it? Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I deleted this line and everything runs with the same result, so it seems this part was unnecessary.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. I'll take care of the Poisson equation.

@siuwuncheung
Copy link
Member

Looks good to me! Thanks @andersonw1 for the effort. Please run astyle again after addressing the comment. I'll approve it after that.

@andersonw1 andersonw1 merged commit fd15973 into master Nov 13, 2023
4 checks passed
@andersonw1 andersonw1 deleted the PROM_MAXWELL branch January 22, 2024 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants