-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for waveform relaxation with linear interpolation (#35)
* If subcycling is used, results that belong to the substeps may be exchanged, as well. * Exchange of additional data that is associated with the substeps is realized by introducing additional data in the precice-config. `Temperature` becomes `Temperature1`, `Temperature2`,... * Linear interpolation is used between substeps. Be aware that this approach is not compatible with the original preCICE API and experimental. In `waveform_bindings.py` API functions like `readBlockScalarData` are extended with the additional parameter `time` (see [here](https://github.com/precice/fenics-adapter/blob/14cef37ca902b96bc4ab2b22e03c879b9e0d5a8c/fenicsadapter/waveform_bindings.py#L72-L84)). For example usage of the modified adapter, refer to precice/tutorials#30.
- Loading branch information
1 parent
1b8a278
commit 0a16b99
Showing
17 changed files
with
1,144 additions
and
107 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -3,3 +3,5 @@ build | |
dist | ||
.idea | ||
*.pyc | ||
venv | ||
.pytest* |
This file contains 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 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
from .fenicsadapter import Adapter, CustomExpression | ||
|
This file contains 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,31 @@ | ||
from .solverstate import SolverState | ||
|
||
class Checkpoint: | ||
|
||
def __init__(self): | ||
""" | ||
A checkpoint for the solver state | ||
""" | ||
self._state = None | ||
|
||
def get_state(self): | ||
return self._state | ||
|
||
def write(self, new_state): | ||
""" | ||
write checkpoint from solver state. | ||
:param u: function value | ||
:param t: time | ||
:param n: timestep | ||
""" | ||
if self.is_empty(): | ||
self._state = SolverState(None, None, None) | ||
|
||
self._state.copy(new_state) | ||
|
||
def is_empty(self): | ||
""" | ||
Returns whether checkpoint is empty. An empty checkpoint has no state saved. | ||
:return: | ||
""" | ||
return not self._state |
This file contains 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 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
Oops, something went wrong.