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

Surface Outside Face Convection Heat Gain Rate was fixed when rain flag is true & to be altered for OSCM as well #7504

Merged
merged 27 commits into from
Sep 21, 2019

Conversation

dareumnam
Copy link
Collaborator

@dareumnam dareumnam commented Sep 16, 2019

Pull request overview

  • Fixes Surface outside face heat balance reporting is confusing when rain flag is true #6939 reporting for Surface Outside Face Convection (and Per Area) when raining

  • Also fixes Surface Outside Face Convection when using OtherSideConditionsModel (OSCM), the per Area value was correct and remains unchanged.

  • HeatBalanceSurfaceManager.cc & HeatBalanceSurfaceManager.hh

    • Add a function for QdotConvOutRepPerArea to separate cases
      • If Optr is set, use OSCM boundary data
      • If Optr is not set,
        • If it is raining, (IsRain = True): Surface Outside Face Convection Heat Gain Rate calculation uses outdoor wet bulb temp.
        • Otherwise (IsRain = False): Surface Outside Face Convection Heat Gain Rate calculation uses outdoor dry bulb temp.
  • Add a unit test to HeatBalanceSurfaceManager.unit.cc

  • Expected Diffs:

    • ESO Diffs: .csv output files of regression tests
      • that have Output: Variable of Surface Outside Face Convection Heat Gain Rate or Surface Outside Face Convection Heat Gain Rate per Area &&
      • that use a weather file that has at least one rainy day
      • this is likely to introduce small diffs in the Per Area output, because the surface area is no longer multiplied in and then divided back out.

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

@dareumnam dareumnam added the Defect Includes code to repair a defect in EnergyPlus label Sep 16, 2019
@dareumnam dareumnam self-assigned this Sep 16, 2019
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.

Current code fixes the defect as expected (will retest after changes).
See comments below.

Real64 GetQdotConvOutRep(int SurfNum)
{
if (IsRain) {
return -Surface(SurfNum).Area * HcExtSurf(SurfNum) * (TH(1, 1, SurfNum) - Surface(SurfNum).OutWetBulbTemp);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be more efficient to leave area out of this, using this function to set QdotConvOutRepPerArea, then QdotConvOutRep = QdotConvOutRepPerArea * ...Area

@@ -5707,17 +5707,29 @@ namespace HeatBalanceSurfaceManager {
}

// fill in reporting values for outside face
QdotConvOutRep(SurfNum) = -Surface(SurfNum).Area * HcExtSurf(SurfNum) * (TH(1, 1, SurfNum) - Surface(SurfNum).OutDryBulbTemp);

QdotConvOutRep(SurfNum) = GetQdotConvOutRep(SurfNum);

if (Surface(SurfNum).OSCMPtr > 0) { // Optr is set above in this case, use OSCM boundary data
QdotConvOutRepPerArea(SurfNum) = -OSCM(OPtr).HConv * (TH(1, 1, SurfNum) - OSCM(OPtr).TConv);
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 wrong here that QdotConvOutRepPerArea is altered for OSCM but not QdotConvOutRep (not your error but another one here).

I would move this if into the new function as well. Then this area of code becomes 2 lines:

QdotConvOutRepPerArea(SurfNum) = GetQdotConvOutRep(SurfNum);
QdotConvOutRep(SurfNum) = QdotConvOutRepPerArea(SurfNum) * Surface(SurfNum).Area;

Please update the title and description to mention fixing this for OSCM.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mjwitte Thank you for all the reviews. I will fix these as you suggested.

} else {
return -Surface(SurfNum).Area * HcExtSurf(SurfNum) * (TH(1, 1, SurfNum) - Surface(SurfNum).OutDryBulbTemp);
}
return Real64();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this line necessary? @Myoldmopar ?

DataEnvironment::IsRain = true;
Real64 ExpectedQconv1 = -58.197 * 1000 * (6.71793958923051 - 6.66143784594778);

EXPECT_EQ(ExpectedQconv1, GetQdotConvOutRep(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

For Real64 calcs like this, we prefer EXPECT_NEAR with a small tolerance reasonable for the expected result magnitude: EXPECT_NEAR(ExpectedQconv1, GetQdotConvOutRep(1), 0.01);

@dareumnam dareumnam changed the title Fix #6939 - Surface outside face heat balance reporting when rain flag is true Surface Outside Face Convection Heat Gain Rate was fixed when rain flag is true & to be altered for OSCM as well Sep 20, 2019
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.

@dareumnam Thanks - changes look good. I made one more small change adding const to the SurfNum agrument in the new function. Once CI completes, this will be merged.

} // ...end of DO loop over all surface (actually heat transfer surfaces)
}

Real64 GetQdotConvOutRepPerArea(int const SurfNum)
{
int OPtr = Surface(SurfNum).OSCPtr;
Copy link
Contributor

Choose a reason for hiding this comment

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

@dareumnam Some integration tests are failing. Here's the problem - this should be .OSCMPtr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mjwitte Oops, thank you for letting me know. I'll fix it and push the branch again.

@mjwitte
Copy link
Contributor

mjwitte commented Sep 20, 2019

That's looking much better now - 2 files with small eso diffs. I'll let CI run its course here.

@dareumnam
Copy link
Collaborator Author

dareumnam commented Sep 20, 2019

I am guessing that these ESO diffs are coming from .csv output files that have Surface Outside Face Convection Heat Gain Rate (Per Area) of rainy days (hopefully). I'll wait and see the CI testing results.

@mjwitte
Copy link
Contributor

mjwitte commented Sep 20, 2019

Yep, the diffs are in Surface Outside Face Convection Heat Gain Rate, on the order of e-11 or less.

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.

Surface outside face heat balance reporting is confusing when rain flag is true
7 participants