OGS
HCNonAdvectiveFreeComponentFlowBoundaryCondition.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
8
9namespace ProcessLib
10{
12 BaseLib::ConfigTree const& config)
13{
14 DBUG("Parsing open boundary for Component Transport process.");
15
17 config.checkConfigParameter("type",
18 "HCNonAdvectiveFreeComponentFlowBoundary");
19
20 auto const boundary_permeability_name =
22 config.getConfigParameter<std::string>("parameter");
23
24 return boundary_permeability_name;
25}
26
27std::unique_ptr<HCNonAdvectiveFreeComponentFlowBoundaryCondition>
29 std::string const& boundary_permeability_name, MeshLib::Mesh const& bc_mesh,
30 NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
31 int const component_id, unsigned const integration_order,
32 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
33 unsigned const global_dim, Process const& process,
34 unsigned const shapefunction_order)
35{
36 DBUG("Constructing open boundary for Component Transport process.");
37
38 if (bc_mesh.getDimension() + 1 != global_dim)
39 {
41 "The dimension ({:d}) of the given boundary mesh '{:s}' is not by "
42 "one lower than the bulk dimension ({:d}).",
43 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
44 }
45
46 auto const& boundary_permeability = ParameterLib::findParameter<double>(
47 boundary_permeability_name, parameters, 1, &bc_mesh);
48
49 if (global_dim != 3)
50 {
52 "HCNonAdvectiveFreeComponentFlowBoundary is only implemented for "
53 "2D boundary meshes");
54 }
55 auto const bulk_element_ids =
56 bc_mesh.getProperties().template getPropertyVector<std::size_t>(
59 auto const bulk_face_ids =
60 bc_mesh.getProperties().template getPropertyVector<std::size_t>(
63
64 // In case of partitioned mesh the boundary could be empty, i.e. there is no
65 // boundary condition.
66#ifdef USE_PETSC
67 // This can be extracted to createBoundaryCondition() but then the config
68 // parameters are not read and will cause an error.
69 // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
70 // subtree and move the code up in createBoundaryCondition().
71 if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
72 bc_mesh.getNumberOfElements() == 0)
73 {
74 return nullptr;
75 }
76#endif // USE_PETSC
77
78 return std::make_unique<HCNonAdvectiveFreeComponentFlowBoundaryCondition>(
79 integration_order, shapefunction_order, dof_table, variable_id,
80 component_id, global_dim, bc_mesh,
82 boundary_permeability, *bulk_face_ids, *bulk_element_ids, process});
83}
84
85} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:79
Properties & getProperties()
Definition Mesh.h:125
const std::string getName() const
Get name of the mesh.
Definition Mesh.h:94
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition Mesh.h:91
std::size_t getNumberOfElements() const
Get the number of elements.
Definition Mesh.h:88
constexpr std::string_view getBulkIDString(MeshItemType mesh_item_type)
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::string parseHCNonAdvectiveFreeComponentFlowBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< HCNonAdvectiveFreeComponentFlowBoundaryCondition > createHCNonAdvectiveFreeComponentFlowBoundaryCondition(std::string const &boundary_permeability_name, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const global_dim, Process const &process, unsigned const shapefunction_order)