Skip to content

Commit

Permalink
Merge pull request #8342 from NREL/global_dataGlobals_2_again
Browse files Browse the repository at this point in the history
Global DataGlobals: Part 2
  • Loading branch information
mitchute authored Oct 15, 2020
2 parents 5230026 + 519eaa2 commit 111e8bd
Show file tree
Hide file tree
Showing 358 changed files with 4,231 additions and 5,267 deletions.
6 changes: 3 additions & 3 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->HWLoopNum).FluidName,
DataGlobals::HWInitConvTemp,
DataGlobalConstants::HWInitConvTemp(),
DataPlant::PlantLoop(this->HWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand All @@ -831,7 +831,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->CWLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->CWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand All @@ -848,7 +848,7 @@ namespace AirLoopHVACDOAS {
Real64 CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", CompName, ErrorsFound);
rho = FluidProperties::GetDensityGlycol(state,
DataPlant::PlantLoop(this->CWLoopNum).FluidName,
DataGlobals::CWInitConvTemp,
DataGlobalConstants::CWInitConvTemp(),
DataPlant::PlantLoop(this->CWLoopNum).FluidIndex,
RoutineName);
PlantUtilities::InitComponentNodes(0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

#ifndef TOKELVIN
#include "../../../DataGlobals.hh"
#define TOKELVIN(T) (T + DataGlobals::KelvinConv)
#define TOKELVIN(T) (T + DataGlobalConstants::KelvinConv())
#else
// Need a fallback
#endif
Expand Down
18 changes: 7 additions & 11 deletions src/EnergyPlus/AirflowNetwork/src/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,6 @@ namespace AirflowNetwork {
// Lawrence Berkeley National Laboratory, Berkeley, CA, May 1990

// USE STATEMENTS:
using DataGlobals::PiOvr2;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:

Expand Down Expand Up @@ -1958,7 +1956,7 @@ namespace AirflowNetwork {
DpZeroOffset = DifLim * 1e-3;
// New definition for opening factors for LVO type 2: opening angle = 90 degrees --> opening factor = 1.0
// should be PIOvr2 in below?
alpha = Fact * PiOvr2;
alpha = Fact * DataGlobalConstants::PiOvr2();
Real64 const cos_alpha(std::cos(alpha));
Real64 const tan_alpha(std::tan(alpha));
h2 = Axishght * (1.0 - cos_alpha);
Expand Down Expand Up @@ -2500,7 +2498,7 @@ namespace AirflowNetwork {
// ed = Rough / DisSysCompCoilData(CompNum).hydraulicDiameter;
ed = Rough / hydraulicDiameter;

area = square(hydraulicDiameter) * DataGlobals::Pi;
area = square(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2658,7 +2656,7 @@ namespace AirflowNetwork {
// ed = Rough / DisSysCompCoilData(CompNum).hydraulicDiameter;
ed = Rough / hydraulicDiameter;

area = square(hydraulicDiameter) * DataGlobals::Pi;
area = square(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2810,7 +2808,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -2975,7 +2973,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -3121,7 +3119,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
ed = Rough / hydraulicDiameter;
area = pow_2(hydraulicDiameter) * DataGlobals::Pi;
area = pow_2(hydraulicDiameter) * DataGlobalConstants::Pi();
ld = L / hydraulicDiameter;
g = 1.14 - 0.868589 * std::log(ed);
AA1 = g;
Expand Down Expand Up @@ -3475,8 +3473,6 @@ namespace AirflowNetwork {
// NISTIR 89-4052, National Institute of Standards and Technology, Gaithersburg, MD

// USE STATEMENTS:
using DataGlobals::Pi;

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 RhozAver;
Real64 expn;
Expand Down Expand Up @@ -3509,7 +3505,7 @@ namespace AirflowNetwork {
// Slope = MultizoneCompHorOpeningData(CompNum).Slope;
// DischCoeff = MultizoneCompHorOpeningData(CompNum).DischCoeff;
Cshape = 0.942 * Width / Height;
OpenArea = Width * Height * Fact * std::sin(Slope * Pi / 180.0) * (1.0 + std::cos(Slope * Pi / 180.0));
OpenArea = Width * Height * Fact * std::sin(Slope * DataGlobalConstants::Pi() / 180.0) * (1.0 + std::cos(Slope * DataGlobalConstants::Pi() / 180.0));
DH = 4.0 * (Width * Height) / 2.0 / (Width + Height) * Fact;

// Check which zone is higher
Expand Down
20 changes: 7 additions & 13 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ namespace AirflowNetwork {
using DataEnvironment::OutDryBulbTemp;
using DataEnvironment::OutHumRat;
using DataEnvironment::StdBaroPress;
using DataGlobals::DegToRadians;
using DataGlobals::KelvinConv;
using DataGlobals::Pi;
using DataGlobals::rTinyValue;
using DataSurfaces::Surface;

//std::vector<AirProperties> properties;
Expand Down Expand Up @@ -787,7 +783,7 @@ namespace AirflowNetwork {
C = CCF(n) * CEF(n);
} else {
// IF (CCF(N) .EQ. 0.0d0) CCF(N)=TINY(CCF(N)) ! 1.0E-40
if (CCF(n) == 0.0) CCF(n) = rTinyValue; // 1.0E-40 (Epsilon)
if (CCF(n) == 0.0) CCF(n) = DataGlobalConstants::rTinyValue(); // 1.0E-40 (Epsilon)
PCF(n) = CCF(n);
C = CCF(n);
}
Expand Down Expand Up @@ -1113,11 +1109,11 @@ namespace AirflowNetwork {
if (LFLAG) {
// Initialization by linear relation.
if (PDROP >= 0.0) {
RhoCor = (propN.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propN.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propN.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
DF[0] = coef * propN.density / propN.viscosity * Ctl;
} else {
RhoCor = (propM.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propM.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propM.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
DF[0] = coef * propM.density / propM.viscosity * Ctl;
}
Expand All @@ -1127,7 +1123,7 @@ namespace AirflowNetwork {
if (PDROP >= 0.0) {
// Flow in positive direction.
// Laminar flow.
RhoCor = (propN.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propN.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propN.density / RhoCor, expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
CDM = coef * propN.density / propN.viscosity * Ctl;
FL = CDM * PDROP;
Expand All @@ -1140,7 +1136,7 @@ namespace AirflowNetwork {
} else {
// Flow in negative direction.
// Laminar flow.
RhoCor = (propM.temperature + KelvinConv) / (Tave + KelvinConv);
RhoCor = (propM.temperature + DataGlobalConstants::KelvinConv()) / (Tave + DataGlobalConstants::KelvinConv());
Ctl = std::pow(RhozNorm / propM.density / RhoCor, 2.0 * expn - 1.0) * std::pow(VisczNorm / VisAve, 2.0 * expn - 1.0);
CDM = coef * propM.density / propM.viscosity * Ctl;
FL = CDM * PDROP;
Expand Down Expand Up @@ -1214,7 +1210,7 @@ namespace AirflowNetwork {
// FLOW:
// Get component properties
Real64 ed = Rough / Diameter;
Real64 area = Diameter * Diameter * Pi / 4.0;
Real64 area = Diameter * Diameter * DataGlobalConstants::Pi() / 4.0;
Real64 ld = Length / Diameter;
Real64 g = 1.14 - 0.868589 * std::log(ed);
Real64 AA1 = g;
Expand Down Expand Up @@ -1966,8 +1962,6 @@ namespace AirflowNetwork {
// Lawrence Berkeley National Laboratory, Berkeley, CA, May 1990

// USE STATEMENTS:
using DataGlobals::Pi;

// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// na
Expand Down Expand Up @@ -2039,7 +2033,7 @@ namespace AirflowNetwork {
// FLOW:
RhoREF = AIRDENSITY(PSea, OutDryBulbTemp, OutHumRat);

CONV = Latitude * 2.0 * Pi / 360.0;
CONV = Latitude * 2.0 * DataGlobalConstants::Pi() / 360.0;
G = 9.780373 * (1.0 + 0.0052891 * pow_2(std::sin(CONV)) - 0.0000059 * pow_2(std::sin(2.0 * CONV)));

Hfl = 1.0;
Expand Down
Loading

5 comments on commit 111e8bd

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2267 of 2267 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2287 of 2287 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1548 of 1548 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2240 of 2240 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.