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.
https://energyplus.net
Other
1.12k stars 388 forks source link

Test for surface heat balance algorithm should be moved to some other place? #9560

Closed rraustad closed 2 years ago

rraustad commented 2 years ago

Issue overview

In ZoneTempPredictorCorrector::CalcPredictedHumidityRatio this loop is executed every time step. If this is in fact the same result each time (i.e., the surface heat balance algorithm cannot change during the simulation) then this slows program exectution. This could be moved to an init routine where an array variable is set as no_ht_EMPD_or_HAMT(ZoneNum).

UPDATE: further investigation shows that the SumHmA* variables are only used for EMPD and HAMT so they can be reset where these values are calculated.

    // if no surface in the zone uses EMPD or HAMT then zero
    bool no_ht_EMPD_or_HAMT(true);
    for (int i = Zone(ZoneNum).HTSurfaceFirst, e = Zone(ZoneNum).HTSurfaceLast; i <= e; ++i) {
        auto const &htAlgo(state.dataSurface->Surface(i).HeatTransferAlgorithm);
        if ((htAlgo == DataSurfaces::HeatTransferModel::EMPD) || (htAlgo == DataSurfaces::HeatTransferModel::HAMT)) {
            no_ht_EMPD_or_HAMT = false;
            break;
        }
    }
    if (no_ht_EMPD_or_HAMT) {
        state.dataHeatBalFanSys->SumHmARaW(ZoneNum) = 0.0;
        state.dataHeatBalFanSys->SumHmARa(ZoneNum) = 0.0;
    }

HeatBalanceAlgorithm, \memo Determines which Heat Balance Algorithm will be used ie. \memo CTF (Conduction Transfer Functions), \memo EMPD (Effective Moisture Penetration Depth with Conduction Transfer Functions). \memo Advanced/Research Usage: CondFD (Conduction Finite Difference) \memo Advanced/Research Usage: ConductionFiniteDifferenceSimplified \memo Advanced/Research Usage: HAMT (Combined Heat And Moisture Finite Element) \unique-object \format singleLine A1 , \field Algorithm \type choice \key ConductionTransferFunction \key MoisturePenetrationDepthConductionTransferFunction \key ConductionFiniteDifference \key CombinedHeatAndMoistureFiniteElement \default ConductionTransferFunction

Details

Some additional details for this issue (if relevant):

Checklist

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

amirroth commented 2 years ago

While we’re at it, declaring htAlgo as auto const & unnecessarily introduces a pointer (a reference is a pointer in disguise) and disables some compiler optimizations as a result. For scalars, just use the type name, it’s right there in the line below, HeatTransferModel.

AGeissler commented 2 years ago

Hi there. I just stumbled on a further possible issue here. I am trying to use the "selected construction algorithm change", however, simulation exits with the fatal error "InitialInitHeatBalFiniteDiff: Found Material that is too thin ..." and gives a material, that is not part of the switched construction (version 22.1, macOS).