Skip to content
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

Adjustment to View Factor Fix for Surfaces that are Nearly Half of Zone Surface Area #8809

Merged
merged 12 commits into from
Jun 21, 2021

Conversation

RKStrand
Copy link
Contributor

@RKStrand RKStrand commented Jun 8, 2021

Pull request overview

  • Fixes Internal Mass is affected by the Building North Angle Axis variation #8700
  • The original problem was demonstrated by a user who ran a fairly simple single zone run with a large amount of internal mass at integer values of North Axis that varied from 0 to 359 (literally, north axis = 0, 1, 2, 3, 4, ...359). Upon graphing the results of these cases, the user noted that the results were not a nice smooth curve but rather had many discontinuities in it. After testing and tracking down a warning message in the error file, it was determined that the problem was actually stemming from a problem in the view factor calculations. The specification of an internal mass that had a surface area that was just below by a tiny amount the surface area of the remaining surfaces in the zone the correction for such cases was not done. As a result, the view factors calculations did not successfully iterate to completion and this resulted in the odd variations in cooling load. The fix was to allow the view factor correction for such extreme cases to be done when the largest area is larger than 0.99 times the remaining zone surface area. In addition, several other minor code and documentation issues were also addressed. The revised code now runs the user file successfully to completion and no longer exhibits the strangely fluxuating results as north axis varies.
  • Adds reporting of InternalMass surfaces to the Envelope Summary, Opaque Interior subtable. Previously internal mass was omitted from this report.

Audit diffs are due to additional table entries for internal mass.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions (see above)
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions (see above)
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

RKStrand and others added 8 commits June 4, 2021 10:54
This commit corrects a variety of view factor issues that were noted in CR#8700.  While the changes are not particularly massive, it did require quite a bit of time to investigate these issues.
Fixed some format errors and included a new unit test for this work.  Also modified the check slightly to see how that impacts results.
A few more formatting changes were made in this commit.  In addition, some Engineering Reference documentation was updated to reflect the changes made and also correct a slightly off description of the view factor calculation algorithm.
Tweaked the description of to add a bit more information.
Came up with one more thought to add to this.  Should be ready for review now.
One of the requests for this CR was an additional warning message when there is an internal mass surface in the zone.  Includes new bool function and unit test.
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Jun 8, 2021
@RKStrand RKStrand requested a review from mjwitte June 8, 2021 20:24
@RKStrand RKStrand self-assigned this Jun 8, 2021
}
}

bool DoesZoneHaveInternalMass(EnergyPlusData &state, int const numZoneSurfaces, const Array1D_int &surfPointer)
Copy link
Contributor

Choose a reason for hiding this comment

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

state is unused here.
Also, minor detail, but numZoneSurfaces isn't necessary. The loop statement could be for (int surfNum : surfPointer).
If I'm following correctly, this only happens once per enclosure? So, there's no concern about repeating this, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, should happen once (at most twice--not exactly sure why it's coming through twice sometimes?) per enclosure. So, basically, get rid of state and numZoneSurfaces and adjust loop to the suggestion. Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You sure I don't need state? It's used in the line:

if (state.dataSurface->Surface(surfPointer(surfNum)).Class == SurfaceClass::IntMass)...

My compiler (after getting rid of state) is unhappy and I've tried a variety of variations. Of course, maybe I just don't understand "state"...

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, sorry, missed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The for (int surfNum : surfPointer) didn't work...this happens once per zone. The second time it comes into this routine (for the second zone), the counter picks up where it left off and then I get a crash. In the file that I was running, there were 9 surfaces in the first zone and six in the second. The first time through there weren't any problems. The second time through for zone 2 the counter starts at 10 which is more than the number of surfaces in the zone and I get a pointer issue. I think I need to go back to what I originally had?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine as-is, but for future reference, there's no counter with the suggested form, so this should work fine for multiple calls.

for (int surfNum : surfPointer){
 if (state.dataSurface->Surface(surfNum).Class == SurfaceClass::IntMass) return true;
}

// "unbalanced" in surface area distribution so other strange cases can take advantage of
// this correction. The use of 0.9 is simply to provide some reasonable boundary numerically
// and does not have some derived theoretical basis.
if (LargestArea > 0.9 * (sum(A) - LargestArea) && (N > 3)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the diff comments, you suggest the the files with diffs have a surface that is triggering this rule, but I'm not seeing anything like that in 5ZoneSupRetPlenRAB. I see a couple of large surfaces (TOP-1 and BOTTOM-1) but these should be balanced by an equal area of floor/ceiling surfaces, plus the wall surfaces. Even in the plenum zones I'm puzzled why results would change. I haven't looked at any of the other files with diffs. Is it possible some other change is driving these diffs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, wait, I see what's going on, I think. For a plenum zone, say there are 2 large surfaces of 100m2 each and 4 small ones that add up to 10m2. So this would be if (100 > 0.9*(210-100)=99 which trips the rule. But I don't see why that isn't a valid enclosure as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there's some question as to what is the limit of "valid". The old rule was a comparison without the 0.9. Maybe 0.9 is not great either. What about 0.99? The problem is that if a user gets close but not exactly there, the file could run into problems like was seen in this defect. How do you feel about 0.99? It would probably make most of the diffs from develop go away.

Copy link
Contributor

Choose a reason for hiding this comment

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

"When one surface has an area that exceeds the sum of all other surface areas in a zone".

I assume the surfaces in question here are the zone floor, walls and ceiling. If so, then the largest surface's area should not be greater than 1/2 the total surface area. I can't think of a geometry where that would be the case unless the walls aren't vertical but I assume someone put this here for a reason. Not even sure if a unit test could sort this out.

Copy link
Contributor

Choose a reason for hiding this comment

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

So perhaps a better solution to the numerical problem in the users file would be to use a small absolute tolerance, like
if (LargestArea > (sum(A) - LargestArea - somesmallvalue)

Copy link
Contributor

Choose a reason for hiding this comment

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

@RKStrand are the walls in the defect file vertical? What is the specific geometry that trips this limit?

Copy link
Contributor

Choose a reason for hiding this comment

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

Even a pyramid wouldn't trip this limit. Are walls missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The zone in question here is a simple and fairly normal box (4 vertical walls, roof, floor) with one exception--it has an internal mass surface with an area equal to just slightly below the total area of the remaining surfaces. As a result the "correction" in the current code gets skipped and the view factor calculations never iterate to completion. This resulted in weird trends in the results. I agree that it is not possible to have a valid geometry (i.e., a full enclosure) where one surface has an area larger than the remaining surface areas--it's no longer a full enclosure. That's why the correction is there to avoid numerical issues when you are trying to figure out view factors for an incomplete enclosure. In the user file that resulted in the defect, it just missed the cutoff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjwitte I can do the small absolute tolerance instead of the percentage. I think I was thinking that because everything is scaled to area that a fraction would be better. Of course in either case, we have to establish either what the small value or the small fraction is. I could go to 0.99 or 0.999 as a fraction. I could also go to say 1m2 as a small tolerance. Which do you prefer? I'm good with any of those.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion, just use something reasonable that fixes the defect file without tripping 5ZoneSupRetPlenRAB.

ShowContinueError(state,
"For zones with internal mass like this one, this"
"can happen when the internal mass has an area that"
"is much larger than the other surfaces in the zone.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be appropriate to suggest splitting the internal mass into two or more surfaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will adjust the error message to suggest splitting the thermal mass into two or more surfaces.

RKStrand added 2 commits June 14, 2021 12:29
Addressed the review comments.  One request to change the passed variables to the new subroutine could not be implemented--ran into problems with hard crash because counter variable was keeping it's value from call to call which caused a pointer issue.
@RKStrand
Copy link
Contributor Author

@mjwitte I addressed the internal mass error messaging issue and adjusted the fraction from 0.9 to 0.99. Hopefully this resolves everything and the ci tests come back better than before. Let me know if you still want me to adjust the passed variables to the new subroutine (see note above--I couldn't get your suggestion to work). Thanks!

@RKStrand
Copy link
Contributor Author

Not sure why it is failing on "AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest". It runs on my machine just fine. Good news is that the 0.99 gets rid of all the other differences. Somehow GitHub didn't push one minor change to a comment line up so I'm doing that now...

Not sure why GitHub did not push this change in the last round.  Anyway, here it is...
Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

@RKStrand Looks good. Merging.

@mjwitte mjwitte merged commit 8850db6 into develop Jun 21, 2021
@mjwitte mjwitte deleted the 8700InternalMassNorthAxisIssue branch June 21, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal Mass is affected by the Building North Angle Axis variation
9 participants