Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop' into 10823FanFr…
Browse files Browse the repository at this point in the history
…eeUnitary
  • Loading branch information
mjwitte committed Nov 22, 2024
2 parents 3cce73c + 7493b9f commit 17e34a4
Show file tree
Hide file tree
Showing 71 changed files with 1,433 additions and 2,559 deletions.
9 changes: 6 additions & 3 deletions .decent_ci-Linux.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
compilers:
- name: "gcc"
version: "11.4"
version: "13.2"
cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DBUILD_PERFORMANCE_TESTS:BOOL=ON -DVALGRIND_ANALYZE_PERFORMANCE_TESTS:BOOL=ON -DENABLE_PCH:BOOL=OFF
collect_performance_results: true
skip_regression: true
s3_upload_bucket: energyplus
num_parallel_builds: 16

- name: "gcc"
version: "11.4"
version: "13.2"
build_type: RelWithDebInfo
cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_REGRESSION_TESTING:BOOL=OFF -DCOMMIT_SHA:STRING=$COMMIT_SHA -DENABLE_COVERAGE:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DENABLE_PCH:BOOL=OFF
coverage_enabled: true
Expand All @@ -19,9 +20,10 @@ compilers:
ctest_filter: -E "integration.*"
skip_regression: true
skip_packaging: true
num_parallel_builds: 16

- name: "gcc"
version: "11.4"
version: "13.2"
build_type: RelWithDebInfo
cmake_extra_flags: -DLINK_WITH_PYTHON:BOOL=ON -DPYTHON_CLI:BOOL=OFF -DPython_REQUIRED_VERSION:STRING=3.12.2 -DPython_ROOT_DIR:PATH=~/.pyenv/versions/3.12.2/ -DBUILD_FORTRAN:BOOL=ON -DBUILD_TESTING:BOOL=ON -DENABLE_REGRESSION_TESTING:BOOL=OFF -DCOMMIT_SHA:STRING=$COMMIT_SHA -DENABLE_COVERAGE:BOOL=ON -DENABLE_GTEST_DEBUG_MODE:BOOL=OFF -DENABLE_PCH:BOOL=OFF
coverage_enabled: true
Expand All @@ -33,3 +35,4 @@ compilers:
ctest_filter: -R "integration.*"
skip_regression: true
skip_packaging: true
num_parallel_builds: 16
2 changes: 1 addition & 1 deletion .decent_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ results_repository : Myoldmopar/EnergyPlusBuildResults
results_path : _posts
results_base_url : https://myoldmopar.github.io/EnergyPlusBuildResults
regression_repository : NREL/EnergyPlusRegressionTool
regression_branch : BumpToBoto3 # this is the branch of NREL/EnergyPlusRegressionTool to use (usually main)
regression_branch : main # this is the branch of NREL/EnergyPlusRegressionTool to use (usually main)
regression_baseline_default : develop # this is the NREL/EnergyPlus branch to use as the baseline for regressions
regression_baseline_develop : ""
regression_baseline_master : ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
path: ./dist

- name: Deploy on Test PyPi
uses: pypa/gh-action-pypi-publish@v1.10.3
uses: pypa/gh-action-pypi-publish@v1.12.2
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
Expand Down
32 changes: 32 additions & 0 deletions dictionary.dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
AirLoopHVAC
AirToAir
BalancedFlow
Celdek
CeldekPad
CoilSystem
ComponentModel
ConstantVolume
DetailedGeometry
Evaporative
EvaporativeCooler
FlatPlate
HeatExchanger
HeatExchangerAssisted
HVACDOAS
Liesen
NoFans
OutdoorAir
OutdoorAirSystem
PhotovoltaicThermal
ResearchSpecial
SensibleAndLatent
SolarCollector
SystemModel
TerminalUnit
UnglazedTranspired
UnitarySystem
UserDefined
VariableRefrigerantFlow
VariableVolume
WetCoil
ZoneHVAC
1 change: 1 addition & 0 deletions src/EnergyPlus/Data/BaseData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct EnergyPlusData; // Forward declaration

