Skip to content

Commit

Permalink
More daylighting arrays moved
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Sep 15, 2021
1 parent c344ee8 commit c2d07ab
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 66 deletions.
22 changes: 22 additions & 0 deletions src/EnergyPlus/DaylightingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10409,6 +10409,28 @@ void DayltgSetupAdjZoneListsAndPointers(EnergyPlusData &state)
}
} // End of map loop

state.dataDaylightingManager->EINTSK.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 4, 0.0);
state.dataDaylightingManager->EINTSU.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 0.0);
state.dataDaylightingManager->EINTSUdisk.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 0.0);
state.dataDaylightingManager->WLUMSK.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 4, 0.0);
state.dataDaylightingManager->WLUMSU.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 0.0);
state.dataDaylightingManager->WLUMSUdisk.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 0.0);
state.dataDaylightingManager->EDIRSK.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 4);
state.dataDaylightingManager->EDIRSU.dimension(24, state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->EDIRSUdisk.dimension(24, state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->AVWLSK.dimension(24, state.dataSurface->actualMaxSlatAngs + 1, 4);
state.dataDaylightingManager->AVWLSU.dimension(24, state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->AVWLSUdisk.dimension(24, state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->FLFWSU.dimension(state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->FLFWSUdisk.dimension(state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->FLCWSU.dimension(state.dataSurface->actualMaxSlatAngs + 1);
state.dataDaylightingManager->TransMult.dimension(state.dataSurface->actualMaxSlatAngs);
state.dataDaylightingManager->DayltgInterReflectedIllumTransBmBmMult.dimension(state.dataSurface->actualMaxSlatAngs);
state.dataDaylightingManager->TransBmBmMult.dimension(state.dataSurface->actualMaxSlatAngs);
state.dataDaylightingManager->TransBmBmMultRefl.dimension(state.dataSurface->actualMaxSlatAngs);
state.dataDaylightingManager->FLCWSK.dimension(state.dataSurface->actualMaxSlatAngs + 1, 4);
state.dataDaylightingManager->FLFWSK.dimension(state.dataSurface->actualMaxSlatAngs + 1, 4);

// TODO MJW: These eio outputs need to change from zone to enclosure
static constexpr std::string_view Format_700(
"! <Zone/Window Adjacency Daylighting Counts>, Zone Name, Number of Exterior Windows, Number of Exterior Windows in Adjacent Zones\n");
Expand Down
125 changes: 59 additions & 66 deletions src/EnergyPlus/DaylightingManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -516,26 +516,24 @@ struct DaylightingManagerData : BaseGlobalStruct
// I = 1 for clear sky, 2 for clear turbid, 3 for intermediate, 4 for overcast;
// J = 1 for bare window, 2 - 12 for shaded;
// K = sun position index.
Array3D<Real64> EINTSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4, 0.0); // Sky-related portion of internally reflected illuminance
Array2D<Real64> EINTSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0); // Sun-related portion of internally reflected illuminance,
Array3D<Real64> EINTSK; // Sky-related portion of internally reflected illuminance
Array2D<Real64> EINTSU; // Sun-related portion of internally reflected illuminance,
// excluding entering beam
Array2D<Real64> EINTSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0); // Sun-related portion of internally reflected illuminance
Array2D<Real64> EINTSUdisk; // Sun-related portion of internally reflected illuminance
// due to entering beam
Array3D<Real64> WLUMSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4, 0.0); // Sky-related window luminance
Array2D<Real64> WLUMSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0); // Sun-related window luminance, excluding view of solar disk
Array2D<Real64> WLUMSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0); // Sun-related window luminance, due to view of solar disk
Array3D<Real64> WLUMSK; // Sky-related window luminance
Array2D<Real64> WLUMSU; // Sun-related window luminance, excluding view of solar disk
Array2D<Real64> WLUMSUdisk; // Sun-related window luminance, due to view of solar disk

Array2D<Real64> GILSK = Array2D<Real64>(24, 4, 0.0); // Horizontal illuminance from sky, by sky type, for each hour of the day
Array1D<Real64> GILSU = Array1D<Real64>(24, 0.0); // Horizontal illuminance from sun for each hour of the day

