TransFlow
0.1.0
A transient pipeline flow simulation library
|
The BoundaryConditions class is a container for the boundary conditions at the inlet and outlet of a pipeline, for a single time step. More...
#include <boundaryconditions.hpp>
Classes | |
class | SingleCondition |
The SingleCondition class is used to store a single boundary condition (like flow, pressure or temperature), and also contains information on whether the condition is "active", meaning if it is meant to be a constrain when solving the governing equations. More... | |
Public Member Functions | |
BoundaryConditions () | |
BoundaryConditions with no properties set. | |
BoundaryConditions (const arma::mat &boundaryConditionMat, const Composition &inletComposition=Composition::defaultComposition, const Composition &outletComposition=Composition::defaultComposition) | |
Constructor with defaults for inlet and outlet composition. More... | |
BoundaryConditions (const double inletFlow, const double outletFlow, const double inletPressure, const double outletPressure, const double inletTemperature, const double outletTemperature, const Composition &inletComposition=Composition::defaultComposition, const Composition &outletComposition=Composition::defaultComposition) | |
Construct from arma::vec for each property at inlet and outlet, and composition. More... | |
BoundaryConditions (const Pipeline &pipeline, const std::vector< std::string > &boundarySettings={"inlet", "outlet", "inlet"}) | |
Construct from a Pipeline object. More... | |
void | setBoundarySettings (const std::vector< std::string > &strings) |
Set boundary settings via vector of string, or brace-init-list like {"inlet", "outlet", "inlet"} More... | |
arma::uword | nActiveBoundaryConditions () const |
Returns the number of active boundary conditions. | |
const auto & | inletFlow () const |
Get inlet flow [kg/s]. | |
const auto & | outletFlow () const |
Get outlet flow [kg/s]. | |
const auto & | inletPressure () const |
Get inlet pressure [Pa]. | |
const auto & | outletPressure () const |
Get outlet pressure [Pa]. | |
const auto & | inletTemperature () const |
Get inlet temperature [K]. | |
const auto & | outletTemperature () const |
Get outlet temperature [k]. | |
const Composition & | inletComposition () const |
Get inlet Composition. | |
const Composition & | outletComposition () const |
Get outlet Composition. | |
auto & | inletFlow () |
Get inlet flow [kg/s]. | |
auto & | outletFlow () |
Get outlet flow [kg/s]. | |
auto & | inletPressure () |
Get inlet pressure [Pa]. | |
auto & | outletPressure () |
Get outlet pressure [Pa]. | |
auto & | inletTemperature () |
Get inlet temperature [K]. | |
auto & | outletTemperature () |
Get outlet temperature [k]. | |
Composition & | inletComposition () |
Inlet Composition setter. | |
Composition & | outletComposition () |
Outlet Composition setter. | |
const auto & | inlet (const arma::uword i) const |
const auto & | outlet (const arma::uword i) const |
BoundaryConditions (const SingleCondition inletFlow, const SingleCondition outletFlow, const SingleCondition inletPressure, const SingleCondition outletPressure, const SingleCondition inletTemperature, const SingleCondition outletTemperature, const Composition &inletComposition=Composition::defaultComposition, const Composition &outletComposition=Composition::defaultComposition) | |
Construct BoundaryConditions::SingleCondition for each property at inlet and outlet, and composition. More... | |
Private Member Functions | |
void | setBoundarySettings (const arma::uword i, const std::string &setting) |
Set a single boundary setting (private) | |
SingleCondition & | inlet (const arma::uword i) |
SingleCondition & | outlet (const arma::uword i) |
Private Attributes | |
SingleCondition | m_inletFlow |
Inlet flow [kg/s]. | |
SingleCondition | m_inletPressure |
Inlet pressure [Pa]. | |
SingleCondition | m_inletTemperature |
Inlet temperature [K]. | |
SingleCondition | m_outletFlow |
Outlet flow [kg/s]. | |
SingleCondition | m_outletPressure |
Outlet presure [Pa]. | |
SingleCondition | m_outletTemperature |
Outlet temperature [K]. | |
Composition | m_inletComposition |
Inlet Composition [fraction]. | |
Composition | m_outletComposition |
Outlet Composition [fraction]. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const BoundaryConditions &c) |
Overload the ostream::operator<< so we can do "cout << bc" and get nice print of the boundary conditions. | |
The BoundaryConditions class is a container for the boundary conditions at the inlet and outlet of a pipeline, for a single time step.
The class uses a armadillo fixed size matrix to guarantee that the boundary conditions have the correct format (3 properties at the inlet and the outlet) as well as the Composition class, which uses the same trick to ensure the correct number of components (10).
This class also has some convenience getters like inletFlow() etc., and a std::ostream& operator << overload to allow nice printing of a BoundaryConditions object.
|
explicit |
Constructor with defaults for inlet and outlet composition.
This is marked explicit, to not allow implicit conversion between arma::mat and BoundaryConditions.
boundaryConditionMat | Boundary conditions in form of a matrix |
inletComposition | Inlet composition |
outletComposition | Outlet composition |
BoundaryConditions::BoundaryConditions | ( | const double | inletFlow, |
const double | outletFlow, | ||
const double | inletPressure, | ||
const double | outletPressure, | ||
const double | inletTemperature, | ||
const double | outletTemperature, | ||
const Composition & | inletComposition = Composition::defaultComposition , |
||
const Composition & | outletComposition = Composition::defaultComposition |
||
) |
Construct from arma::vec for each property at inlet and outlet, and composition.
inletFlow | Inlet flow [kg/s] |
outletFlow | Outlet flow [kg/s] |
inletPressure | Inlet pressure [Pa] |
outletPressure | Outlet pressure [Pa] |
inletTemperature | Inlet temperature [K] |
outletTemperature | Outlet temperature [K] |
inletComposition | Inlet composition |
outletComposition | Outlet composition |
|
explicit |
Construct from a Pipeline object.
pipeline | Pipeline instance to get boundary conditions from |
boundarySettings | Boundary settings to apply. See setBoundarySettings() examples for valid input. |
BoundaryConditions::BoundaryConditions | ( | const SingleCondition | inletFlow, |
const SingleCondition | outletFlow, | ||
const SingleCondition | inletPressure, | ||
const SingleCondition | outletPressure, | ||
const SingleCondition | inletTemperature, | ||
const SingleCondition | outletTemperature, | ||
const Composition & | inletComposition = Composition::defaultComposition , |
||
const Composition & | outletComposition = Composition::defaultComposition |
||
) |
Construct BoundaryConditions::SingleCondition for each property at inlet and outlet, and composition.
inletFlow | Inlet flow [kg/s] |
outletFlow | Outlet flow [kg/s] |
inletPressure | Inlet pressure [Pa] |
outletPressure | Outlet pressure [Pa] |
inletTemperature | Inlet temperature [K] |
outletTemperature | Outlet temperature [K] |
inletComposition | Inlet composition |
outletComposition | Outlet composition |
|
inlineprivate |
Get (non-const ref) inlet property from index (private) 0 == flow 1 == pressure 2 == temperature
|
inline |
Get (const ref) inlet property from index 0 == flow 1 == pressure 2 == temperature
|
inlineprivate |
Get (non-const ref) outlet property from index (private) 0 == flow 1 == pressure 2 == temperature
|
inline |
Get (const ref) outlet property from index 0 == flow 1 == pressure 2 == temperature
void BoundaryConditions::setBoundarySettings | ( | const std::vector< std::string > & | strings | ) |
Set boundary settings via vector of string, or brace-init-list like {"inlet", "outlet", "inlet"}
strings | Vector of strings or brace-init-list, like {"inlet", "outlet", "inlet"} . |
Valid options are "inlet"
, "outlet"
, "both"
and "none"
.