Skip to content

Commit

Permalink
Improvements for v0.7.0 release (#77)
Browse files Browse the repository at this point in the history
* Fixes for vector elements

* Single real precsision tested with all tests and demos. Supported almost everywhere

* Add stokes demo to docs.

* Rewrite usage of comms
* Fix BP4 engine choice for VTX
* Try fixing coverage issues of relative imports
  • Loading branch information
jorgensd authored Oct 28, 2023
1 parent 17c532e commit 33ff717
Show file tree
Hide file tree
Showing 54 changed files with 808 additions and 581 deletions.
6 changes: 3 additions & 3 deletions .github/actions/install-dolfinx/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ inputs:
petsc_arch: # id of input
description: 'PETSc Arch'
required: false
default: 'linux-gnu-real-32'
default: 'linux-gnu-real64-32'

runs:
using: composite


steps:
- name: Get Basix
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./basix
repository: FEniCS/basix
ref: ${{ inputs.basix }}

- name: Get DOLFINx
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./dolfinx
repository: FEniCS/dolfinx
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
container: ghcr.io/fenics/dolfinx/dev-env:nightly
container: ghcr.io/fenics/dolfinx/dev-env:v0.7.0-mpich
env:
# Directory that will be published on github pages
PUBLISH_DIR: ./docs/_build/html
PETSC_ARCH: "linux-gnu-real-32"
PUBLISH_DIR: ./_build/html
PETSC_ARCH: "linux-gnu-real64-32"

steps:
- uses: actions/checkout@v4
Expand All @@ -32,7 +32,7 @@ jobs:
run: python3 -m pip -v install python/[docs]

- name: Build docs
run: jupyter book build docs
run: jupyter book build .

- name: Upload documentation as artifact
uses: actions/upload-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ jobs:
path: "./public/code-coverage-report"

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
path: "./public"

- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v3

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v2
10 changes: 5 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ jobs:
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
branches:
- main


jobs:
build:
name: Build
Expand All @@ -16,15 +15,15 @@ jobs:
# avoid running on pull requests from forks
# which don't have access to secrets
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
container: ghcr.io/fenics/test-env:nightly-mpich
container: ghcr.io/fenics/dolfinx/dev-env:v0.7.0

env:
SONAR_SCANNER_VERSION:
4.8.0.2856 # Find the latest version in at:
# https://github.com/SonarSource/sonar-scanner-cli/tags
SONAR_SCANNER_VERSION: 5.0.1.3006 # Find the latest version in at: https://github.com/SonarSource/sonar-scanner-cli/tags
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
PETSC_ARCH: linux-gnu-real-32
PETSC_ARCH: linux-gnu-real64-32

PETSC_DIR: /usr/local/petsc
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -35,12 +34,12 @@ jobs:
apt-get -y update
apt-get install unzip
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

distribution: "zulu"
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand All @@ -67,7 +66,9 @@ jobs:
- name: Install DOLFINx
uses: ./.github/actions/install-dolfinx

with:
petsc_arch: ${PETSC_ARCH}

- name: Run build-wrapper
run: |
cmake -S ./cpp -B build-mpc
Expand All @@ -87,4 +88,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
30 changes: 18 additions & 12 deletions .github/workflows/test_mpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/fenics/test-env:nightly-mpich
container: ghcr.io/fenics/dolfinx/dev-env:v0.7.0

strategy:
matrix:
build_mode: [Release, Debug]
petsc_arch: [real, complex]
petsc_arch:
[
linux-gnu-complex128-32,
linux-gnu-complex64-32,
linux-gnu-real64-32,
linux-gnu-real32-32,
]
# Due to: https://gitlab.com/petsc/petsc/-/issues/1288
CXX: [c++]
#, clang++]
Expand All @@ -31,13 +37,13 @@ jobs:
# - CC: clang
# CXX: c++
env:
DOLFINX_BRANCH: "main"
BASIX_BRANCH: "main"
UFL_BRANCH: "main"
FFCX_BRANCH: "main"
DOLFINX_BRANCH: "v0.7.1"
BASIX_BRANCH: "v0.7.0"
UFL_BRANCH: "2023.2.0"
FFCX_BRANCH: "v0.7.0"
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
PETSC_ARCH: "linux-gnu-${{ matrix.petsc_arch }}-32"
PETSC_ARCH: "${{ matrix.petsc_arch }}"
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_rmaps_base_oversubscribe: 1
Expand Down Expand Up @@ -73,10 +79,9 @@ jobs:
cd python
python3 -m mypy . --exclude=build
- name: Install h5py (https://github.com/h5py/h5py/issues/2222)
- name: Install h5py
run: |
python3 -m pip install mpi4py cython numpy
python3 -m pip install --no-cache-dir --no-binary=h5py h5py --no-build-isolation
python3 -m pip install --no-cache-dir --no-binary=h5py h5py
- name: Install DOLFINx
uses: ./.github/actions/install-dolfinx
Expand All @@ -94,10 +99,11 @@ jobs:
cmake --install build-dir
- name: Install DOLFINx-MPC (Python)
run: CXX_FLAGS="${MPC_CMAKE_CXX_FLAGS}" python3 -m pip -v install python/[test]
run: CXX_FLAGS="${MPC_CMAKE_CXX_FLAGS}" python3 -m pip -v install -e python/[test]


- name: Run tests (serial)
run: coverage run --rcfile=.coveragerc -m mpi4py -m pytest python/tests/
run: coverage run --rcfile=.coveragerc -m mpi4py -m pytest python/tests/ -vs

- name: Run tests (2 processes)
run: mpirun -n 2 coverage run --rcfile=.coveragerc -m mpi4py -m pytest python/tests/ -vs
Expand Down
55 changes: 34 additions & 21 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
# Changelog

## main
## v0.7.0

- **API**:
- Change input of `dolfinx_mpc.MultiPointConstraint.homogenize` and `dolfinx_mpc.backsubstitution` to `dolfinx.fem.Function` instead of `PETSc.Vec`.
- Add support for more floating types (`dtype` can now be specified as input for coefficients). In theory this means one could support single precision. Not thoroughly tested.
- **New feature**: Add support for more floating types (float32, float64, complex64, complex128). The floating type of a MPC is related to the mesh geometry.
- This resulted in a minor refactoring of the pybindings, meaning that tte class `dolfinx_mpc.cpp.mpc.MultiPointConstraint` is replaced by `dolfinx_mpc.cpp.mpc.MultiPointConstraint_{dtype}`
- Casting scalar-type with `dolfinx.default_scalar_type` instead of `PETSc.ScalarType`
- Remove usage of `VectorFunctionSpace`. Use blocked basix element instead.
- **DOLFINX API-changes**:
- Use `dolfinx.fem.functionspace(mesh, ("Lagrange", 1, (mesh.geometry.dim, )))` instead of `dolfinx.fem.VectorFunctionSpace(mesh, ("Lagrange", 1))` as the latter is being deprecated.
- Use `basix.ufl.element` in favor of `ufl.FiniteElement` as the latter is deprecated in DOLFINx.

## v0.6.1 (30.01.2023)
- Fixes for CI
- Add auto-publishing CI
- Fixes for `h5py` installation

- Fixes for CI
- Add auto-publishing CI
- Fixes for `h5py` installation

## v0.6.0 (27.01.2023)
- Remove `dolfinx::common::impl::copy_N` in favor of `std::copy_n` by @jorgensd in #24
- Improving and fixing `demo_periodic_gep.py` by @fmonteghetti in #22 and @conpierce8 in #30
- Remove xtensor by @jorgensd in #25
- Complex valued periodic constraint (scale) by @jorgensd in #34
- Implement Hermitian pre-multiplication by @conpierce8 in #38
- Fixes for packaging by @mirk in #41, #42, #4
- Various updates to dependencies

- Remove `dolfinx::common::impl::copy_N` in favor of `std::copy_n` by @jorgensd in #24
- Improving and fixing `demo_periodic_gep.py` by @fmonteghetti in #22 and @conpierce8 in #30
- Remove xtensor by @jorgensd in #25
- Complex valued periodic constraint (scale) by @jorgensd in #34
- Implement Hermitian pre-multiplication by @conpierce8 in #38
- Fixes for packaging by @mirk in #41, #42, #4
- Various updates to dependencies

## v0.5.0 (12.08.2022)
- Minimal C++ standard is now [C++20](https://en.cppreference.com/w/cpp/20)
- Deprecating GMSH IO functions from `dolfinx_mpc.utils`, see: [DOLFINx PR: 2261](https://github.com/FEniCS/dolfinx/pull/2261) for details.
- Various API changes in DOLFINx relating to `dolfinx.common.IndexMap`.
- Made code [mypy](https://mypy.readthedocs.io/en/stable/)-compatible (tests added to CI).
- Made code [PEP-561](https://peps.python.org/pep-0561/) compatible.

- Minimal C++ standard is now [C++20](https://en.cppreference.com/w/cpp/20)
- Deprecating GMSH IO functions from `dolfinx_mpc.utils`, see: [DOLFINx PR: 2261](https://github.com/FEniCS/dolfinx/pull/2261) for details.
- Various API changes in DOLFINx relating to `dolfinx.common.IndexMap`.
- Made code [mypy](https://mypy.readthedocs.io/en/stable/)-compatible (tests added to CI).
- Made code [PEP-561](https://peps.python.org/pep-0561/) compatible.

## v0.4.0 (30.04.2022)

- **API**:

- **New feature**: Support for nonlinear problems (by @nate-sime) for mpc, see `test_nonlinear_assembly.py` for usage
- Updated user interface for `dolfinx_mpc.create_slip_constraint`. See documentation for details.
- **New feature**: Support for periodic constraints on sub-spaces. See `dolfinx_mpc.create_periodic_constraint` for details.
Expand All @@ -50,11 +58,13 @@
- `slave_cells` does now longer exist as it can be gotten implicitly from `cell_to_slaves`.

- **Performance**:

- Major rewrite of periodic boundary conditions. On average at least a 5 x performance speed-up.
- The C++ assembler has been fully rewritten.
- Various improvements to `ContactConstraint`.

- **Bugs**

- Resolved issue where `create_facet_normal_approximation` would give you a 0 normal for a surface dof it was not owned by any of the cells with facets on the surface.

- **DOLFINX API-changes**:
Expand All @@ -67,19 +77,22 @@
- Various internal changes to handle new way of JIT-compliation of `dolfinx::fem::Form_{scalar_type}`

## 0.3.0 (25.08.2021)

- Minor internal changes

## 0.2.0 (06.08.2021)

- Add new MPC constraint: Periodic boundary condition constrained geometrically. See `demo_periodic_geometrical.py` for use-case.
- New: `demo_periodic_gep.py` proposed and initally implemented by [fmonteghetti](https://github.com/fmonteghetti) using SLEPc for eigen-value problems.
This demo illustrates the usage of the new `diagval` keyword argument in the `assemble_matrix` class.
- New: `demo_periodic_gep.py` proposed and initally implemented by [fmonteghetti](https://github.com/fmonteghetti) using SLEPc for eigen-value problems.
This demo illustrates the usage of the new `diagval` keyword argument in the `assemble_matrix` class.

- **API**:

- Renaming and clean-up of `assemble_matrix` in C++
- Renaming of Periodic constraint due to additional geometrical constraint, `mpc.create_periodic_constraint` -> `mpc.create_periodic_constraint_geometrical/topological`.
- Introduce new class `dolfinx_mpc.LinearProblem` mimicking the DOLFINx class (Usage illustrated in `demo_periodic_geometrical.py`)
- Additional `kwarg` `b: PETSc.Vec` for `assemble_vector` to be able to re-use Vector.
- Additional `kwargs`: `form_compiler_parameters` and `jit_parameters` to `assemble_matrix`, `assemble_vector`, to allow usage of fast math etc.
- Additional `kwargs`: `form_compiler_parameters` and `jit_parameters` to `assemble_matrix`, `assemble_vector`, to allow usage of fast math etc.

- **Performance**:
- Slip condition constructor moved to C++ (Speedup for large problems)
Expand All @@ -90,6 +103,6 @@
- `dolfinx.cpp.la.scatter_forward(x)` is replaced by `x.scatter_forward()`
- Various interal updates to match DOLFINx API (including dof transformations moved outside of ffcx kernel)


## 0.1.0 (11.05.2021)

- First tagged release of dolfinx_mpc, compatible with [DOLFINx 0.1.0](https://github.com/FEniCS/dolfinx/releases/tag/0.1.0).
11 changes: 8 additions & 3 deletions docs/_config.yml → _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ title: "DOLFINx-MPC: An extension to DOLFINx for multi point constraints"
author: Jørgen S. Dokken
copyright: "2022"

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: force
execute_notebooks: cache

only_build_toc_files: true

# Information about where the book exists on the web
repository:
Expand All @@ -24,6 +23,7 @@ launch_buttons:
html:
use_issues_button: true
use_repository_button: true


parse:
myst_enable_extensions:
Expand All @@ -37,5 +37,10 @@ sphinx:
- 'sphinx.ext.napoleon'
- 'sphinx.ext.viewcode'

config:

nb_custom_formats:
.py:
- jupytext.reads
- fmt: py

12 changes: 12 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
format: jb-book
root: index

parts:
- caption: "Demos"
chapters:
- file: "python/demos/demo_stokes.py"
- caption: "Python API"
chapters:
- file: "docs/api"
- file: "docs/utils"
- file: "docs/numba"
Loading

0 comments on commit 33ff717

Please sign in to comment.