Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into JDBetteridge/update_build_…
Browse files Browse the repository at this point in the history
…system
  • Loading branch information
JDBetteridge committed Nov 8, 2024
2 parents febeac3 + 8ede8bd commit 9168553
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you already have NGSolve (with MPI support) and PETSc installed, you can inst
git clone https://github.com/UZerbinati/ngsPETSc.git
pip install ./ngsPETSc
```
Alternatively, you can also build PETSc, SLEPc, and NGSolve from source following the instructions in the [documentation](https://ngspetsc.readthedocs.io/en/latest/installation.html).
Alternatively, you can also build PETSc, SLEPc, and NGSolve from source following the instructions in the [documentation](https://ngspetsc.readthedocs.io/en/latest/install.html).

### Testing
To test the installation, you can run the tests in the `tests` folder, via the Makefile in the root directory of the repository:
Expand Down
18 changes: 9 additions & 9 deletions docs/src/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ First we install all the needed packages using apt and pip or an equivalent pack
::
apt-get update
apt-get -y install git build-essential cmake python3 python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev g++ libglu1-mesa-dev liblapacke-dev libblas-dev liblapack-dev
pip install numpy cython pytest pytest-mpi
pip install numpy cython pytest pytest-mpi netgen-occt

We now install PETSc from scratch in a suitable folder, with OpenMPI, HYPRE, Metis, MUMPS, SuprLU, Scalapack and eigen.
::
git clone https://gitlab.com/petsc/petsc.git
cd petsc
python configure --download-chaco \
--download-cmake \
--download-eigen \
python configure --download-cmake \
--download-openmpi \
--download-hypre \
--download-metis \
Expand All @@ -28,13 +26,13 @@ We now install PETSc from scratch in a suitable folder, with OpenMPI, HYPRE, Met
--download-mumps \
--download-scalapack \
--download-superlu_dist \
--download-fblaslapack=1 \
--with-c2html=0 \
--with-cxx-dialect=C++11 \
--with-debugging=0 \
--download-fblaslapack=1 \
--with-fortran-bindings=0 \
--with-shared-libraries=1 \
--with-petsc4py=1 \
--with-petsc4py=1

To build PETSc you need to run the Makefile as suggested at the end of the configuration script.
We now need to set in the ``.bashrc`` (on OSX in ``.bash_profile``) file the ``PETSC_DIR``, ``PETSC_ARCH`` system variables as they appear when we finish build PETSc.
You also need to add to your ``PYTHONPATH`` the ``PYTHONPATH`` that appears when we finished building PETSc.
Expand Down Expand Up @@ -68,12 +66,14 @@ Now we build NGSolve from source.
mkdir $BASEDIR/ngsolve-build
mkdir $BASEDIR/ngsolve-install
cd $BASEDIR/ngsolve-build
cmake -DCMAKE_INSTALL_PREFIX=${BASEDIR}/ngsolve-install ${BASEDIR}/ngsolve-src -DUSE_MPI=ON
cmake -DCMAKE_INSTALL_PREFIX=${BASEDIR}/ngsolve-install ${BASEDIR}/ngsolve-src -DUSE_MPI=ON -DUSE_OCC=ON
make
make install

You should add to your ``.bashrc`` the ``BASEDIR`` system variable:
::
echo "export $BASEDIR=${BASEDIR}" >> ~/.bashrc
echo "export $BASEDIR=${BASEDIR}" >> ~/.bashrc

We suggest you add the following lines to your ``.bashrc``:
::
export NETGENDIR="${BASEDIR}/ngsolve-install/bin"
Expand Down
3 changes: 1 addition & 2 deletions ngsPETSc/utils/fenicsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def model_to_mesh(self, hmax: float, gdim: int = 2,
[_MPI.Comm, int, int, dolfinx.cpp.graph.AdjacencyList_int32],
dolfinx.cpp.graph.AdjacencyList_int32] =
dolfinx.mesh.create_cell_partitioner(dolfinx.mesh.GhostMode.none),
transform: typing.Any = None, routine: typing.Any = None) -> typing.Tuple[dolfinx.mesh.Mesh,
dolfinx.cpp.mesh.MeshTags_int32,dolfinx.cpp.mesh.MeshTags_int32]:
transform: typing.Any = None, routine: typing.Any = None) -> dolfinx.mesh.Mesh:
"""Given a NetGen model, take all physical entities of the highest
topological dimension and create the corresponding DOLFINx mesh.
Expand Down
81 changes: 81 additions & 0 deletions paper/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ @article{Firedrake
year={2023},
doi= {10.25561/104839}
}
@article{TETGEN,
author = {Si, Hang},
title = {TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator},
year = {2015},
issue_date = {January 2015},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {41},
number = {2},
issn = {0098-3500},
url = {https://doi.org/10.1145/2629697},
doi = {10.1145/2629697},
journal = {ACM Trans. Math. Softw.},
month = feb,
articleno = {11},
numpages = {36}
}
@techreport{PETSc,
author={Satish Balay and Shrirang Abhyankar and Mark~F. Adams and Steven Benson and Jed
Brown and Peter Brune and Kris Buschelman and Emil Constantinescu and Lisandro
Expand Down Expand Up @@ -181,3 +198,67 @@ @article{stevenson2006
R.},
year={2006},
pages={245--269} }
@article{FreeFEM,
title={FreeFem++ manual},
author={Hecht, Fr{\'e}d{\'e}ric and Pironneau, Olivier and Le Hyaric, A and Ohtsuka, K},
journal={Laboratoire Jacques Louis Lions},
year={2005}
}
@Article{DUNE,
author={Dedner, Andreas
and Kl{\"o}fkorn, Robert
and Nolte, Martin
and Ohlberger, Mario},
title={A generic interface for parallel and adaptive discretization schemes: abstraction principles and the Dune-Fem module},
journal={Computing},
year={2010},
month={Nov},
day={01},
volume={90},
number={3},
pages={165-196},
issn={1436-5057},
doi={10.1007/s00607-010-0110-3},
url={https://doi.org/10.1007/s00607-010-0110-3}
}
@Article{dealII,
title = {The \texttt{deal.II} Library, Version 9.5},
author = {Daniel Arndt and Wolfgang Bangerth and Maximilian Bergbauer and
Marco Feder and Marc Fehling and Johannes Heinz and
Timo Heister and Luca Heltai and Martin Kronbichler and
Matthias Maier and Peter Munch and Jean-Paul Pelteret and
Bruno Turcksin and David Wells and Stefano Zampini},
journal = {Journal of Numerical Mathematics},
year = {2023},
doi = {10.1515/jnma-2023-0089},
pages = {231--246},
volume = {31},
number = {3},
url = {https://dealii.org/deal95-preprint.pdf}
}
@misc{dolfinX,
author = {Baratta, Igor A. and
Dean, Joseph P. and
Dokken, Jørgen S. and
Habera, Michal and
Hale, Jack S. and
Richardson, Chris N. and
Rognes, Marie E. and
Scroggs, Matthew W. and
Sime, Nathan and
Wells, Garth N.},
title = {{DOLFINx: The next generation FEniCS problem solving environment}},
month = dec,
year = 2023,
publisher = {Zenodo},
doi = {10.5281/zenodo.10447666},
url = {https://doi.org/10.5281/zenodo.10447666}
}
@article{GMSH,
title={A three-dimensional finite element mesh generator with built-in pre-and post-processing facilities},
author={Geuzaine, Christophe and Remacle, Jean-Fran{\c{c}}ois},
journal={International Journal for Numerical Methods in Engineering},
volume={11},
pages={79},
year={2020}
}
22 changes: 16 additions & 6 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ authors:
- name: Patrick E. Farrell
orcid: 0000-0002-1241-7060
equal-contrib: true
affiliation: 3
- name: Matthias Hochsteger
orcid: 0009-0001-8842-3221
equal-contrib: true
affiliation: 2
- name: Christopher Lackner
orcid: 0009-0000-3448-3002
equal-contrib: true
affiliation: 2
- name: Joachim Schöberl
affiliation: 3
affiliation: 2,4
equal-contrib: true
orcid: 0000-0002-1250-5087
- name: Stefano Zampini
orcid: 0000-0002-0435-0433
equal-contrib: true
affiliation: 4
affiliation: 5
- name: Umberto Zerbinati
orcid: 0000-0002-2577-1106
corresponding: true
Expand All @@ -29,19 +37,21 @@ authors:
affiliations:
- name: Imperial College London, United Kingdom
index: 1
- name: University of Oxford, United Kingdom
- name: CERBSim GmbH, Austria
index: 2
- name: TU Wien, Austria
- name: University of Oxford, United Kingdom
index: 3
- name: King Abdullah University of Science and Technology, Saudi Arabia
- name: TU Wien, Austria
index: 4
- name: King Abdullah University of Science and Technology, Saudi Arabia
index: 5
date: 1 July 2024
bibliography: paper.bib
---

# Summary

Combining advanced meshing techniques with robust solver capabilities is essential for solving difficult problems in computational science and engineering. This paper introduces ngsPETSc, software built with petsc4py [@petsc4py] that seamlessly integrates the NETGEN mesher [@Netgen], the NGSolve finite element library [@NGSolve], and the PETSc toolkit [@PETSc]. ngsPETSc enables the use of NETGEN meshes and geometries in PETSc-based solvers, and provides NGSolve users access to the wide array of linear, nonlinear solvers, and time-steppers available in PETSc.
Combining advanced meshing techniques with robust solver capabilities is essential for solving difficult problems in computational science and engineering. In recent years, various software packages have been developed to support the integration of meshing tools with finite element solvers. To mention a few, FreeFEM [@FreeFEM] includes built-in support for mesh generation, allowing users to create and manipulate meshes directly within the software. Similarly, deal.II [@dealII] provides a GridGenerator class for generating standard mesh geometries like grids and cylinders. Furthermore, deal.II can interface with OpenCASCADE [@OpenCASCADE] to refine existing grids while conforming to the geometry provided. Other finite element libraries, such as Firedrake [@Firedrake], DUNE-FEM [@DUNE], and FEniCSx [@dolfinX], rely on external tools like Gmsh [@GMSH] and Tetgen [@TETGEN] for mesh generation. This paper introduces ngsPETSc, software built with petsc4py [@petsc4py] that seamlessly integrates the NETGEN mesher [@Netgen], the NGSolve finite element library [@NGSolve], and the PETSc toolkit [@PETSc]. ngsPETSc enables the use of NETGEN meshes and geometries in PETSc-based solvers, and provides NGSolve users access to the wide array of linear, nonlinear solvers, and time-steppers available in PETSc.

# Statement of Need

Expand Down

0 comments on commit 9168553

Please sign in to comment.