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