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

Fixed Crash in CondFD for Interzone Surfaces for Very Specific Condition #8937

Merged
merged 1 commit into from Aug 21, 2021

Conversation

RKStrand
Copy link
Contributor

Pull request overview

  • Fixes EnergyPlus crash when having unused constructions and conduction finite difference algorithms #8919
  • Under a particular condition (CondFD used, interzone surface that has another zone as the outside boundary condition causing E+ to create it internally, and the user supplying the reversed construction but it isn't used by any user defined surface), a variable was not being set (IsUsed) for the reversed construction causing a crash (array index of zero). This is now fixed and this particular case trapped by the new unit test.

NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE

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
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • 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

This commit includes the fix and the unit test for defect #8919.  Under a particular condition (CondFD used, interzone surface that has another zone as the outside boundary condition causing E+ to create it internally, and the user supplying the reversed construction but it isn't used by any user defined surface), a variable was not being set (IsUsed) for the reversed construction causing a crash (array index of zero).  This is now fixed and this particular case trapped by the new unit test.
@RKStrand RKStrand added the Defect Includes code to repair a defect in EnergyPlus label Jul 30, 2021
@RKStrand RKStrand self-assigned this Jul 30, 2021
@Myoldmopar Myoldmopar added this to the EnergyPlus 9.6 Release milestone Aug 6, 2021
Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

All good here. I'll test this out and get it in the merge queue.

@@ -906,6 +906,7 @@ int AssignReverseConstructionNumber(EnergyPlusData &state,
}
if (Found) {
NewConstrNum = Loop;
state.dataConstruction->Construct(Loop).IsUsed = true;
Copy link
Member

Choose a reason for hiding this comment

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

Seems quite reasonable.

// for other defined surfaces, IsUsed was set to false and this construction
// was then skipped in the CondFD routine that calculates the number of
// nodes. This led to a hard crash. This test simply makes sure that
// IsUsed is set to true when the reversed construction already exists.
Copy link
Member

Choose a reason for hiding this comment

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

This helps me understand not only the fix you made, but also the intent of the unit test. This is good stuff. Thanks @RKStrand

int ConstrNum;
int expectedResultRevConstrNum;
int functionResultRevConstrNum;
bool ErrorsFound = false;
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget, in C++, you don't have to declare the variables up here at the top of the function, just declare them at the point you use them. 👍

@Myoldmopar
Copy link
Member

The defect file was apparently sent by email and not attached to the issue or this PR or put in DevSupport, so I cannot verify the fix, but I'm trusting that it has been fixed and will use the new unit test as verification for now. Building and running...

@Myoldmopar
Copy link
Member

All passing here. Thanks @RKStrand

@Myoldmopar Myoldmopar merged commit 7931e6d into develop Aug 21, 2021
@Myoldmopar Myoldmopar deleted the 8919ConductionFDCrashUnusedConstruction branch August 21, 2021 20:20
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.

EnergyPlus crash when having unused constructions and conduction finite difference algorithms
6 participants