diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 119e9063dd9e36bdfd5d030ab33c6b01751870be..0a4a85f36b7f9b593ec0afbec7e9d141319fa495 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -31,7 +31,8 @@ Process::Process( _secondary_variables(std::move(secondary_variables)), _named_function_caller(std::move(named_function_caller)), _global_assembler(std::move(jacobian_assembler)), - _coupled_solutions(nullptr), + _is_monolithic_scheme(true), + _coupling_term(nullptr), _integration_order(integration_order), _process_variables(std::move(process_variables)), _boundary_conditions(parameters) @@ -188,9 +189,19 @@ void Process::constructDofTable() // Create a vector of the number of variable components std::vector<int> vec_var_n_components; - for (ProcessVariable const& pv : _process_variables) - vec_var_n_components.push_back(pv.getNumberOfComponents()); - + if (_is_monolithic_scheme) + { + for (ProcessVariable const& pv : _process_variables) + vec_var_n_components.push_back(pv.getNumberOfComponents()); + } + else // for staggered scheme + { + // Assuming that all equations of the coupled process use the same + // element order. Other cases can be considered by overloading this + // member function in the derived class. + vec_var_n_components.push_back( + _process_variables[0].get().getNumberOfComponents()); + } _local_to_global_index_map = std::make_unique<NumLib::LocalToGlobalIndexMap>( std::move(all_mesh_subsets), vec_var_n_components, diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index ef2ef4d1b096652af79a874469fe49e9c07e1513..4f35961f0cc3e80e4ebf1a42cb910d1a41df4586 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -77,9 +77,9 @@ public: _coupled_solutions = coupled_solutions; } - void preAssemble(const double t, GlobalVector const& x) override final; virtual void setCoupledSolutionsForStaggeredSchemeToLocalAssemblers() {} + void preAssemble(const double t, GlobalVector const& x) override final; void assemble(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) final; @@ -89,6 +89,11 @@ public: GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) final; + void setDecouplingSchemeType(const bool is_monolithic_scheme) + { + _is_monolithic_scheme = is_monolithic_scheme; + } + std::vector<NumLib::IndexValueVector<GlobalIndexType>> const* getKnownSolutions(double const t) const final { @@ -211,10 +216,11 @@ protected: VectorMatrixAssembler _global_assembler; + mutable bool _is_monolithic_scheme; + /// Pointer to CoupledSolutionsForStaggeredScheme, which contains the - /// references to the - /// coupled processes and the references to the solutions of the coupled - /// processes. + /// references to the coupled processes and the references to the + /// solutions of the coupled processes. CoupledSolutionsForStaggeredScheme* _coupled_solutions; /// Order of the integration method for element-wise integration. diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp index b2e6a015c2e60980ef3aa788991bf07a5cbc6a40..b9d45047765e77e4706b04a3503af8196990bce3 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.cpp +++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp @@ -336,9 +336,25 @@ std::vector<std::unique_ptr<SingleProcessData>> createPerProcessData( } if (per_process_data.size() != processes.size()) - OGS_FATAL( - "Some processes have not been configured to be solved by this time " - "time loop."); + { + if (processes.size() > 1) + { + OGS_FATAL( + "Some processes have not been configured to be solved by this " + " time loop."); + } + else + { + const bool _is_monolithic_scheme = false; + for (auto const& process : processes) + { + process.second->setDecouplingSchemeType(_is_monolithic_scheme); + } + INFO( + "The equations of the coupled processes will be solved by the " + "staggered scheme.") + } + } return per_process_data; }