diff --git a/src/EnergyPlus/DataHeatBalance.cc b/src/EnergyPlus/DataHeatBalance.cc index bacf8618fd3..57c076b95b8 100644 --- a/src/EnergyPlus/DataHeatBalance.cc +++ b/src/EnergyPlus/DataHeatBalance.cc @@ -608,7 +608,7 @@ void CheckAndSetConstructionProperties(EnergyPlusData &state, auto const *thisMaterialGapR = dynamic_cast(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 diff --git a/src/EnergyPlus/HeatBalanceManager.cc b/src/EnergyPlus/HeatBalanceManager.cc index 545196e3c6f..05b4330a558 100644 --- a/src/EnergyPlus/HeatBalanceManager.cc +++ b/src/EnergyPlus/HeatBalanceManager.cc @@ -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); } } diff --git a/src/EnergyPlus/Material.cc b/src/EnergyPlus/Material.cc index f02ee060703..1dcbe576275 100644 --- a/src/EnergyPlus/Material.cc +++ b/src/EnergyPlus/Material.cc @@ -101,10 +101,10 @@ constexpr std::array GasSpecificHeatRatio = {0.0, 1.4, 1.67, 1.68, 1 constexpr std::array 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 @@ -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. @@ -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. @@ -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) diff --git a/src/EnergyPlus/Material.hh b/src/EnergyPlus/Material.hh index a3a94913bb2..216ef8bc245 100644 --- a/src/EnergyPlus/Material.hh +++ b/src/EnergyPlus/Material.hh @@ -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 gases; @@ -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 gasFracts = {0.0}; std::array gases = {Gas()}; GapVentType gapVentType = GapVentType::Sealed; // Gap Ven type for equivalent Layer window model diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 8a9489be821..a132ee5f182 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -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; diff --git a/src/EnergyPlus/WindowComplexManager.cc b/src/EnergyPlus/WindowComplexManager.cc index 58d208e1aed..ea79f4a55a7 100644 --- a/src/EnergyPlus/WindowComplexManager.cc +++ b/src/EnergyPlus/WindowComplexManager.cc @@ -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 diff --git a/src/EnergyPlus/WindowManager.cc b/src/EnergyPlus/WindowManager.cc index 37615891f0f..2b0e2ca602b 100644 --- a/src/EnergyPlus/WindowManager.cc +++ b/src/EnergyPlus/WindowManager.cc @@ -2399,10 +2399,11 @@ namespace Window { ++IGap; auto const *matGas = dynamic_cast(state.dataMaterial->Material(LayPtr)); assert(matGas != nullptr); - wm->gap[IGap - 1] = matGas->Thickness; - wm->gnmix[IGap - 1] = matGas->numGases; - for (int IMix = 0; IMix < wm->gnmix[IGap - 1]; ++IMix) { - wm->gases[IGap - 1][IMix] = matGas->gases[IMix]; + wm->gaps[IGap - 1].width = matGas->Thickness; + wm->gaps[IGap - 1].numGases = matGas->numGases; + for (int IMix = 0; IMix < wm->gaps[IGap - 1].numGases; ++IMix) { + wm->gaps[IGap - 1].gases[IMix] = matGas->gases[IMix]; + wm->gaps[IGap - 1].gasFracts[IMix] = matGas->gasFracts[IMix]; } } @@ -2413,15 +2414,16 @@ namespace Window { // Fill gap between blind/shade and adjacent glass with air properties. ++IGap; if (ShadeFlag == WinShadingType::IntShade || ShadeFlag == WinShadingType::ExtShade) // Interior or exterior shade - wm->gap[IGap - 1] = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->WinShadeToGlassDist; + wm->gaps[IGap - 1].width = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->WinShadeToGlassDist; else if (ShadeFlag == WinShadingType::ExtScreen) { - wm->gap[IGap - 1] = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->toGlassDist; + wm->gaps[IGap - 1].width = dynamic_cast(state.dataMaterial->Material(ShadeLayPtr))->toGlassDist; } else { // Interior or exterior blind - wm->gap[IGap - 1] = state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).BlindToGlassDist; + wm->gaps[IGap - 1].width = state.dataMaterial->Blind(state.dataSurface->SurfWinBlindNumber(SurfNum)).BlindToGlassDist; } - wm->gnmix[IGap - 1] = 1; + wm->gaps[IGap - 1].numGases = 1; - wm->gases[IGap - 1][0] = Material::gases[(int)Material::GasType::Air]; + wm->gaps[IGap - 1].gases[0] = Material::gases[(int)Material::GasType::Air]; + wm->gaps[IGap - 1].gasFracts[0] = 1; } // Exterior convection coefficient, exterior air temperature and IR radiance @@ -2677,7 +2679,7 @@ namespace Window { case 2: { // double pane WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = (con / wm->gap[0] * nu) * surfWin.edgeGlassCorrFac; + hgap(1) = (con / wm->gaps[0].width * nu) * surfWin.edgeGlassCorrFac; wm->fvec[0] = wm->Outir * wm->emis[0] - @@ -2704,11 +2706,11 @@ namespace Window { case 3: { // Triple Pane WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu * surfWin.edgeGlassCorrFac; + hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu * surfWin.edgeGlassCorrFac; + hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); @@ -2744,15 +2746,15 @@ namespace Window { case 4: { // Quad Pane WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu * surfWin.edgeGlassCorrFac; + hgap(1) = con / wm->gaps[0].width * nu * surfWin.edgeGlassCorrFac; WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu * surfWin.edgeGlassCorrFac; + hgap(2) = con / wm->gaps[1].width * nu * surfWin.edgeGlassCorrFac; WindowGasConductance(state, wm->thetas[5], wm->thetas[6], 3, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[5], wm->thetas[6], 3, gr, pr, nu); - hgap(3) = con / wm->gap[2] * nu * surfWin.edgeGlassCorrFac; + hgap(3) = con / wm->gaps[2].width * nu * surfWin.edgeGlassCorrFac; thetas_2_3_4 = pow_4(wm->thetas[1]) - pow_4(wm->thetas[2]); thetas_4_5_4 = pow_4(wm->thetas[3]) - pow_4(wm->thetas[4]); @@ -2826,7 +2828,7 @@ namespace Window { } else if (nglasslayer == 2) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, 0, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; Bface(1) = wm->Outir * wm->emis[0] + wm->hcout * wm->tout + wm->AbsRadGlassFace[0]; Bface(2) = wm->AbsRadGlassFace[1]; @@ -2850,11 +2852,11 @@ namespace Window { } else if (nglasslayer == 3) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, 0, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, 0, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu; + hgap(2) = con / wm->gaps[1].width * nu; Bface(1) = wm->Outir * wm->emis[0] + wm->hcout * wm->tout + wm->AbsRadGlassFace[0]; Bface(2) = wm->AbsRadGlassFace[1]; @@ -2888,15 +2890,15 @@ namespace Window { } else if (nglasslayer == 4) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, 0, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, 0, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu; + hgap(2) = con / wm->gaps[1].width * nu; WindowGasConductance(state, wm->thetas[5], wm->thetas[6], 3, con, pr, gr); NusseltNumber(state, 0, wm->thetas[5], wm->thetas[6], 3, gr, pr, nu); - hgap(3) = con / wm->gap[2] * nu; + hgap(3) = con / wm->gaps[2].width * nu; Bface(1) = wm->Outir * wm->emis[0] + wm->hcout * wm->tout + wm->AbsRadGlassFace[0]; Bface(2) = wm->AbsRadGlassFace[1]; @@ -3039,7 +3041,7 @@ namespace Window { } else if (nglasslayer == 2) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[0] = 0.5 * std::abs(wm->A23) * pow_3(wm->thetas[1] + wm->thetas[2]); hgap(1) = hgap(1) * surfWin.edgeGlassCorrFac + wm->hrgap[0] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3141,7 +3143,7 @@ namespace Window { } else if (nglasslayer == 3) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[0] = 0.5 * std::abs(wm->A23) * pow_3(wm->thetas[1] + wm->thetas[2]); hgap(1) = hgap(1) * surfWin.edgeGlassCorrFac + wm->hrgap[0] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3149,7 +3151,7 @@ namespace Window { WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu; + hgap(2) = con / wm->gaps[1].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[1] = 0.5 * std::abs(wm->A45) * pow_3(wm->thetas[3] + wm->thetas[4]); hgap(2) = hgap(2) * surfWin.edgeGlassCorrFac + wm->hrgap[1] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3257,7 +3259,7 @@ namespace Window { } else if (nglasslayer == 4) { WindowGasConductance(state, wm->thetas[1], wm->thetas[2], 1, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[1], wm->thetas[2], 1, gr, pr, nu); - hgap(1) = con / wm->gap[0] * nu; + hgap(1) = con / wm->gaps[0].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[0] = 0.5 * std::abs(wm->A23) * pow_3(wm->thetas[1] + wm->thetas[2]); hgap(1) = hgap(1) * surfWin.edgeGlassCorrFac + wm->hrgap[0] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3265,7 +3267,7 @@ namespace Window { WindowGasConductance(state, wm->thetas[3], wm->thetas[4], 2, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[3], wm->thetas[4], 2, gr, pr, nu); - hgap(2) = con / wm->gap[1] * nu; + hgap(2) = con / wm->gaps[1].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[1] = 0.5 * std::abs(wm->A45) * pow_3(wm->thetas[3] + wm->thetas[4]); hgap(2) = hgap(2) * surfWin.edgeGlassCorrFac + wm->hrgap[1] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3273,7 +3275,7 @@ namespace Window { WindowGasConductance(state, wm->thetas[5], wm->thetas[6], 3, con, pr, gr); NusseltNumber(state, SurfNum, wm->thetas[5], wm->thetas[6], 3, gr, pr, nu); - hgap(3) = con / wm->gap[2] * nu; + hgap(3) = con / wm->gaps[2].width * nu; if (surfWin.edgeGlassCorrFac > 1.0) { // Edge of glass correction wm->hrgap[2] = 0.5 * std::abs(wm->A67) * pow_3(wm->thetas[5] + wm->thetas[6]); hgap(3) = hgap(3) * surfWin.edgeGlassCorrFac + wm->hrgap[2] * (surfWin.edgeGlassCorrFac - 1.0); @@ -3911,7 +3913,7 @@ namespace Window { // Conductance of gap between glass and shade assuming gap is sealed WindowGasConductance(state, TGlassFace, TShadeFace, TotGaps, con, pr, gr); NusseltNumber(state, SurfNum, TGlassFace, TShadeFace, TotGaps, gr, pr, nu); - hGapStill = con / wm->gap[TotGaps - 1] * nu; + hGapStill = con / wm->gaps[TotGaps - 1].width * nu; // For near-horizontal windows (i.e., no more than 5 deg from horizontal) assume // there is no air flow thru gap @@ -4128,7 +4130,7 @@ namespace Window { // Conductance of gaps on either side of shade/blind assuming gaps are sealed WindowGasConductance(state, TGlassFace(IGap), TShadeFace(IGap), IGap + IGapInc, con, pr, gr); NusseltNumber(state, SurfNum, TGlassFace(IGap), TShadeFace(IGap), IGap + IGapInc, gr, pr, nu); - hGapStill(IGap) = con / wm->gap[IGap + IGapInc - 1] * nu; + hGapStill(IGap) = con / wm->gaps[IGap + IGapInc - 1].width * nu; } // For near-horizontal windows (i.e., no more than 5 deg from horizontal) assume @@ -4144,7 +4146,7 @@ namespace Window { } GapHeight = state.dataSurface->Surface(SurfNum).Height; - GapDepth = wm->gap[IGapInc]; + GapDepth = wm->gaps[IGapInc].width; AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; if (ShadeFlag == WinShadingType::BGShade) { @@ -4303,7 +4305,7 @@ namespace Window { // Conductance of gap assuming it is sealed WindowGasConductance(state, TGlassFace1, TGlassFace2, GapNum, con, pr, gr); NusseltNumber(state, SurfNum, TGlassFace1, TGlassFace2, GapNum, gr, pr, nu); - hGapStill = con / wm->gap[GapNum - 1] * nu; + hGapStill = con / wm->gaps[GapNum - 1].width * nu; GapHeight = state.dataSurface->Surface(SurfNum).Height; GapDepth = state.dataMaterial->Material(state.dataConstruction->Construct(ConstrNum).LayerPoint(2 * NGlass - 2))->Thickness; AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; @@ -4422,7 +4424,7 @@ namespace Window { } GapHeight = state.dataSurface->Surface(SurfNum).Height; - GapDepth = wm->gap[IGapInc]; + GapDepth = wm->gaps[IGapInc].width; AGap = GapDepth * state.dataSurface->Surface(SurfNum).Width; // Factor of 2 below assumes gaps on either side of shade/blind have same depth VGap = state.dataSurface->SurfWinAirflowThisTS(SurfNum) / (2.0 * GapDepth); @@ -4437,7 +4439,7 @@ namespace Window { // Conductance of gaps on either side of shade/blind assuming gaps are sealed WindowGasConductance(state, TGlassFace(IGap), TShadeFace(IGap), IGap + IGapInc, con, pr, gr); NusseltNumber(state, SurfNum, TGlassFace(IGap), TShadeFace(IGap), IGap + IGapInc, gr, pr, nu); - hGapStill(IGap) = con / wm->gap[IGap + IGapInc - 1] * nu; + hGapStill(IGap) = con / wm->gaps[IGap + IGapInc - 1].width * nu; // Shade/blind or glass surface to air convection coefficient hcv(IGap) = 2.0 * hGapStill(IGap) + 4.0 * VGap; RhoAir(IGap) = @@ -4662,16 +4664,16 @@ namespace Window { std::array fcp = {0.0}; // Specific heat of each gas in a mixture (J/m3-K) // Autodesk:Logic Either assert NMix>0 or handle NMix<=0 in logic so that con and locals guar. initialized before use - NMix = wm->gnmix[IGap - 1]; + NMix = wm->gaps[IGap - 1].numGases; for (int IMix = 0; IMix < NMix; ++IMix) { - frct[IMix] = wm->gases[IGap - 1][IMix - 1].fract; + frct[IMix] = wm->gaps[IGap - 1].gasFracts[IMix]; } Real64 const tmean(0.5 * (tleft + tright)); // Average gap gas temperature (K) Real64 const tmean_2(pow_2(tmean)); - auto const &wmgas0 = wm->gases[IGap - 1][0]; + auto const &wmgas0 = wm->gaps[IGap - 1].gases[0]; fcon[0] = wmgas0.con.c0 + wmgas0.con.c1 * tmean + wmgas0.con.c2 * tmean_2; fvis[0] = wmgas0.vis.c0 + wmgas0.vis.c1 * tmean + wmgas0.vis.c2 * tmean_2; fcp[0] = wmgas0.cp.c0 + wmgas0.cp.c1 * tmean + wmgas0.cp.c2 * tmean_2; @@ -4699,7 +4701,7 @@ namespace Window { // Calculate properties of mixture constituents for (int i = 2; i <= NMix; ++i) { - auto const &wmgas = wm->gases[IGap - 1][i - 1]; + auto const &wmgas = wm->gaps[IGap - 1].gases[i - 1]; fcon[i - 1] = wmgas.con.c0 + wmgas.con.c1 * tmean + wmgas.con.c2 * tmean_2; fvis[i - 1] = wmgas.vis.c0 + wmgas.vis.c1 * tmean + wmgas.vis.c2 * tmean_2; @@ -4715,10 +4717,10 @@ namespace Window { } for (int i = 1; i <= NMix; ++i) { - auto const &wmgasI = wm->gases[IGap - 1][i - 1]; + auto const &wmgasI = wm->gaps[IGap - 1].gases[i - 1]; for (int j = 1; j <= NMix; ++j) { - auto const &wmgasJ = wm->gases[IGap - 1][j - 1]; + auto const &wmgasJ = wm->gaps[IGap - 1].gases[j - 1]; // numerator of equation 61 phimup = pow_2(1.0 + std::sqrt(fvis[i - 1] / fvis[j - 1]) * root_4(wmgasJ.wght / wmgasI.wght)); @@ -4756,7 +4758,7 @@ namespace Window { } // End of check if single or multiple gases in gap pr = cp * visc / con; - gr = 9.807 * pow_3(wm->gap[IGap - 1]) * std::abs(tleft - tright) * pow_2(dens) / (tmean * pow_2(visc)); + gr = 9.807 * pow_3(wm->gaps[IGap - 1].width) * std::abs(tleft - tright) * pow_2(dens) / (tmean * pow_2(visc)); } // WindowGasConductance() //****************************************************************************** @@ -4803,14 +4805,14 @@ namespace Window { auto &wm = state.dataWindowManager; - NMix = wm->gnmix[IGap - 1]; + NMix = wm->gaps[IGap - 1].numGases; for (int IMix = 1; IMix <= NMix; ++IMix) { - frct(IMix) = wm->gases[IGap - 1][IMix - 1].fract; + frct(IMix) = wm->gaps[IGap - 1].gasFracts[IMix - 1]; } Real64 const tmean_2(pow_2(tmean)); - auto const &wmgas0 = wm->gases[IGap - 1][0]; + auto const &wmgas0 = wm->gaps[IGap - 1].gases[0]; fvis(1) = wmgas0.vis.c0 + wmgas0.vis.c1 * tmean + wmgas0.vis.c2 * tmean_2; fdens(1) = pres * wmgas0.wght / (gaslaw * tmean); // Density using ideal gas law: // rho=(presure*molecweight)/(gasconst*tmean) @@ -4826,7 +4828,7 @@ namespace Window { // Calculate properties of mixture constituents for (int i = 2; i <= NMix; ++i) { - auto const &wmgas = wm->gases[IGap - 1][i - 1]; + auto const &wmgas = wm->gaps[IGap - 1].gases[i - 1]; fvis(i) = wmgas.vis.c0 + wmgas.vis.c1 * tmean + wmgas.vis.c2 * tmean_2; fdens(i) = pres * wmgas.wght / (gaslaw * tmean); molmix += frct(i) * wmgas.wght; // eq. 56 @@ -4834,9 +4836,9 @@ namespace Window { } for (int i = 1; i <= NMix; ++i) { - auto const &wmgasI = wm->gases[IGap - 1][i - 1]; + auto const &wmgasI = wm->gaps[IGap - 1].gases[i - 1]; for (int j = 1; j <= NMix; ++j) { - auto const &wmgasJ = wm->gases[IGap - 1][j - 1]; + auto const &wmgasJ = wm->gaps[IGap - 1].gases[j - 1]; // numerator of equation 61 phimup = pow_2(1.0 + std::sqrt(fvis(i) / fvis(j)) * root_4(wmgasJ.wght / wmgasI.wght)); // denomonator of eq. 61, 64 and 66 @@ -5047,10 +5049,10 @@ namespace Window { auto &wm = state.dataWindowManager; if (SurfNum > 0) { - asp = state.dataSurface->Surface(SurfNum).Height / wm->gap[IGap - 1]; + asp = state.dataSurface->Surface(SurfNum).Height / wm->gaps[IGap - 1].width; } else { // SurfNum = 0 when NusseltNumber is called from CalcNominalWindowCond, which applies to a // particular construction. So window height is not known and we assume 5 ft (1.524 m) - asp = 1.524 / wm->gap[IGap - 1]; + asp = 1.524 / wm->gaps[IGap - 1].width; } wm->tiltr = wm->tilt * Constant::DegToRadians; @@ -6605,10 +6607,11 @@ namespace Window { } auto const *matGas = dynamic_cast(state.dataMaterial->Material(LayPtr)); assert(matGas != nullptr); - wm->gap[IGap - 1] = matGas->Thickness; - wm->gnmix[IGap - 1] = matGas->numGases; - for (int IMix = 0; IMix < wm->gnmix[IGap - 1]; ++IMix) { - wm->gases[IGap - 1][IMix] = matGas->gases[IMix]; + wm->gaps[IGap - 1].width = matGas->Thickness; + wm->gaps[IGap - 1].numGases = matGas->numGases; + for (int IMix = 0; IMix < wm->gaps[IGap - 1].numGases; ++IMix) { + wm->gaps[IGap - 1].gases[IMix] = matGas->gases[IMix]; + wm->gaps[IGap - 1].gasFracts[IMix] = matGas->gasFracts[IMix]; } } } // for (Lay) diff --git a/src/EnergyPlus/WindowManager.hh b/src/EnergyPlus/WindowManager.hh index 15e6ed06fc0..f8bec982c9b 100644 --- a/src/EnergyPlus/WindowManager.hh +++ b/src/EnergyPlus/WindowManager.hh @@ -423,9 +423,9 @@ namespace Window { struct WindowGap { int numGases = 0; - std::array gases; - Real64 width; - + std::array gases = {Material::Gas()}; + std::array gasFracts = {0.0}; + Real64 width = 0.0; }; } // namespace Window @@ -499,9 +499,7 @@ struct WindowManagerData : BaseGlobalStruct Real64 Outir = 0.0; // IR radiance of window's exterior surround (W/m2) Real64 Rmir = 0.0; // IR radiance of window's interior surround (W/m2) Real64 Rtot = 0.0; // Total thermal resistance of window (m2-K/W) - std::array, Window::maxGlassLayers> gases = {Material::Gas()}; // Gas thermal conductivity coefficients for each gap - std::array gnmix = {0}; // Number of gases in gap - std::array gap = {0.0}; // Gap width (m) + std::array gaps = {Window::WindowGap()}; // Gas thermal conductivity coefficients for each gap std::array thick = {0.0}; // Glass layer thickness (m) std::array scon = {0.0}; // Glass layer conductance--conductivity/thickness (W/m2-K) @@ -581,9 +579,7 @@ struct WindowManagerData : BaseGlobalStruct this->Outir = 0.0; this->Rmir = 0.0; this->Rtot = 0.0; - this->gases = {Material::Gas()}; - this->gnmix = {0}; - this->gap = {0.0}; + this->gaps = {Window::WindowGap()}; this->thick = {0.0}; this->scon = {0.0}; this->tir = {0.0}; diff --git a/src/EnergyPlus/WindowManagerExteriorThermal.cc b/src/EnergyPlus/WindowManagerExteriorThermal.cc index 48a8d3fe674..493fb50bc4f 100644 --- a/src/EnergyPlus/WindowManagerExteriorThermal.cc +++ b/src/EnergyPlus/WindowManagerExteriorThermal.cc @@ -756,7 +756,7 @@ namespace Window { for (int i = 0; i < numGases; ++i) { auto const &gas = matGas->gases[i]; Real64 wght = gas.wght; - Real64 fract = gas.fract; + Real64 fract = matGas->gasFracts[i]; Gases::CIntCoeff aCon(gas.con.c0, gas.con.c1, gas.con.c2); Gases::CIntCoeff aCp(gas.cp.c0, gas.cp.c1, gas.cp.c2); Gases::CIntCoeff aVis(gas.vis.c0, gas.vis.c1, gas.vis.c2);