LCOV - code coverage report
Current view: top level - EnergyPlus - TARCOGDeflection.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 0.0 % 84 0
Test Date: 2025-05-22 16:09:37 Functions: 0.0 % 3 0

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // ObjexxFCL Headers
      49              : #include <ObjexxFCL/Array1D.hh>
      50              : 
      51              : // EnergyPlus Headers
      52              : #include <EnergyPlus/DataGlobals.hh>
      53              : #include <EnergyPlus/TARCOGCommon.hh>
      54              : #include <EnergyPlus/TARCOGDeflection.hh>
      55              : #include <EnergyPlus/TARCOGParams.hh>
      56              : 
      57              : namespace EnergyPlus::TARCOGDeflection {
      58              : 
      59              : // MODULE INFORMATION:
      60              : //       AUTHOR         Simon Vidanovic
      61              : //       DATE WRITTEN   October/22/2011
      62              : //       MODIFIED       na
      63              : //       RE-ENGINEERED  na
      64              : //  Revision: 7.0.02  (October 22, 2011)
      65              : //   - Initial setup
      66              : 
      67              : // PURPOSE OF THIS MODULE:
      68              : // A module which contains functions for deflection calculation
      69              : 
      70              : // Using/Aliasing
      71              : using namespace TARCOGParams;
      72              : using namespace TARCOGCommon;
      73              : 
      74            0 : void PanesDeflection(DeflectionCalculation const DeflectionStandard,
      75              :                      Real64 const W,
      76              :                      Real64 const H,
      77              :                      int const nlayer,
      78              :                      Real64 const Pa,
      79              :                      Real64 const Pini,
      80              :                      Real64 const Tini,
      81              :                      const Array1D<Real64> &PaneThickness,
      82              :                      const Array1D<Real64> &NonDeflectedGapWidth,
      83              :                      Array1D<Real64> &DeflectedGapWidthMax,
      84              :                      Array1D<Real64> &DeflectedGapWidthMean,
      85              :                      const Array1D<Real64> &PanelTemps,
      86              :                      const Array1D<Real64> &YoungsMod,
      87              :                      const Array1D<Real64> &PoissonsRat,
      88              :                      Array1D<Real64> &LayerDeflection,
      89              :                      int &nperr,
      90              :                      std::string &ErrorMessage)
      91              : {
      92              :     //***********************************************************************
      93              :     // PanesDeflection - calculates deflection of panes and recalculate gap
      94              :     //                   widths at maximal point of deflection
      95              :     //***********************************************************************
      96              : 
      97              :     // Argument array dimensioning
      98            0 :     EP_SIZE_CHECK(PaneThickness, maxlay);
      99            0 :     EP_SIZE_CHECK(NonDeflectedGapWidth, MaxGap);
     100            0 :     EP_SIZE_CHECK(DeflectedGapWidthMax, MaxGap);
     101            0 :     EP_SIZE_CHECK(DeflectedGapWidthMean, MaxGap);
     102            0 :     EP_SIZE_CHECK(PanelTemps, maxlay2);
     103            0 :     EP_SIZE_CHECK(YoungsMod, maxlay);
     104            0 :     EP_SIZE_CHECK(PoissonsRat, maxlay);
     105            0 :     EP_SIZE_CHECK(LayerDeflection, maxlay);
     106              : 
     107              :     // Localy used
     108            0 :     Array1D<Real64> DCoeff(maxlay);
     109              : 
     110              :     // first calculate D coefficients since that will be necessary for any of selected standards
     111            0 :     for (int i = 1; i <= nlayer; ++i) {
     112            0 :         DCoeff(i) = YoungsMod(i) * pow_3(PaneThickness(i)) / (12 * (1 - pow_2(PoissonsRat(i))));
     113              :     }
     114            0 :     if (DeflectionStandard == DeflectionCalculation::TEMPERATURE) {
     115            0 :         DeflectionTemperatures(nlayer,
     116              :                                W,
     117              :                                H,
     118              :                                Pa,
     119              :                                Pini,
     120              :                                Tini,
     121              :                                NonDeflectedGapWidth,
     122              :                                DeflectedGapWidthMax,
     123              :                                DeflectedGapWidthMean,
     124              :                                PanelTemps,
     125              :                                DCoeff,
     126              :                                LayerDeflection,
     127              :                                nperr,
     128              :                                ErrorMessage);
     129            0 :     } else if (DeflectionStandard == DeflectionCalculation::GAP_WIDTHS) {
     130            0 :         DeflectionWidths(nlayer, W, H, DCoeff, NonDeflectedGapWidth, DeflectedGapWidthMax, DeflectedGapWidthMean, LayerDeflection);
     131              :     } else { // including NO_DEFLECTION_CALCULATION
     132            0 :         return;
     133              :     }
     134            0 : }
     135              : 
     136            0 : void DeflectionTemperatures(int const nlayer,
     137              :                             Real64 const W,
     138              :                             Real64 const H,
     139              :                             Real64 const Pa,
     140              :                             Real64 const Pini,
     141              :                             Real64 const Tini,
     142              :                             const Array1D<Real64> &NonDeflectedGapWidth,
     143              :                             Array1D<Real64> &DeflectedGapWidthMax,
     144              :                             Array1D<Real64> &DeflectedGapWidthMean,
     145              :                             const Array1D<Real64> &PanelTemps,
     146              :                             Array1D<Real64> &DCoeff,
     147              :                             Array1D<Real64> &LayerDeflection,
     148              :                             int &nperr,
     149              :                             std::string &ErrorMessage)
     150              : {
     151              :     //***********************************************************************************************************
     152              :     // DeflectionTemperatures - calculates deflection of panes and recalculate gap
     153              :     //                          widths at maximal point of deflection based on gap pressures and temperatures
     154              :     //***********************************************************************************************************
     155              : 
     156              :     // Argument array dimensioning
     157            0 :     EP_SIZE_CHECK(NonDeflectedGapWidth, MaxGap);
     158            0 :     EP_SIZE_CHECK(DeflectedGapWidthMax, MaxGap);
     159            0 :     EP_SIZE_CHECK(DeflectedGapWidthMean, MaxGap);
     160            0 :     EP_SIZE_CHECK(PanelTemps, maxlay2);
     161            0 :     EP_SIZE_CHECK(DCoeff, maxlay);
     162            0 :     EP_SIZE_CHECK(LayerDeflection, maxlay);
     163              : 
     164              :     // Static constants
     165            0 :     static Real64 const Pi_6(pow_6(Constant::Pi));
     166              : 
     167              :     // localy used
     168            0 :     Array1D<Real64> DPressure(maxlay); // delta pressure at each glazing layer
     169            0 :     Array1D<Real64> Vini(MaxGap);
     170            0 :     Array1D<Real64> Vgap(MaxGap);
     171            0 :     Array1D<Real64> Pgap(MaxGap);
     172            0 :     Array1D<Real64> Tgap(MaxGap);
     173              :     Real64 MaxLDSum;
     174              :     Real64 MeanLDSum;
     175              :     Real64 Ratio;
     176              : 
     177              :     // calculate Vini for each gap
     178            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     179            0 :         Vini(i) = NonDeflectedGapWidth(i) * W * H;
     180              :     } // do i = 1, nlayer
     181              : 
     182            0 :     MaxLDSum = LDSumMax(W, H);
     183            0 :     MeanLDSum = LDSumMean(W, H);
     184            0 :     Ratio = MeanLDSum / MaxLDSum;
     185              : 
     186              :     // calculate Vgap for each gap
     187            0 :     Real64 const W_H_Ratio(W * H * Ratio);
     188            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     189            0 :         Vgap(i) = Vini(i) + W_H_Ratio * (LayerDeflection(i) - LayerDeflection(i + 1));
     190              :     } // do i = 1, nlayer
     191              : 
     192              :     // calculate Tgap for each gap
     193            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     194            0 :         int const j = 2 * i;
     195            0 :         Tgap(i) = (PanelTemps(j) + PanelTemps(j + 1)) / 2;
     196              :     } // do i = 1, nlayer
     197              : 
     198            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     199            0 :         Pgap(i) = Pini * Vini(i) * Tgap(i) / (Tini * Vgap(i));
     200              :     } // do i = 1, nlayer
     201              : 
     202            0 :     DPressure(1) = Pgap(1) - Pa;
     203            0 :     if (nlayer > 1) {
     204            0 :         DPressure(nlayer) = Pa - Pgap(nlayer - 1);
     205              :     }
     206              : 
     207            0 :     for (int i = 2; i <= nlayer - 1; ++i) {
     208            0 :         DPressure(i) = Pgap(i) - Pgap(i - 1);
     209              :     } // do i = 1, nlayer
     210              : 
     211            0 :     Real64 const deflection_fac(DeflectionRelaxation * MaxLDSum * 16);
     212            0 :     for (int i = 1; i <= nlayer; ++i) {
     213            0 :         LayerDeflection(i) += deflection_fac * DPressure(i) / (Pi_6 * DCoeff(i));
     214              :     }
     215              : 
     216            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     217            0 :         DeflectedGapWidthMax(i) = NonDeflectedGapWidth(i) + LayerDeflection(i) - LayerDeflection(i + 1);
     218            0 :         if (DeflectedGapWidthMax(i) < 0.0) {
     219            0 :             nperr = 2001; // glazing panes collapsed
     220            0 :             ErrorMessage = "Glazing panes collapsed";
     221              :         }
     222              :     }
     223              : 
     224            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     225            0 :         DeflectedGapWidthMean(i) = NonDeflectedGapWidth(i) + Ratio * (DeflectedGapWidthMax(i) - NonDeflectedGapWidth(i));
     226              :     }
     227            0 : }
     228              : 
     229            0 : void DeflectionWidths(int const nlayer,
     230              :                       Real64 const W,
     231              :                       Real64 const H,
     232              :                       Array1D<Real64> &DCoeff,
     233              :                       const Array1D<Real64> &NonDeflectedGapWidth,
     234              :                       const Array1D<Real64> &DeflectedGapWidthMax,
     235              :                       Array1D<Real64> &DeflectedGapWidthMean,
     236              :                       Array1D<Real64> &LayerDeflection)
     237              : {
     238              :     // Argument array dimensioning
     239            0 :     EP_SIZE_CHECK(DCoeff, maxlay);
     240            0 :     EP_SIZE_CHECK(NonDeflectedGapWidth, MaxGap);
     241            0 :     EP_SIZE_CHECK(DeflectedGapWidthMax, MaxGap);
     242            0 :     EP_SIZE_CHECK(DeflectedGapWidthMean, MaxGap);
     243            0 :     EP_SIZE_CHECK(LayerDeflection, maxlay);
     244              : 
     245            0 :     Real64 nominator = 0.0;
     246            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     247            0 :         Real64 SumL = 0.0;
     248            0 :         for (int j = i; j <= nlayer - 1; ++j) {
     249            0 :             SumL += NonDeflectedGapWidth(j) - DeflectedGapWidthMax(j);
     250              :         }
     251            0 :         nominator += SumL * DCoeff(i);
     252              :     }
     253              : 
     254            0 :     Real64 denominator = 0.0;
     255            0 :     for (int i = 1; i <= nlayer; ++i) {
     256            0 :         denominator += DCoeff(i);
     257              :     }
     258              : 
     259            0 :     LayerDeflection(nlayer) = nominator / denominator;
     260              : 
     261            0 :     for (int i = nlayer - 1; i >= 1; --i) {
     262            0 :         LayerDeflection(i) = DeflectedGapWidthMax(i) - NonDeflectedGapWidth(i) + LayerDeflection(i + 1);
     263              :     }
     264              : 
     265            0 :     Real64 MaxLDSum = LDSumMax(W, H);
     266            0 :     Real64 MeanLDSum = LDSumMean(W, H);
     267            0 :     Real64 Ratio = MeanLDSum / MaxLDSum;
     268              : 
     269            0 :     for (int i = 1; i <= nlayer - 1; ++i) {
     270            0 :         DeflectedGapWidthMean(i) = NonDeflectedGapWidth(i) + Ratio * (DeflectedGapWidthMax(i) - NonDeflectedGapWidth(i));
     271              :     }
     272            0 : }
     273              : 
     274              : } // namespace EnergyPlus::TARCOGDeflection
        

Generated by: LCOV version 2.0-1