Skip to content

Commit

Permalink
Fix some issues (gas fractions)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Jan 7, 2024
1 parent ef1d1e2 commit f64f231
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 94 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/DataHeatBalance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state,
auto const *thisMaterialGapR = dynamic_cast<const Material::MaterialGasMix *>(state.dataMaterial->Material(MatGapR));
for (int IGas = 0; IGas < Material::maxMixGases; ++IGas) {
if ((thisMaterialGapL->gases[IGas].type != thisMaterialGapR->gases[IGas].type) ||
(thisMaterialGapL->gases[IGas].fract != thisMaterialGapR->gases[IGas].fract))
(thisMaterialGapL->gasFracts[IGas] != thisMaterialGapR->gasFracts[IGas]))
WrongWindowLayering = true;
}
// Gap width on either side of a between-glass shade/blind must be the same
Expand Down
15 changes: 8 additions & 7 deletions src/EnergyPlus/HeatBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4265,19 +4265,20 @@ namespace HeatBalanceManager {
assert(matGas != nullptr);
matGas->numGases = NumGases(IGap, IGlSys);
for (int IGas = 0; IGas < matGas->numGases; ++IGas) {
auto &gas = matGas->gases[IGas];
NextLine = W5DataFile.readLine();
++FileLineCount;
readList(NextLine.data.substr(19),
GasName(IGas+1),
matGas->gases[IGas].fract,
matGas->gases[IGas].wght,
matGas->gases[IGas].con.c0, matGas->gases[IGas].con.c1, matGas->gases[IGas].con.c2,
matGas->gases[IGas].vis.c0, matGas->gases[IGas].vis.c1, matGas->gases[IGas].vis.c2,
matGas->gases[IGas].cp.c0, matGas->gases[IGas].cp.c1, matGas->gases[IGas].cp.c2);
matGas->gasFracts[IGas],
gas.wght,
gas.con.c0, gas.con.c1, gas.con.c2,
gas.vis.c0, gas.vis.c1, gas.vis.c2,
gas.cp.c0, gas.cp.c1, gas.cp.c2);
}
// Nominal resistance of gap at room temperature (based on first gas in mixture)
state.dataHeatBal->NominalR(MatNum) =
matGas->Thickness / (matGas->gases[0].con.c0 + matGas->gases[0].con.c1 * 300.0 + matGas->gases[0].con.c2 * 90000.0);
auto const &gas0 = matGas->gases[0];
state.dataHeatBal->NominalR(MatNum) = matGas->Thickness / (gas0.con.c0 + gas0.con.c1 * 300.0 + gas0.con.c2 * 90000.0);
}
}

