https://github.com/sloisel/multigridbarrierpetsc.jl
https://github.com/sloisel/multigridbarrierpetsc.jl
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sloisel/multigridbarrierpetsc.jl
- Owner: sloisel
- License: mit
- Created: 2025-11-19T20:24:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-19T11:44:33.000Z (6 months ago)
- Last Synced: 2025-12-22T03:57:06.953Z (6 months ago)
- Language: Julia
- Size: 740 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultiGridBarrierPETSc.jl
[](https://sloisel.github.io/MultiGridBarrierPETSc.jl/stable/)
[](https://sloisel.github.io/MultiGridBarrierPETSc.jl/dev/)
[](https://github.com/sloisel/MultiGridBarrierPETSc.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/sloisel/MultiGridBarrierPETSc.jl)
**A Julia package that bridges [MultiGridBarrier.jl](https://github.com/sloisel/MultiGridBarrier.jl) and [SafePETSc.jl](https://github.com/sloisel/SafePETSc.jl) for distributed multigrid barrier computations.**
MultiGridBarrierPETSc.jl extends MultiGridBarrier's API to work with PETSc's distributed Mat and Vec types, enabling efficient parallel computation of multigrid barrier methods across multiple MPI ranks.
## Quick Start
```julia
using MultiGridBarrierPETSc
MultiGridBarrierPETSc.Init() # Initialize MPI, PETSc, and MUMPS solver
# Solve a 2D finite element problem with PETSc distributed types
sol = fem2d_petsc_solve(Float64; L=3, p=1.0, verbose=false)
# Convert to native types for plotting
using MultiGridBarrier
sol_native = petsc_to_native(sol)
plot(sol_native)
```
## Key Features
- **Drop-in Replacement**: Seamlessly use PETSc types with MultiGridBarrier's API
- **Distributed Computing**: Leverage PETSc's distributed linear algebra for large-scale problems
- **Type Conversion**: Easy conversion between native Julia arrays and PETSc distributed types
- **MPI-Aware**: All operations correctly handle MPI collective requirements
- **Automatic MUMPS**: Direct solver automatically configured for accurate Newton iterations
## Installation
```julia
using Pkg
Pkg.add("MultiGridBarrierPETSc")
```
**Prerequisites:**
- Julia 1.10 or later
- MPI installation (OpenMPI, MPICH, or Intel MPI)
- PETSc with MUMPS (automatically installed via PETSc_jll.jl, or custom build for HPC)
See the [Installation Guide](https://sloisel.github.io/MultiGridBarrierPETSc.jl/dev/installation/) for detailed instructions.
## Documentation
- **[User Guide](https://sloisel.github.io/MultiGridBarrierPETSc.jl/dev/guide/)**: Workflows, examples, and best practices
- **[API Reference](https://sloisel.github.io/MultiGridBarrierPETSc.jl/dev/api/)**: Complete function documentation
- **[Examples](examples/)**: Runnable example scripts
## Running Examples
```bash
# Basic solve example
julia -e 'using MPI; run(`$(MPI.mpiexec()) -n 4 $(Base.julia_cmd()) examples/basic_solve.jl`)'
# Round-trip conversion example
julia -e 'using MPI; run(`$(MPI.mpiexec()) -n 4 $(Base.julia_cmd()) examples/roundtrip_conversion.jl`)'
```
Add `--project` or other Julia options as needed for your environment.
## Testing
Run the test suite with 4 MPI ranks:
```bash
julia --project=. -e 'using Pkg; Pkg.test()'
```
## Type Mappings
| Native Julia Type | PETSc Distributed Type | Storage |
|-------------------|------------------------|---------|
| `Matrix{T}` | `Mat{T, MPIDENSE}` | Dense distributed |
| `Vector{T}` | `Vec{T}` | Dense distributed |
| `SparseMatrixCSC{T,Int}` | `Mat{T, MPIAIJ}` | Sparse distributed |
## Package Ecosystem
- **[MultiGridBarrier.jl](https://github.com/sloisel/MultiGridBarrier.jl)**: Core multigrid barrier method
- **[SafePETSc.jl](https://github.com/sloisel/SafePETSc.jl)**: Safe PETSc bindings
- **[MPI.jl](https://github.com/JuliaParallel/MPI.jl)**: Julia MPI bindings
## Citation
If you use this package in your research, please cite:
```bibtex
@software{multigridbarrierpetsc,
author = {Loisel, Sebastien},
title = {MultiGridBarrierPETSc.jl: Distributed Multigrid Barrier Methods},
year = {2024},
url = {https://github.com/sloisel/MultiGridBarrierPETSc.jl}
}
```
## Development
To develop this package locally:
```bash
git clone https://github.com/sloisel/MultiGridBarrierPETSc.jl
cd MultiGridBarrierPETSc.jl
julia --project -e 'using Pkg; Pkg.instantiate()'
julia --project -e 'using Pkg; Pkg.test()'
```
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.