NREL / EnergyPlus

EnergyPlus™ is a whole building energy simulation program that engineers, architects, and researchers use to model both energy consumption and water use in buildings.

Home Page:https://energyplus.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

idf file causing segfault and mirrors of nonconvex shading surfaces are classified as convex

marklemay opened this issue · comments

Issue overview

This idf file causes a segfualt. It is likely there is bad geometry in the file, but this should be reported through the eplusout.err and not a crash.

The file may be failing the assert at: src\EnergyPlus\DataSurfaces.cc, line 183. But this should be confirmed.

Details

Some additional details for this issue (if relevant):

  • Platform: Windows
  • Version of EnergyPlus: 23.1.0-87ed9199d4 (also think it happens with 24.1.0-1c07712767)
  • Unmethours link or helpdesk ticket number

Checklist

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

  • Defect file: in.zip
  • Ticket added to Pivotal for defect (development team task)
  • Pull request created (the pull request will have additional tasks related to reviewing changes that fix this defect)

@MatthewSteen this is the issue we were discussing earlier.

@marklemay Yes, it is failing at that assert (when running a debug build). The surface that it's failing on appears to be Mir-AIM108660 which is the mirror of AIM108660 a shading surface with 24 vertices.

I see why it's failing the assert. The surface is convex with 24 vertices, so it falls into this block:

} else if ((shapeCat == ShapeCat::Nonconvex) || (n >= nVerticesBig)) { // Set up slabs

It goes through some gymnastics and fails here, because crossEdges.size()=4.

assert((shapeCat == ShapeCat::Nonconvex) || (crossEdges.size() == 2));

For reference:

// Parameters for PierceSurface
constexpr std::size_t nVerticesBig(20); // Number of convex surface vertices at which to switch to PierceSurface O( log N ) method

However, deleting all of the shading surfaces with >=20 vertices doesn't solve the crash (for release builds).

The root of the segfault problem is here:

if (state.dataHeatBalSurf->InterZoneWindow) {
if (state.dataHeatBalSurfMgr->InitSurfaceHeatBalancefirstTime) {
DisplayString(state, "Computing Interior Diffuse Solar Exchange through Interzone Windows");
}
ComputeDifSolExcZonesWIZWindows(state, state.dataGlobal->NumOfZones);
}

The second argument should be state.dataViewFactor->NumOfSolarEnclosures which is 363 for this file, not NumOfZones which is 115 for this file. This argument is used to size some arrays that are only used for interzone windows and this results in an array bounds error later on.

So, there are actually two issues here:

  1. The surface geometry problem that fails the assert.
  2. The array size problem for models with interzone (or interspace) windows where NumZones < NumOfSolarEnclosures.

If the interior window(s) are not important for this simulation, the easiest (possibly only) workaround is to delete them.

Surfaces "aim39809" and "aim39809 Reversed" are the interzone window surfaces. With these removed, the simulation runs to completion.