Array3D<Real64> EDIRSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related component of direct illuminance
Array2D<Real64> EDIRSU =
Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1); // Sun-related component of direct illuminance (excluding beam solar at ref pt)
Array2D<Real64> EDIRSUdisk =
Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1); // Sun-related component of direct illuminance due to beam solar at ref pt
Array3D<Real64> AVWLSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related average window luminance
Array2D<Real64> AVWLSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1); // Sun-related average window luminance, excluding view of solar disk
Array2D<Real64> AVWLSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1); // Sun-related average window luminance due to view of solar disk
Array3D<Real64> EDIRSK; // Sky-related component of direct illuminance
Array2D<Real64> EDIRSU; // Sun-related component of direct illuminance (excluding beam solar at ref pt)
Array2D<Real64> EDIRSUdisk; // Sun-related component of direct illuminance due to beam solar at ref pt
Array3D<Real64> AVWLSK; // Sky-related average window luminance
Array2D<Real64> AVWLSU; // Sun-related average window luminance, excluding view of solar disk
Array2D<Real64> AVWLSUdisk; // Sun-related average window luminance due to view of solar disk

// Allocatable daylight factor arrays -- are in the ZoneDaylight Structure

Expand Down Expand Up @@ -668,24 +666,24 @@ struct DaylightingManagerData : BaseGlobalStruct
Array1D<Real64> BACLUM;
Array1D<Real64> DayltgInteriorMapIllumGLRNDX;
Array1D<Real64> daylight_illum;
Array1D<Real64> FLFWSU = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related downgoing luminous flux, excluding entering beam
Array1D<Real64> FLFWSUdisk = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related downgoing luminous flux, due to entering beam
Array1D<Real64> FLCWSU = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related upgoing luminous flux
Array1D<Real64> TransMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Transmittance multiplier
Array1D<Real64> DayltgInterReflectedIllumTransBmBmMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Isolated blind beam-beam transmittance
Array1D<Real64> TransBmBmMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Beam-beam transmittance of isolated blind
Array1D<Real64> TransBmBmMultRefl = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // As above but for beam reflected from exterior obstruction
Array1D<Real64> PH = Array1D<Real64>(DaylightingManager::NPH); // Altitude of sky element (radians)
Array1D<Real64> TH = Array1D<Real64>(DaylightingManager::NTH); // Azimuth of sky element (radians)
Array1D<Real64> SPHCPH = Array1D<Real64>(DaylightingManager::NPH); // Sine times cosine of altitude of sky element
Array1D<Real64> SetPnt; // Illuminance setpoint at reference points (lux)
Array1D<Real64> GLRNDX; // Glare index at reference point
Array1D<Real64> GLRNEW; // New glare index at reference point
Array2D<Real64> FLCWSK = Array2D<Real64>(DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related upgoing luminous flux
Array1D<Real64> FLFWSU; // Sun-related downgoing luminous flux, excluding entering beam
Array1D<Real64> FLFWSUdisk; // Sun-related downgoing luminous flux, due to entering beam
Array1D<Real64> FLCWSU; // Sun-related upgoing luminous flux
Array1D<Real64> TransMult; // Transmittance multiplier
Array1D<Real64> DayltgInterReflectedIllumTransBmBmMult; // Isolated blind beam-beam transmittance
Array1D<Real64> TransBmBmMult; // Beam-beam transmittance of isolated blind
Array1D<Real64> TransBmBmMultRefl; // As above but for beam reflected from exterior obstruction
Array1D<Real64> PH = Array1D<Real64>(DaylightingManager::NPH); // Altitude of sky element (radians)
Array1D<Real64> TH = Array1D<Real64>(DaylightingManager::NTH); // Azimuth of sky element (radians)
Array1D<Real64> SPHCPH = Array1D<Real64>(DaylightingManager::NPH); // Sine times cosine of altitude of sky element
Array1D<Real64> SetPnt; // Illuminance setpoint at reference points (lux)
Array1D<Real64> GLRNDX; // Glare index at reference point
Array1D<Real64> GLRNEW; // New glare index at reference point
Array2D<Real64> FLCWSK; // Sky-related upgoing luminous flux
Array2D<Real64> SkyObstructionMult =
Array2D<Real64>(DaylightingManager::NPHMAX,
DaylightingManager::NTHMAX); // Ratio of obstructed to unobstructed sky diffuse at a ground point for each (TH,PH) direction
Array2D<Real64> FLFWSK = Array2D<Real64>(DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related downgoing luminous flux
Array2D<Real64> FLFWSK; // Sky-related downgoing luminous flux
Array2D<Real64> ObTransM = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX); // ObTrans value for each (TH,PH) direction
Array2D<Real64> SFSKHR = Array2D<Real64>(2, 4); // Sky source luminance factor for sky type (second index), bare/shaded window (first index)
Array2D<Real64> DFSKHR = Array2D<Real64>(2, 4); // Sky daylight factor for sky type (second index), bare/shaded window (first index)
Expand Down Expand Up @@ -757,20 +755,20 @@ struct DaylightingManagerData : BaseGlobalStruct
this->SPHSUNHR = Array1D<Real64>(24, 0.0);
this->CPHSUNHR = Array1D<Real64>(24, 0.0);
this->THSUNHR = Array1D<Real64>(24, 0.0);
this->EINTSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4, 0.0);
this->EINTSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0);
this->EINTSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0);
this->WLUMSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4, 0.0);
this->WLUMSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0);
this->WLUMSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 0.0);
this->EINTSK.deallocate();
this->EINTSU.deallocate();
this->EINTSUdisk.deallocate();
this->WLUMSK.deallocate();
this->WLUMSU.deallocate();
this->WLUMSUdisk.deallocate();
this->GILSK = Array2D<Real64>(24, 4, 0.0);
this->GILSU = Array1D<Real64>(24, 0.0);
this->EDIRSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4);
this->EDIRSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1);
this->EDIRSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1);
this->AVWLSK = Array3D<Real64>(24, DataSurfaces::MaxSlatAngs + 1, 4);
this->AVWLSU = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1);
this->AVWLSUdisk = Array2D<Real64>(24, DataSurfaces::MaxSlatAngs + 1);
this->EDIRSK.deallocate();
this->EDIRSU.deallocate();
this->EDIRSUdisk.deallocate();
this->AVWLSK.deallocate();
this->AVWLSU.deallocate();
this->AVWLSUdisk.deallocate();
this->TDDTransVisBeam.deallocate();
this->TDDFluxInc.deallocate();
this->TDDFluxTrans.deallocate();
Expand Down Expand Up @@ -835,37 +833,32 @@ struct DaylightingManagerData : BaseGlobalStruct
this->VTDark = 0.0;
this->VTMULT = 1.0;

