-
Notifications
You must be signed in to change notification settings - Fork 394
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
Implement Carroll method for Interior Radiant Heat Exchange #7534
Conversation
idd/Energy+.idd.in
Outdated
\type choice | ||
\key ScriptF | ||
\key CarrollMRT | ||
\default ScriptF |
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.
We have a proliferation of these single-function objects. I'd prefer to see this as a new field in, say, HeatBalanceAlgorithm.
Or a better fit might be the new PerformancePrecisionTradeoffs object since that's the intent here.
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.
@mjwitte I can do that.
Is the PerformancePrecisionTradeoffs object merged in yet? If not, I think it would be best to have these tradeoffs in existing topical settings objects (like HeatBalanceAlgorithm) with a clear document on the various tradeoff options and where to find them. There are already several alternatives that aren't in the PerformancePrecisionTradeoffs that can be included, too (e.g., CTF vs. finite difference, and the air heat balance algorithm).
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.
Yes, it's in v9.2. There is no plan to move existing algorithm options into PerformancePrecisionTradeoffs.
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.
Getting close. See comments below. Checked in a small tweak to the code and some doc cleanups (easier to just fix than to list here).
Array1<Real64> &Fp // VECTOR OF OPPENHEIM RESISTNACE VALUES | ||
); | ||
|
||
void CalcMatrixInverse(Array2<Real64> &A, // Matrix: Gets reduced to L\U form |
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.
Looks like the indent got lost here.
Real64 IRfromParentZone_acc(0.0); // Local accumulator | ||
for (size_type SendZoneSurfNum = 0; SendZoneSurfNum < s_zone_Surfaces; ++SendZoneSurfNum, ++lSR) { | ||
Real64 const scriptF(zone_ScriptF[lSR]); // [ lSR ] == ( SendZoneSurfNum+1, RecZoneSurfNum+1 ) | ||
if (CarrollMethod) { |
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.
It's a little disappointing to see multiple if (CarrollMethod)
in these loops. But I see there's some significant shared sections. I guess other streamlining of CalcInteriorRadExchange will have to wait for another pass.
DoCoilDirectSolutions = | ||
UtilityRoutines::MakeUPPERCase(fields.at("use_coil_direct_solutions"))=="YES"; | ||
} | ||
if (fields.find("zone_radiant_exchange_algorithm") != fields.end()) { |
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.
So, I see input changes, but no output changes. We let PerformancePrecisionTradeoffs into the code without it generating a lick of output to identify what options are active? Would be great if you could add an eio line to report these (similar to System Convergence Limits, for example). If not here, then post an issue to add it.
@@ -141,6 +141,7 @@ ADD_SIMULATION_TEST(IDF_FILE AirflowWindowsAndBetweenGlassShades.idf EPW_FILE US | |||
ADD_SIMULATION_TEST(IDF_FILE ASIHPMixedTank.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw) | |||
ADD_SIMULATION_TEST(IDF_FILE BaseBoardElectric.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw) | |||
ADD_SIMULATION_TEST(IDF_FILE CVRhMinHum.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw) | |||
ADD_SIMULATION_TEST(IDF_FILE CarrollMRT-RefBldgLargeOfficeNew2004_Chicago.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw) |
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.
Ran this with and without CarrollMRT (unscientifically on my laptop) and saw negligible change in run time. I suppose we don't have a better example file in the test suite. Do you have a test file that you could attach at the top of the PR that illustrates the potential speed-up?
|
||
Carroll, J. A., 1980, An `MRT Method' of Computing Radiant Energy Exchange in Rooms, Proceedings of the Second Systems Simulation and Economic Analysis Conference, San Diego, CA. | ||
|
||
Carroll, J. A., 1980a, "An MRT method of computing radiant energy exchange in rooms," Proceedings of the 2nd Systems Simulation and Economic Analysis Conference, San Diego, CA. |
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.
1980 and 1980a look like the same paper, just formatted a little differently.
|
||
CalcFMRT(N, A, FMRT); | ||
|
||
std::string const error_string = " ** Severe ** Geometry not compatible with Carroll MRT Zone Radiant Exchange method.\n"; |
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.
This test fails locally on windows, because of mismatched line endings. Need to use a delimited string for the comparison error message, like here.
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.
Comments have been addressed.
#7646 posted to add eio output for PerformancePrecisionTradeoffs.
Ran the new example file with and without the CarrollMRT option, annual source energy differs by about 1.5%.
Merged in develop one more time to check performance.
auto const &construct(Construct(ConstrNumRec)); | ||
auto &surface_window(SurfaceWindow(RecSurfNum)); | ||
auto const &rec_construct(Construct(ConstrNumRec)); | ||
auto &rec_surface_window(SurfaceWindow(RecSurfNum)); |
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.
Good to clarify rec_surface
@RKStrand Do you want to review before this is merged? |
@mjwitte I'm not sure when I will get around to doing this (finals start next week) and having looked around at the code once already I trust your review. I don't want to hold this up. |
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.
@nealkruis I know a performance slowdown of 0.49% is small, it seems we can do better than that here. CalcInteriorRadExchange
is a known hot spot that gets called many times. There are four if (CarrollMethod)
blocks, two of which are inside surface loops. It seems small, but these add up.
Looking for ways to reduce these extra ifs. The brute force way would be two separate CalcInteriorRadExchange
functions, one for CMRT and one for ScriptF. I realize that could result is signficant chunks of duplicate code. So, then we could break those out into some smaller functions? Just thinking out loud here.
} | ||
} else { | ||
SendSurfTemp = SurfaceTemp(SendSurfNum); | ||
} |
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.
These lines appear to be identical to the logic in lines 348:360. Why not save SendSurfTemp in an array and just grab it here instead of going through all these gymnastics all over again? Seems that would improve the CMRT speed.
And then we're doing all the same stuff again for RecSurfs in 394:420? This one gets emissivities too, but seems we could do that up in 348:360, save arrays of temps and emissivities and get rid of all of these ifs.
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.
Here is something else to consider. There is a possibility that we will want to run both ScriptF and CarrollMRT within the same simulation. For the same enclosure. In the same timestep. My guess is that the difference between ScriptF and CarrollMRT is not uniform, but rather geometry dependent. I can see an optimization where we run both for all enclosures for a few time steps and then choose the algorithm on an enclosure basis based on whether the two algorithms produce similar results within threshold (CarrollMRT) or not (ScriptF).
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.
@mjwitte I like your suggestion. Let me see if I can clean it up a bit.
It's always a question of where to stop. This whole file could probably use a refactor/redesign, especially if we are moving towards enclosures as a concept. We could make an Enclosure
class that contains many of these methods broken out into a cleaner design to avoid repetition.
Don't think this is possible. The Carroll factors have the property that
they result in first-law-balanced radiant exchange using a single effective
radiant temperature for the space. Carroll in his papers showed that the
resulting radiant fluxes are very good approximations to the "real" values
(e.g. ScriptF), but not identical. They are exact for cubic spaces and
surprisingly close for other shapes, even those that are pretty non-cubic.
Running both at the same time would require parallel simulations, since
different radiant exchange would result in different surface temp history
-- the whole state of the space would be (slightly) different.
…On Sun, Dec 8, 2019 at 11:21 AM amirroth ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/EnergyPlus/HeatBalanceIntRadExchange.cc
<#7534 (comment)>:
> +
+ Real64 SendSurfTemp;
+ if (SendZoneSurfNum != RecZoneSurfNum) {
+ if (send_construct.WindowTypeEQL || send_construct.WindowTypeBSDF) {
+ SendSurfTemp = send_surface_window.EffInsSurfTemp;
+ } else if (send_construct.TypeIsWindow && send_surface_window.OriginalClass != SurfaceClass_TDD_Diffuser) {
+ if (SurfIterations == 0 && send_surface_window.ShadingFlag <= 0) {
+ SendSurfTemp = send_surface_window.ThetaFace(2 * send_construct.TotGlassLayers) - KelvinConv;
+ } else if (send_surface_window.ShadingFlag == IntShadeOn || send_surface_window.ShadingFlag == IntBlindOn) {
+ SendSurfTemp = send_surface_window.EffInsSurfTemp;
+ } else {
+ SendSurfTemp = SurfaceTemp(SendSurfNum);
+ }
+ } else {
+ SendSurfTemp = SurfaceTemp(SendSurfNum);
+ }
Here is something else to consider. There is a possibility that we will
want to run both ScriptF and CarrollMRT within the same simulation. For the
same enclosure. In the same timestep. My guess is that the difference
between ScriptF and CarrollMRT is not uniform, but rather geometry
dependent. I can see an optimization where we run both for all enclosures
for a few time steps and then choose the algorithm on an enclosure basis
based on whether the two algorithms produce similar results within
threshold (CarrollMRT) or not (ScriptF).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7534?email_source=notifications&email_token=ACWGW7BTQKFXNQWA4XIVSBDQXUNJLA5CNFSM4I364MQ2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCOLFCEA#discussion_r355197614>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACWGW7DUX4CEXH63SCD2Z6DQXUNJLANCNFSM4I364MQQ>
.
|
Running CarrollMRT, writing the surface temperatures (or net heat fluxes) into a temporary array, comparing with ScriptF and after a few iterations choosing whether to use CarrollMRT full time is "not possible"? |
Yes, that would be possible. But the conduction history would be different
etc.
If the question is whether the Carroll approximation is good enough for a
particular space shape, I think that could be assessed by comparing view
factors. That is what Carroll did in his original papers that led him to
assert the method is surprisingly accurate. I am supposed to be searching
for the papers (I think I have hard copies) ... his methodology would be a
good starting point for putting together an algorithm for on-the-fly
scriptF vs. Carroll determination.
…On Sun, Dec 8, 2019 at 7:10 PM amirroth ***@***.***> wrote:
Running CarrollMRT, writing the surface temperatures (or net heat fluxes)
into a temporary array, comparing with ScriptF and after a few iterations
choosing whether to use CarrollMRT full time is "not possible"?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7534?email_source=notifications&email_token=ACWGW7B6QQUC77G7WNXDQLLQXWEIBA5CNFSM4I364MQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGHOWCY#issuecomment-563014411>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACWGW7CAZPOVJSF5LZCE5JDQXWEIBANCNFSM4I364MQQ>
.
|
I think that writing results into different arrays is possible (it would have to be done for both surface temperature and heat flux histories for all surfaces), but it's probably going to be a bit messy (in a section of code that already isn't a shining example of easy to follow). The question is how many time steps would you need to go before you had an accurate assessment on whether or not the results are similar enough. I think Chip's idea that checking the view factors might be a little less painful if he can find what he is looking for in the literature. One other thing--whatever method would need to perhaps get a sense for how long the simulation is going to be. It might not be worth switching to a faster method after a period of time if the user is only doing a design day or two? |
Chip suggested that we look at view factors instead of surface heat-fluxes/temps, and that's probably a cleaner idea. |
@mjwitte I think the remaining diffs are related to the fact that receiving and sending surface temperatures were not being calculated consistently before when a complex glazing system had between-glass shading/blinds. In these cases, the sending surface temperature was calculated as It's not clear what it should be. In this branch I'm using |
@nealkruis I've made a couple of commits that eliminate the complex glazing diffs and give a slight speed improvement now. If you agree with these changes, I'll merge. |
This does look clean from a CI perspective, though the branch is now kinda out-of-date. Is it worth just pulling develop in to get final results before merge? I'm not saying we need to, just wondering. |
@nealkruis This will merge after CI comes back all green and pretty. If you want to review my changes before this drops in, now's your chance. |
@Myoldmopar Is something amiss on Mac? |
Yes, something looks to have gone awry. Disregard for the moment and continue merging as needed. I'll take a look. |
I took the Mac down for a full reboot and got it going again. It was working great recently so hopefully that's all it needed. |
Pull request overview
This PR implements the Carroll method for interior radiant heat exchange instead of the current Hottel's ScriptF method. The Carroll method has linear complexity while the ScriptF method has O(n^2) complexity. This greatly improves runtime (up to 95% runtime reduction) when a zone has a large number of surfaces.
New option added to PerformancePrecisionTradeoffs:
A2; \field Zone Radiant Exchange Algorithm
\note Determines which algorithm will be used to solve long wave radiant exchange among surfaces within a zone.
\type choice
\key ScriptF
\key CarrollMRT
\default ScriptF
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.
If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix