Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/galerkintoolkit/galerkintoolkit.jl
FEM toolbox with automatic code generation, HPC support, and more.
https://github.com/galerkintoolkit/galerkintoolkit.jl
code-generation computational-science finite-element-methods hpc julia metaprogramming mpi pdes scientific-computing
Last synced: about 2 months ago
JSON representation
FEM toolbox with automatic code generation, HPC support, and more.
- Host: GitHub
- URL: https://github.com/galerkintoolkit/galerkintoolkit.jl
- Owner: GalerkinToolkit
- License: mit
- Created: 2022-05-28T08:35:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T12:14:08.000Z (about 2 months ago)
- Last Synced: 2024-10-25T07:32:32.140Z (about 2 months ago)
- Topics: code-generation, computational-science, finite-element-methods, hpc, julia, metaprogramming, mpi, pdes, scientific-computing
- Language: Julia
- Homepage:
- Size: 6 MB
- Stars: 22
- Watchers: 2
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# GalerkinToolkit
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://GalerkinToolkit.github.io/GalerkinToolkit.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://GalerkinToolkit.github.io/GalerkinToolkit.jl/dev/)
[![Build Status](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/GalerkinToolkit/GalerkinToolkit.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/GalerkinToolkit/GalerkinToolkit.jl)
[![DOI](https://zenodo.org/badge/497260571.svg)](https://doi.org/10.5281/zenodo.13938389)## What
This package aims at providing a fully-fledged finite-element toolbox in pure Julia, with support for different computing systems from laptops to supercomputers and GPUs.
NB. This package is work in progress; a proof-of-concept API is already available (for CPUs). The package is not production ready at this point. Planned performance and documentation improvements are needed.
## Why
This package follows a new approach to implement finite-element methods based on the lessons learned in the [Gridap](https://github.com/gridap/Gridap.jl) project.
## Acknowledgments
Since July 2024, this package is being developed with support from the [Netherlands eScience Center](https://www.esciencecenter.nl/) under grant ID [NLESC.SS.2023.008](https://research-software-directory.org/projects/hp2sim).
## Documentation
- [**STABLE**](https://GalerkinToolkit.github.io/GalerkinToolkit.jl/stable) — **Documentation for the most recently tagged version.**
- [**LATEST**](https://GalerkinToolkit.github.io/GalerkinToolkit.jl/dev) — *Documentation for the in-development version.*## Help and discussion
- You can open a new discussion to ask questions [here](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/discussions).
- If you have found a bug, open an issue [here](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/issues). Do not forget to include a (minimal) reproducer.## Contributing
This package is under active development and there are several ways to contribute:
- by enhancing the documentation (e.g., fixing typos, enhancing doc strings, adding examples).
- by addressing one of the [issues waiting for help](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/labels/help%20wanted).
- by adding more tests to increase the code coverage.
- by extending the current functionality. In this case, open a discussion [here](https://github.com/GalerkinToolkit/GalerkinToolkit.jl/discussions) to coordinate with the package maintainers before proposing significant changes.Discuss with the package authors before working on any non-trivial contribution.
## Examples
### "Hello world" Laplace PDE
The following code solves a Laplace PDE with Dirichlet boundary conditions.
```julia
import GalerkinToolkit as GT
import ForwardDiff
using LinearAlgebra
mesh = GT.mesh_from_gmsh("assets/demo.msh")
GT.label_boundary_faces!(mesh;physical_name="boundary")
Ω = GT.interior(mesh)
Γd = GT.boundary(mesh;physical_names=["boundary"])
k = 2
V = GT.lagrange_space(Ω,k;dirichlet_boundary=Γd)
uhd = GT.dirichlet_field(Float64,V)
u = GT.analytical_field(sum,Ω)
GT.interpolate_dirichlet!(u,uhd)
dΩ = GT.measure(Ω,2*k)
gradient(u) = x->ForwardDiff.gradient(u,x)
∇(u,x) = GT.call(gradient,u)(x)
a(u,v) = GT.∫( x->∇(u,x)⋅∇(v,x), dΩ)
l(v) = 0
x,A,b = GT.linear_problem(uhd,a,l)
x .= A\b
uh = GT.solution_field(uhd,x)
GT.vtk_plot("results",Ω) do plt
GT.plot!(plt,u;label="u")
GT.plot!(plt,uh;label="uh")
end
```### Multi-field example
This code solves the same boundary value problem, but using an auxiliary field of Lagrange
multipliers to impose Dirichlet boundary conditions.```julia
import GalerkinToolkit as GT
import ForwardDiff
using LinearAlgebra
mesh = GT.mesh_from_gmsh("assets/demo.msh")
GT.label_boundary_faces!(mesh;physical_name="boundary")
Ω = GT.interior(mesh)
Γd = GT.boundary(mesh;physical_names=["boundary"])
k = 2
V = GT.lagrange_space(Ω,k)
Q = GT.lagrange_space(Γd,k-1; conformity=:L2)
VxQ = V × Q
dΓd = GT.measure(Γd,2*k)
gradient(u) = x->ForwardDiff.gradient(u,x)
∇(u,x) = GT.call(gradient,u)(x)
a((u,p),(v,q)) =
GT.∫( x->∇(u,x)⋅∇(v,x), dΩ) +
GT.∫(x->
(u(x)+p(x))*(v(x)+q(x))
-u(x)*v(x)-p(x)*q(x), dΓd)
l((v,q)) = GT.∫(x->u(x)*q(x), dΓd)
x,A,b = GT.linear_problem(Float64,VxQ,a,l)
x .= A\b
uh,qh = GT.solution_field(VxQ,x)
GT.vtk_plot("results",Ω) do plt
GT.plot!(plt,u;label="u")
GT.plot!(plt,uh;label="uh")
end
```