50 : TAG(
"coupling-scheme"),
51 TAG_PARTICIPANTS(
"participants"),
52 TAG_PARTICIPANT(
"participant"),
53 TAG_EXCHANGE(
"exchange"),
54 TAG_MAX_TIME(
"max-time"),
55 TAG_MAX_TIME_WINDOWS(
"max-time-windows"),
56 TAG_TIME_WINDOW_SIZE(
"time-window-size"),
57 TAG_ABS_CONV_MEASURE(
"absolute-convergence-measure"),
58 TAG_ABS_OR_REL_CONV_MEASURE(
"absolute-or-relative-convergence-measure"),
59 TAG_REL_CONV_MEASURE(
"relative-convergence-measure"),
60 TAG_RES_REL_CONV_MEASURE(
"residual-relative-convergence-measure"),
61 TAG_MIN_ITERATIONS(
"min-iterations"),
62 TAG_MAX_ITERATIONS(
"max-iterations"),
65 ATTR_PARTICIPANT(
"participant"),
66 ATTR_INITIALIZE(
"initialize"),
67 ATTR_EXCHANGE_SUBSTEPS(
"substeps"),
70 ATTR_SECOND(
"second"),
72 ATTR_METHOD(
"method"),
74 ATTR_ABS_LIMIT(
"abs-limit"),
75 ATTR_REL_LIMIT(
"rel-limit"),
79 ATTR_SUFFICES(
"suffices"),
80 ATTR_STRICT(
"strict"),
81 ATTR_CONTROL(
"control"),
82 VALUE_SERIAL_EXPLICIT(
"serial-explicit"),
83 VALUE_PARALLEL_EXPLICIT(
"parallel-explicit"),
84 VALUE_SERIAL_IMPLICIT(
"serial-implicit"),
85 VALUE_PARALLEL_IMPLICIT(
"parallel-implicit"),
88 VALUE_FIRST_PARTICIPANT(
"first-participant"),
90 _meshConfig(
std::move(meshConfig)),
91 _m2nConfig(
std::move(m2nConfig)),
92 _participantConfig(participantConfig),
94 _couplingSchemeCompositions()
98 XMLTag::Occurrence occ = XMLTag::OCCUR_ARBITRARY;
102 tag.setDocumentation(
"Explicit coupling scheme according to conventional serial staggered procedure (CSS).");
108 tag.setDocumentation(
"Explicit coupling scheme according to conventional parallel staggered procedure (CPS).");
114 tag.setDocumentation(
"Implicit coupling scheme according to block Gauss-Seidel iterations (S-System). "
115 "Improved implicit iterations are achieved by using a acceleration (recommended!).");
121 tag.setDocumentation(
"Parallel Implicit coupling scheme according to block Jacobi iterations (V-System). "
122 "Improved implicit iterations are achieved by using a acceleration (recommended!).");
128 tag.setDocumentation(
"Multi coupling scheme according to block Jacobi iterations. "
129 "Improved implicit iterations are achieved by using a acceleration (recommended!).");
134 for (XMLTag &tag : tags) {
149 "No coupling scheme defined for participant \"{}\". "
150 "Please make sure to provide at least one <coupling-scheme:TYPE> in your "
151 "precice-config.xml that couples this participant using the <participants .../> tag.",
169 "First participant in coupling-scheme <participants first=\"{}\" second=\"{}\" /> is unknown. {}",
172 "Second participant in coupling-scheme <participants first=\"{}\" second=\"{}\" /> is unknown. {}",
175 "First and second participant in coupling scheme are the same. "
176 "Please choose different in the <participants first=\"{}\" second=\"{}\" /> tag in the <coupling-scheme:...> of your precice-config.xml",
185 "Provided participant in multi coupling-scheme <participant name=\"{}\" ... /> is unknown. {}",
188 "Participant \"{0}\" is provided multiple times to multi coupling scheme. "
189 "Please make sure that you do not provide the participant multiple times via the <participant name=\"{0}\" /> "
190 "tag in the <coupling-scheme:...> of your precice-config.xml",
194 "Only one controller per MultiCouplingScheme can be defined. "
195 "Please check the <participant name=\"{}\" control=\"{}\" /> tag in the <coupling-scheme:...> of your precice-config.xml",
196 participantName, control);
204 "Maximum time has to be larger than zero. "
205 "Please check the <max-time value=\"{}\" /> tag in the <coupling-scheme:...> of your precice-config.xml",
210 "Maximum number of time windows has to be larger than zero. "
211 "Please check the <max-time-windows value=\"{}\" /> tag in the <coupling-scheme:...> of your precice-config.xml",
220 "The minimal time window size supported by preCICE is {}. "
221 "Please check the <time-window-size value=\"{}\" /> tag "
222 "in the <coupling-scheme:...> of your precice-config.xml and pick an appropriate time window size.",
227 "You combined a custom time-window-size of {} with method=\"first-participant\". "
228 "The given time-window-size will be ignored as it is prescribed by the participant.",
274 "Mesh \"{}\" with data \"{}\" not defined. "
275 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> "
276 "tag in the <coupling-scheme:... /> of your precice-config.xml.",
277 nameMesh, nameData, nameData, nameMesh, nameParticipantFrom, nameParticipantTo);
284 Config::Exchange newExchange{exchangeData, exchangeMesh, nameParticipantFrom, nameParticipantTo, initialize, exchangeSubsteps};
286 R
"(Data "{}" of mesh "{}" cannot be exchanged multiple times between participants "{}" and "{}". Please remove one of the exchange tags.)",
287 nameData, nameMesh, nameParticipantFrom, nameParticipantTo);
289 _meshConfig->addNeededMesh(nameParticipantFrom, nameMesh);
290 _meshConfig->addNeededMesh(nameParticipantTo, nameMesh);
296 "Minimum iteration limit has to be larger than zero. Please check the <min-iterations value = \"{}\" /> subtag in the <coupling-scheme:... /> of your precice-config.xml.",
302 "Maximal iteration limit has to be larger than zero. "
303 "Please check the <max-iterations value=\"{0}\" /> subtag in the <coupling-scheme:... /> of your precice-config.xml. "
304 "To disable the iteration limit, remove the <max-iterations value=\"{0}\" /> subtag.",
311 "Maximum iteration limit {1} has to be larger or equal than the minimum iteration limit {0}. "
312 "Please check the <min-iterations value = \"{0}\" /> and <max-iterations value = \"{1}\" /> subtags in the <coupling-scheme:... /> of your precice-config.xml.",
325 PRECICE_CHECK(!
_allowRemeshing,
"Remeshing is currently incompatible with serial coupling schemes. Try using a parallel or a multi coupling scheme instead.");
346 PRECICE_CHECK(!
_allowRemeshing,
"Remeshing is currently incompatible with serial coupling schemes. Try using a parallel or a multi coupling scheme instead.");
358 PRECICE_INFO_IF(
_allowRemeshing,
"Remeshing for implicit coupling schemes is in development. Currently, the acceleration data is deleted on remeshing.");
369 PRECICE_CHECK(!
_allowRemeshing,
"Remeshing is currently incompatible with multi coupling schemes. Try using a parallel coupling scheme instead.");
370 PRECICE_INFO_IF(
_allowRemeshing,
"Remeshing for implicit coupling schemes is in development. Currently, the acceleration data is deleted on remeshing.");
373 "One controller per MultiCoupling needs to be defined. "
374 "Please check the <participant name=... /> tags in the <coupling-scheme:... /> of your precice-config.xml. "
375 "Make sure that at least one participant tag provides the attribute <participant name=... control=\"True\"/>.");
393 PRECICE_DEBUG(
"No coupling scheme exists for the participant");
400 PRECICE_CHECK(!
_allowRemeshing,
"Remeshing is currently incompatible with compositional coupling schemes. If you need remeshing, try using a multi coupling scheme to compose your participants.");
404 PRECICE_DEBUG(
"Creating a compositional coupling scheme for the participant");
415 PRECICE_CHECK(!cplScheme->isImplicitCouplingScheme() || !composition->isImplicitCouplingScheme(),
416 "You attempted to define a second implicit coupling-scheme for the participant \"{}\", which is not allowed. "
417 "Please use a multi coupling-scheme for true implicit coupling of multiple participants.",
478 XMLTag tagMaxTime(*
this,
TAG_MAX_TIME, XMLTag::OCCUR_NOT_OR_ONCE);
479 tagMaxTime.setDocumentation(
"Defined the end of the simulation as total time.");
481 XMLAttribute<double> attrValueMaxTime(
ATTR_VALUE);
482 attrValueMaxTime.setDocumentation(
"The value of the maximum simulation time.");
483 tagMaxTime.addAttribute(attrValueMaxTime);
487 tagMaxTimeWindows.setDocumentation(
"Defined the end of the simulation as a total count of time windows.");
488 XMLAttribute<int> attrValueMaxTimeWindows(
ATTR_VALUE);
489 attrValueMaxTimeWindows.setDocumentation(
"The maximum count of time windows.");
490 tagMaxTimeWindows.addAttribute(attrValueMaxTimeWindows);
494 tagTimeWindowSize.setDocumentation(
"Defines the size of the time window.");
496 .setDocumentation(
"The maximum time window size.");
497 tagTimeWindowSize.addAttribute(attrValueTimeWindowSize);
502 .setDocumentation(
"The method used to determine the time window size. Use `fixed` to fix the time window size for the participants.");
503 tagTimeWindowSize.addAttribute(attrMethod);
505 tagTimeWindowSize.addAttributeHint(
ATTR_METHOD,
"This feature is only available for serial coupling schemes.");
515 tagParticipants.setDocumentation(
"Defines the participants of the coupling scheme.");
516 XMLAttribute<std::string> attrFirst(
ATTR_FIRST);
517 attrFirst.setDocumentation(
"First participant to run the solver.");
518 tagParticipants.addAttribute(attrFirst);
520 attrSecond.setDocumentation(
"Second participant to run the solver.");
521 tagParticipants.addAttribute(attrSecond);
529 XMLTag tagParticipant(*
this,
TAG_PARTICIPANT, XMLTag::OCCUR_ONCE_OR_MORE);
530 XMLAttribute<std::string> attrName(
ATTR_NAME);
531 attrName.setDocumentation(
"Name of the participant.");
532 tagParticipant.addAttribute(attrName);
534 attrControl.setDocumentation(
"Does this participant control the coupling?");
535 tagParticipant.addAttribute(attrControl);
543 XMLTag tagExchange(*
this,
TAG_EXCHANGE, XMLTag::OCCUR_ONCE_OR_MORE);
544 tagExchange.setDocumentation(
"Defines the flow of data between meshes of participants.");
546 auto attrData = XMLAttribute<std::string>(
ATTR_DATA).setDocumentation(
"The data to exchange.");
547 tagExchange.addAttribute(attrData);
548 auto attrMesh = XMLAttribute<std::string>(
ATTR_MESH).setDocumentation(
"The mesh which uses the data.");
549 tagExchange.addAttribute(attrMesh);
550 auto participantFrom = XMLAttribute<std::string>(
ATTR_FROM).setDocumentation(
"The participant sending the data.");
551 tagExchange.addAttribute(participantFrom);
552 auto participantTo = XMLAttribute<std::string>(
ATTR_TO).setDocumentation(
"The participant receiving the data.");
553 tagExchange.addAttribute(participantTo);
554 auto attrInitialize = XMLAttribute<bool>(
ATTR_INITIALIZE,
false).setDocumentation(
"Should this data be initialized during initialize?");
555 tagExchange.addAttribute(attrInitialize);
556 auto attrExchangeSubsteps = XMLAttribute<bool>(
ATTR_EXCHANGE_SUBSTEPS, substepsDefault).setDocumentation(
"Should this data exchange substeps?");
557 tagExchange.addAttribute(attrExchangeSubsteps);
566 tagConvergenceMeasure.setDocumentation(
567 "Absolute convergence criterion based on the two-norm difference of data values between iterations.\n"
568 "\\$$\\left\\lVert H(x^k) - x^k \\right\\rVert_2 < \\text{limit}\\$$");
571 attrLimit.setDocumentation(
"Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).");
572 tagConvergenceMeasure.addAttribute(attrLimit);
581 tagConvergenceMeasure.setDocumentation(
582 "Absolute or relative convergence, which is the disjunction of an absolute criterion based on the two-norm difference of data values between iterations and a relative criterion based on the relative two-norm difference of data values between iterations,i.e. convergence is reached as soon as one of the both criteria is fulfilled."
583 "\\$$\\left\\lVert H(x^k) - x^k \\right\\rVert_2 < \\text{abs-limit}\\quad\\text{or}\\quad\\frac{\\left\\lVert H(x^k) - x^k \\right\\rVert_2}{\\left\\lVert H(x^k) \\right\\rVert_2} < \\text{rel-limit} \\$$ ");
586 attrAbsLimit.setDocumentation(R
"(Absolute limit under which the measure is considered to have converged.)");
587 tagConvergenceMeasure.addAttribute(attrAbsLimit);
589 attrAbsLimit.setDocumentation(R"(Relative limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).)");
590 tagConvergenceMeasure.addAttribute(attrRelLimit);
599 XMLTag::OCCUR_ARBITRARY);
600 tagConvergenceMeasure.setDocumentation(
601 "Relative convergence criterion comparing the currently measured residual to the residual of the first iteration in the time window.\n"
602 "\\$$\\frac{\\left\\lVert H(x^k) - x^k \\right\\rVert_2}{\\left\\lVert H(x^0) - x^0 \\right\\rVert_2} < \\text{limit}\\$$");
605 attrLimit.setDocumentation(
"Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).");
606 tagConvergenceMeasure.addAttribute(attrLimit);
615 tagConvergenceMeasure.setDocumentation(
616 "Relative convergence criterion based on the relative two-norm difference of data values between iterations.\n"
617 "\\$$\\frac{\\left\\lVert H(x^k) - x^k \\right\\rVert_2}{\\left\\lVert H(x^k) \\right\\rVert_2} < \\text{limit} \\$$");
620 attrLimit.setDocumentation(R
"(Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).)");
621 tagConvergenceMeasure.addAttribute(attrLimit);
629 auto attrData = XMLAttribute<std::string>(
ATTR_DATA)
632 auto attrMesh = XMLAttribute<std::string>(
ATTR_MESH)
636 .setDocumentation(
"If true, convergence of this measure is sufficient for overall convergence.");
638 auto attrStrict = makeXMLAttribute(
ATTR_STRICT,
false)
639 .setDocumentation(
"If true, non-convergence of this measure ends the simulation. \"strict\" overrules \"suffices\".");
648 tagMinIterations.setDocumentation(
"Allows to specify a minimum amount of iterations that must be performed per time window.");
650 attrValue.setDocumentation(
"The minimum amount of iterations.");
651 tagMinIterations.addAttribute(attrValue);
660 tagMaxIterations.setDocumentation(
"Allows to specify a maximum amount of iterations per time window.");
662 attrValue.setDocumentation(
"The maximum value of iterations.");
663 tagMaxIterations.addAttribute(attrValue);
687 "Absolute convergence limit has to be greater than zero. "
688 "Please check the <absolute-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
689 "in your <coupling-scheme ... /> in the preCICE configuration file.",
690 limit, dataName, meshName);
694 convMeasureDef.
strict = strict;
710 "Absolute convergence limit has to be greater than zero. "
711 "Please check the <absolute-or-relative-convergence-measure abs-limit=\"{}\" rel-limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
712 "in your <coupling-scheme ... /> in the preCICE configuration file.",
713 absLimit, relLimit, dataName, meshName);
715 "Relative convergence limit has to be in ]0;1]. "
716 "Please check the <absolute-or-relative-convergence-measure abs-limit=\"{}\" rel-limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
717 "in your <coupling-scheme ... /> in the preCICE configuration file.",
718 absLimit, relLimit, dataName, meshName);
722 convMeasureDef.
strict = strict;
737 "Relative convergence limit has to be in ]0;1]. "
738 "Please check the <relative-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
739 "in your <coupling-scheme ... /> in the preCICE configuration file.",
740 limit, dataName, meshName);
743 "The relative convergence limit=\"{}\" is close to the hard-coded numerical resolution=\"{}\" of preCICE. "
744 "This may lead to instabilities. The minimum relative convergence limit should be > \"{}\" ",
750 convMeasureDef.
strict = strict;
765 "Relative convergence limit has to be in ]0;1]. "
766 "Please check the <residul-relative-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
767 "in your <coupling-scheme ... /> in the preCICE configuration file.",
768 limit, dataName, meshName);
771 "The relative convergence limit=\"{}\" is close to the hard-coded numerical resolution=\"{}\" of preCICE. "
772 "This may lead to instabilities. The minimum relative convergence limit should be > \"{}\" ",
778 convMeasureDef.
strict = strict;
789 "Data \"{}\" used by mesh \"{}\" is not configured.", dataName, meshName);
791 return mesh->data(dataName);
798 if (mesh->hasDataID(ID)) {
799 return mesh->data(ID);
816 "Exchange of substeps is activated in the serial-explicit coupling between the second participant \"{}\" and first participant \"{}\". This is inefficient as these substeps will never be used. You can turn this off in your preCICE configuration setting substeps=\"False\" in <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" substeps=\"False\" />", exchange.from, exchange.to, exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
835 if (exchange.exchangeSubsteps) {
837 "Exchange of substeps is activated in the parallel-explicit coupling between \"{}\" and \"{}\". This is inefficient as these substeps will never be used. You can turn this off in your preCICE configuration setting substeps=\"False\" in <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" substeps=\"False\" />", exchange.from, exchange.to, exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
856 SerialCouplingScheme *scheme =
new SerialCouplingScheme(
_config.
maxTime,
_config.
maxTimeWindows,
_config.
timeWindowSize, first, second, accessor, m2n,
_config.
dtMethod,
BaseCouplingScheme::Implicit,
_config.
minIterations,
_config.
maxIterations);
860 "No send data configured. "
861 "Use explicit scheme for one-way coupling. "
862 "Please check your <coupling-scheme ... /> and make sure that you provide at least one <exchange .../> subtag, "
863 "where from=\"{}\".",
876 "In case of serial coupling, acceleration can be defined for data of second participant only!");
893 "No send data configured. Use explicit scheme for one-way coupling. "
894 "Please check your <coupling-scheme ... /> and make sure that you provide at least one <exchange .../> subtag, "
895 "where from=\"{}\".",
918 if (
_m2nConfig->isM2NConfigured(accessor, participant)) {
919 m2ns[participant] =
_m2nConfig->getM2N(accessor, participant);
927 PRECICE_ASSERT(castedScheme,
"The dynamic cast of CouplingScheme failed.");
931 "No send data configured. Use explicit scheme for one-way coupling. "
932 "Please check your <coupling-scheme ... /> and make sure that you provide at least one "
933 "<exchange .../> subtag, where from=\"{}\".",
947 "Due to numerical reasons, for multi coupling, the number of coupling data vectors should be at least 3, not: {}. "
948 "Please check the <data .../> subtags in your <acceleration:.../> and make sure that you have at least 3.",
979 "Not defining convergence measures without providing a maximum iteration limit is forbidden."
980 "Please define a convergence measure or set a maximum iteration limit using <max-iterations value=\"...\" />.");
982 PRECICE_INFO(
"No convergence measures were defined for an implicit coupling scheme. "
983 "It will always iterate the maximum amount iterations, which is {}."
984 "You may want to add a convergence measure in your <coupling-scheme:.../> in your configuration.",
993 const auto &meshPtr = participant->findMesh(exchange.data->getName());
995 if (meshPtr ==
nullptr) {
997 PRECICE_WARN(
"You defined <exchange data=\"{}\" ... to=\"{}\" /> in the <coupling-scheme:... />, but <participant name=\"{}\"> has no corresponding <read-data name=\"{}\" ... />. Usually this means that there is an error in your configuration.",
998 exchange.data->getName(), exchange.to, exchange.to, exchange.data->getName());
1002 const auto &readDataContext = participant->readDataContext(meshPtr->getName(), exchange.data->getName());
1003 if (readDataContext.getWaveformDegree() == 0) {
1005 "You configured <data:scalar/vector name=\"{}\" waveform-degree=\"{}\" />. Please deactivate exchange of substeps by setting substeps=\"false\" in the following exchange tag of your coupling scheme: <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" />. Reason: For constant interpolation no exchange of data for substeps is needed. Please consider using waveform-degree=\"1\" or higher, if you want to use subcycling.",
1006 readDataContext.getDataName(), readDataContext.getWaveformDegree(), exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
1007 }
else if (readDataContext.getWaveformDegree() >= 2) {
1009 "You configured <data:scalar/vector name=\"{}\" waveform-degree=\"{}\" />. Please activate exchange of substeps by setting substeps=\"true\" in the following exchange tag of your coupling scheme: <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" />. Reason: For higher-order interpolation exchange of data for substeps is required. If you don't want to activate exchange of additional data, please consider using waveform-degree=\"1\". Note that deactivating exchange of substep data might lead to worse results, if you use subcycling.",
1010 readDataContext.getDataName(), readDataContext.getWaveformDegree(), exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
1024 const std::string &dataName = exchange.data->getName();
1025 const std::string &meshName = exchange.mesh->getName();
1028 "You cannot define an exchange from and to the same participant. "
1029 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1030 dataName, meshName, from, to);
1033 "Participant \"{}\" is not configured for coupling scheme. "
1034 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1035 from, dataName, meshName, from, to);
1038 "Participant \"{}\" is not configured for coupling scheme. "
1039 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1040 to, dataName, meshName, from, to);
1042 const bool requiresInitialization = exchange.requiresInitialization;
1045 !(requiresInitialization &&
_participantConfig->getParticipant(from)->isDirectAccessAllowed(exchange.mesh->getName())),
1046 "Participant \"{}\" cannot initialize data of the directly-accessed mesh \"{}\" from the participant\"{}\". "
1047 "Either disable the initialization in the <exchange /> tag or use a locally provided mesh instead.",
1048 from, meshName, to);
1050 const bool exchangeSubsteps = exchange.exchangeSubsteps;
1052 if (from == accessor) {
1053 scheme.
addDataToSend(exchange.data, exchange.mesh, requiresInitialization, exchangeSubsteps);
1054 }
else if (to == accessor) {
1056 scheme.
addDataToReceive(exchange.data, exchange.mesh, requiresInitialization, exchangeSubsteps);
1072 const std::string &dataName = exchange.data->getName();
1073 const std::string &meshName = exchange.mesh->getName();
1076 "You cannot define an exchange from and to the same participant. "
1077 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1078 dataName, meshName, from, to);
1081 "Participant \"{}\" is not configured for coupling scheme",
1085 "Participant \"{}\" is not configured for coupling scheme", to);
1087 const bool initialize = exchange.requiresInitialization;
1088 const bool exchangeSubsteps = exchange.exchangeSubsteps;
1090 if (from == accessor) {
1091 scheme.
addDataToSend(exchange.data, exchange.mesh, initialize, exchangeSubsteps, to);
1092 }
else if (to == accessor) {
1093 scheme.
addDataToReceive(exchange.data, exchange.mesh, initialize, exchangeSubsteps, from);
1104 [dataID](
const Config::Exchange &exchange) { return exchange.data->getID() == dataID; });
1113 dataName = dataptr->getName();
1116 PRECICE_ERROR(
"You need to exchange every data that you use for convergence measures and/or the iteration acceleration. "
1117 "Data \"{}\" is currently not exchanged over the respective mesh on which it is used for convergence measures and/or iteration acceleration. "
1118 "Please check the <exchange ... /> and <...-convergence-measure ... /> tags in the <coupling-scheme:... /> of your precice-config.xml.",
1130 [dataID](
const Config::Exchange &exchange) { return exchange.data->getID() == dataID; });
1132 const auto &exchange = *match;
1135 if (second == exchange.from) {
1142 dataName = dataptr->getName();
1146 "You configured acceleration data \"{}\" in the serial implicit coupling scheme between participants \"{}\" and \"{}\". "
1147 "For serial implicit coupling schemes, only data exchanged from the second to the first participant can be used for acceleration. "
1148 "Here, from \"{}\" to \"{}\". "
1149 "However, you configured data \"{}\" for acceleration, which is exchanged from \"{}\" to \"{}\". "
1150 "Please remove this acceleration data tag or switch to a parallel implicit coupling scheme.",
1151 dataName, first, second, second, first, dataName, first, second);
1159 for (
auto &elem : convergenceMeasureDefinitions) {
1160 _meshConfig->addNeededMesh(participant, elem.meshName);
1188 _meshConfig->addNeededMesh(participant, neededMesh);
1197 "You configured participant \"{}\" in a parallel-implicit coupling scheme with \"Aitken\" "
1198 "acceleration, which is known to perform bad in parallel coupling schemes. "
1199 "See https://precice.org/configuration-acceleration.html#dynamic-aitken-under-relaxation for details."
1200 "Consider switching to a serial-implicit coupling scheme or changing the acceleration method.",
#define PRECICE_ERROR(...)
#define PRECICE_WARN_IF(condition,...)
#define PRECICE_WARN(...)
#define PRECICE_DEBUG(...)
#define PRECICE_TRACE(...)
#define PRECICE_INFO_IF(condition,...)
#define PRECICE_INFO(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
#define PRECICE_UNREACHABLE(...)
Abstract base class for standard coupling schemes.
virtual bool hasAnySendData()=0
void setAcceleration(const acceleration::PtrAcceleration &acceleration)
Set an acceleration technique.
void addConvergenceMeasure(int dataID, bool suffices, bool strict, impl::PtrConvergenceMeasure measure)
Adds a measure to determine the convergence of coupling iterations.
bool doesFirstStep() const
Getter for _doesFirstStep.
Abstract base class for coupling schemes with two participants.
bool hasSendData(DataID dataID)
bool hasAnySendData() final override
void addDataToReceive(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps)
Adds data to be received on data exchange.
void addDataToSend(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps)
Adds data to be sent on data exchange and possibly be modified during coupling iterations.
void determineInitialDataExchange() override
Determines which data is initialized and therefore has to be exchanged during initialize.
const std::string TAG_ABS_CONV_MEASURE
const std::string ATTR_NAME
PtrCouplingScheme createSerialExplicitCouplingScheme(const std::string &accessor) const
void checkIterationLimits() const
Helper function to check iteration limits in conjunction with convergence measures.
const std::string VALUE_PARALLEL_IMPLICIT
const PtrCouplingScheme & getCouplingScheme(const std::string &participantName) const
Returns the configured coupling scheme.
precice::config::PtrParticipantConfiguration _participantConfig
const std::string TAG_MAX_TIME_WINDOWS
void addMultiDataToBeExchanged(MultiCouplingScheme &scheme, const std::string &accessor) const
Adds configured exchange data to be sent or received to scheme. Only used specifically for MultiCoupl...
PtrCouplingScheme createSerialImplicitCouplingScheme(const std::string &accessor) const
void addBaseAttributesTagConvergenceMeasure(xml::XMLTag &tag)
const std::string TAG_TIME_WINDOW_SIZE
void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback method required when using xml::XMLTag.
void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback method required when using xml::XMLTag.
void setSerialAcceleration(BaseCouplingScheme *scheme, const std::string &first, const std::string &second) const
void addResidualRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
void addTagMinIterations(xml::XMLTag &tag)
const std::string ATTR_SECOND
const std::string ATTR_REL_LIMIT
mesh::PtrData getData(const std::string &dataName, const std::string &meshName) const
void addAbsoluteConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
const std::string ATTR_INITIALIZE
const std::string TAG_RES_REL_CONV_MEASURE
void addDataToBeExchanged(BiCouplingScheme &scheme, const std::string &accessor) const
Adds configured exchange data to be sent or received to scheme.
void addTagRelativeConvergenceMeasure(xml::XMLTag &tag)
void addTagAcceleration(xml::XMLTag &tag)
const std::string ATTR_METHOD
void addTagParticipant(xml::XMLTag &tag)
struct precice::cplscheme::CouplingSchemeConfiguration::Config _config
void checkSubstepExchangeWaveformDegree(const Config::Exchange &exchange) const
Helper function to check that waveform-degree and substep exchange are compatible.
const std::string VALUE_SERIAL_EXPLICIT
const std::string TAG_REL_CONV_MEASURE
const std::string ATTR_VALUE
const std::string VALUE_PARALLEL_EXPLICIT
constants::TimesteppingMethod getTimesteppingMethod(const std::string &method) const
void checkSerialImplicitAccelerationData(DataID dataID, const std::string &first, const std::string &second) const
void addTagAbsoluteConvergenceMeasure(xml::XMLTag &tag)
acceleration::PtrAccelerationConfiguration _accelerationConfig
std::map< std::string, PtrCouplingScheme > _couplingSchemes
Map from participant name to coupling scheme (composition).
const std::string ATTR_LIMIT
const std::string TAG_MIN_ITERATIONS
const std::string TAG_EXCHANGE
CouplingSchemeConfiguration(xml::XMLTag &parent, mesh::PtrMeshConfiguration meshConfig, m2n::M2NConfiguration::SharedPointer m2nConfig, config::PtrParticipantConfiguration participantConfig)
Constructor.
void addTagExchange(xml::XMLTag &tag, bool substepsDefault)
void checkIfDataIsExchanged(DataID dataID) const
mesh::PtrData findDataByID(int ID) const
const std::string TAG_PARTICIPANT
void addTypespecifcSubtags(const std::string &type, xml::XMLTag &tag)
PtrCouplingScheme createMultiCouplingScheme(const std::string &accessor) const
const std::string ATTR_STRICT
mesh::PtrMeshConfiguration _meshConfig
const std::string ATTR_CONTROL
void addCouplingScheme(const PtrCouplingScheme &cplScheme, const std::string &participantName)
Adds a manually configured coupling scheme for a participant.
const std::string ATTR_MESH
const std::string ATTR_SUFFICES
const std::string TAG_PARTICIPANTS
void setRemeshing(bool allowed)
bool hasCouplingScheme(const std::string &participantName) const
Check, if a coupling scheme is configured for a participant.
static const int DEFAULT_MAX_ITERATIONS
void updateConfigForImplicitCoupling()
Helper to update some configs which may have a different meaning in implicit coupling.
const std::string VALUE_FIXED
m2n::M2NConfiguration::SharedPointer _m2nConfig
void addAbsoluteOrRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double absLimit, double relLimit, bool suffices, bool strict)
static const int DEFAULT_MIN_ITERATIONS
void addTagParticipants(xml::XMLTag &tag)
PtrCouplingScheme createParallelImplicitCouplingScheme(const std::string &accessor) const
const std::string VALUE_SERIAL_IMPLICIT
const std::string ATTR_ABS_LIMIT
const std::string ATTR_TO
const std::string VALUE_MULTI
void addTagResidualRelativeConvergenceMeasure(xml::XMLTag &tag)
const std::string TAG_MAX_TIME
PtrCouplingScheme createParallelExplicitCouplingScheme(const std::string &accessor) const
void addTransientLimitTags(const std::string &type, xml::XMLTag &tag)
void addTagAbsoluteOrRelativeConvergenceMeasure(xml::XMLTag &tag)
const std::string TAG_MAX_ITERATIONS
const std::string ATTR_FROM
void addTagMaxIterations(xml::XMLTag &tag)
const std::string ATTR_EXCHANGE_SUBSTEPS
void addRelativeConvergenceMeasure(const std::string &dataName, const std::string &meshName, double limit, bool suffices, bool strict)
const std::string ATTR_FIRST
std::map< std::string, CompositionalCouplingScheme * > _couplingSchemeCompositions
If a participant has more than one coupling scheme, a composition is created.
void addConvergenceMeasures(BaseCouplingScheme *scheme, const std::string &participant, const std::vector< ConvergenceMeasureDefintion > &convergenceMeasureDefinitions) const
void setParallelAcceleration(BaseCouplingScheme *scheme, const std::string &participant) const
const std::string VALUE_FIRST_PARTICIPANT
const std::string ATTR_DATA
const std::string TAG_ABS_OR_REL_CONV_MEASURE
static const int INFINITE_MAX_ITERATIONS
To be used, when the number of max iterations is infinite (for implicit coupling).
static const int UNDEFINED_MAX_ITERATIONS
To be used, when the number of max iterations is not defined (for explicit coupling).
static const double UNDEFINED_TIME_WINDOW_SIZE
To be used, when the time window size is determined dynamically during the coupling.
A coupling scheme with multiple participants.
void addDataToSend(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps, const std::string &to)
Adds data to be sent on data exchange and possibly be modified during coupling iterations.
void determineInitialDataExchange() override
Determines which data is initialized and therefore has to be exchanged during initialize.
void addDataToReceive(const mesh::PtrData &data, mesh::PtrMesh mesh, bool requiresInitialization, bool exchangeSubsteps, const std::string &from)
Adds data to be received on data exchange.
Coupling scheme for parallel coupling, i.e. simultaneous execution of two coupled participants.
Coupling scheme for serial coupling, i.e. staggered execution of two coupled participants.
Represents an XML tag to be configured automatically.
const std::string & getNamespace() const
Returns xml namespace.
std::string getStringAttributeValue(const std::string &name, std::optional< std::string > default_value=std::nullopt) const
bool getBooleanAttributeValue(const std::string &name, std::optional< bool > default_value=std::nullopt) const
XMLTag & setDocumentation(std::string_view documentation)
Adds a description of the purpose of this XML tag.
const std::string & getName() const
Returns name (without namespace).
const std::string & getFullName() const
Returns full name consisting of xml namespace + ":" + name.
int getIntAttributeValue(const std::string &name, std::optional< int > default_value=std::nullopt) const
double getDoubleAttributeValue(const std::string &name, std::optional< double > default_value=std::nullopt) const
XMLTag & addAttribute(const XMLAttribute< double > &attribute)
Adds a XML attribute by making a copy of the given attribute.
XMLTag & addSubtag(const XMLTag &tag)
Adds an XML tag as subtag by making a copy of the given tag.
vector< double > getData()
@ FIRST_PARTICIPANT_SETS_TIME_WINDOW_SIZE
contains implementations of coupling schemes for coupled simulations.
std::shared_ptr< CouplingScheme > PtrCouplingScheme
constexpr double NUMERICAL_ZERO_DIFFERENCE
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greaterEquals(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greater(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool contained(const ELEMENT_T &element, const std::vector< ELEMENT_T > &vec)
Returns true, if given element is in vector, otherwise false.
bool hasExchange(const Exchange &totest) const
std::vector< Exchange > exchanges
std::vector< std::string > participants
std::vector< ConvergenceMeasureDefintion > convergenceMeasureDefinitions
constants::TimesteppingMethod dtMethod
impl::PtrConvergenceMeasure measure
Tightly coupled to the parameters of Participant()