Expand Down
16 changes: 9 additions & 7 deletions src/EnergyPlus/Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ constexpr std::array<Real64, 10> GasSpecificHeatRatio = {0.0, 1.4, 1.67, 1.68, 1

constexpr std::array<Material::Gas, 10> gases = {
Gas(), // Empty
{GasType::Air, {2.873e-3, 7.760e-5, 0.0}, {3.723e-6, 4.940e-8, 0.0}, {1002.737, 1.2324e-2, 0.0}, 28.97, 1.4, 0.0}, // Air
{GasType::Argon, {2.285e-3, 5.149e-5, 0.0}, {3.379e-6, 6.451e-8, 0.0}, {521.929, 0.0, 0.0}, 39.948, 1.67, 0.0}, // Argon
{GasType::Krypton, {9.443e-4, 2.826e-5, 0.0}, {2.213e-6, 7.777e-8, 0.0}, {248.091, 0.0, 0.0}, 83.8, 1.68, 0.0}, // Krypton
{GasType::Xenon, {4.538e-4, 1.723e-5, 0.0}, {1.069e-6, 7.414e-8, 0.0}, {158.340, 0.0, 0.0}, 131.3, 1.66, 0.0}, // Xenon
{GasType::Air, {2.873e-3, 7.760e-5, 0.0}, {3.723e-6, 4.940e-8, 0.0}, {1002.737, 1.2324e-2, 0.0}, 28.97, 1.4}, // Air
{GasType::Argon, {2.285e-3, 5.149e-5, 0.0}, {3.379e-6, 6.451e-8, 0.0}, {521.929, 0.0, 0.0}, 39.948, 1.67}, // Argon
{GasType::Krypton, {9.443e-4, 2.826e-5, 0.0}, {2.213e-6, 7.777e-8, 0.0}, {248.091, 0.0, 0.0}, 83.8, 1.68}, // Krypton
{GasType::Xenon, {4.538e-4, 1.723e-5, 0.0}, {1.069e-6, 7.414e-8, 0.0}, {158.340, 0.0, 0.0}, 131.3, 1.66}, // Xenon
Gas(), // Empty
Gas(), // Empty
Gas(), // Empty
Expand Down Expand Up @@ -1179,7 +1179,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if
state.dataMaterial->Material(MaterNum) = matGas;
matGas->group = Group::WindowGas;
matGas->numGases = 1;
matGas->gases[0].fract = 1.0;
matGas->gasFracts[0] = 1.0;

// Load the material derived type from the input data.

Expand Down Expand Up @@ -1281,7 +1281,7 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if
state.dataMaterial->Material(MaterNum) = matGas;
matGas->group = Group::GapEquivalentLayer;
matGas->numGases = 1;
matGas->gases[0].fract = 1.0;
matGas->gasFracts[0] = 1.0;

// Load the material derived type from the input data.

Expand Down Expand Up @@ -1409,8 +1409,10 @@ void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound) // set to true if

for (NumGas = 0; NumGas < NumGases; ++NumGas) {
GasType gasType = matGas->gases[NumGas].type;
if (gasType != GasType::Custom)
if (gasType != GasType::Custom) {
matGas->gasFracts[NumGas] = MaterialProps(3 + NumGas);
matGas->gases[NumGas] = gases[(int)gasType];
}
}

// Nominal resistance of gap at room temperature (based on first gas in mixture)
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Material.hh
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ namespace Material {
GasCoeffs cp = GasCoeffs();
Real64 wght = 0.0;
Real64 specHeatRatio = 0.0;
Real64 fract = 0.0;
};

extern const std::array<Gas, 10> gases;
Expand All @@ -588,6 +587,7 @@ namespace Material {
// up to 5 gases in a mixture [Window gas only]. It is defined as parameter (GasCoefs)
int numGases = 0; // Number of gases in a window gas mixture

std::array<Real64, maxMixGases> gasFracts = {0.0};
std::array<Gas, maxMixGases> gases = {Gas()};

GapVentType gapVentType = GapVentType::Sealed; // Gap Ven type for equivalent Layer window model
Expand Down
17 changes: 2 additions & 15 deletions src/EnergyPlus/SurfaceGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14047,23 +14047,10 @@ namespace SurfaceGeometry {
// thisMaterial->ThermGradCoef = 0.0;
thisMaterial->Thickness = distance;
// thisMaterial->VaporDiffus = 0.0;
// thisMaterial->GasTypes = Material::GasType::Custom;
// thisMaterial->GasCon = 0.0;
// thisMaterial->GasVis = 0.0;
// thisMaterial->GasCp = 0.0;
// thisMaterial->GasWght = 0.0;
// thisMaterial->GasFract = 0.0;
// thisMaterial->gasTypes(1) = Material::GasType::Air;
// thisMaterial->GlassSpectralDataPtr = 0;
thisMaterial->numGases = 1;
thisMaterial->gases[0].con.c0 = 2.873e-3;
thisMaterial->gases[0].con.c1 = 7.760e-5;
thisMaterial->gases[0].vis.c0 = 3.723e-6;
thisMaterial->gases[0].vis.c1 = 4.940e-8;
thisMaterial->gases[0].cp.c0 = 1002.737;
thisMaterial->gases[0].cp.c1 = 1.2324e-2;
thisMaterial->gases[0].wght = 28.97;
thisMaterial->gases[0].fract = 1.0;
thisMaterial->gases[0] = Material::gases[(int)Material::GasType::Air];
thisMaterial->gasFracts[0] = 1.0;
thisMaterial->AbsorpSolar = 0.0;
thisMaterial->AbsorpThermal = 0.0;
thisMaterial->AbsorpVisible = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/WindowComplexManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2931,7 +2931,7 @@ namespace WindowComplexManager {
nmix(IGap + 1) = thisMaterialGas->numGases;
for (IMix = 1; IMix <= nmix(IGap + 1); ++IMix) {
auto const &gas = thisMaterialGas->gases[IMix-1];
frct(IMix, IGap + 1) = gas.fract;
frct(IMix, IGap + 1) = thisMaterialGas->gasFracts[IMix-1];

// Now has to build-up gas coefficients arrays. All used gasses should be stored into these arrays and
// to be correctly referenced by gap arrays
Expand Down
Loading

5 comments on commit f64f231

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

WindowManager1 (amirroth) - Win64-Windows-10-VisualStudio-16: OK (2754 of 2756 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 787
  • Failed: 2

Build Badge Test Badge

@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.

WindowManager1 (amirroth) - x86_64-MacOS-10.17-clang-14.0.0: OK (3524 of 3543 tests passed, 6 test warnings)

Messages:\n

  • 23 tests had: EIO diffs.
  • 13 tests had: ESO big diffs.
  • 16 tests had: Table big diffs.
  • 2 tests had: EDD diffs.
  • 2 tests had: ESO small diffs.
  • 2 tests had: MTR small diffs.
  • 1 test had: ZSZ small diffs.
  • 1 test had: Table small diffs.
  • 1 test had: ERR diffs.
  • 1 test had: SSZ small diffs.
  • 1 test had: ZSZ big diffs.

Failures:\n

integration Test Summary

  • Passed: 787
  • Failed: 2

regression Test Summary

  • Passed: 769
  • Failed: 17

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.

WindowManager1 (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3563 of 3584 tests passed, 6 test warnings)

Messages:\n

  • 25 tests had: EIO diffs.
  • 13 tests had: ESO big diffs.
  • 18 tests had: Table big diffs.
  • 2 tests had: EDD diffs.
  • 2 tests had: ESO small diffs.
  • 2 tests had: MTR small diffs.
  • 1 test had: ZSZ small diffs.
  • 1 test had: Table small diffs.
  • 1 test had: ERR diffs.
  • 1 test had: SSZ small diffs.
  • 1 test had: ZSZ big diffs.

Failures:\n

integration Test Summary

  • Passed: 790
  • Failed: 2

regression Test Summary

  • Passed: 787
  • Failed: 19

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.

WindowManager1 (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1969 of 1969 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

WindowManager1 (amirroth) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (786 of 790 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 786
  • Failed: 4

Build Badge Test Badge Coverage Badge

Please sign in to comment.