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",
219 "The minimal time window size supported by preCICE is {}. "
220 "Please check the <time-window-size value=\"{}\" /> tag "
221 "in the <coupling-scheme:...> of your precice-config.xml and pick an appropriate time window size.",
226 "Time window size value has to be equal to -1 (default), if method=\"first-participant\" is used. "
227 "Please check the <time-window-size value=\"{}\" method=\"{}\" /> "
228 "tag in the <coupling-scheme:...> of your precice-config.xml",
273 "Mesh \"{}\" with data \"{}\" not defined. "
274 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> "
275 "tag in the <coupling-scheme:... /> of your precice-config.xml.",
276 nameMesh, nameData, nameData, nameMesh, nameParticipantFrom, nameParticipantTo);
283 Config::Exchange newExchange{exchangeData, exchangeMesh, nameParticipantFrom, nameParticipantTo, initialize, exchangeSubsteps};
285 R
"(Data "{}" of mesh "{}" cannot be exchanged multiple times between participants "{}" and "{}". Please remove one of the exchange tags.)",
286 nameData, nameMesh, nameParticipantFrom, nameParticipantTo);
288 _meshConfig->addNeededMesh(nameParticipantFrom, nameMesh);
289 _meshConfig->addNeededMesh(nameParticipantTo, nameMesh);
295 "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.",
301 "Maximal iteration limit has to be larger than zero. "
302 "Please check the <max-iterations value=\"{0}\" /> subtag in the <coupling-scheme:... /> of your precice-config.xml. "
303 "To disable the iteration limit, remove the <max-iterations value=\"{0}\" /> subtag.",
310 "Maximum iteration limit {1} has to be larger or equal than the minimum iteration limit {0}. "
311 "Please check the <min-iterations value = \"{0}\" /> and <max-iterations value = \"{1}\" /> subtags in the <coupling-scheme:... /> of your precice-config.xml.",
366 "One controller per MultiCoupling needs to be defined. "
367 "Please check the <participant name=... /> tags in the <coupling-scheme:... /> of your precice-config.xml. "
368 "Make sure that at least one participant tag provides the attribute <participant name=... control=\"True\"/>.");
386 PRECICE_DEBUG(
"No coupling scheme exists for the participant");
395 PRECICE_DEBUG(
"Creating a compositional coupling scheme for the participant");
396 auto composition = std::make_shared<CompositionalCouplingScheme>();
406 PRECICE_CHECK(!cplScheme->isImplicitCouplingScheme() || !composition->isImplicitCouplingScheme(),
407 "You attempted to define a second implicit coupling-scheme for the participant \"{}\", which is not allowed. "
408 "Please use a multi coupling-scheme for true implicit coupling of multiple participants.",
469 XMLTag tagMaxTime(*
this,
TAG_MAX_TIME, XMLTag::OCCUR_NOT_OR_ONCE);
470 tagMaxTime.setDocumentation(
"Defined the end of the simulation as total time.");
472 XMLAttribute<double> attrValueMaxTime(
ATTR_VALUE);
473 attrValueMaxTime.setDocumentation(
"The value of the maximum simulation time.");
474 tagMaxTime.addAttribute(attrValueMaxTime);
478 tagMaxTimeWindows.setDocumentation(
"Defined the end of the simulation as a total count of time windows.");
479 XMLAttribute<int> attrValueMaxTimeWindows(
ATTR_VALUE);
480 attrValueMaxTimeWindows.setDocumentation(
"The maximum count of time windows.");
481 tagMaxTimeWindows.addAttribute(attrValueMaxTimeWindows);
485 tagTimeWindowSize.setDocumentation(
"Defines the size of the time window.");
488 tagTimeWindowSize.addAttribute(attrValueTimeWindowSize);
493 .setDocumentation(
"The method used to determine the time window size. Use `fixed` to fix the time window size for the participants.");
494 tagTimeWindowSize.addAttribute(attrMethod);
496 tagTimeWindowSize.addAttributeHint(
ATTR_METHOD,
"This feature is only available for serial coupling schemes.");
506 tagParticipants.setDocumentation(
"Defines the participants of the coupling scheme.");
507 XMLAttribute<std::string> attrFirst(
ATTR_FIRST);
508 attrFirst.setDocumentation(
"First participant to run the solver.");
509 tagParticipants.addAttribute(attrFirst);
511 attrSecond.setDocumentation(
"Second participant to run the solver.");
512 tagParticipants.addAttribute(attrSecond);
520 XMLTag tagParticipant(*
this,
TAG_PARTICIPANT, XMLTag::OCCUR_ONCE_OR_MORE);
521 XMLAttribute<std::string> attrName(
ATTR_NAME);
522 attrName.setDocumentation(
"Name of the participant.");
523 tagParticipant.addAttribute(attrName);
525 attrControl.setDocumentation(
"Does this participant control the coupling?");
526 tagParticipant.addAttribute(attrControl);
534 XMLTag tagExchange(*
this,
TAG_EXCHANGE, XMLTag::OCCUR_ONCE_OR_MORE);
535 tagExchange.setDocumentation(
"Defines the flow of data between meshes of participants.");
537 auto attrData = XMLAttribute<std::string>(
ATTR_DATA).setDocumentation(
"The data to exchange.");
538 tagExchange.addAttribute(attrData);
539 auto attrMesh = XMLAttribute<std::string>(
ATTR_MESH).setDocumentation(
"The mesh which uses the data.");
540 tagExchange.addAttribute(attrMesh);
541 auto participantFrom = XMLAttribute<std::string>(
ATTR_FROM).setDocumentation(
"The participant sending the data.");
542 tagExchange.addAttribute(participantFrom);
543 auto participantTo = XMLAttribute<std::string>(
ATTR_TO).setDocumentation(
"The participant receiving the data.");
544 tagExchange.addAttribute(participantTo);
545 auto attrInitialize = XMLAttribute<bool>(
ATTR_INITIALIZE,
false).setDocumentation(
"Should this data be initialized during initialize?");
546 tagExchange.addAttribute(attrInitialize);
547 auto attrExchangeSubsteps = XMLAttribute<bool>(
ATTR_EXCHANGE_SUBSTEPS,
false).setDocumentation(
"Should this data exchange substeps?");
548 tagExchange.addAttribute(attrExchangeSubsteps);
557 tagConvergenceMeasure.setDocumentation(
558 "Absolute convergence criterion based on the two-norm difference of data values between iterations.\n"
559 "\\$$\\left\\lVert H(x^k) - x^k \\right\\rVert_2 < \\text{limit}\\$$");
562 attrLimit.setDocumentation(
"Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).");
563 tagConvergenceMeasure.addAttribute(attrLimit);
572 tagConvergenceMeasure.setDocumentation(
573 "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."
574 "\\$$\\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} \\$$ ");
577 attrAbsLimit.setDocumentation(R
"(Absolute limit under which the measure is considered to have converged.)");
578 tagConvergenceMeasure.addAttribute(attrAbsLimit);
580 attrAbsLimit.setDocumentation(R"(Relative limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).)");
581 tagConvergenceMeasure.addAttribute(attrRelLimit);
590 XMLTag::OCCUR_ARBITRARY);
591 tagConvergenceMeasure.setDocumentation(
592 "Relative convergence criterion comparing the currently measured residual to the residual of the first iteration in the time window.\n"
593 "\\$$\\frac{\\left\\lVert H(x^k) - x^k \\right\\rVert_2}{\\left\\lVert H(x^0) - x^0 \\right\\rVert_2} < \\text{limit}\\$$");
596 attrLimit.setDocumentation(
"Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).");
597 tagConvergenceMeasure.addAttribute(attrLimit);
606 tagConvergenceMeasure.setDocumentation(
607 "Relative convergence criterion based on the relative two-norm difference of data values between iterations.\n"
608 "\\$$\\frac{\\left\\lVert H(x^k) - x^k \\right\\rVert_2}{\\left\\lVert H(x^k) \\right\\rVert_2} < \\text{limit} \\$$");
611 attrLimit.setDocumentation(R
"(Limit under which the measure is considered to have converged. Must be in \\((0, 1]\\).)");
612 tagConvergenceMeasure.addAttribute(attrLimit);
620 auto attrData = XMLAttribute<std::string>(
ATTR_DATA)
623 auto attrMesh = XMLAttribute<std::string>(
ATTR_MESH)
627 .
setDocumentation(
"If true, convergence of this measure is sufficient for overall convergence.");
629 auto attrStrict = makeXMLAttribute(
ATTR_STRICT,
false)
630 .
setDocumentation(
"If true, non-convergence of this measure ends the simulation. \"strict\" overrules \"suffices\".");
639 tagMinIterations.setDocumentation(
"Allows to specify a minimum amount of iterations that must be performed per time window.");
641 attrValue.setDocumentation(
"The minimum amount of iterations.");
642 tagMinIterations.addAttribute(attrValue);
651 tagMaxIterations.setDocumentation(
"Allows to specify a maximum amount of iterations per time window.");
653 attrValue.setDocumentation(
"The maximum value of iterations.");
654 tagMaxIterations.addAttribute(attrValue);
678 "Absolute convergence limit has to be greater than zero. "
679 "Please check the <absolute-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
680 "in your <coupling-scheme ... /> in the preCICE configuration file.",
681 limit, dataName, meshName);
686 convMeasureDef.
strict = strict;
688 convMeasureDef.
measure = std::move(measure);
703 "Absolute convergence limit has to be greater than zero. "
704 "Please check the <absolute-or-relative-convergence-measure abs-limit=\"{}\" rel-limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
705 "in your <coupling-scheme ... /> in the preCICE configuration file.",
706 absLimit, relLimit, dataName, meshName);
708 "Relative convergence limit has to be in ]0;1]. "
709 "Please check the <absolute-or-relative-convergence-measure abs-limit=\"{}\" rel-limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
710 "in your <coupling-scheme ... /> in the preCICE configuration file.",
711 absLimit, relLimit, dataName, meshName);
716 convMeasureDef.
strict = strict;
718 convMeasureDef.
measure = std::move(measure);
732 "Relative convergence limit has to be in ]0;1]. "
733 "Please check the <relative-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
734 "in your <coupling-scheme ... /> in the preCICE configuration file.",
735 limit, dataName, meshName);
738 "The relative convergence limit=\"{}\" is close to the hard-coded numerical resolution=\"{}\" of preCICE. "
739 "This may lead to instabilities. The minimum relative convergence limit should be > \"{}\" ",
746 convMeasureDef.
strict = strict;
748 convMeasureDef.
measure = std::move(measure);
762 "Relative convergence limit has to be in ]0;1]. "
763 "Please check the <residul-relative-convergence-measure limit=\"{}\" data=\"{}\" mesh=\"{}\" /> subtag "
764 "in your <coupling-scheme ... /> in the preCICE configuration file.",
765 limit, dataName, meshName);
768 "The relative convergence limit=\"{}\" is close to the hard-coded numerical resolution=\"{}\" of preCICE. "
769 "This may lead to instabilities. The minimum relative convergence limit should be > \"{}\" ",
776 convMeasureDef.
strict = strict;
778 convMeasureDef.
measure = std::move(measure);
788 "Data \"{}\" used by mesh \"{}\" is not configured.", dataName, meshName);
790 return mesh->data(dataName);
797 if (mesh->hasDataID(ID)) {
798 return mesh->data(ID);
815 "You enabled exchanging substeps in the serial-explicit coupling between the second participant \"{}\" and first participant \"{}\". "
816 "This is inefficient as these substeps will never be used.",
817 exchange.from, exchange.to);
836 if (exchange.exchangeSubsteps) {
838 "You enabled exchanging substeps in the parallel-explicit coupling between \"{}\" and \"{}\". "
839 "This is inefficient as these substeps will never be used.",
840 exchange.from, exchange.to);
860 SerialCouplingScheme *scheme =
new SerialCouplingScheme(
_config.
maxTime,
_config.
maxTimeWindows,
_config.
timeWindowSize, first, second, accessor, m2n,
_config.
dtMethod,
BaseCouplingScheme::Implicit,
_config.
minIterations,
_config.
maxIterations);
864 "No send data configured. "
865 "Use explicit scheme for one-way coupling. "
866 "Please check your <coupling-scheme ... /> and make sure that you provide at least one <exchange .../> subtag, "
867 "where from=\"{}\".",
880 "In case of serial coupling, acceleration can be defined for data of second participant only!");
892 ParallelCouplingScheme *scheme =
new ParallelCouplingScheme(
_config.
maxTime,
_config.
maxTimeWindows,
_config.
timeWindowSize,
_config.
participants[0],
_config.
participants[1], accessor, m2n,
_config.
dtMethod,
BaseCouplingScheme::Implicit,
_config.
minIterations,
_config.
maxIterations);
896 "No send data configured. Use explicit scheme for one-way coupling. "
897 "Please check your <coupling-scheme ... /> and make sure that you provide at least one <exchange .../> subtag, "
898 "where from=\"{}\".",
920 if (
_m2nConfig->isM2NConfigured(accessor, participant)) {
921 m2ns[participant] =
_m2nConfig->getM2N(accessor, participant);
929 PRECICE_ASSERT(castedScheme,
"The dynamic cast of CouplingScheme failed.");
933 "No send data configured. Use explicit scheme for one-way coupling. "
934 "Please check your <coupling-scheme ... /> and make sure that you provide at least one "
935 "<exchange .../> subtag, where from=\"{}\".",
949 "Due to numerical reasons, for multi coupling, the number of coupling data vectors should be at least 3, not: {}. "
950 "Please check the <data .../> subtags in your <acceleration:.../> and make sure that you have at least 3.",
981 "Not defining convergence measures without providing a maximum iteration limit is forbidden."
982 "Please define a convergence measure or set a maximum iteration limit using <max-iterations value=\"...\" />.");
984 PRECICE_INFO(
"No convergence measures were defined for an implicit coupling scheme. "
985 "It will always iterate the maximum amount iterations, which is {}."
986 "You may want to add a convergence measure in your <coupling-scheme:.../> in your configuration.",
995 const auto &meshPtr = participant->findMesh(exchange.data->getName());
997 if (meshPtr ==
nullptr) {
999 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.",
1000 exchange.data->getName(), exchange.to, exchange.to, exchange.data->getName());
1004 const auto &readDataContext = participant->readDataContext(meshPtr->getName(), exchange.data->getName());
1005 if (readDataContext.getWaveformDegree() == 0) {
1007 "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.",
1008 readDataContext.getDataName(), readDataContext.getWaveformDegree(), exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
1009 }
else if (readDataContext.getWaveformDegree() >= 2) {
1011 "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.",
1012 readDataContext.getDataName(), readDataContext.getWaveformDegree(), exchange.data->getName(), exchange.mesh->getName(), exchange.from, exchange.to);
1026 const std::string &dataName = exchange.data->getName();
1027 const std::string &meshName = exchange.mesh->getName();
1030 "You cannot define an exchange from and to the same participant. "
1031 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1032 dataName, meshName, from, to);
1035 "Participant \"{}\" is not configured for coupling scheme. "
1036 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1037 from, dataName, meshName, from, to);
1040 "Participant \"{}\" is not configured for coupling scheme. "
1041 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1042 to, dataName, meshName, from, to);
1044 const bool requiresInitialization = exchange.requiresInitialization;
1047 !(requiresInitialization &&
_participantConfig->getParticipant(from)->isDirectAccessAllowed(exchange.mesh->getName())),
1048 "Participant \"{}\" cannot initialize data of the directly-accessed mesh \"{}\" from the participant\"{}\". "
1049 "Either disable the initialization in the <exchange /> tag or use a locally provided mesh instead.",
1050 from, meshName, to);
1052 const bool exchangeSubsteps = exchange.exchangeSubsteps;
1054 if (from == accessor) {
1055 scheme.
addDataToSend(exchange.data, exchange.mesh, requiresInitialization, exchangeSubsteps);
1056 }
else if (to == accessor) {
1058 scheme.
addDataToReceive(exchange.data, exchange.mesh, requiresInitialization, exchangeSubsteps);
1074 const std::string &dataName = exchange.data->getName();
1075 const std::string &meshName = exchange.mesh->getName();
1078 "You cannot define an exchange from and to the same participant. "
1079 "Please check the <exchange data=\"{}\" mesh=\"{}\" from=\"{}\" to=\"{}\" /> tag in the <coupling-scheme:... /> of your precice-config.xml.",
1080 dataName, meshName, from, to);
1083 "Participant \"{}\" is not configured for coupling scheme",
1087 "Participant \"{}\" is not configured for coupling scheme", to);
1089 const bool initialize = exchange.requiresInitialization;
1090 const bool exchangeSubsteps = exchange.exchangeSubsteps;
1092 if (from == accessor) {
1093 scheme.
addDataToSend(exchange.data, exchange.mesh, initialize, exchangeSubsteps, to);
1094 }
else if (to == accessor) {
1095 scheme.
addDataToReceive(exchange.data, exchange.mesh, initialize, exchangeSubsteps, from);
1106 [dataID](
const Config::Exchange &exchange) { return exchange.data->getID() == dataID; });
1115 dataName = dataptr->getName();
1118 PRECICE_ERROR(
"You need to exchange every data that you use for convergence measures and/or the iteration acceleration. "
1119 "Data \"{}\" is currently not exchanged over the respective mesh on which it is used for convergence measures and/or iteration acceleration. "
1120 "Please check the <exchange ... /> and <...-convergence-measure ... /> tags in the <coupling-scheme:... /> of your precice-config.xml.",
1132 [dataID](
const Config::Exchange &exchange) { return exchange.data->getID() == dataID; });
1134 const auto &exchange = *match;
1137 if (second == exchange.from) {
1144 dataName = dataptr->getName();
1148 "You configured acceleration data \"{}\" in the serial implicit coupling scheme between participants \"{}\" and \"{}\". "
1149 "For serial implicit coupling schemes, only data exchanged from the second to the first participant can be used for acceleration. "
1150 "Here, from \"{}\" to \"{}\". "
1151 "However, you configured data \"{}\" for acceleration, which is exchanged from \"{}\" to \"{}\". "
1152 "Please remove this acceleration data tag or switch to a parallel implicit coupling scheme.",
1153 dataName, first, second, second, first, dataName, first, second);
1161 for (
auto &elem : convergenceMeasureDefinitions) {
1162 _meshConfig->addNeededMesh(participant, elem.meshName);
1164 scheme->
addConvergenceMeasure(elem.data->getID(), elem.suffices, elem.strict, elem.measure, elem.doesLogging);
1190 _meshConfig->addNeededMesh(participant, neededMesh);
1199 "You configured participant \"{}\" in a parallel-implicit coupling scheme with \"Aitken\" "
1200 "acceleration, which is known to perform bad in parallel coupling schemes. "
1201 "See https://precice.org/configuration-acceleration.html#dynamic-aitken-under-relaxation for details."
1202 "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(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
#define PRECICE_UNREACHABLE(...)
Abstract base class for standard coupling schemes.
virtual bool hasAnySendData()=0
void addConvergenceMeasure(int dataID, bool suffices, bool strict, impl::PtrConvergenceMeasure measure, bool doesLogging)
Adds a measure to determine the convergence of coupling iterations.
void setAcceleration(const acceleration::PtrAcceleration &acceleration)
Set an acceleration technique.
bool doesFirstStep() const
Getter for _doesFirstStep.
Abstract base class for coupling schemes with two participants.
bool hasAnySendData() override final
bool hasSendData(DataID dataID)
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 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.
virtual void xmlEndTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback method required when using xml::XMLTag.
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
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
void addTagExchange(xml::XMLTag &tag)
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
virtual void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag)
Callback method required when using xml::XMLTag.
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.
Measures the convergence from an old data set to a new one.
Measures the convergence from an old data set to a new one.
Measures the convergence from an old data set to a new one.
Measures the convergence from an old data set to a new one.
XMLAttribute & setOptions(std::vector< ATTRIBUTE_T > options)
XMLAttribute & setDocumentation(std::string documentation)
Sets a documentation string for the attribute.
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(const std::string &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)
Removes the XML subtag with given name.
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()