OGS 6.1.0-1699-ge946d4c5f
NonuniformVariableDependentNeumannBoundaryCondition.cpp
Go to the documentation of this file.
1 
11 
14 
15 namespace ProcessLib
16 {
17 std::unique_ptr<NonuniformVariableDependentNeumannBoundaryCondition>
19  BaseLib::ConfigTree const& config, MeshLib::Mesh const& boundary_mesh,
20  NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
21  int const component_id, unsigned const integration_order,
22  unsigned const shapefunction_order, MeshLib::Mesh const& bulk_mesh)
23 {
24  DBUG("Constructing NonuniformVariableDependentNeumann BC from config.");
26  config.checkConfigParameter("type", "NonuniformVariableDependentNeumann");
27  if (dof_table.getNumberOfVariables() != 2)
28  {
29  OGS_FATAL(
30  "NonuniformVariableDependentNeumann BC only implemented for 2 "
31  "variable processes.");
32  }
33  assert(variable_id == 0 || variable_id == 1);
34 
35  // TODO finally use ProcessLib::Parameter here
36  auto const constant_name =
38  config.getConfigParameter<std::string>("constant_name");
39  auto const& constant =
40  *boundary_mesh.getProperties().getPropertyVector<double>(
41  constant_name, MeshLib::MeshItemType::Node, 1);
42 
43  auto const coefficient_current_variable_name =
45  config.getConfigParameter<std::string>(
46  "coefficient_current_variable_name");
47  auto const& coefficient_current_variable =
48  *boundary_mesh.getProperties().getPropertyVector<double>(
49  coefficient_current_variable_name, MeshLib::MeshItemType::Node, 1);
50 
51  auto const coefficient_other_variable_name =
53  config.getConfigParameter<std::string>(
54  "coefficient_other_variable_name");
55  auto const& coefficient_other_variable =
56  *boundary_mesh.getProperties().getPropertyVector<double>(
57  coefficient_other_variable_name, MeshLib::MeshItemType::Node, 1);
58 
59  auto const coefficient_mixed_variables_name =
61  config.getConfigParameter<std::string>(
62  "coefficient_mixed_variables_name");
63  auto const& coefficient_mixed_variables =
64  *boundary_mesh.getProperties().getPropertyVector<double>(
65  coefficient_mixed_variables_name, MeshLib::MeshItemType::Node, 1);
66 
67  std::string const mapping_to_bulk_nodes_property = "bulk_node_ids";
68  boundary_mesh.getProperties().getPropertyVector<std::size_t>(
69  mapping_to_bulk_nodes_property, MeshLib::MeshItemType::Node, 1);
70 
71  std::vector<MeshLib::Node*> const& bc_nodes = boundary_mesh.getNodes();
72  MeshLib::MeshSubset bc_mesh_subset(boundary_mesh, bc_nodes);
73  auto const& dof_table_boundary_other_variable =
75  (variable_id + 1) % 2, {component_id}, std::move(bc_mesh_subset));
76 
77  // In case of partitioned mesh the boundary could be empty, i.e. there is no
78  // boundary condition.
79 #ifdef USE_PETSC
80  // This can be extracted to createBoundaryCondition() but then the config
81  // parameters are not read and will cause an error.
82  // TODO (naumov): Add a function to ConfigTree for skipping the tags of the
83  // subtree and move the code up in createBoundaryCondition().
84  if (boundary_mesh.getDimension() == 0 &&
85  boundary_mesh.getNumberOfNodes() == 0 &&
86  boundary_mesh.getNumberOfElements() == 0)
87  {
88  return nullptr;
89  }
90 #endif // USE_PETSC
91 
92  return std::make_unique<
94  integration_order, shapefunction_order, dof_table, variable_id,
95  component_id, bulk_mesh.getDimension(), boundary_mesh,
97  constant, coefficient_current_variable, coefficient_other_variable,
98  coefficient_mixed_variables, dof_table_boundary_other_variable});
99 }
100 
101 } // namespace ProcessLib
std::size_t getNumberOfNodes() const
Get the number of nodes.
Definition: Mesh.h:99
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:105
MeshLib::Properties & getProperties()
Definition: Mesh.h:131
T getConfigParameter(std::string const &param) const
Definition of readMeshFromFile function.
void checkConfigParameter(std::string const &param, T const &value) const
PropertyVector< T > const * getPropertyVector(std::string const &name) const
Definition: Properties.h:119
LocalToGlobalIndexMap * deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition: Mesh.h:81
std::size_t getNumberOfElements() const
Get the number of elements.
Definition: Mesh.h:96
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
std::unique_ptr< NonuniformVariableDependentNeumannBoundaryCondition > createNonuniformVariableDependentNeumannBoundaryCondition(BaseLib::ConfigTree const &config, MeshLib::Mesh const &boundary_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, MeshLib::Mesh const &bulk_mesh)
A subset of nodes on a single mesh.
Definition: MeshSubset.h:26