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

Address 24.2 EMPD Issue #10781

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EnergyPlus/MoistureBalanceEMPDManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ void GetMoistureBalanceEMPDInput(EnergyPlusData &state)

auto const &constr = state.dataConstruction->Construct(surf.Construction);
auto const *mat = dynamic_cast<const MaterialEMPD *>(s_mat->materials(constr.LayerPoint(constr.TotLayers)));
assert(mat != nullptr);
// assert(mat != nullptr);
Copy link
Member Author

Choose a reason for hiding this comment

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

The way things are structured now, it's totally fine for this to result in a nullptr. If the material doesn't have any EMPD properties, that's fine. So we shouldn't do a hard assertion.


if (mat->mu > 0.0 && surf.Zone > 0) {
if (mat && mat->mu > 0.0 && surf.Zone > 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead, let's just check that mat is real before accessing it. This will properly pass if the inside layer has EMPD stuff. And it will properly result in a warning message if the layer does not have EMPD stuff. This works happily now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why not not the hasEMPD boolean? isn't what it's for?

EMPDzone(surf.Zone) = true;
} else {
++state.dataMoistureBalEMPD->ErrCount;
Expand Down