Newer
Older
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
* \copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
namespace ProcessLib
{
//! Base class for BHENetwork.
//! This class will get Python bindings and is intended to be to be derived in
//! Python.
class BHEInflowPythonBoundaryConditionPythonSideInterface
{
public:
/*!
* Initialize network dataframe
* return a tuple (time, BHE inflow temperature, BHE outflow
* temperature, BHE outflow bc node id, BHE flowrate)
* set at that position and the parameters of the BHE network.
*/
virtual std::tuple<bool,
double /*time*/,
std::vector<double> /*Tin_val*/,
std::vector<double> /*Tout_val*/,
std::vector<int> /*bc_out_ids*/,
std::vector<double> /*BHE_flowrate*/>
initializeDataContainer() const
{
_overridden_essential = false;
return std::tuple<bool,
double,
std::vector<double>,
std::vector<double>,
std::vector<int>,
std::vector<double>>{
false, std::numeric_limits<double>::quiet_NaN(), {}, {}, {}, {}};
}
/*!
* transfer BHE network dataframe to TESPy and get Tin from TESPy
*
* \return a tuple (time, BHE Tin and Tout value from TESPy)
* indicating if a natural BC shall be set at that position and the new
* inflow temperature of all BHEs
*/
virtual std::tuple<bool, bool, std::vector<double>> tespyThermalSolver(
double /*t*/,
std::vector<double> const& /*Tin_val*/,
std::vector<double> const& /*Tout_val*/) const
{
_overridden_natural = false;
return std::tuple<bool, bool, std::vector<double>>{false, false, {}};
}
/*!
* call Tespy hydraulic solver to get flow velocity in each pipe
*
* \return a tuple (is_natural, f_velocity ) indicating if a
* natural BC shall be set at that position and the flow velocity in each
* pipe of all BHEs
*/
virtual std::tuple<bool, std::vector<double>> tespyHydroSolver(
double /*t*/) const
{
_overridden_natural = false;
return std::tuple<bool, std::vector<double>>{false, {}};
}
//! Tells if initializeDataContainer() has been overridden in the derived
//! class in Python.
//!
//! \pre initializeDataContainer() must already have been called
//! once.
bool isOverriddenEssential() const { return _overridden_essential; }
//! Tells if tespySolver() has been overridden in the derived class in
//! Python.
//!
//! \pre tespySolver() must already have been called once.
bool isOverriddenNatural() const { return _overridden_natural; }
// BHE network dataframe container
std::tuple<bool,
double,
std::vector<double>,
std::vector<double>,
std::vector<int>,
std::vector<double>>
dataframe_network;
virtual ~BHEInflowPythonBoundaryConditionPythonSideInterface() = default;
private:
//! Tells if initializeDataContainer() has been overridden in the derived
//! class in Python.
mutable bool _overridden_essential = true;
//! Tells if tespySolver() has been overridden in the derived class in
//! Python.
mutable bool _overridden_natural = true;
};
} // namespace ProcessLib