struct BaseGlobalStruct
{
virtual ~BaseGlobalStruct() = default;
virtual void init_state([[maybe_unused]] EnergyPlusData &state) = 0;
virtual void clear_state() = 0;
};
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/Data/CommonIncludes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
#include <EnergyPlus/GlobalNames.hh>
#include <EnergyPlus/GroundHeatExchangers.hh>
#include <EnergyPlus/GroundTemperatureModeling/FiniteDifferenceGroundTemperatureModel.hh>
#include <EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh>
#include <EnergyPlus/HVACControllers.hh>
#include <EnergyPlus/HVACCooledBeam.hh>
#include <EnergyPlus/HVACDXHeatPumpSystem.hh>
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@

// C++ Headers
#include <memory>
#include <string>
#include <unordered_map>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
Expand Down
143 changes: 55 additions & 88 deletions src/EnergyPlus/GroundHeatExchangers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

// C++ Headers
#include <cmath>
#include <iterator>
#include <vector>

// ObjexxFCL Headers
Expand Down Expand Up @@ -487,12 +488,10 @@ GLHEResponseFactors::GLHEResponseFactors(EnergyPlusData &state, std::string cons
}

this->numGFuncPairs = static_cast<int>(tmpLntts.size());
this->LNTTS.dimension(this->numGFuncPairs, 0.0);
this->GFNC.dimension(this->numGFuncPairs, 0.0);

for (int i = 1; i <= (int)tmpLntts.size(); ++i) {
this->LNTTS(i) = tmpLntts[i - 1];
this->GFNC(i) = tmpGvals[i - 1];
this->LNTTS.push_back(tmpLntts[i - 1]);
this->GFNC.push_back(tmpGvals[i - 1]);
}
}

Expand Down Expand Up @@ -649,7 +648,7 @@ BuildAndGetResponseFactorsObjectFromSingleBHs(EnergyPlusData &state, std::vector
// Make new props object which has the mean values of the other props objects referenced by the individual BH objects
std::shared_ptr<GLHEVertProps> thisProps(new GLHEVertProps);
thisProps->name = format("Response Factor Auto Generated Mean Props No: {}", state.dataGroundHeatExchanger->numAutoGeneratedResponseFactors + 1);
for (auto &thisBH : state.dataGroundHeatExchanger->singleBoreholesVector) {
for (auto &thisBH : singleBHsForRFVect) {
thisProps->bhDiameter += thisBH->props->bhDiameter;
thisProps->bhLength += thisBH->props->bhLength;
thisProps->bhTopDepth += thisBH->props->bhTopDepth;
Expand Down Expand Up @@ -962,18 +961,12 @@ void GLHEVert::calcUniformBHWallTempGFunctions(EnergyPlusData &state)
boreholes.emplace_back(bh->props->bhLength, bh->props->bhTopDepth, bh->props->bhDiameter / 2.0, bh->xLoc, bh->yLoc);
}

// convert time to a std::vector from an Array1D
std::vector<double> time;
for (auto &v : this->myRespFactors->time) {
time.push_back(v);
}

// Obtain number of segments by adaptive discretization
gt::segments::adaptive adptDisc;
int nSegments = adptDisc.discretize(this->bhLength, this->totalTubeLength);

this->myRespFactors->GFNC =
gt::gfunction::uniform_borehole_wall_temperature(boreholes, time, this->soil.diffusivity, nSegments, true, state.dataGlobal->numThread);
this->myRespFactors->GFNC = gt::gfunction::uniform_borehole_wall_temperature(
boreholes, this->myRespFactors->time, this->soil.diffusivity, nSegments, true, state.dataGlobal->numThread);
}

//******************************************************************************
Expand All @@ -989,8 +982,8 @@ void GLHEVert::calcGFunctions(EnergyPlusData &state)

// save data for later
if (state.files.outputControl.glhe && !state.dataSysVars->DisableGLHECaching) {
myCacheData["Response Factors"]["time"] = std::vector<Real64>(this->myRespFactors->time.begin(), this->myRespFactors->time.end());
myCacheData["Response Factors"]["LNTTS"] = std::vector<Real64>(this->myRespFactors->LNTTS.begin(), this->myRespFactors->LNTTS.end());
myCacheData["Response Factors"]["time"] = std::vector<Real64>(this->myRespFactors->time);
myCacheData["Response Factors"]["LNTTS"] = std::vector<Real64>(this->myRespFactors->LNTTS);
myCacheData["Response Factors"]["GFNC"] = std::vector<Real64>(this->myRespFactors->GFNC.begin(), this->myRespFactors->GFNC.end());
writeGLHECacheToFile(state);
}
Expand Down Expand Up @@ -1025,17 +1018,12 @@ void GLHEVert::setupTimeVectors()
}
}