this->DayltgInteriorMapIllumDFSKHR =
Array2D<Real64>(2, 4); // Sky daylight factor for sky type (first index), bare/shaded window (second index)
this->DayltgInteriorMapIllumBFSKHR =
Array2D<Real64>(2, 4); // Sky background luminance factor for sky type (first index), bare/shaded window (second index)
this->DayltgInteriorMapIllumSFSKHR =
Array2D<Real64>(2, 4); // Sky source luminance factor for sky type (first index), bare/shaded window (second index)
this->DayltgInteriorMapIllumDFSKHR = Array2D<Real64>(2, 4);
this->DayltgInteriorMapIllumBFSKHR = Array2D<Real64>(2, 4);
this->DayltgInteriorMapIllumSFSKHR = Array2D<Real64>(2, 4);
this->BACLUM.clear();
this->DayltgInteriorMapIllumGLRNDX.clear();
this->daylight_illum.clear();
this->FLFWSU = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related downgoing luminous flux, excluding entering beam
this->FLFWSUdisk = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related downgoing luminous flux, due to entering beam
this->FLCWSU = Array1D<Real64>(DataSurfaces::MaxSlatAngs + 1); // Sun-related upgoing luminous flux
this->TransMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Transmittance multiplier
this->DayltgInterReflectedIllumTransBmBmMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Isolated blind beam-beam transmittance
this->TransBmBmMult = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // Beam-beam transmittance of isolated blind
this->TransBmBmMultRefl = Array1D<Real64>(DataSurfaces::MaxSlatAngs); // As above but for beam reflected from exterior obstruction
this->PH = Array1D<Real64>(DaylightingManager::NPH); // Altitude of sky element (radians)
this->TH = Array1D<Real64>(DaylightingManager::NTH); // Azimuth of sky element (radians)
this->SPHCPH = Array1D<Real64>(DaylightingManager::NPH); // Sine times cosine of altitude of sky element
this->FLFWSU.clear();
this->FLFWSUdisk.clear();
this->FLCWSU.clear();
this->TransMult.clear();
this->DayltgInterReflectedIllumTransBmBmMult.clear();
this->TransBmBmMult.clear();
this->TransBmBmMultRefl.clear();
this->PH = Array1D<Real64>(DaylightingManager::NPH);
this->TH = Array1D<Real64>(DaylightingManager::NTH);
this->SPHCPH = Array1D<Real64>(DaylightingManager::NPH);
this->SetPnt.clear();
this->GLRNDX.clear();
this->GLRNEW.clear();
this->FLCWSK = Array2D<Real64>(DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related upgoing luminous flux
this->SkyObstructionMult = Array2D<Real64>(
DaylightingManager::NPHMAX,
DaylightingManager::NTHMAX); // Ratio of obstructed to unobstructed sky diffuse at a ground point for each (TH,PH) direction
this->FLFWSK = Array2D<Real64>(DataSurfaces::MaxSlatAngs + 1, 4); // Sky-related downgoing luminous flux
this->ObTransM = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX); // ObTrans value for each (TH,PH) direction
this->SFSKHR = Array2D<Real64>(2, 4); // Sky source luminance factor for sky type (second index), bare/shaded window (first index)
this->DFSKHR = Array2D<Real64>(2, 4); // Sky daylight factor for sky type (second index), bare/shaded window (first index)
this->BFSKHR = Array2D<Real64>(2, 4); // Sky background luminance factor for sky type (second index), bare/shaded window (first index)
this->FLCWSK.clear();
this->SkyObstructionMult = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX);

