OGS
SourceTermCollection.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <range/v3/view/filter.hpp>
7
8namespace ProcessLib
9{
11 std::vector<std::reference_wrapper<ProcessVariable>> const&
12 process_variables,
13 NumLib::LocalToGlobalIndexMap const& dof_table,
14 unsigned const integration_order,
15 const MeshLib::Mesh& bulk_mesh)
16{
17 for (int variable_id = 0;
18 variable_id < static_cast<int>(process_variables.size());
19 ++variable_id)
20 {
21 ProcessVariable& pv = process_variables[variable_id];
22 auto sts =
23 pv.createSourceTerms(dof_table, variable_id, integration_order,
24 _parameters, process_variables, bulk_mesh);
25
26 std::move(sts.begin(), sts.end(), std::back_inserter(_source_terms));
27 }
28}
29
30void SourceTermCollection::integrate(const double t, GlobalVector const& x,
31 GlobalVector& b, GlobalMatrix* jac) const
32{
33 // For parallel computing with DDC, a partition may not have source term
34 // but a nullptr is assigned to its element in _source_terms.
35 auto non_nullptr = [](std::unique_ptr<SourceTermBase> const& st)
36 { return st != nullptr; };
37
38 for (auto const& st : _source_terms | ranges::views::filter(non_nullptr))
39 {
40 st->integrate(t, x, b, jac);
41 }
42}
43
44} // namespace ProcessLib
MathLib::EigenMatrix GlobalMatrix
MathLib::EigenVector GlobalVector
std::vector< std::unique_ptr< SourceTermBase > > createSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int variable_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, const MeshLib::Mesh &bulk_mesh)
void integrate(const double t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *jac) const
void addSourceTermsForProcessVariables(std::vector< std::reference_wrapper< ProcessVariable > > const &process_variables, NumLib::LocalToGlobalIndexMap const &dof_table, unsigned const integration_order, const MeshLib::Mesh &bulk_mesh)
std::vector< std::unique_ptr< SourceTermBase > > _source_terms
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const & _parameters