Skip to content

**OUTDATED** writeData when subcycling is used#1414

Closed
BenjaminRodenberg wants to merge 163 commits intoprecice:developfrom
BenjaminRodenberg:1171-write-data-when-subcycling-is-used
Closed

**OUTDATED** writeData when subcycling is used#1414
BenjaminRodenberg wants to merge 163 commits intoprecice:developfrom
BenjaminRodenberg:1171-write-data-when-subcycling-is-used

Conversation

@BenjaminRodenberg
Copy link
Copy Markdown
Contributor

@BenjaminRodenberg BenjaminRodenberg commented Aug 11, 2022

Main changes of this PR

Allows to write data to preCICE when subcycling is used. This either results in a piecewise constant or linear interpolation. Possibly also in higher-order interpolation.

Motivation and additional information

See #1171

Author's checklist

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

BenjaminRodenberg and others added 10 commits August 11, 2022 13:02
* Remove mapReadDataTo and mapWriteDataFrom.
* Remove tests using removed API.
* Merge initialize and initializeData in SolverInterfaceImpl.
* Merge initialize and initializeData in CouplingScheme.
* Update tests correspondingly
* Allow to check actions before initialize, especially checking whether initial data has to be written
* Check for sending and receiving of initial data during coupling scheme configuration
* Code simplification w.r.t waveform.
* Use dt=0.0 in actions in initialize.

Co-authored-by: Benjamin Uekermann <[email protected]>
Co-authored-by: Frédéric Simonis <[email protected]>
…recice#1352)

* Get tests and configs for serial implicit waveform interpolation from precice#1029.
* Differentiate between received initial data and data (from advance).
* Split data communication for SerialCouplingScheme and store initial data in waveform.
* Move common functionality of serial and parallel coupling scheme into BiCouplingScheme.

Co-authored-by: Benjamin Uekermann <[email protected]>
* Add test Integration/Serial/InitializeData/ImplicitBoth where both participants initialize.
* Allow initialize=true for both participants in serial-implicit coupling scheme.
* Raise warning, if first participant in serial coupling scheme initializes data with waveform order zero.
* Remove check for write data, because participant does not know about waveform order.

Co-authored-by: Benjamin Uekermann <[email protected]>
* Make read mapping conditional to avoid unnecessary mappings.
* Update corresponding tests.

Co-authored-by: Benjamin Uekermann <[email protected]>
@BenjaminRodenberg BenjaminRodenberg added the enhancement A new feature, a new functionality of preCICE (from user perspective) label Aug 11, 2022
@BenjaminRodenberg BenjaminRodenberg added this to the Version 3.0.0 milestone Aug 11, 2022
@BenjaminRodenberg BenjaminRodenberg self-assigned this Aug 11, 2022
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

Summary of important changes of today:

  • I'm using Eigen's BSpline interpolation for higher order. This needs a sufficient number of samples on the window. If there is an insufficient number of sample, we will fall back to lower order interpolation on the window.
  • I removed the feature to use older samples (only properly implemented for quadratic interpolation and not accessible through API), because it made the implementation much more complicated and has no use-case.

BenjaminRodenberg added a commit that referenced this pull request Nov 4, 2022
* Increase timeouts for precice.cplscheme and precice.integration.Serial, because they will take longer with new tests introduced in #1414

Co-authored-by: Frédéric Simonis <[email protected]>
Comment on lines +279 to +284
} else {
// work-around for explicit coupling, because it does not support waveform relaxation.
if (reachedEndOfTimeWindow()) { // only necessary to trigger at end of time window.
storeTimeStepSendData(time::Storage::WINDOW_END); // only write data at end of window
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably remove this if-else block if we always give the correct data to time and let time decide what to do with it.

Comment on lines +421 to +425
if (_couplingScheme->isTimeWindowComplete() && _couplingScheme->moveWindowBeforeMapping()) { /*
* move to next window before mapping, if second in serial coupling.
* Reason:
* Window is complete, but first participant has already performed an iteration in the new window and the data just received is already from the new window. So we want to use it, but before doing this we have to use the data from the old window to initialize the waveform at 0.0.
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed together: let's try to move the "before-mapping" branch up till the advance call from the previous iteration. Should always be possible when hacking isTimeWindowComplete.
But maybe we find a proper solution when seeing this refactoring?

…ultOfFirstAdvance()

* Use time::Storage as receive data buffer
* CplSchemeTests, TimeTests and some integration tests for time
interpolation are failing
…. Remove support for second order extrapolation.
* Partially tested for serial coupling.
* Integration/Serial/Time/Implicit/SerialCoupling/ReadWriteScalarDataWithWaveformSamplingZero works.
* Initializing with zero is an open todo.
* Integration/Serial/Time/Implicit/SerialCoupling/ReadWriteScalarDataWithWaveformSamplingFirstNoInit breaks.
* Integration/Serial/Time/Implicit/SerialCoupling works
* Integration/Serial/Time/Implicit/ParallelCoupling breaks
* Integration/Serial/Time/Implicit/SerialCoupling works
* Integration/Serial/Time/Implicit/ParallelCoupling works
* Integration/Serial/Time/Implicit/MultiCoupling breaks
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

Current state:

  • Most of the Integration tests for time interpolation are working again
  • I did not check the unit tests thoroughly, but there are still some issues, for example in CplSchemeTests. Probably minor.
  • Code structure is in my opinion much more understandable now, because we require less going back and forth between CouplingScheme and SolverInterfaceImpl. (I managed to remove CouplingScheme::receiveResultOfFirstAdvance, everything happens now directly in CouplingScheme::initialize())

Next steps:

  • Get the remaining tests working again (some tests in MultiCoupling are optional, because this is basically a new feature).
  • Try to also remove CouplingScheme::moveWindowBeforeMapping
  • Implement Extrapolation again, but inside Waveform.
  • Try to factor out changes (refactoring SolverInterfaceImpl/CouplingScheme and Extrapolation) into a smaller PRs.

@BenjaminRodenberg BenjaminRodenberg changed the base branch from develop-v3.0.0 to develop December 12, 2022 12:11
BenjaminRodenberg added a commit to BenjaminRodenberg/precice that referenced this pull request Dec 16, 2022
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

I tried to merge #1504 into this PR in BenjaminRodenberg@3f35b8c, but there are a lot of conflicts and I think it's probably easier to reimplement the changes from #1414 on top of #1504 instead of trying to fix the merge.

BenjaminRodenberg added a commit to BenjaminRodenberg/precice that referenced this pull request Dec 22, 2022
@BenjaminRodenberg BenjaminRodenberg changed the title WIP: writeData when subcycling is used **OUTDATED** writeData when subcycling is used Dec 22, 2022
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

This PR is outdated and won't be merged. I will port all relevant work from here to #1523 and then close this PR.

BenjaminRodenberg added a commit to BenjaminRodenberg/precice that referenced this pull request Dec 28, 2022
* Copied functions from precice#1414
* Requires still some debugging to get tests working
@BenjaminRodenberg
Copy link
Copy Markdown
Contributor Author

Closing this PR, development will continue in #1523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A new feature, a new functionality of preCICE (from user perspective)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants