-
-
Notifications
You must be signed in to change notification settings - Fork 18
Release v2.2.0 #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Release v2.2.0 #184
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6350747
Use `benjaminrodenberg/fenics` for CI stage "Build and Test" (#174)
BenjaminRodenberg 5e713b8
Fix link
BenjaminRodenberg f78286f
Fix link (typo in previous commit)
BenjaminRodenberg 8e0dfa5
Update setup.py (#175)
BenjaminRodenberg 98fcd95
Tests checking implementation of checkpointing/SolverState (#173)
NiklasVin b04e6c9
Fix autopep8.
BenjaminRodenberg 8716694
Use `copy(deepcopy=true)` for checkpointing (#172)
BenjaminRodenberg 2d1894b
Add changelog entry.
BenjaminRodenberg b3a9a28
Remove checks for FEniCS and python3 (#182)
BenjaminRodenberg 250ccdb
Modify `setup.py` to avoid crash due to version 4.0.0 of `mpi4py` dur…
NiklasVin 8ca28ae
bump version
BenjaminRodenberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| from unittest.mock import MagicMock | ||
| from unittest import TestCase | ||
| from fenics import FunctionSpace, UnitSquareMesh, Expression, interpolate | ||
| from fenicsprecice.solverstate import SolverState | ||
|
|
||
|
|
||
| class TestCheckpointing(TestCase): | ||
| def test_solverstate_basic(self): | ||
| """ | ||
| Check if correct values are read from the checkpoint, while the state of the object that is copied is not changed | ||
| """ | ||
| n = 1 | ||
| size = 5 | ||
| mesh = UnitSquareMesh(size, size) | ||
| V = FunctionSpace(mesh, 'P', 2) | ||
| dummy_value = 1 | ||
| E = Expression("t", t=dummy_value, degree=2) | ||
| u = interpolate(E, V) | ||
|
|
||
| # "write checkpoint" | ||
| sstate = SolverState(u, dummy_value, n) | ||
| # "read checkpoint" | ||
| u_cp, t_cp, n_cp = sstate.get_state() | ||
|
|
||
| # check values | ||
| self.assertEqual(t_cp, dummy_value) | ||
| self.assertEqual(n, n_cp) | ||
| # function should be the same everywhere (-> check vector values of the function) | ||
| vec_u = u.vector() | ||
| vec_u_cp = u_cp.vector() | ||
| for i in range(size * size): | ||
| self.assertAlmostEqual(vec_u[i], vec_u_cp[i]) | ||
|
|
||
| def test_solverstate_modification_vector(self): | ||
| """ | ||
| Check if correct values are read from the checkpoint, if the dof vector of the dolfin functions are changed directly | ||
|
|
||
| Motivation for this test: Related to https://github.com/precice/fenics-adapter/pull/172 and https://github.com/precice/tutorials/pull/554 | ||
| """ | ||
| n = 1 | ||
| size = 5 | ||
| mesh = UnitSquareMesh(size, size) | ||
| V = FunctionSpace(mesh, 'P', 2) | ||
| ref_value = 1 | ||
| E = Expression("t", t=ref_value, degree=2) | ||
| u = interpolate(E, V) | ||
|
|
||
| # "write checkpoint" | ||
| sstate = SolverState(u, ref_value, n) | ||
|
|
||
| # modify state of u | ||
| dummy_value = ref_value + 2 | ||
| u.vector()[:] = dummy_value | ||
|
|
||
| # "read checkpoint" | ||
| u_cp, _, _ = sstate.get_state() | ||
|
|
||
| # check values | ||
| # function should be the same everywhere | ||
| # (so the vector values should all be ref_value) | ||
| vec_u_cp = u_cp.vector() | ||
| for i in range(size * size): | ||
| self.assertAlmostEqual(ref_value, vec_u_cp[i]) | ||
|
|
||
| def test_solverstate_modification_assign(self): | ||
| """ | ||
| Check if correct values are read from the checkpoint, if the dof of the dolfin functions are changed with the assign function | ||
| and not directly via the dof vector | ||
| """ | ||
| n = 1 | ||
| size = 5 | ||
| mesh = UnitSquareMesh(size, size) | ||
| V = FunctionSpace(mesh, 'P', 2) | ||
| ref_value = 1 | ||
| E = Expression("t", t=ref_value, degree=2) | ||
| u = interpolate(E, V) | ||
|
|
||
| # "write checkpoint" | ||
| sstate = SolverState(u, ref_value, n) | ||
|
|
||
| # modify state of u | ||
| # "compute" new solution | ||
| dummy_value = ref_value + 2 | ||
| E.t = dummy_value | ||
| u2 = interpolate(E, V) | ||
| u.assign(u2) | ||
|
|
||
| # "read checkpoint" | ||
| u_cp, _, _ = sstate.get_state() | ||
|
|
||
| # check values | ||
| # function should be the same everywhere | ||
| # (so the vector values should all be ref_value) | ||
| vec_u_cp = u_cp.vector() | ||
| for i in range(size * size): | ||
| self.assertAlmostEqual(ref_value, vec_u_cp[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Dockerfile to build a ubuntu image containing the installed Debian package of a release | ||
| FROM ubuntu:24.04 | ||
|
|
||
| # Add the precice user to run test with mpi | ||
| RUN useradd -m -s /bin/bash precice | ||
| ENV PRECICE_USER=precice | ||
|
|
||
| # Installing necessary dependencies | ||
| RUN apt-get -qq update && \ | ||
| apt-get -qq install software-properties-common && \ | ||
| add-apt-repository -y ppa:fenics-packages/fenics && \ | ||
| apt-get -qq update && \ | ||
| apt-get -qq install --no-install-recommends fenics python3-pip && \ | ||
| rm -rf /var/lib/apt/lists/* |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.