Allow initialize=true all data in serial coupling scheme#1368
Allow initialize=true all data in serial coupling scheme#1368BenjaminRodenberg merged 149 commits intodevelop-v3.0.0from
Conversation
…ce/precice into 1149-restructure-integration-tests
…ce/precice into 1149-restructure-integration-tests
…ce/precice into 1149-restructure-integration-tests
…ce/precice into 1149-restructure-integration-tests
| int CouplingSchemeConfiguration::getWaveformUsedOrder(std::string dataName) const | ||
| { | ||
| int maxUsedOrder = -1; | ||
| for (const precice::impl::PtrParticipant &participant : _participantConfig->getParticipants()) { | ||
| for (auto &dataContext : participant->readDataContexts()) { | ||
| if (dataContext.getDataName() == dataName) { | ||
| int usedOrder = dataContext.getInterpolationOrder(); | ||
| PRECICE_ASSERT(usedOrder >= 0); // ensure that usedOrder was set | ||
| return usedOrder; | ||
| } | ||
| } | ||
| } | ||
| return maxUsedOrder; | ||
| } |
There was a problem hiding this comment.
I am a bit confused by the variable maxUsedOrder here.
Wouldn't it be "more correct" if we we pass the participant name as an argument here and return the order of that participant? In the end, we are only interested in the receiving participant, no?
There was a problem hiding this comment.
That's a leftover. You are 100% right. I will quickly fix it.
BenjaminRodenberg
left a comment
There was a problem hiding this comment.
I added a few comments.
| if (requiresInitialization && (_config.type == VALUE_SERIAL_EXPLICIT || _config.type == VALUE_SERIAL_IMPLICIT)) { | ||
| if (not _experimental) { | ||
| PRECICE_CHECK(not scheme.doesFirstStep(), | ||
| "In serial coupling only second participant can initialize data and send it. " | ||
| "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" initialize=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml. You can bypass this restriction by activating the experimental interface for time interpolation. Please refer to the documentation for more details.", | ||
| dataName, meshName, from, to, requiresInitialization); | ||
| } | ||
| } |
There was a problem hiding this comment.
We only define the waveform-order on the read-data. Therefore, we cannot check it here and raise a warning. Meaning: The first participant will not raise a warning.
There was a problem hiding this comment.
Completely OK if only one of both participants raises a warning.
| dataName, meshName, from, to, requiresInitialization); | ||
| } | ||
| // Checks for a serial coupling scheme, where initial data is received by first participant. | ||
| if (!scheme.doesFirstStep() && requiresInitialization && (_config.type == VALUE_SERIAL_EXPLICIT || _config.type == VALUE_SERIAL_IMPLICIT) && getWaveformUsedOrder(dataName) == 0) // the order of the statements is crucial! getWaveformUsedOrder should be called last, because it may run into an error, if the data is initialized, but not defined as read data (for example Integration/Serial/AitkenAcceleration) |
There was a problem hiding this comment.
This part is a bit tricky: Usually the second participant to which we are writing the initial data defines this as read-data. This is strictly not required (@uekerman, we briefly discussed this in the chat), but I think in most of the cases everything should work.
There is the highly theoretical case that a user does not define data that is initialized as read data. If this every happens, the error in getWaveformUsedOrder will be raised (and this might also be something worth knowing...).
| } | ||
| } | ||
| } | ||
| PRECICE_ERROR("Name \"{}\" not found. This is probably a bug. Please report it under https://github.com/precice/precice/issues/new/choose.", dataName); |
There was a problem hiding this comment.
I'm raising an error here, to make sure that the order that we receive from this function is actually valid.
uekerman
left a comment
There was a problem hiding this comment.
Minor tweaks.
Feel free to directly merge when done.
| if (requiresInitialization && (_config.type == VALUE_SERIAL_EXPLICIT || _config.type == VALUE_SERIAL_IMPLICIT)) { | ||
| if (not _experimental) { | ||
| PRECICE_CHECK(not scheme.doesFirstStep(), | ||
| "In serial coupling only second participant can initialize data and send it. " | ||
| "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" initialize=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml. You can bypass this restriction by activating the experimental interface for time interpolation. Please refer to the documentation for more details.", | ||
| dataName, meshName, from, to, requiresInitialization); | ||
| } | ||
| } |
There was a problem hiding this comment.
Completely OK if only one of both participants raises a warning.
Co-authored-by: Benjamin Uekermann <[email protected]>
* Add corresponding getters in Participant and ParticipantConfiguration * Raise assertion, if dataName or participantName is not found
* 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]>
* 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]>
* 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]>
* 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]>
* 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]>
* 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]>
* 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]>
* 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]>
Main changes of this PR
Closes #1367
Motivation and additional information
See #1367
Todo
Author's checklist
make changelogif there are user-observable changes since the last release.make formatto ensure everything is formatted correctly.Reviewers' checklist