// Setup the arrays
this->myRespFactors->time.dimension(tempLNTTS.size(), 0.0);
this->myRespFactors->LNTTS.dimension(tempLNTTS.size(), 0.0);
this->myRespFactors->GFNC.dimension(tempLNTTS.size(), 0.0);

int index = 1;
for (auto const &thisLNTTS : tempLNTTS) {
this->myRespFactors->time(index) = exp(thisLNTTS) * t_s;
this->myRespFactors->LNTTS(index) = thisLNTTS;
++index;
}
this->myRespFactors->LNTTS = tempLNTTS;
this->myRespFactors->time = tempLNTTS;
std::transform(this->myRespFactors->time.begin(), this->myRespFactors->time.end(), this->myRespFactors->time.begin(), [&t_s](auto &c) {
return exp(c) * t_s;
});
this->myRespFactors->GFNC = std::vector<Real64>(tempLNTTS.size(), 0.0);
}

//******************************************************************************
Expand All @@ -1045,15 +1033,15 @@ void GLHEVert::calcUniformHeatFluxGFunctions(EnergyPlusData &state)
DisplayString(state, "Initializing GroundHeatExchanger:System: " + this->name);

// Calculate the g-functions
for (size_t lntts_index = 1; lntts_index <= this->myRespFactors->LNTTS.size(); ++lntts_index) {
for (size_t lntts_index = 0; lntts_index < this->myRespFactors->LNTTS.size(); ++lntts_index) {
for (auto const &bh_i : this->myRespFactors->myBorholes) {
Real64 sum_T_ji = 0;
for (auto const &bh_j : this->myRespFactors->myBorholes) {
sum_T_ji += doubleIntegral(bh_i, bh_j, this->myRespFactors->time(lntts_index));
sum_T_ji += doubleIntegral(bh_i, bh_j, this->myRespFactors->time[lntts_index]);
}
this->myRespFactors->GFNC(lntts_index) += sum_T_ji;
this->myRespFactors->GFNC[lntts_index] += sum_T_ji;
}
this->myRespFactors->GFNC(lntts_index) /= (2 * this->totalTubeLength);
this->myRespFactors->GFNC[lntts_index] /= (2 * this->totalTubeLength);

std::stringstream ss;
ss << std::fixed << std::setprecision(1) << float(lntts_index) / this->myRespFactors->LNTTS.size() * 100;
Expand Down Expand Up @@ -1375,25 +1363,18 @@ void GLHEVert::combineShortAndLongTimestepGFunctions()
}

// Add the rest of the long time-step g-functions to the combined curve
for (int index_longTS = this->myRespFactors->GFNC.l(); index_longTS <= this->myRespFactors->GFNC.u(); ++index_longTS) {
GFNC_combined.push_back(this->myRespFactors->GFNC(index_longTS));
LNTTS_combined.push_back(this->myRespFactors->LNTTS(index_longTS));
for (int index_longTS = 0; index_longTS < this->myRespFactors->GFNC.size(); ++index_longTS) {
GFNC_combined.push_back(this->myRespFactors->GFNC[index_longTS]);
LNTTS_combined.push_back(this->myRespFactors->LNTTS[index_longTS]);
}

// Move combined values into right data struct
this->myRespFactors->time.deallocate();
this->myRespFactors->LNTTS.deallocate();
this->myRespFactors->GFNC.deallocate();
this->myRespFactors->time = LNTTS_combined;
std::transform(this->myRespFactors->time.begin(), this->myRespFactors->time.end(), this->myRespFactors->time.begin(), [&t_s](auto &c) {
return exp(c) * t_s;
});

this->myRespFactors->time.dimension(GFNC_combined.size(), 0.0);
this->myRespFactors->LNTTS.dimension(GFNC_combined.size(), 0.0);
this->myRespFactors->GFNC.dimension(GFNC_combined.size(), 0.0);

for (unsigned int index = 0; index < GFNC_combined.size(); ++index) {
this->myRespFactors->time[index] = exp(LNTTS_combined[index]) * t_s;
this->myRespFactors->LNTTS[index] = LNTTS_combined[index];
this->myRespFactors->GFNC[index] = GFNC_combined[index];
}
this->myRespFactors->LNTTS = LNTTS_combined;
this->myRespFactors->GFNC = GFNC_combined;
}

void GLHEBase::makeThisGLHECacheAndCompareWithFileCache(EnergyPlusData &state)
Expand Down Expand Up @@ -1460,13 +1441,13 @@ void GLHEVert::readCacheFileAndCompareWithThisGLHECache(EnergyPlusData &state)

if (gFunctionsExist) {
// Populate the time array
this->myRespFactors->time = Array1D<Real64>(myCacheData["Response Factors"]["time"].get<std::vector<Real64>>());
this->myRespFactors->time = std::vector<Real64>(myCacheData["Response Factors"]["time"].get<std::vector<Real64>>());

// Populate the lntts array
this->myRespFactors->LNTTS = Array1D<Real64>(myCacheData["Response Factors"]["LNTTS"].get<std::vector<Real64>>());
this->myRespFactors->LNTTS = std::vector<Real64>(myCacheData["Response Factors"]["LNTTS"].get<std::vector<Real64>>());

// Populate the g-function array
this->myRespFactors->GFNC = Array1D<Real64>(myCacheData["Response Factors"]["GFNC"].get<std::vector<Real64>>());
this->myRespFactors->GFNC = std::vector<Real64>(myCacheData["Response Factors"]["GFNC"].get<std::vector<Real64>>());
}
}

