OGS
WellboreCompensateNeumannBoundaryCondition.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 WellboreCompensateNeumann BC.");
16 config.checkConfigParameter("type", "WellboreCompensateNeumann");
17
18 auto const pressure_coefficient =
20 config.getConfigParameter<double>("coefficient_pressure");
21
22 auto const velocity_coefficient =
24 config.getConfigParameter<double>("coefficient_velocity");
25
26 auto const enthalpy_coefficient =
28 config.getConfigParameter<double>("coefficient_enthalpy");
29
30 return {pressure_coefficient, velocity_coefficient, enthalpy_coefficient};
31}
32
33std::unique_ptr<WellboreCompensateNeumannBoundaryCondition>
35 WellboreCompensateCoefficients const& coefficients,
36 MeshLib::Mesh const& bc_mesh,
37 NumLib::LocalToGlobalIndexMap const& dof_table, int const variable_id,
38 int const component_id, unsigned const integration_order,
39 unsigned const shapefunction_order, unsigned const global_dim,
40 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
41{
42 DBUG("Constructing WellboreCompensateNeumann BC.");
43
44 if (dof_table.getNumberOfVariables() != 3)
45 {
47 "WellboreCompensateNeumann BC only implemented for the "
48 "WellboreSimulator processes.");
49 }
50 assert(variable_id == 0 || variable_id == 1 || variable_id == 2);
51
52 if (bc_mesh.getDimension() + 1 != global_dim)
53 {
55 "The dimension ({:d}) of the given boundary mesh '{:s}' is not by "
56 "one "
57 "lower than the bulk dimension ({:d}).",
58 bc_mesh.getDimension(), bc_mesh.getName(), global_dim);
59 }
60
61 auto const pressure_id = 0;
62 auto const velocity_id = 1;
63 auto const enthalpy_id = 2;
64
65 std::vector<MeshLib::Node*> const& bc_nodes = bc_mesh.getNodes();
66 MeshLib::MeshSubset bc_mesh_subset(bc_mesh, bc_nodes);
67 auto dof_table_boundary_pressure = dof_table.deriveBoundaryConstrainedMap(
68 pressure_id, {component_id}, std::move(bc_mesh_subset));
69 auto dof_table_boundary_velocity = dof_table.deriveBoundaryConstrainedMap(
70 velocity_id, {component_id}, std::move(bc_mesh_subset));
71 auto dof_table_boundary_enthalpy = dof_table.deriveBoundaryConstrainedMap(
72 enthalpy_id, {component_id}, std::move(bc_mesh_subset));
73
74 //
75 // maybe the boundary mesh needs material ids
77 media, bc_mesh);
78
79 return std::make_unique<WellboreCompensateNeumannBoundaryCondition>(
80 integration_order, shapefunction_order, dof_table, variable_id,
81 component_id, global_dim, bc_mesh,
83 coefficients, std::move(dof_table_boundary_pressure),
84 std::move(dof_table_boundary_velocity),
85 std::move(dof_table_boundary_enthalpy), std::move(media_map)});
86}
87
88} // 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
A subset of nodes on a single mesh.
Definition MeshSubset.h:17
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:97
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:79
const std::string getName() const
Get name of the mesh.
Definition Mesh.h:94
std::unique_ptr< LocalToGlobalIndexMap > deriveBoundaryConstrainedMap(int const variable_id, std::vector< int > const &component_ids, MeshLib::MeshSubset &&new_mesh_subset) const
MaterialSpatialDistributionMap createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium > > const &media, MeshLib::Mesh const &mesh)
WellboreCompensateCoefficients parseWellboreCompensateNeumannBoundaryCondition(BaseLib::ConfigTree const &config)
std::unique_ptr< WellboreCompensateNeumannBoundaryCondition > createWellboreCompensateNeumannBoundaryCondition(WellboreCompensateCoefficients const &coefficients, MeshLib::Mesh const &bc_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, int const component_id, unsigned const integration_order, unsigned const shapefunction_order, unsigned const global_dim, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)