OGS
HCNonAdvectiveFreeComponentFlowBoundaryCondition.cpp
Go to the documentation of this file.
1 
12 
14 #include "ParameterLib/Utils.h"
15 
16 namespace ProcessLib
17 {
18 std::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  {
36  OGS_FATAL(
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  {
50  OGS_FATAL(
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>(
56  "bulk_element_ids", MeshLib::MeshItemType::Cell, 1);
57  auto const bulk_face_ids =
58  bc_mesh.getProperties().template getPropertyVector<std::size_t>(
59  "bulk_face_ids", MeshLib::MeshItemType::Cell, 1);
60 
61  // In case of partitioned mesh the boundary could be empty, i.e. there is no
62  // boundary condition.
63 #ifdef USE_PETSC
64  // This can be extracted to createBoundaryCondition() but then the config
65  // parameters are not read and will cause an error.
66  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
67  // subtree and move the code up in createBoundaryCondition().
68  if (bc_mesh.getDimension() == 0 && bc_mesh.getNumberOfNodes() == 0 &&
69  bc_mesh.getNumberOfElements() == 0)
70  {
71  return nullptr;
72  }
73 #endif // USE_PETSC
74 
75  return std::make_unique<HCNonAdvectiveFreeComponentFlowBoundaryCondition>(
76  integration_order, shapefunction_order, dof_table, variable_id,
77  component_id, global_dim, bc_mesh,
79  boundary_permeability, *bulk_face_ids, *bulk_element_ids, process});
80 }
81 
82 } // namespace ProcessLib
Definition of the Element class.
#define OGS_FATAL(...)
Definition: Error.h:26
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
void checkConfigParameter(std::string const &param, T const &value) const
T getConfigParameter(std::string const &param) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:71
const std::string getName() const
Get name of the mesh.
Definition: Mesh.h:92
Properties & getProperties()
Definition: Mesh.h:123
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:89
std::size_t getNumberOfElements() const
Get the number of elements.
Definition: Mesh.h:86
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)