From 5cd915b9af7846e98d9958d084f865a25c835f77 Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Wed, 17 Aug 2022 15:53:58 +0200
Subject: [PATCH] [TimeLoop] Check whether tag "coupling_scheme" is set to
 "staggered"

when the process data are prepared for the staggered scheme.
---
 ProcessLib/CreateTimeLoop.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/ProcessLib/CreateTimeLoop.cpp b/ProcessLib/CreateTimeLoop.cpp
index c0dbdc90470..feba8366ff4 100644
--- a/ProcessLib/CreateTimeLoop.cpp
+++ b/ProcessLib/CreateTimeLoop.cpp
@@ -10,6 +10,8 @@
 
 #include "CreateTimeLoop.h"
 
+#include <range/v3/algorithm/any_of.hpp>
+
 #include "BaseLib/ConfigTree.h"
 #include "ProcessLib/CreateProcessData.h"
 #include "ProcessLib/Output/CreateOutput.h"
@@ -65,6 +67,21 @@ std::unique_ptr<TimeLoop> createTimeLoop(
         config.getConfigSubtree("processes"), processes, nonlinear_solvers,
         compensate_non_equilibrium_initial_residuum);
 
+    const bool use_staggered_scheme =
+        ranges::any_of(processes.begin(), processes.end(),
+                       [](auto const& process)
+                       { return !(process->isMonolithicSchemeUsed()); });
+
+    if (!use_staggered_scheme && per_process_data.size() > 1)
+    {
+        OGS_FATAL(
+            "The monolithic scheme is used. However more than one process data "
+            "tags (by name \"process\") inside tag \"time_loop\" are defined "
+            "for the staggered scheme. If you want to use staggered scheme, "
+            "please set the element of tag \"<coupling_scheme>\" to "
+            "\"staggered\".");
+    }
+
     if (coupling_config)
     {
         if (global_coupling_conv_criteria.size() != per_process_data.size())
-- 
GitLab