OGS
CreateVolumetricSourceTerm.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
7#include "BaseLib/FileTools.h"
8#include "MeshLib/Mesh.h"
10#include "ParameterLib/Utils.h"
12
13namespace ProcessLib
14{
15std::unique_ptr<SourceTerm> createVolumetricSourceTerm(
16 BaseLib::ConfigTree const& config, unsigned const bulk_mesh_dimension,
17 MeshLib::Mesh const& source_term_mesh,
18 std::unique_ptr<NumLib::LocalToGlobalIndexMap> source_term_dof_table,
19 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
20 unsigned const integration_order, unsigned const shapefunction_order)
21{
23 auto const type = config.peekConfigParameter<std::string>("type");
24 if (type == "Line")
25 {
27 config.checkConfigParameter("type", "Line");
28 DBUG("Constructing LineSourceTerm from config.");
29 }
30 else
31 {
33 config.checkConfigParameter("type", "Volumetric");
34 DBUG("Constructing VolumetricSourceTerm from config.");
35 }
36
37 // source term field name
38 auto const& volumetric_source_term_parameter_name =
40 config.getConfigParameter<std::string>("parameter");
41 auto& volumetric_source_term = ParameterLib::findParameter<double>(
42 volumetric_source_term_parameter_name, parameters, 1,
43 &source_term_mesh);
44
45 // instruction to create documentation for the parameter
47
48 DBUG("Using '{:s}' as volumetric source term parameter.",
49 volumetric_source_term.name);
50
51 return std::make_unique<VolumetricSourceTerm>(
52 bulk_mesh_dimension, source_term_mesh, std::move(source_term_dof_table),
53 integration_order, shapefunction_order, volumetric_source_term);
54}
55
56} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
T peekConfigParameter(std::string const &param) const
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
std::unique_ptr< SourceTerm > createVolumetricSourceTerm(BaseLib::ConfigTree const &config, unsigned const bulk_mesh_dimension, MeshLib::Mesh const &source_term_mesh, std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, unsigned const shapefunction_order)