Expand Down Expand Up @@ -1522,18 +1503,13 @@ void GLHESlinky::calcGFunctions(EnergyPlusData &state)
int NPairs = static_cast<int>((tLg_max - tLg_min) / (tLg_grid) + 1);

// Allocate and setup g-function arrays
this->myRespFactors->GFNC.allocate(NPairs);
this->myRespFactors->LNTTS.allocate(NPairs);
this->myRespFactors->GFNC = std::vector<Real64>(NPairs, 0.0);
this->myRespFactors->LNTTS = std::vector<Real64>(NPairs, 0.0);
this->QnMonthlyAgg.allocate(static_cast<int>(this->maxSimYears * 12));
this->QnHr.allocate(730 + this->AGG + this->SubAGG);
this->QnSubHr.allocate(static_cast<int>((this->SubAGG + 1) * maxTSinHr + 1));
this->LastHourN.allocate(this->SubAGG + 1);

for (int i = 1; i <= NPairs; ++i) {
this->myRespFactors->GFNC(i) = 0.0;
this->myRespFactors->LNTTS(i) = 0.0;
}

// Calculate the number of loops (per trench) and number of trenches to be involved
// Due to the symmetry of a slinky GHX field, we need only calculate about
// on quarter of the rings' tube wall temperature perturbation to get the
Expand Down Expand Up @@ -1652,8 +1628,8 @@ void GLHESlinky::calcGFunctions(EnergyPlusData &state)
} // n1
} // m1

