Skip to content

Commit

Permalink
update kiva lambdas to explicitly pass SurfNum
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 9, 2020
1 parent 20257b6 commit 4432eb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/EnergyPlus/ConvectionCoefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2756,7 +2756,7 @@ namespace ConvectionCoefficients {
if (!Surface(SurfNum).HeatTransSurf) continue; // Skip non-heat transfer surfaces

if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
SurfaceGeometry::kivaManager.surfaceConvMap[SurfNum].in = [&](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
SurfaceGeometry::kivaManager.surfaceConvMap[SurfNum].in = [&, SurfNum](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
return CalcCeilingDiffuserIntConvCoeff(
state, ACH, Tsurf, Tamb, cosTilt, AirHumRat, Surface(SurfNum).Height, state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow);
};
Expand Down Expand Up @@ -6121,7 +6121,7 @@ namespace ConvectionCoefficients {
if (UserCurve.HcFnTempDiffDivHeightCurveNum > 0) {
HcFnTempDiffDivHeight = CurveValue(state, UserCurve.HcFnTempDiffDivHeightCurveNum,
(std::abs(TH(2, 1, SurfNum) - tmpAirTemp) / Surface(SurfNum).IntConvZoneWallHeight));
HcFnTempDiffDivHeightFn = [&](double Tsurf, double Tamb, double, double, double) -> double {
HcFnTempDiffDivHeightFn = [&, SurfNum](double Tsurf, double Tamb, double, double, double) -> double {
return CurveValue(state, UserCurve.HcFnTempDiffDivHeightCurveNum, std::abs(Tsurf - Tamb) / Surface(SurfNum).IntConvZoneWallHeight);
};
}
Expand Down Expand Up @@ -6218,7 +6218,7 @@ namespace ConvectionCoefficients {
HnFnTempDiffDivHeight =
CurveValue(state, UserCurve.HnFnTempDiffDivHeightCurveNum,
((std::abs(TH(1, 1, SurfNum) - Surface(SurfNum).OutDryBulbTemp)) / Surface(SurfNum).OutConvFaceHeight));
HnFnTempDiffDivHeightFn = [&](double Tsurf, double Tamb, double, double, double) -> double {
HnFnTempDiffDivHeightFn = [&, SurfNum](double Tsurf, double Tamb, double, double, double) -> double {
return CurveValue(state, UserCurve.HnFnTempDiffDivHeightCurveNum, ((std::abs(Tsurf - Tamb)) / Surface(SurfNum).OutConvFaceHeight));
};
}
Expand Down

7 comments on commit 4432eb0

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2983 of 2984 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: EIO diffs.
  • 1 test had: ESO big diffs.
  • 1 test had: MTR big diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 716
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3022 of 3024 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 1 test had: Table big diffs.

Failures:\n

integration Test Summary

  • Passed: 721
  • Failed: 1

regression Test Summary

  • Passed: 736
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1548 of 1548 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2240 of 2240 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

global_dataConstruction (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nealkruis
Copy link
Member

Choose a reason for hiding this comment

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

@mitchute I suspect this works, but I'm now wondering if I hastily captured everything by-reference when there are some cases where it is safer to capture somethings (most things?) by-copy. I imagine state is safe to pass by-reference, but I'm worried that some of these other references will be out of scope by the time the lambda is actually called. It might be best to change the capture to [=, &state]. There are likely memory implications here, too, since we probably don't want to be creating a lot of copies of the Surface array.

Do you want me to look into this on a separate branch?

@mitchute
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, if you don't mind. I'll play with it over here since resolving these diffs this is the last thing that needs to be addressed before this PR goes in. If you come up with a different set of changes we can always get those in later.

Please sign in to comment.