This comment has been minimized.

Copy link
@amirroth

amirroth Sep 15, 2021

Collaborator

Maybe not for this PR, but ... a lot of these things have sizes that are compile-time constants and can be made into std::array that are not separately heap allocated at all.

this->FLFWSK.clear();
this->ObTransM = Array2D<Real64>(DaylightingManager::NPHMAX, DaylightingManager::NTHMAX);
this->SFSKHR = Array2D<Real64>(2, 4);

This comment has been minimized.

Copy link
@amirroth

amirroth Sep 15, 2021

Collaborator

These 2 and 4 dimensions should be enum::NUM or constexpr int rather than be numeric constants.

this->DFSKHR = Array2D<Real64>(2, 4);
this->BFSKHR = Array2D<Real64>(2, 4);
this->tmpIllumFromWinAtRefPt.clear();
this->tmpBackLumFromWinAtRefPt.clear();
this->tmpSourceLumFromWinAtRefPt.clear();
Expand Down

5 comments on commit c2d07ab

@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.

reduceDaylightingAllocations (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3210 of 3210 tests passed, 16 test warnings)

Messages:\n

  • 2 tests had: ESO small diffs.
  • 1 test had: EIO diffs.
  • 14 tests had: ERR diffs.

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.

reduceDaylightingAllocations (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1706 of 1706 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.

reduceDaylightingAllocations (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2417 of 2417 tests passed, 0 test warnings)

Build Badge Test Badge

@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.

reduceDaylightingAllocations (mjwitte) - x86_64-MacOS-10.15-clang-11.0.0: OK (3169 of 3169 tests passed, 16 test warnings)

Messages:\n

  • 2 tests had: ESO small diffs.
  • 1 test had: EIO diffs.
  • 14 tests had: ERR diffs.

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.

reduceDaylightingAllocations (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (735 of 735 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.