this->myRespFactors->GFNC(NT) = (gFunc * (this->coilDiameter / 2.0)) / (4 * Constant::Pi * fraction * this->numTrenches * this->numCoils);
this->myRespFactors->LNTTS(NT) = tLg;
this->myRespFactors->GFNC[NT - 1] = (gFunc * (this->coilDiameter / 2.0)) / (4 * Constant::Pi * fraction * this->numTrenches * this->numCoils);
this->myRespFactors->LNTTS[NT - 1] = tLg;

} // NT time
}
Expand Down Expand Up @@ -1834,7 +1810,7 @@ inline bool GLHEBase::isEven(int const val)

//******************************************************************************

Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1, Real64 const t, Real64 const eta, Real64 const J0)
Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1, Real64 const t, Real64 const eta, int const J0)
{
// SUBROUTINE INFORMATION:
// AUTHOR: Matt Mitchell
Expand All @@ -1848,33 +1824,28 @@ Real64 GLHESlinky::integral(int const m, int const n, int const m1, int const n1
// Simpson's 1/3 rule of integration

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 sumIntF = 0.0;
Real64 theta = 0.0;
constexpr Real64 theta1 = 0.0;
constexpr Real64 theta2 = 2 * Constant::Pi;
Array1D<Real64> f(J0, 0.0);
std::vector<Real64> f;

Real64 h = (theta2 - theta1) / (J0 - 1);

// Calculate the function at various equally spaced x values
for (int j = 1; j <= J0; ++j) {

theta = theta1 + (j - 1) * h;

f(j) = nearFieldResponseFunction(m, n, m1, n1, eta, theta, t);
for (int j = 0; j < J0; ++j) {
theta = theta1 + j * h;
f.push_back(nearFieldResponseFunction(m, n, m1, n1, eta, theta, t));
}

if (j == 1 || j == J0) {
f(j) = f(j);
} else if (isEven(j)) {
f(j) = 4 * f(j);
for (int j = 1; j < J0 - 1; ++j) {
if (!isEven(j)) {
f[j] = 4 * f[j];
} else {
f(j) = 2 * f(j);
f[j] = 2 * f[j];
}

sumIntF += f(j);
}

return (h / 3) * sumIntF;
return (h / 3) * std::reduce(f.begin(), f.end());
}

//******************************************************************************
Expand All @@ -1896,29 +1867,25 @@ Real64 GLHESlinky::doubleIntegral(int const m, int const n, int const m1, int co
constexpr Real64 eta1 = 0.0;
constexpr Real64 eta2 = 2 * Constant::Pi;

Real64 sumIntF = 0.0;
Array1D<Real64> g(I0, 0.0);
std::vector<Real64> g;

Real64 h = (eta2 - eta1) / (I0 - 1);

// Calculates the value of the function at various equally spaced values
for (int i = 1; i <= I0; ++i) {

Real64 eta = eta1 + (i - 1) * h;
g(i) = integral(m, n, m1, n1, t, eta, J0);
for (int i = 0; i < I0; ++i) {
Real64 eta = eta1 + i * h;
g.push_back(integral(m, n, m1, n1, t, eta, J0));
}

if (i == 1 || i == I0) {
g(i) = g(i);
} else if (isEven(i)) {
g(i) = 4 * g(i);
for (int i = 1; i < g.size() - 1; ++i) {
if (!isEven(i)) {
g[i] = 4 * g[i];
} else {
g(i) = 2 * g(i);
g[i] = 2 * g[i];
}

sumIntF += g(i);
}

return (h / 3) * sumIntF;
return (h / 3) * std::reduce(g.begin(), g.end());
}

//******************************************************************************
Expand Down
Loading

4 comments on commit 17e34a4

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

10823FanFreeUnitary (mjwitte) - x86_64-Linux-Ubuntu-24.04-gcc-13.2: OK (2918 of 2918 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

10823FanFreeUnitary (mjwitte) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-UnitTestsCoverage-RelWithDebInfo: OK (2100 of 2100 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.

10823FanFreeUnitary (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2896 of 2896 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

10823FanFreeUnitary (mjwitte) - x86_64-Linux-Ubuntu-24.04-gcc-13.2-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.