!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! function attributes:
! INPUTS:
! General:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nlayer | |||
integer, | intent(in) | :: | iwd | |||
real(kind=r64), | intent(inout) | :: | tout | |||
real(kind=r64), | intent(inout) | :: | tind | |||
real(kind=r64), | intent(inout) | :: | trmin | |||
real(kind=r64), | intent(in) | :: | wso | |||
real(kind=r64), | intent(in) | :: | wsi | |||
real(kind=r64), | intent(in) | :: | dir | |||
real(kind=r64), | intent(in) | :: | outir | |||
integer, | intent(in) | :: | isky | |||
real(kind=r64), | intent(in) | :: | tsky | |||
real(kind=r64), | intent(inout) | :: | esky | |||
real(kind=r64), | intent(in) | :: | fclr | |||
real(kind=r64), | intent(in) | :: | VacuumPressure | |||
real(kind=r64) | :: | VacuumMaxGapThickness | ||||
integer, | intent(in) | :: | CalcDeflection | |||
real(kind=r64), | intent(in) | :: | Pa | |||
real(kind=r64), | intent(in) | :: | Pini | |||
real(kind=r64), | intent(in) | :: | Tini | |||
real(kind=r64), | intent(inout), | dimension(maxlay) | :: | gap | ||
real(kind=r64), | intent(inout), | dimension(MaxGap) | :: | GapDefMax | ||
real(kind=r64), | intent(inout), | dimension(maxlay) | :: | thick | ||
real(kind=r64), | intent(inout), | dimension(maxlay) | :: | scon | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | YoungsMod | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | PoissonsRat | !! INPUTS/OUTPUTS: |
|
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | tir | ||
real(kind=r64), | intent(in), | dimension(maxlay2) | :: | emis | ||
real(kind=r64), | intent(in) | :: | totsol | |||
real(kind=r64), | intent(in) | :: | tilt | |||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | asol | ! Venetians: |
|
real(kind=r64), | intent(in) | :: | height | |||
real(kind=r64), | intent(in) | :: | heightt | |||
real(kind=r64), | intent(in) | :: | width | |||
real(kind=r64), | intent(in), | dimension(maxlay1) | :: | presure | ||
integer, | intent(in), | dimension(maxlay1, maxgas) | :: | iprop | ||
real(kind=r64), | intent(in), | dimension(maxlay1, maxgas) | :: | frct | ||
real(kind=r64), | intent(in), | dimension(maxgas, 3) | :: | xgcon | ||
real(kind=r64), | intent(in), | dimension(maxgas, 3) | :: | xgvis | ||
real(kind=r64), | intent(in), | dimension(maxgas, 3) | :: | xgcp | ||
real(kind=r64), | intent(in), | dimension(maxgas) | :: | xwght | ||
real(kind=r64), | intent(in), | dimension(maxgas) | :: | gama | ||
integer, | intent(in), | dimension(maxlay1) | :: | nmix | ||
integer, | intent(in), | dimension(maxlay) | :: | SupportPillar | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | PillarSpacing | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | PillarRadius | ||
real(kind=r64), | intent(inout), | dimension(maxlay2) | :: | theta | ||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | LayerDef | ! Gaps: |
|
real(kind=r64), | intent(out), | dimension(maxlay3) | :: | q | ||
real(kind=r64), | intent(out), | dimension(maxlay1) | :: | qv | ||
real(kind=r64), | intent(out) | :: | ufactor | |||
real(kind=r64), | intent(out) | :: | sc | |||
real(kind=r64), | intent(out) | :: | hflux | |||
real(kind=r64), | intent(out) | :: | hcin | |||
real(kind=r64), | intent(out) | :: | hcout | |||
real(kind=r64), | intent(out) | :: | hrin | |||
real(kind=r64), | intent(out) | :: | hrout | |||
real(kind=r64), | intent(inout) | :: | hin | |||
real(kind=r64), | intent(inout) | :: | hout | ! OUTPUTS: ! Overall: |
||
real(kind=r64), | intent(out), | dimension(maxlay1) | :: | hcgas | ||
real(kind=r64), | intent(out), | dimension(maxlay1) | :: | hrgas | ||
real(kind=r64), | intent(out) | :: | shgc | |||
integer, | intent(out) | :: | nperr | |||
character(len=*), | intent(inout) | :: | ErrorMessage | |||
real(kind=r64), | intent(out) | :: | shgct | |||
real(kind=r64), | intent(out) | :: | tamb | |||
real(kind=r64), | intent(out) | :: | troom | ! Layers: |
||
integer, | intent(in), | dimension(2) | :: | ibc | ! Layers: |
|
real(kind=r64), | intent(in), | dimension(maxlay) | :: | Atop | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | Abot | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | Al | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | Ar | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | Ah | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatThick | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatWidth | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatAngle | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatCond | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatSpacing | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | SlatCurve | ||
real(kind=r64), | intent(in), | dimension(maxlay1) | :: | vvent | ||
real(kind=r64), | intent(in), | dimension(maxlay1) | :: | tvent | ! Laminates: |
|
integer, | intent(in), | dimension(maxlay) | :: | LayerType | ||
integer, | intent(in), | dimension(maxlay) | :: | nslice | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | LaminateA | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | LaminateB | ||
real(kind=r64), | intent(in), | dimension(maxlay) | :: | sumsol | ! Gaps: |
|
real(kind=r64), | intent(out), | dimension(maxlay) | :: | hg | ||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | hr | ||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | hs | ||
real(kind=r64), | intent(out) | :: | he | |||
real(kind=r64), | intent(out) | :: | hi | |||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | Ra | ||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | Nu | ! Shading related: |
|
integer, | intent(in) | :: | standard | |||
integer, | intent(in) | :: | ThermalMod | |||
integer, | intent(in) | :: | Debug_mode | |||
character(len=*), | intent(in) | :: | Debug_dir | |||
character(len=*), | intent(in) | :: | Debug_file | |||
integer, | intent(in) | :: | win_ID | |||
integer, | intent(in) | :: | igu_ID | ! Environment related: |
||
real(kind=r64), | intent(out) | :: | ShadeEmisRatioOut | |||
real(kind=r64), | intent(out) | :: | ShadeEmisRatioIn | |||
real(kind=r64), | intent(out) | :: | ShadeHcRatioOut | |||
real(kind=r64), | intent(out) | :: | ShadeHcRatioIn | |||
real(kind=r64), | intent(out) | :: | HcUnshadedOut | |||
real(kind=r64), | intent(out) | :: | HcUnshadedin | |||
real(kind=r64), | intent(out), | dimension(maxlay) | :: | Keff | ||
real(kind=r64), | intent(out), | dimension(MaxGap) | :: | ShadeGapKeffConv | ||
real(kind=r64), | intent(in) | :: | SDScalar | |||
integer, | intent(in) | :: | SHGCCalc | |||
integer, | intent(out) | :: | NumOfIterations |
subroutine TARCOG90(nlayer, iwd, tout, tind, trmin, wso, wsi, dir, outir, isky, tsky, esky, fclr, VacuumPressure, &
VacuumMaxGapThickness, CalcDeflection, Pa, Pini, Tini, gap, GapDefMax, thick, scon, YoungsMod, PoissonsRat, &
tir, emis, totsol, tilt, asol, height, heightt, width, &
presure, iprop, frct, xgcon, xgvis, xgcp, xwght, gama, nmix, &
SupportPillar, PillarSpacing, PillarRadius, &
theta, LayerDef, q, qv, ufactor, sc, hflux, hcin, hcout, hrin, hrout, hin, hout, hcgas, hrgas, shgc, nperr, &
ErrorMessage, shgct, tamb, troom, ibc, Atop, Abot, Al, Ar, Ah, SlatThick, SlatWidth, SlatAngle, &
SlatCond, SlatSpacing, SlatCurve, vvent,tvent, LayerType, nslice, LaminateA, LaminateB, &
sumsol, hg, hr, hs, he, hi, Ra, Nu, standard, ThermalMod, Debug_mode, Debug_dir, Debug_file, win_ID, igu_ID, &
ShadeEmisRatioOut, ShadeEmisRatioIn, ShadeHcRatioOut, ShadeHcRatioIn, &
HcUnshadedOut, HcUnshadedIn, Keff, ShadeGapKeffConv, SDScalar, SHGCCalc, NumOfIterations)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! function attributes:
!!! INPUTS:
!!! General:
integer, intent(in) :: nlayer !Number of layers (glass + SD)
real(r64), intent(in) :: width ! Window width
real(r64), intent(in) :: height ! IGU cavity height
real(r64), intent(in) :: heightt ! Window height
integer, intent(in) :: standard ! Calculation standard switch:
! 1 - ISO15099
! 2 - ISO10292
! 3 - EN673
integer, intent(in) :: ThermalMod ! Thermal model:
! 0 - ISO15099
! 1 - Thermal model 1
! 2 - Thermal model 2 (not implemented)
integer, intent(in) :: Debug_mode ! Switch for debug output files:
! 0 - don't create debug output files
! 1 - append results to existing debug output file
! 2 - store results in new debug output file
! 3 - save in-between results (in all iterations) to existing debug file
integer, intent(in) :: SHGCCalc ! SHGC calculation switch:
! 0 - do not perform SHGC calculations
! 1 - perform SHGC calculations
character(len=*), intent(in) :: Debug_dir ! Target directory for debug files
character(len=*), intent(in) :: Debug_file ! File name template for debug files
character(len=*), intent(inout) :: ErrorMessage ! To store error message from tarcog execution
integer, intent(in) :: win_ID ! ID of window (passed by W6)
integer, intent(in) :: igu_ID ! ID of the IGU (passed by W6)
!!! Environment related:
real(r64), intent(inout) :: tout ! Outdoor temperature [K]
real(r64), intent(inout) :: tind ! Indoor temperature [K]
real(r64), intent(in) :: wso ! Outdoor wind speed [m/s]
real(r64), intent(in) :: wsi ! Inside forced air speed [m/s]
real(r64), intent(in) :: dir ! Direct solar radiation [W/m2]
real(r64), intent(in) :: outir ! IR radiance of window's exterior surround [W/m2]
real(r64), intent(in) :: tsky ! Night sky temperature [K]
real(r64), intent(in) :: fclr ! Fraction of sky that is clear
real(r64), intent(in) :: VacuumPressure !maximal pressure for gas to be considered as vacuum
real(r64) :: VacuumMaxGapThickness !maximum allowed thickness without producing warning message
real(r64), intent(in) :: totsol ! Total solar transmittance of the IGU
real(r64), intent(in) :: tilt ! Window tilt [degrees]
integer, intent(in) :: iwd ! Wind direction:
! 0 - windward
! 1 - leeward
integer, intent(in) :: isky ! Flag for sky temperature(Tsky) and sky emittance(esky)
! 0 - both Tsky and Esky are specified
! 1 - Tsky specified; esky = 1
! 2 - Swinbank model for effective sky emittance
! 3 - IR radiance is provided from external source
!integer, intent(in) :: mgas ! Flag for gas property constants:
! 0 - gas constants supplied (through gcon, gvis and gcp arrays)
! 1 - use internal constants; when internal then first index
! in gcon, gciv and gcp is:
! 1 - Air
! 2 - Argon
! 3 - Krypton
! 4 - Xenon
integer, dimension(2), intent(in):: ibc ! Vector of boundary condition flags (ibc(1) - outdoor, ibc(2) - indoor
! 0 - h to be calculated
! 1 - combined film coefficient h prescribed
! 2 - convective film coefficient (hc) prescibed
! Also used in old algorithms for calculating h, accessible through negative
! values for flags:
! -1 - old SPC142 correlation
! -2 - Klems-Yazdanian correlation (applicable to outdoor only)
! -3 - Kimura correlation (applicable to outdoor only)
!!! Layers:
integer, dimension(maxlay), intent(in) :: LayerType ! Glazing layer type flag
! 0 - Specular layer
! 1 - Venetian blind (SD)
! 2 - Woven shade (SD) (not implemented)
! 3 - Diffuse shade
real(r64), dimension(maxlay2), intent(in) :: tir ! Vector of IR transmittances of each surface
real(r64), dimension(maxlay2), intent(in) :: emis ! Vector of IR emittances of each surface
real(r64), dimension(maxlay), intent(in) :: asol ! Vector of Absorbed solar energy fractions for each layer
!!! Venetians:
real(r64), dimension(maxlay), intent(in) :: Atop ! Vector with areas of top openings - between SD layers and top of
! glazing cavity [m2]
real(r64), dimension(maxlay), intent(in) :: Abot ! Vector with areas of bottom openings - between SD layers and
! bottom of glazing cavity [m2]
real(r64), dimension(maxlay), intent(in) :: Al ! Vector with areas of left-hand side openings - between SD layers and
! left end of glazing cavity [m2]
real(r64), dimension(maxlay), intent(in) :: Ar ! Vector of areas of right-hand side openings - between SD layers and
! right end of glazing cavity [m2]
real(r64), dimension(maxlay), intent(in) :: Ah ! Vector of total areas of holes for each SD [m2]
real(r64), dimension(maxlay), intent(in) :: SlatThick ! Thickness of the slat material [m]
real(r64), dimension(maxlay), intent(in) :: SlatWidth ! Slat width [m]
real(r64), dimension(maxlay), intent(in) :: SlatAngle ! Slat tilt angle [deg]
real(r64), dimension(maxlay), intent(in) :: SlatCond ! Conductivity of the slat material [W/m.K]
real(r64), dimension(maxlay), intent(in) :: SlatSpacing ! Distance between slats [m]
real(r64), dimension(maxlay), intent(in) :: SlatCurve ! Curvature radius of the slat [m]
real(r64), dimension(maxlay1), intent(in) :: vvent ! Vector of velocities for forced ventilation, for each gap, and for
! outdoor and indoor environment [m/s]
real(r64), dimension(maxlay1), intent(in) :: tvent ! Vector of temperatures of ventilation gas for forced ventilation,
! for each gap, and for outdoor and indoor environment
!!! Laminates:
integer, dimension(maxlay), intent(in) :: nslice ! Vector of numbers of slices in a laminated glazing layers
! (0 - monolithic layer)
real(r64), dimension(maxlay), intent(in) :: LaminateA ! Left-hand side array for creating slice equations
real(r64), dimension(maxlay), intent(in) :: LaminateB ! Right-hand side array for creating slice equations
real(r64), dimension(maxlay), intent(in) :: sumsol ! Array of absorbed solar energy fractions for each laminated
! glazing layer [W/m2]
!!! Gaps:
integer, dimension(maxlay1, maxgas), intent(in) :: iprop ! Matrix of gas codes - see mgas definition
integer, dimension(maxlay1), intent(in) :: nmix ! Vector of number of gasses in gas mixture of each gap
real(r64), dimension(maxlay1, maxgas), intent(in) :: frct ! Matrix of mass percentages in gap mixtures
real(r64), dimension(maxlay1), intent(in) :: presure ! Vector of gas pressures in gaps [N/m2]
real(r64), dimension(maxgas, 3), intent(in) :: xgcon ! Matrix of constants for gas conductivity calc
! (A, B, C for max of 10 gasses)
real(r64), dimension(maxgas, 3), intent(in) :: xgvis ! Matrix of constants for gas dynamic viscosity calc
! (A, B, C for max of 10 gasses)
real(r64), dimension(maxgas, 3), intent(in) :: xgcp ! Matrix of constants for gas specific heat calc at constant pressure
! (A, B, C for max of 10 gasses)
real(r64), dimension(maxgas), intent(in) :: xwght ! Vector of Molecular weights for gasses
real(r64), dimension(maxgas), intent(in) :: gama ! Vector of spefic heat ration for low pressure calc
integer, dimension(maxlay), intent(in) :: SupportPillar ! Shows whether or not gap have support pillar
! 0 - does not have support pillar
! 1 - have support pillar
real(r64), dimension(maxlay), intent(in) :: PillarSpacing ! Pillar spacing for each gap (used in case there is support pillar)
real(r64), dimension(maxlay), intent(in) :: PillarRadius ! Pillar radius for each gap (used in case there is support pillar)
real(r64), intent(in) :: SDScalar ! Factor of Venetian SD layer contribution to convection
! (used in conjunction with Thermal Model 2; otherwise, this value is ignored by TARCOG)
! – real(r64) value between 0 (SD contribution to convection is neglected) and
! 1 (SD treated as “"closed”" – as if it is a glass layer with thermal
! properties of SD slat material)
!Deflection
integer, intent(in) :: CalcDeflection ! Deflection calculation flag:
! 0 - no deflection calculations
! 1 - perform deflection calculation (input is Pressure/Temp)
! 2 - perform deflection calculation (input is measured deflection)
real(r64), intent(in) :: Pa ! Atmospheric (outside/inside) pressure (used onlu if CalcDeflection = 1)
real(r64), intent(in) :: Pini ! Initial presssure at time of fabrication (used only if CalcDeflection = 1)
real(r64), intent(in) :: Tini ! Initial temperature at time of fabrication (used only if CalcDeflection = 1)
real(r64), dimension(MaxGap), intent(inout) :: GapDefMax ! Vector of gap widths in deflected state. It will be used as input
! if CalcDeflection = 2. In case CalcDeflection = 1 it will return
! recalculated gap widths. [m]
real(r64), dimension(maxlay), intent(in) :: YoungsMod ! Youngs Modulus coefficients used in deflection calculations
real(r64), dimension(maxlay), intent(in) :: PoissonsRat ! Poissons Ratio coefficients used in deflection calculations
!!!! INPUTS/OUTPUTS:
real(r64), intent(inout) :: trmin ! Indoor mean radiant temperature [K]
real(r64), intent(inout) :: esky ! Effective night sky emittance
real(r64), dimension(maxlay), intent(inout) :: scon ! Vector of conductivities of each glazing layer [W/mK]
real(r64), dimension(maxlay), intent(inout) :: thick ! Vector of glazing layer thicknesses [m]
real(r64), dimension(maxlay), intent(inout) :: gap ! Vector of gap widths [m]
real(r64), intent(inout) :: hin ! Indoor combined film coefficient (if non-zero) [W/m2K]
real(r64), intent(inout) :: hout ! Outdoor combined film coefficient (if non-zero) [W/m2K]
!!! OUTPUTS:
!!! Overall:
integer, intent(out) :: nperr ! Error code
integer, intent(out) :: NumOfIterations ! Number of iterations for reacing solution
real(r64), intent(out) :: ufactor ! Center of glass U-value [W/m2 K]
real(r64), intent(out) :: sc ! Shading Coefficient
real(r64), intent(out) :: hflux ! Net heat flux between room and window [W/m2]
real(r64), intent(out) :: shgc ! Solar heat gain coefficient – per ISO 15099
real(r64), intent(out) :: shgct ! Solar heat gain coefficient – per old procedure
real(r64), intent(out) :: he ! External heat transfer coefficient [W/m2 K] – EN673 and ISO 10292 procedure
real(r64), intent(out) :: hi ! Internal heat transfer coefficient [W/m2 K] – EN673 and ISO 10292 procedure
real(r64), intent(out) :: hcin ! Indoor convective surface heat transfer coefficient [W/m2 K]
real(r64), intent(out) :: hrin ! Indoor radiative surface heat transfer coefficient [W/m2 K]
real(r64), intent(out) :: hcout ! Outdoor convective surface heat transfer coefficient [W/m2 K]
real(r64), intent(out) :: hrout ! Outdoor radiative surface heat transfer coefficient [W/m2 K]
real(r64), intent(out) :: tamb ! Outdoor environmental temperature [K]
real(r64), intent(out) :: troom ! Indoor environmental temperature [K]
!!! Layers:
real(r64), dimension(maxlay2), intent(inout) :: theta ! Vector of average temperatures of glazing surfaces [K]
real(r64), dimension(maxlay3), intent(out) :: q ! Vector of various heat fluxes [W/m2]
! depending on element index:
! 1 - qout (heat flux from outer-most glazing surface to outdoor space)
! 2*i = qpane(i) (heat flux through i-th glazing layer
! 2*i-1 = qgap(i) (heat flux from i-th glazing cavity to indoor-faced
! surface of the adjacent glazing layer)
! 2*nlayer + 1 = qin (heat flux from indoor space to inner-most glazing
! surface)
real(r64), dimension(maxlay1), intent(out) :: qv ! Vector of heat fluxes to each gap by ventillation [W/m2]
real(r64), dimension(maxlay), intent(out) :: Keff ! Vector of keff values for gaps [W/m.K]
real(r64), dimension(maxlay), intent(out) :: LayerDef ! Vector of layers deflection. [m]
!!! Gaps:
real(r64), dimension(maxlay1), intent(out) :: hcgas ! Convective part of gap effective conductivity (including in and out)
real(r64), dimension(maxlay1), intent(out) :: hrgas ! Radiative part of gap effective conductivity (including in and out)
real(r64), dimension(maxlay), intent(out) :: hg ! Gas conductance of the glazing cavity [W/m2 K]
! - EN673 and ISO 10292 procedure
real(r64), dimension(maxlay), intent(out) :: hr ! Radiation conductance of the glazing cavity [W/m2 K]
! - EN673 and ISO 10292 procedure
real(r64), dimension(maxlay), intent(out) :: hs ! Thermal conductance of the glazing cavity [W/m2 K]
! - EN673 and ISO 10292 procedure
real(r64), dimension(maxlay), intent(out) :: Ra ! Vector of Rayleigh numbers, for each gap
real(r64), dimension(maxlay), intent(out) :: Nu ! Vector of Nusselt numbers, for each gap
!!! Shading related:
real(r64), intent(out) :: ShadeEmisRatioOut ! Ratio of modified to glass emissivity at the outermost glazing surface
real(r64), intent(out) :: ShadeEmisRatioIn ! Ratio of modified to glass emissivity at the innermost glazing surface
real(r64), intent(out) :: ShadeHcRatioOut ! Ratio of modified to unshaded Hc at the outermost glazing surface
real(r64), intent(out) :: ShadeHcRatioIn ! Ratio of modified to unshaded Hc at the innermost glazing surface
real(r64), intent(out) :: HcUnshadedOut ! Hc value at outermost glazing surface of an unshaded subsystem [W/m2 K]
real(r64), intent(out) :: HcUnshadedin ! Hc value at innermost glazing surface of an unshaded subsystem [W/m2 K]
real(r64), dimension(MaxGap), intent(out) :: ShadeGapKeffConv ! Vector of convective keff values for areas above/below
! SD layers [W/m.K]
! temporary variables stored between deflection iterations because tarcog need to produce result with exact same
! input variables
real(r64) :: eskyTemp
real(r64) :: trminTemp
real(r64) :: hinTemp
real(r64) :: houtTemp
real(r64), dimension(maxlay) :: sconTemp
real(r64), dimension(maxlay) :: thickTemp
!real(r64), dimension(maxlay) :: sol ! Vector of Absorbed solar energy for each layer [W/m2] = dir*asol
!Internaly used
logical :: converged = .false. !used for convergence check in case of deflection calculations
real(r64), dimension(maxlay2) :: told
real(r64), dimension(MaxGap) :: CurGap
real(r64), dimension(MaxGap) :: GapDefMean
real(r64) :: dtmax
integer :: i
integer :: counter
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Body of TARCOG90
he = 0.0d0
hi = 0.0d0
hcin = 0.0d0
hrin = 0.0d0
hcout = 0.0d0
hrout = 0.0d0
LayerDef = 0.0d0
dtmax = 0.0d0
i = 0
counter = 0
eskyTemp = 0.0d0
trminTemp = 0.0d0
hinTemp = 0.0d0
houtTemp = 0.0d0
ErrorMessage = 'Normal Termination'
!sol = 0.0d0
!if (dir.ne.0) then
! do i= 1, nlayer
! sol(i) = dir * asol(i)
! end do
!end if
do i = 1, nlayer - 1
CurGap(i) = gap(i)
end do
! Prepare common debug variables:
call PrepDebugFilesAndVariables(Debug_dir, Debug_file, Debug_Mode, win_ID, igu_ID, nperr)
! Check input arguments:
nperr = ArgCheck(nlayer,iwd,tout,tind,trmin,wso,wsi,dir,outir,isky,tsky,esky,fclr,VacuumPressure, VacuumMaxGapThickness, &
& CalcDeflection, Pa, Pini, Tini, &
& gap,GapDefMax,thick,scon,YoungsMod,PoissonsRat,tir,emis,totsol, &
& tilt,asol,height,heightt,width,presure,iprop,frct,xgcon,xgvis,xgcp,xwght,gama,nmix, &
& SupportPillar, PillarSpacing, PillarRadius, &
& hin,hout, ibc, Atop, Abot, Al, Ar, Ah, SlatThick, SlatWidth, SlatAngle, &
& SlatCond, SlatSpacing, SlatCurve, vvent,tvent, LayerType, nslice, LaminateA, LaminateB, &
& sumsol, standard, ThermalMod, SDScalar,ErrorMessage)
! in case of provided deflected gap widths just store deflected widhts before temperatures calculation
! deflections in this case do not depend of temperatures and it should be calculated before to avoid
! one extra call of temperatures calculations
if (CalcDeflection.eq.DEFLECTION_CALC_GAP_WIDTHS) then
call PanesDeflection(CalcDeflection, width, height, nlayer, Pa, Pini, Tini, thick, gap, &
GapDefMax, GapDefMean, theta, YoungsMod, PoissonsRat, LayerDef, nperr, ErrorMessage)
do i = 1, nlayer - 1
CurGap(i) = GapDefMean(i)
end do !do i = 1, nlayer - 1
end if
! in case of deflection calculation for temperature & pressure input some variables needs to be stored because
! Calc_ISO15099 and EN673 routines will change them and for deflection recalculation everything needs to be
! called in same way except for changed gap widths
if (CalcDeflection.eq.DEFLECTION_CALC_TEMPERATURE) then
eskyTemp = esky
trminTemp = trmin
hinTemp = hin
houtTemp = hout
sconTemp = scon
thickTemp = thick
end if
if (GoAhead(nperr)) then
select case (standard)
case (ISO15099)
call Calc_ISO15099(nlayer,iwd,tout,tind,trmin,wso,wsi,dir,outir,isky,tsky,esky,fclr,VacuumPressure, &
VacuumMaxGapThickness, CurGap,thick,scon,tir,emis,totsol, &
tilt,asol,height,heightt,width,presure,iprop,frct,xgcon,xgvis,xgcp,xwght,gama,nmix, &
SupportPillar, PillarSpacing, PillarRadius, &
theta,q,qv,ufactor,sc,hflux,hcin,hcout,hrin,hrout,hin,hout,hcgas,hrgas,shgc,nperr,ErrorMessage, &
shgct,tamb,troom,ibc,Atop,Abot,Al,Ar,Ah, SlatThick, SlatWidth, SlatAngle, &
SlatCond, SlatSpacing, SlatCurve, vvent,tvent, LayerType, nslice, LaminateA, LaminateB, &
sumsol, Ra,Nu, ThermalMod, Debug_mode, &
ShadeEmisRatioOut, ShadeEmisRatioIn, ShadeHcRatioOut, ShadeHcRatioIn, &
HcUnshadedOut, HcUnshadedIn, Keff, ShadeGapKeffConv, SDScalar, SHGCCalc, NumOfIterations)
case (EN673, EN673Design)
call Calc_EN673(standard, nlayer, tout, tind, CurGap, thick, scon, emis, totsol, &
& tilt, dir, asol, presure, iprop, frct, nmix, xgcon, xgvis, xgcp, xwght, &
& theta, ufactor, hcin, hin, hout, shgc, nperr, ErrorMessage, ibc, hg, hr, hs, Ra,Nu)
case default
end select
end if
!Deflection calculations in case of temperature & pressure inputs
if (GoAhead(nperr)) then
if (.not.(GoAhead(nperr))) then
return
end if
if (CalcDeflection.eq.DEFLECTION_CALC_TEMPERATURE) then
converged = .false.
do while (.not.(converged))
call PanesDeflection(CalcDeflection, width, height, nlayer, Pa, Pini, Tini, thick, gap, &
GapDefMax, GapDefMean, theta, YoungsMod, PoissonsRat, LayerDef, nperr, ErrorMessage)
if (.not.(GoAhead(nperr))) then
return
end if
!store temperatures before new calculations are performed. This is necessary in order to determine
do i=1, 2*nlayer
told(i) = theta(i)
end do !do i=1, 2*nlayer
!before calling thermal calculations, return back old variables
esky = eskyTemp
trmin = trminTemp
hin = hinTemp
hout = houtTemp
scon = sconTemp
thick = thickTemp
!after performed deflection recalculate temperatures with new gap widths
select case (standard)
case (ISO15099)
call Calc_ISO15099(nlayer,iwd,tout,tind,trmin,wso,wsi,dir,outir,isky,tsky,esky,fclr,VacuumPressure, &
VacuumMaxGapThickness, GapDefMean,thick,scon,tir,emis,totsol, &
tilt,asol,height,heightt,width,presure,iprop,frct,xgcon,xgvis,xgcp,xwght,gama,nmix, &
SupportPillar, PillarSpacing, PillarRadius, &
theta,q,qv,ufactor,sc,hflux,hcin,hcout,hrin,hrout,hin,hout,hcgas,hrgas,shgc,nperr,ErrorMessage, &
shgct,tamb,troom,ibc,Atop,Abot,Al,Ar,Ah, SlatThick, SlatWidth, SlatAngle, &
SlatCond, SlatSpacing, SlatCurve, vvent,tvent, LayerType, nslice, LaminateA, LaminateB, &
sumsol, Ra,Nu, ThermalMod, Debug_mode, &
ShadeEmisRatioOut, ShadeEmisRatioIn, ShadeHcRatioOut, ShadeHcRatioIn, &
HcUnshadedOut, HcUnshadedIn, Keff, ShadeGapKeffConv, SDScalar, SHGCCalc, NumOfIterations)
case (EN673, EN673Design)
call Calc_EN673(standard, nlayer, tout, tind, GapDefMean, thick, scon, emis, totsol, &
& tilt, dir, asol, presure, iprop, frct, nmix, xgcon, xgvis, xgcp, xwght, &
& theta, ufactor, hcin, hin, hout, shgc, nperr, ErrorMessage, ibc, hg, hr, hs, Ra, Nu)
case default
end select !select case (standard)
if (.not.(GoAhead(nperr))) then
return
end if
!calc error
dtmax = 0.0d0
do i=1, 2*nlayer
dtmax = abs(told(i) - theta(i))
end do !do i=1, 2*nlayer
if (dtmax < DeflectionErrorMargin) then
converged = .true.
end if
counter = counter + 1
if (counter > DeflectionMaxIterations) then
converged = .true.
nperr = 41 ! Deflection calculations failed to converge
ErrorMessage = 'Deflection calculations failed to converge'
end if
end do !do while (.not.(converged))
end if ! if ((CalcDeflection.eq.DEFLECTION_CALC_TEMPERATURE).or.(CalcDeflection.eq.DEFLECTION_CALC_GAP_WIDTHS)) then
end if ! if (GoAhead(nperr)) then
call FinishDebugOutputFiles(nperr)
end subroutine TARCOG90