diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ad96d2c..153b9802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # FEniCS-preCICE adapter changelog -## latest +## v2.2.0 * Use `copy(deepcopy=True)` when checkpointing to make checkpointing more user-friendly and secure. IMPORTANT: might increase runtime, please open an issue if you face serious problems. [#172](https://github.com/precice/fenics-adapter/pull/172) * Add unit tests for checkpointing. [#173](https://github.com/precice/fenics-adapter/pull/173) +* Add required version of `mpi4py` to `<4` to avoid crash during installation. [#181](https://github.com/precice/fenics-adapter/pull/181) +* Remove checks for FEniCS installation and python3 from `setup.py` since the approach is deprecated. [#182](https://github.com/precice/fenics-adapter/pull/182) ## 2.1.0 diff --git a/CITATION.cff b/CITATION.cff index 759c6345..fa1d48a9 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -32,7 +32,7 @@ abstract: >- preCICE-adapter for the open source computing platform FEniCS. license: LGPL-3.0 -version: 2.1.0 +version: 2.2.0 preferred-citation: title: "FEniCS-preCICE: Coupling FEniCS to other Simulation Software" type: "article" diff --git a/README.md b/README.md index 5f97135c..234b240a 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,18 @@ preCICE-adapter for the open source computing platform FEniCS. It is recommended to install [fenicsprecice from PyPI](https://pypi.org/project/fenicsprecice/) via ```bash -pip3 install --user fenicsprecice +pip3 install fenicsprecice ``` +For more recent pip versions you may encounter the error `error: externally-managed-environment` during installation of the fenicsprecice. You can read why [here](https://packaging.python.org/en/latest/specifications/externally-managed-environments/). In this case, it is recommended to create a virtual environment and install the package in the virtual environment. The following commands will create the virtual environment `venv_name` at the location `path/of/your/venv/`: + +```bash +python3 -m venv --system-site-packages path/of/your/venv/venv_name +. path/of/your/venv/venv_name/bin/activate +``` + +You can replace `path/of/your/venv/venv_name` with the location and name you want to use for your virtual environment. The command `--system-size-packages` will allow the virtual environment to access the FEniCS installation on your system. Refer to the [Python documentation](https://docs.python.org/3/library/venv.html) for further details on virtual environments. + This should work out of the box, if all dependencies are installed correctly. If you face problems during installation or you want to run the tests, see below for a list of dependencies and alternative installation procedures ### Clone this repository and use pip3 diff --git a/docs/ReleaseGuide.md b/docs/ReleaseGuide.md index 6365b0dc..3ee4eaa7 100644 --- a/docs/ReleaseGuide.md +++ b/docs/ReleaseGuide.md @@ -19,10 +19,39 @@ Before starting this process make sure to check that all relevant changes are in a) If a pre-release is made: Directly hit the "Publish release" button in your Release Draft. Now you can check the artifacts (e.g. release on [PyPI](https://pypi.org/project/fenicsprecice/#history)) of the release. *Note:* As soon as a new tag is created github actions will take care of deploying the new version on PyPI using [this workflow](https://github.com/precice/fenics-adapter/actions?query=workflow%3A%22Upload+Python+Package%22). - b) If this is a "real" release: As soon as one approving review is made, merge the release PR (`fenics-adapter-vX.X.X`) into `master`. + b) If this is a "real" release: As soon as one approving review is made, merge the release PR (`fenics-adapter-vX.X.X`) into `master`. Use **Merge pull request**, don't squash the commits. 5. Merge `master` into `develop` for synchronization of `develop`. 6. If everything is in order up to this point then the new version can be released by hitting the "Publish release" button in your Release Draft. 7. Now there should be a tag for the release. Re-run the [docker release workflow `build-docker.yml` via dispatch](https://github.com/precice/fenics-adapter/actions/workflows/build-docker.yml) such that the correct version is picked up by `versioneer`. Check the version in the container via `docker pull precice/fenics-adapter`, then `docker run -ti precice/fenics-adapter`, and inside the container `$ python3 -c "import fenicsprecice; print(fenicsprecice.__version__)"`. + +8. Add an empty commit (details see [here](https://github.com/precice/python-bindings/issues/109)) on master by running the steps: + + ```bash + git checkout master + git commit --allow-empty -m "post-tag bump" + git push + ``` + + Check that everything is in order via `git log`. Important: The `tag` and `origin/master` should not point to the same commit. For example: + + ```bash + commit 9d0d6bf978b2363c7ee041201df4322f930dd456 (HEAD -> master) + Author: Benjamin Rodenberg + Date: Thu Oct 31 08:52:07 2024 +0100 + + post-tag bump + + commit 0d8eecb54b4bc582f33f5f38fca77dfe6161a237 (origin/master) + Merge: f3abeb0 8ca28ae + Author: Benjamin Rodenberg + Date: Thu Oct 31 08:41:36 2024 +0100 + + Merge pull request #184 from precice/fenics-adapter-v2.2.0 + + Release v2.2.0 + ``` + + For more details refer to [this issue](https://github.com/precice/python-bindings/issues/109) and [this issue](https://github.com/python-versioneer/python-versioneer/issues/217). diff --git a/fenicsprecice/fenicsprecice.py b/fenicsprecice/fenicsprecice.py index e766f7d7..97da5e5d 100644 --- a/fenicsprecice/fenicsprecice.py +++ b/fenicsprecice/fenicsprecice.py @@ -432,7 +432,7 @@ def initialize(self, coupling_subdomain, read_function_space=None, write_object= self._participant.initialize() - def store_checkpoint(self, payload, t, n): + def store_checkpoint(self, payload, t = None, n = None): """ Defines an object of class SolverState which stores the current state of the variable and the time stamp. @@ -440,9 +440,9 @@ def store_checkpoint(self, payload, t, n): ---------- payload : fenics.function or a list of fenics.functions Current state of the physical variable(s) of interest for this participant. - t : double + t : double (optional) Current simulation time. - n : int + n : int (optional) Current time window (iteration) number. """ if self._first_advance_done: @@ -459,14 +459,25 @@ def retrieve_checkpoint(self): ------- u : FEniCS Function Current state of the physical variable of interest for this participant. - t : double + t : double (optional) Current simulation time. - n : int + n : int (optional) Current time window (iteration) number. """ assert (not self.is_time_window_complete()) logger.debug("Restore solver state") - return self._checkpoint.get_state() + + # since t and n are optional, they should not be returned, if not specified + payload, t, n = self._checkpoint.get_state() + match (t, n): + case (None, None): + return payload + case (_, None): + return payload, t + case (None, _): + return payload, n + case _: + return payload, t, n def advance(self, dt): """ diff --git a/setup.py b/setup.py index 1b277b9e..df8b2120 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,6 @@ import os from setuptools import setup import versioneer -import warnings - -# from https://stackoverflow.com/a/9079062 -import sys -if sys.version_info[0] < 3: - raise Exception("fenicsprecice only supports Python3. Did you run $python setup.py