OGS
BHEInflowDirichletBoundaryCondition.h
Go to the documentation of this file.
1
11#pragma once
12
15
17{
18template <typename BHEUpdateCallback>
20{
21public:
23 std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices,
24 BHEUpdateCallback bhe_update_callback)
25 : _in_out_global_indices(std::move(in_out_global_indices)),
26 _bhe_update_callback(bhe_update_callback)
27 {
28 }
29
31 const double t, GlobalVector const& x,
32 NumLib::IndexValueVector<GlobalIndexType>& bc_values) const override
33 {
34 bc_values.ids.resize(1);
35 bc_values.values.resize(1);
36
37 bc_values.ids[0] = _in_out_global_indices.first;
38 // here call the corresponding BHE functions
39 auto const T_out = x[_in_out_global_indices.second];
40 bc_values.values[0] = _bhe_update_callback(T_out, t);
41 }
42
43private:
44 std::pair<GlobalIndexType, GlobalIndexType> const _in_out_global_indices;
45 BHEUpdateCallback _bhe_update_callback;
46};
47
48template <typename BHEUpdateCallback>
49std::unique_ptr<BHEInflowDirichletBoundaryCondition<BHEUpdateCallback>>
51 std::pair<GlobalIndexType, GlobalIndexType>&& in_out_global_indices,
52 BHEUpdateCallback bhe_update_callback)
53{
54 DBUG("Constructing BHEInflowDirichletBoundaryCondition.");
55
56 // In case of partitioned mesh the boundary could be empty, i.e. there is no
57 // boundary condition.
58#ifdef USE_PETSC
59 // For this special boundary condition the boundary condition is not empty
60 // if the global indices are non-negative.
61 if (in_out_global_indices.first < 0 && in_out_global_indices.second < 0)
62 {
63 return nullptr;
64 }
65 // If only one of the global indices (in or out) is negative the
66 // implementation is not valid.
67 if (in_out_global_indices.first < 0 || in_out_global_indices.second < 0)
68 {
70 "The partition cuts the BHE into two independent parts. This "
71 "behaviour is not implemented.");
72 }
73#endif // USE_PETSC
74
75 return std::make_unique<
77 std::move(in_out_global_indices), bhe_update_callback);
78}
79} // namespace ProcessLib::HeatTransportBHE
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Global vector based on Eigen vector.
Definition EigenVector.h:25
BHEInflowDirichletBoundaryCondition(std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEUpdateCallback bhe_update_callback)
void getEssentialBCValues(const double t, GlobalVector const &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override
Writes the values of essential BCs to bc_values.
std::unique_ptr< BHEInflowDirichletBoundaryCondition< BHEUpdateCallback > > createBHEInflowDirichletBoundaryCondition(std::pair< GlobalIndexType, GlobalIndexType > &&in_out_global_indices, BHEUpdateCallback bhe_update_callback)
std::vector< IndexType > ids
std::vector< double > values