-
Notifications
You must be signed in to change notification settings - Fork 461
Avoid duplicate view factor calculations (Plan B) #11364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2e877f4
aefcf34
9fbc815
8b110fd
8d3bf6f
ec49778
a9704b4
ffc52e4
6c617dd
4989108
cdc5cfd
187f00d
d94d5bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,6 +377,7 @@ namespace Dayltg { | |
| if (ShelfSurf > 0) { | ||
| // Double surface area so that both sides of the shelf are treated as internal mass | ||
| state.dataSurface->Surface(ShelfSurf).Area *= 2.0; | ||
| state.dataGlobal->AnyInsideShelf = true; // Set this to force recalc for radiant view factors due to area change | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set the flag here. This is where the shelf area gets doubled (after |
||
| } | ||
|
|
||
| ShelfSurf = state.dataDaylightingDevicesData->Shelf(ShelfNum).OutSurf; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -459,15 +459,13 @@ namespace HeatBalanceIntRadExchange { | |
|
|
||
| // SUBROUTINE LOCAL VARIABLE DECLARATIONS: | ||
| static constexpr std::string_view RoutineName("InitInteriorRadExchange: "); | ||
| bool NoUserInputF; // Logical flag signifying no input F's for zone | ||
| bool ErrorsFound(false); | ||
| Real64 CheckValue1; | ||
| Real64 CheckValue2; | ||
| Real64 FinalCheckValue; | ||
| Real64 CheckValue1 = 0.0; | ||
| Real64 CheckValue2 = 0.0; | ||
| Real64 FinalCheckValue = 0.0; | ||
| Array2D<Real64> SaveApproximateViewFactors; // Save for View Factor reporting | ||
| Real64 RowSum; | ||
| Real64 FixedRowSum; | ||
| int NumIterations; | ||
| Real64 FixedRowSum = 0.0; | ||
| int NumIterations = 0; | ||
| std::string Option1; // view factor report option | ||
|
|
||
| auto &ViewFactorReport = state.dataHeatBalIntRadExchg->ViewFactorReport; | ||
|
|
@@ -524,8 +522,10 @@ namespace HeatBalanceIntRadExchange { | |
| thisEnclosure.Emissivity.dimension(numEnclosureSurfaces, 0.0); | ||
| thisEnclosure.Azimuth.dimension(numEnclosureSurfaces, 0.0); | ||
| thisEnclosure.Tilt.dimension(numEnclosureSurfaces, 0.0); | ||
| thisEnclosure.Fp.dimension(numEnclosureSurfaces, 1.0); | ||
| thisEnclosure.FMRT.dimension(numEnclosureSurfaces, 0.0); | ||
| if (state.dataHeatBalIntRadExchg->CarrollMethod) { | ||
| thisEnclosure.Fp.dimension(numEnclosureSurfaces, 1.0); | ||
| thisEnclosure.FMRT.dimension(numEnclosureSurfaces, 0.0); | ||
|
Comment on lines
+525
to
+527
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are only used for
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And the statement is just to save initialization when not needed? The values you are initializing to don't seem to matter since they are not used until they are set below. That's fine if correct. Just noting it. Let me know otherwise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. Make sense. |
||
| } | ||
| thisEnclosure.SurfacePtr.dimension(numEnclosureSurfaces, 0); | ||
|
|
||
| // Initialize the enclosure surface arrays | ||
|
|
@@ -577,8 +577,10 @@ namespace HeatBalanceIntRadExchange { | |
| // If there is only one surface in a zone, then there is no radiant exchange | ||
| thisEnclosure.F = 0.0; | ||
| thisEnclosure.ScriptF = 0.0; | ||
| thisEnclosure.Fp = 0.0; | ||
| thisEnclosure.FMRT = 0.0; | ||
| if (state.dataHeatBalIntRadExchg->CarrollMethod) { | ||
| thisEnclosure.Fp = 0.0; | ||
| thisEnclosure.FMRT = 0.0; | ||
| } | ||
| if (state.dataGlobal->DisplayAdvancedReportVariables) { | ||
| print(state.files.eio, "Surface View Factor Check Values,{},0,0,0,-1,0,0\n", thisEnclosure.Name); | ||
| } | ||
|
|
@@ -596,53 +598,63 @@ namespace HeatBalanceIntRadExchange { | |
| CalcFMRT(state, thisEnclosure.NumOfSurfaces, thisEnclosure.Area, thisEnclosure.FMRT); | ||
| CalcFp(thisEnclosure.NumOfSurfaces, thisEnclosure.Emissivity, thisEnclosure.FMRT, thisEnclosure.Fp); | ||
| } else { | ||
| // Get user supplied view factors if available in idf. | ||
|
|
||
| NoUserInputF = true; | ||
| // For radiant enclosures: | ||
| // If UseRepresentativeSurfaceCalculations is true and there are no user input view factors, then calc approx view factors | ||
| // (If User supplied view factors are present, then UseRepresentativeSurfaceCalculations is skipped in SufaceGeometry::GetSurfaceData) | ||
| // If there are any inside light shelfs then calc approx view factors (because the light shelf area is doubled for heat transfer) | ||
| // Otherwise, copy final view factors from the solar enclosure | ||
|
Comment on lines
601
to
605
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the new rules to decide if the solar view factors can be used for radiant exchange or if they need to be recalculated.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||
|
|
||
| constexpr std::string_view cCurrentModuleObject = "ZoneProperty:UserViewFactors:BySurfaceName"; | ||
| int NumZonesWithUserFbyS = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); | ||
| if (NumZonesWithUserFbyS > 0) { | ||
|
|
||
| GetInputViewFactorsbyName(state, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are gotten in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, see below. |
||
| thisEnclosure.Name, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.F, | ||
| thisEnclosure.SurfacePtr, | ||
| NoUserInputF, | ||
| ErrorsFound); // Obtains user input view factors from input file | ||
| } | ||
|
|
||
| if (NoUserInputF) { | ||
| bool useSolarViewFactors = ((!state.dataSurface->UseRepresentativeSurfaceCalculations || NumZonesWithUserFbyS > 0) && | ||
| !state.dataGlobal->AnyInsideShelf && !state.dataViewFactor->EnclSolInfo(enclosureNum).F.empty()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where the new flag AnyInsideShelf is used to avoid a new view factor calculation. At least that part of the change is apparent. |
||
|
|
||
| // Calculate the view factors and make sure they satisfy reciprocity | ||
| CalcApproximateViewFactors(state, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.Area, | ||
| thisEnclosure.Azimuth, | ||
| thisEnclosure.Tilt, | ||
| thisEnclosure.F, | ||
| thisEnclosure.SurfacePtr); | ||
| } | ||
| if (useSolarViewFactors) { | ||
| thisEnclosure.F = state.dataViewFactor->EnclSolInfo(enclosureNum).F; | ||
| } else { | ||
| bool NoUserInputF = true; | ||
| if (NumZonesWithUserFbyS > 0) { | ||
|
|
||
| GetInputViewFactorsbyName(state, | ||
| thisEnclosure.Name, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.F, | ||
| thisEnclosure.SurfacePtr, | ||
| NoUserInputF, | ||
| ErrorsFound); // Obtains user input view factors from input file | ||
| } | ||
|
|
||
| if (ViewFactorReport) { // Allocate and save user or approximate view factors for reporting. | ||
| SaveApproximateViewFactors.allocate(thisEnclosure.NumOfSurfaces, thisEnclosure.NumOfSurfaces); | ||
| SaveApproximateViewFactors = thisEnclosure.F; | ||
| } | ||
| if (NoUserInputF) { | ||
| // Calculate the view factors and make sure they satisfy reciprocity | ||
| CalcApproximateViewFactors(state, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.Area, | ||
| thisEnclosure.Azimuth, | ||
| thisEnclosure.Tilt, | ||
| thisEnclosure.F, | ||
| thisEnclosure.SurfacePtr); | ||
| } | ||
|
|
||
| bool anyIntMassInZone = DoesZoneHaveInternalMass(state, thisEnclosure.NumOfSurfaces, thisEnclosure.SurfacePtr); | ||
| FixViewFactors(state, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.Area, | ||
| thisEnclosure.F, | ||
| thisEnclosure.Name, | ||
| thisEnclosure.spaceNums, | ||
| CheckValue1, | ||
| CheckValue2, | ||
| FinalCheckValue, | ||
| NumIterations, | ||
| FixedRowSum, | ||
| anyIntMassInZone); | ||
| if (ViewFactorReport) { // Allocate and save user or approximate view factors for reporting. | ||
| SaveApproximateViewFactors.allocate(thisEnclosure.NumOfSurfaces, thisEnclosure.NumOfSurfaces); | ||
| SaveApproximateViewFactors = thisEnclosure.F; | ||
| } | ||
|
|
||
| bool anyIntMassInZone = DoesZoneHaveInternalMass(state, thisEnclosure.NumOfSurfaces, thisEnclosure.SurfacePtr); | ||
| FixViewFactors(state, | ||
| thisEnclosure.NumOfSurfaces, | ||
| thisEnclosure.Area, | ||
| thisEnclosure.F, | ||
| thisEnclosure.Name, | ||
| thisEnclosure.spaceNums, | ||
| CheckValue1, | ||
| CheckValue2, | ||
| FinalCheckValue, | ||
| NumIterations, | ||
| FixedRowSum, | ||
| anyIntMassInZone); | ||
| } | ||
|
|
||
| // Calculate the script F factors | ||
| CalcScriptF(state, thisEnclosure.NumOfSurfaces, thisEnclosure.Area, thisEnclosure.F, thisEnclosure.Emissivity, thisEnclosure.ScriptF); | ||
|
|
@@ -668,24 +680,26 @@ namespace HeatBalanceIntRadExchange { | |
| print(state.files.eio, "\n"); | ||
| } | ||
|
|
||
| print(state.files.eio, "Approximate or User Input ViewFactors,To Surface,Surface Class,RowSum"); | ||
| for (int SurfNum : thisEnclosure.SurfaceReportNums) { | ||
| print(state.files.eio, ",{}", state.dataSurface->Surface(thisEnclosure.SurfacePtr(SurfNum)).Name); | ||
| } | ||
| print(state.files.eio, "\n"); | ||
|
|
||
| for (int Findex : thisEnclosure.SurfaceReportNums) { | ||
| RowSum = sum(SaveApproximateViewFactors(_, Findex)); | ||
| print(state.files.eio, | ||
| "{},{},{},{:.4R}", | ||
| "View Factor", | ||
| state.dataSurface->Surface(thisEnclosure.SurfacePtr(Findex)).Name, | ||
| cSurfaceClass(state.dataSurface->Surface(thisEnclosure.SurfacePtr(Findex)).Class), | ||
| RowSum); | ||
| if (!useSolarViewFactors) { | ||
| print(state.files.eio, "Approximate or User Input ViewFactors,To Surface,Surface Class,RowSum"); | ||
| for (int SurfNum : thisEnclosure.SurfaceReportNums) { | ||
| print(state.files.eio, ",{:.4R}", SaveApproximateViewFactors(SurfNum, Findex)); | ||
| print(state.files.eio, ",{}", state.dataSurface->Surface(thisEnclosure.SurfacePtr(SurfNum)).Name); | ||
| } | ||
| print(state.files.eio, "\n"); | ||
|
|
||
| for (int Findex : thisEnclosure.SurfaceReportNums) { | ||
| Real64 RowSum = sum(SaveApproximateViewFactors(_, Findex)); | ||
| print(state.files.eio, | ||
| "{},{},{},{:.4R}", | ||
| "View Factor", | ||
| state.dataSurface->Surface(thisEnclosure.SurfacePtr(Findex)).Name, | ||
| cSurfaceClass(state.dataSurface->Surface(thisEnclosure.SurfacePtr(Findex)).Class), | ||
| RowSum); | ||
| for (int SurfNum : thisEnclosure.SurfaceReportNums) { | ||
| print(state.files.eio, ",{:.4R}", SaveApproximateViewFactors(SurfNum, Findex)); | ||
| } | ||
| print(state.files.eio, "\n"); | ||
| } | ||
| } | ||
|
|
||
| print(state.files.eio, "Final ViewFactors,To Surface,Surface Class,RowSum"); | ||
|
|
@@ -695,7 +709,7 @@ namespace HeatBalanceIntRadExchange { | |
| print(state.files.eio, "\n"); | ||
|
|
||
| for (int Findex : thisEnclosure.SurfaceReportNums) { | ||
| RowSum = sum(thisEnclosure.F(_, Findex)); | ||
| Real64 RowSum = sum(thisEnclosure.F(_, Findex)); | ||
| print(state.files.eio, | ||
| "{},{},{},{:.4R}", | ||
| "View Factor", | ||
|
|
@@ -767,22 +781,24 @@ namespace HeatBalanceIntRadExchange { | |
| SaveApproximateViewFactors.deallocate(); | ||
| } | ||
|
|
||
| RowSum = 0.0; | ||
| for (int Findex : thisEnclosure.SurfaceReportNums) { | ||
| RowSum += sum(thisEnclosure.F(_, Findex)); | ||
| } | ||
| RowSum = std::abs(RowSum - thisEnclosure.NumOfSurfaces); | ||
| FixedRowSum = std::abs(FixedRowSum - thisEnclosure.NumOfSurfaces); | ||
| if (state.dataGlobal->DisplayAdvancedReportVariables) { | ||
| print(state.files.eio, | ||
| "Surface View Factor Check Values,{},{:.6R},{:.6R},{:.6R},{},{:.6R},{:.6R}\n", | ||
| thisEnclosure.Name, | ||
| CheckValue1, | ||
| CheckValue2, | ||
| FinalCheckValue, | ||
| NumIterations, | ||
| FixedRowSum, | ||
| RowSum); | ||
| if (!useSolarViewFactors) { | ||
| Real64 RowSum = 0.0; | ||
| for (int Findex : thisEnclosure.SurfaceReportNums) { | ||
| RowSum += sum(thisEnclosure.F(_, Findex)); | ||
| } | ||
| RowSum = std::abs(RowSum - thisEnclosure.NumOfSurfaces); | ||
| FixedRowSum = std::abs(FixedRowSum - thisEnclosure.NumOfSurfaces); | ||
| if (state.dataGlobal->DisplayAdvancedReportVariables) { | ||
| print(state.files.eio, | ||
| "Surface View Factor Check Values,{},{:.6R},{:.6R},{:.6R},{},{:.6R},{:.6R}\n", | ||
| thisEnclosure.Name, | ||
| CheckValue1, | ||
| CheckValue2, | ||
| FinalCheckValue, | ||
| NumIterations, | ||
| FixedRowSum, | ||
| RowSum); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -849,18 +849,6 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_GetMixingAndCrossMixing) | |
| " ** ~~~ ** So, when there are three or less surfaces in a zone, EnergyPlus will make sure there are no losses of energy but", | ||
| " ** ~~~ ** it will not exchange the full amount of radiation with the rest of the zone as it would if there was a completed " | ||
| "enclosure.", | ||
| " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", // Why are these errors being reported twice, because | ||
| // something is being calculated twice? | ||
| " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1A FLOOR\" in Zone=ZONE 1", | ||
| " ** Warning ** CalcApproximateViewFactors: Zero area for all other zone surfaces.", | ||
| " ** ~~~ ** Happens for Surface=\"DUMMY SPACE 1B FLOOR\" in Zone=ZONE 1", | ||
| " ** Warning ** Surfaces in Zone/Enclosure=\"ZONE 1\" do not define an enclosure.", | ||
| " ** ~~~ ** Number of surfaces <= 3, view factors are set to force reciprocity but may not fulfill completeness.", | ||
| " ** ~~~ ** Reciprocity means that radiant exchange between two surfaces will match and not lead to an energy loss.", | ||
| " ** ~~~ ** Completeness means that all of the view factors between a surface and the other surfaces in a zone add up to unity.", | ||
| " ** ~~~ ** So, when there are three or less surfaces in a zone, EnergyPlus will make sure there are no losses of energy but", | ||
| " ** ~~~ ** it will not exchange the full amount of radiation with the rest of the zone as it would if there was a completed " | ||
| "enclosure.", | ||
| " ************* Testing Individual Branch Integrity", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to have the duplicate error message gone. |
||
| " ************* All Branches passed integrity testing", | ||
| " ************* Testing Individual Supply Air Path Integrity", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add new flag to track if there are any inside light shelves.
Fixed the name of "AndShadingControlInModel" to "AnyShading...."