Skip to content

Allow initialize=true all data in serial coupling scheme#1368

Merged
BenjaminRodenberg merged 149 commits intodevelop-v3.0.0from
1367-allow-initialize-true-serial-coupling
Jul 17, 2022
Merged

Allow initialize=true all data in serial coupling scheme#1368
BenjaminRodenberg merged 149 commits intodevelop-v3.0.0from
1367-allow-initialize-true-serial-coupling

Conversation

@BenjaminRodenberg
Copy link
Copy Markdown
Contributor

@BenjaminRodenberg BenjaminRodenberg commented Jul 9, 2022

Main changes of this PR

Closes #1367

Motivation and additional information

See #1367

Todo

Author's checklist

  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I ran make format to ensure everything is formatted correctly.
  • I sticked to C++14 features.
  • I sticked to CMake version 3.16.3.
  • I squashed / am about to squash all commits that should be seen as one.

Reviewers' checklist

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

fsimonis and others added 30 commits March 10, 2022 18:19
…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
@BenjaminRodenberg BenjaminRodenberg added usability This issue will make preCICE easier for non-expert users breaking change Breaks backwards compatibility and users need to act labels Jul 12, 2022
Comment on lines +1057 to +1070
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;
}
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.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a leftover. You are 100% right. I will quickly fix it.

Copy link
Copy Markdown
Contributor Author

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

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

I added a few comments.

Comment on lines -982 to -989
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);
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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.

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)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm raising an error here, to make sure that the order that we receive from this function is actually valid.

Copy link
Copy Markdown
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

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

Minor tweaks.
Feel free to directly merge when done.

Comment on lines -982 to -989
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);
}
}
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.

Completely OK if only one of both participants raises a warning.

BenjaminRodenberg and others added 3 commits July 16, 2022 14:11
* Add corresponding getters in Participant and ParticipantConfiguration
* Raise assertion, if dataName or participantName is not found
@BenjaminRodenberg BenjaminRodenberg merged commit feb5ca6 into develop-v3.0.0 Jul 17, 2022
BenjaminRodenberg added a commit that referenced this pull request Jul 29, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Aug 5, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Aug 5, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Aug 11, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Aug 22, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Sep 15, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Nov 2, 2022
* 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]>
BenjaminRodenberg added a commit that referenced this pull request Nov 4, 2022
* 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]>
@BenjaminRodenberg BenjaminRodenberg deleted the 1367-allow-initialize-true-serial-coupling branch February 23, 2023 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaks backwards compatibility and users need to act usability This issue will make preCICE easier for non-expert users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generally allow initialize=true for all coupling schemes and all participants

4 participants