TransFlow
0.1.0
A transient pipeline flow simulation library
|
Classes | |
class | linalg_error |
class | LinearInterpolator |
class | no_convergence_error |
class | no_solution_found |
class | physics_error |
class | pressure_range_error |
struct | stringbuilder |
class | temperature_range_error |
Functions | |
double | calcGasThermalConductivity (const double pressure) |
Calculate thermal conductivity of natural gas at given pressure. More... | |
double | calcOuterWallFilmCoefficient (const double diameter, const AmbientFluid &fluid) |
Calculate outer film coefficient for a given outer diameter and AmbientFluid. More... | |
double | calcOuterWallFilmCoefficient (const double diameter, const double heatCapacityConstantPressure=4200, const double viscosity=1.05/1000.0, const double thermalConductivity=0.57, const double density=1020, const double velocity=0.1) |
Calculate the outer film coefficient for external flow normal to a circular cylinder. More... | |
double | calcInnerWallFilmCoefficient (const double diameter, const double fluidPressure, const double fluidReynoldsNumber, const double fluidHeatCapacityConstantPressure, const double fluidViscosity) |
Calculate inner wall film coefficient for flow inside a cylinder. More... | |
double | calcEquivalentBurialLayerWidth (const double innerDiameter, const double wallThickness, const double burialDepth, const double burialMediumConductivity=2.0) |
Calculate equivalent burial layer thickness. More... | |
double | calcEquivalentBurialLayerRadius (const double innerDiameter, const double wallThickness, const double burialDepth, const double burialMediumConductivity=2.0) |
calcEquivalentBurialLayerRadius More... | |
arma::vec | calcLogSpacedShellWidths (const double innerRadius, const double outerRadius, const arma::uword nShells=10) |
Calculate logarithmically (log10) spaced cylinder shell widths. More... | |
arma::vec | calcEquivalentBurialLayerWidths (const double innerDiameter, const double wallThickness, const double burialDepth, const double burialMediumConductivity=2.0, const arma::uword nShells=10) |
Calculate the widths of equivalent burial cylinder shells. More... | |
arma::vec | tridag (const arma::vec &a, const arma::vec &b, const arma::vec &c, const arma::vec &r, const arma::uword n) |
double | calculateHeatCapacityConstantVolumeJFH (const double pressure) |
double | calculateHeatCapacityConstantVolumeTGNet (const double molarMass, const double pressure, const double temperature) |
double | calculateHeatCapacityConstantPressureJFH (const double molarMass, const double pressure, const double temperature) |
double | calculateHeatCapacityConstantPressureLangelandsvik (const double molarMass, const double pressure, const double temperature) |
double | calculateHeatCapacityConstantPressureTGNet (const double molarMassOfMixture, const double pressure, const double temperature) |
double | calculateHeatCapacityConstantPressureKIO (const Composition &comp, const double pressure, const double temperature) |
double | calculateIsobaricHeatCapacityJKH (const Composition &comp, const double pressure, const double temperature, const double Z=0) |
arma::vec | calculateViscosity (const arma::vec &molarMass, const arma::vec &temperature, const arma::vec &density) |
arma::vec | calculateReynoldsNumber (const arma::vec &massFlow, const arma::vec &diameter, const arma::vec &viscosity) |
arma::vec | calculateColebrookWhiteFrictionFactor (const arma::vec &sandGrainEquivalentRoughness, const arma::vec &diameter, const arma::vec &reynoldsNumber) |
double | calculateColebrookWhiteFrictionFactor (const double sandGrainEquivalentRoughness, const double diameter, const double reynoldsNumber) |
double | calculateHaalandFrictionFactor (const double sandGrainEquivalentRoughness, const double diameter, const double reynoldsNumber) |
double | pow2 (const double a) |
arma::vec | pow2 (const arma::vec &a) |
double | pow3 (const double a) |
double | pow4 (const double a) |
double | pow5 (const double a) |
double | pow6 (const double a) |
arma::vec | cubeRoot (const arma::vec &input) |
arma::vec | centerDifference (const arma::vec &input) |
arma::vec | centerDifference (const arma::subview_col< arma::mat::elem_type > &input) |
arma::vec | centerSum (const arma::vec &input) |
arma::vec | centerSum (const arma::subview_col< arma::mat::elem_type > &input) |
arma::vec | centerAverage (const arma::vec &input) |
arma::vec | centerAverage (const arma::subview_col< arma::mat::elem_type > &input) |
arma::vec | weightedAverage (const arma::vec &weightA, const arma::vec &weightB, const arma::vec &A, const arma::vec &B) |
double | weightedAverage (const double weightA, const double weightB, const double A, const double B) |
bool | isRelativeDifferenceWithinTolerance (const double oldValue, const double newValue, const double tolerance) |
bool | areRelativeDifferencesWithinTolerance (const arma::vec &oldValues, const arma::vec &newValues, const double tolerance) |
double | convertBurialToStandardDefinition (const double burial, const double innerDiameter, const arma::rowvec &width) |
double | convertBurialToStandardDefinition (const double burial, const double innerDiameter, const arma::subview_row< arma::mat::elem_type > &width) |
arma::vec | convertBurialToStandardDefinition (const arma::vec &burial, const arma::vec &innerDiameter, const arma::colvec &width) |
arma::vec | convertBurialToStandardDefinition (const arma::vec &burial, const arma::vec &innerDiameter, const arma::mat &width) |
arma::vec | smooth (const arma::vec &x, const double smoothness) |
arma::vec | smoothTransition (const arma::vec &firstPart, const arma::vec &lastPart, double smoothness=1.0, const double timeStep=60) |
arma::vec | createSmoothTransient (const double initialValue, const double finalValue, const arma::uword n, const double smoothness, const arma::uword dt) |
arma::vec | findLogSpacedConcentricShellWidths (const double innerRadius, const double outerRadius, const arma::uword nShells) |
arma::cube | loadCubeFromFile (const std::string &filename, const arma::file_type &fileType=arma::csv_ascii) |
arma::mat | loadMatFromFile (const std::string &filename, const arma::file_type &fileType=arma::csv_ascii) |
arma::vec | loadVecFromFile (const std::string &filename, const arma::file_type &fileType=arma::csv_ascii) |
Namespace for some utilities.
double utils::calcEquivalentBurialLayerRadius | ( | const double | innerDiameter, |
const double | wallThickness, | ||
const double | burialDepth, | ||
const double | burialMediumConductivity = 2.0 |
||
) |
calcEquivalentBurialLayerRadius
For a pipeline buried in a medium at a given depth, this function calculates the outer radius of an equivalent cylinder shell of the same medium around the pipeline which gives the same heat transfer between the fluid in the pipeline and the ambient medium. The calculation is based on equations in the documentation of the OLGA simulation software.
innerDiameter | Pipeline inner diameter [m] |
wallThickness | Pipeline wall thickness [m] |
burialDepth | Distance from top of pipe to top of burial medium [m] |
burialMediumConductivity | Thermal conductivity of burial medium [W/(m K)] |
double utils::calcEquivalentBurialLayerWidth | ( | const double | innerDiameter, |
const double | wallThickness, | ||
const double | burialDepth, | ||
const double | burialMediumConductivity = 2.0 |
||
) |
Calculate equivalent burial layer thickness.
For a pipeline buried in a medium at a given depth, this function calculates the thickness of an equivalent cylinder shell of the same medium around the pipeline which gives the same heat transfer between the fluid in the pipeline and the ambient medium. The calculation is based on equations in the documentation of the OLGA simulation software.
Using the thickness from this function ensures the same results are achieved with steady state and unsteady heat transfer models.
innerDiameter | Pipeline inner diameter [m] |
wallThickness | Pipeline wall thickness [m] |
burialDepth | Distance from top of pipe to top of burial medium [m] |
burialMediumConductivity | Thermal conductivity of burial medium [W/(m K)] |
arma::vec utils::calcEquivalentBurialLayerWidths | ( | const double | innerDiameter, |
const double | wallThickness, | ||
const double | burialDepth, | ||
const double | burialMediumConductivity = 2.0 , |
||
const arma::uword | nShells = 10 |
||
) |
Calculate the widths of equivalent burial cylinder shells.
This is just a wrapper around utils::calcEquivalentBurialLayerRadius() and utils::calcLogSpacedShellWidths() that divides the shell into several logarithmically spaced shells.
innerDiameter | Inner diameter [m] |
wallThickness | Wall thickness [m] |
burialDepth | Distance from top of pipe to top of burial medium [m] |
burialMediumConductivity | Thermal conductivity of burial medium [W/(m K)] |
nShells | Number of shells |
double utils::calcGasThermalConductivity | ( | const double | pressure | ) |
Calculate thermal conductivity of natural gas at given pressure.
This is some kind of empirical relation or fitting, with an unknown source. It should probably be replaced with something else. See for example A simple correlation to estimate natural gas thermal conductivity (Azad Jarrahiana and Ehsan Heidaryan, Journal of Natural Gas Science and Engineering, Volume 18, May 2014).
pressure | Gas pressure [Pa]. |
double utils::calcInnerWallFilmCoefficient | ( | const double | diameter, |
const double | fluidPressure, | ||
const double | fluidReynoldsNumber, | ||
const double | fluidHeatCapacityConstantPressure, | ||
const double | fluidViscosity | ||
) |
Calculate inner wall film coefficient for flow inside a cylinder.
This uses the Dittus-Boelter equation at Reynolds numbers abve 1e4, eq. 8.55 Fundamentals of heat and mass transfer (7th Ed, 2011) (Bergman, Lavine, Incropera, DeWitt) at Reynolds number between 1e4 and 4e4, and returns 0 below 4e4.
diameter | Inner diameter [m] |
fluidPressure | Fluid pressure [Pa] |
fluidReynoldsNumber | Fluid Reynolds number [-] |
fluidHeatCapacityConstantPressure | Fluid heat capacity ( \(c_p\)) [J/(kg K)] |
fluidViscosity | Fluid dynamic viscosity [Pa s] = [kg/m*s] |
arma::vec utils::calcLogSpacedShellWidths | ( | const double | innerRadius, |
const double | outerRadius, | ||
const arma::uword | nShells = 10 |
||
) |
Calculate logarithmically (log10) spaced cylinder shell widths.
This function calculates the widths of nShells cylinder shells, logarithmically (log10) spaced between innerRadius and outerRadius.
innerRadius | Inner radius [m] |
outerRadius | Outer radius [m] |
nShells | Number of cylinder shells |
double utils::calcOuterWallFilmCoefficient | ( | const double | diameter, |
const AmbientFluid & | fluid | ||
) |
Calculate outer film coefficient for a given outer diameter and AmbientFluid.
This is just a wrapper around utils::calcOuterWallFilmCoefficient(const double, const double, const double, const double, const double, const double)
diameter | Outer diameter [m] |
fluid | AmbientFluid describing the fluid |
double utils::calcOuterWallFilmCoefficient | ( | const double | diameter, |
const double | heatCapacityConstantPressure = 4200 , |
||
const double | viscosity = 1.05/1000.0 , |
||
const double | thermalConductivity = 0.57 , |
||
const double | density = 1020 , |
||
const double | velocity = 0.1 |
||
) |
Calculate the outer film coefficient for external flow normal to a circular cylinder.
Uses eq. 7.52 from Fundamentals of heat and mass transfer (7th Ed, 2011) (Bergman, Lavine, Incropera, DeWitt).
diameter | Outer diameter [m] |
heatCapacityConstantPressure | Fluid heat capacity ( \(c_p\)) [J/(kg K)] |
viscosity | Fluid dynamic viscosity [Pa s] = [kg/m*s] |
thermalConductivity | Fluid thermal conductivity [W/(m K)] |
density | Fluid density [kg/m3] |
velocity | Fluid velocity [m/s] |