#
# CCL to calculate Mean Radiant Temperature and Resultant Temperature
# comfort factors.
#
# Author: Y Sinai
#         Updated 8 January 2008 (by N S Wilkes).
#
# Trad is the Mean Radiant Temperature (K).
# TresC is the Resultant Temperature (C).
# Tres assumes speed in m/s, temperature in C.
# TresK is the Resultant Temperature in K.
# Reference: CIBSE Guide A, CIBSE, UK, 1999.
#

PHYSICS CONTROL:
  Default Domain Generation = Off
END

LIBRARY:
  CEL:
    EXPRESSIONS:
#
# N.B. If P1 model is being used, then
#      Trad = (pi*meanint/stefan)^0.25
#      If Monte Carlo or DT is being used,
#      Trad = (0.25*meanint/stefan)^0.25
#
      Trad = (0.25*meanint/stefan)^0.25
      TresC = (Trad-Tzero+f1*(T-Tzero))/(1.0+f1)
      TresK = TresC + Tzero
      Tzero = 273.15 [K]
      f1 = sqrt(10.0[s m^-1]*speed)
      meanint = max(1.0e-10 [W m^-2], abs(radint))
      speed = Velocity
    END
    FUNCTION: pmvppd
      Argument Units = [m/s, m/s, m/s, K, W m^-2 sr^-1]
      Option = User Function
      Result Units = []
      User Routine Name = pmvppd
    END
  END
END

#
# CCL for use with user Fortran to calculate PMV & PPD.
# PMV: Predicted Mean Vote.
# PPD: Predicted Percentage of Dissatisfied.
# Reference: ISO 7730-1984(E).
#
# Authors: Y Sinai & C Staples, CFX, Harwell, UK, 2002.
#          Updated 8 January 2008 (by N S Wilkes).
#
# It is necessary to compile the associated Fortran code (usr_pmvppd.F)
# locally, and insert the appropriate library directory in the
# USER ROUTINE DEFINITIONS object below.
#
# Note:
#
# (1) PMV is clipped to lie between -3 and +3. PPD is thus in
#     the range 0% to +99.12%. This range is used because
#     ISO data reaches these levels.
# (2) However, ISO 7730 recommends a more limited range for use
#     of these indices (see variables defined in USER section
#     below):
#     -2 < PMV < 2
#     0% < PPD < 76.8%
#     46 < GM < 232 W/m^2
#     0 < GICL < 0.31 m^2C/W
#     10 < air temperature < 30 C
#     10 < mean radiant temperature < 40 C
#     0 < air speed < 1 m/s
#     0 < PH2O < 2700 Pa
#     Caution is advised beyond these ranges.
#

LIBRARY:
  ADDITIONAL VARIABLE: PMV
    Option = Definition
    Tensor Type = SCALAR
    Units = [ ]
    Variable Type = Unspecified
  END
  ADDITIONAL VARIABLE: PPD
    Option = Definition
    Tensor Type = SCALAR
    Units = [ ]
    Variable Type = Unspecified
  END
  USER ROUTINE DEFINITIONS:
    USER ROUTINE: pmvppd
      Calling Name = usr_pmvppd
      Library Name = pmvppd
      Library Path = .
      Option = User CEL Function
    END
  END
END

USER:
  GICL = 0.116   # Clothing thermal resistance (m^2K/W)
  GM = 81.0      # Metabolic rate (W/m^2)
  GTRAD = 293.15 # Mean radiant temperature (K)
  JGICL = 4      # Switch for GICL - see below.
  JGM = 2        # Switch for GM - see below.
  JGTRAD = 1     # Switch for GTRAD - see below.
  PH2O = 1000.0  # Water vapour partial pressure (Pa)
  WE = 0.0       # External work (W/m^2) (normally 0.0)
END

# JGM:
# 0  Given value will be used.
# 1  Reclining (46 W/m^2 = 0.8 met).
# 2  Seated, relaxed (58 W/m^2 = 1.0 met).
# 3  Standing, relaxed (70 W/m^2 = 1.2 met).
# 4  Sedentary activity (office, dwelling, school, laboratory, as in 3).# 5  Standing activity (shopping, laboratory, light industry, 93 W/m^2
#    = 1.6 met).
# 6  Standing activity (shop assistant, domestic work, machine work,
#    116 W/m^2 = 2.0 met).
# 7  Medium activity (heavy machine work, garage work, 165 W/m^2
#    = 2.8 met).
# JGICL:
# 0  Given value will be used.
# 1  Nude (0 m^2C/W = 0 clo).
# 2  Shorts (0.015 m^2C/W = 0.1 clo).
# 3  Typical tropical clothing ensemble (briefs, shorts,open-neck
#    short-sleeved shirt, light socks + sandals;
#    0.045 m^2C/W = 0.3 clo).
# 4  Light summer clothing (briefs, long light-weight trousers,
#    open-neck short-sleeved shirt, light socks + shoes;
#    0.08 m^2C/W = 0.5 clo).
# 5  Light working ensemble (light underwear, cotton work shirt
#    with long sleeves, work trousers, woollen socks + shoes;
#    0.11 m^2C/W = 0.7 clo).
# 6  Typical indoor winter clothing ensemble (underwear, shirt with
#    long sleeves, trousers, jacket or sweater with long sleeves,
#    heavy socks + shoes; 0.16 m^2C/W = 1.0 clo).
# 7  Heavy traditional European business suit (cotton underwear
#    with long legs and sleeves, shirt, suit including trousers,
#    jacket and waiscoat, woollen socks + heavy shoes; 0.23 m^2C/W
#    = 1.5 clo).
# JGTRAD:
# 0  Given value will be used.
# 1  Will be evaluated from the radiation intensity, assuming that
#    radiation is being solved for.
#

FLOW: Flow Analysis 1
  DOMAIN: Domain 1
    Coord Frame = Coord 0
    Domain Type = Fluid
    DOMAIN MODELS:
      BUOYANCY MODEL:
        Option = Non Buoyant
      END
      DOMAIN MOTION:
        Option = Stationary
      END
      MESH DEFORMATION:
        Option = None
      END
      REFERENCE PRESSURE:
        Reference Pressure = 1 [atm]
      END
    END
    FLUID DEFINITION: Air at 25 C
      Material = Air at 25 C
      Option = Material Library
      MORPHOLOGY:
        Option = Continuous Fluid
      END
    END
    FLUID MODELS:
      ADDITIONAL VARIABLE: PMV
        Additional Variable Value = pmvppd (u, v, w, T, radint)
        Option = Algebraic Equation
      END
      ADDITIONAL VARIABLE: PPD
        Additional Variable Value = 100-95*exp(-0.03353*PMV^4-0.2179*PMV^2)
        Option = Algebraic Equation
      END
      COMBUSTION MODEL:
        Option = None
      END
      HEAT TRANSFER MODEL:
        Option = Thermal Energy
      END
      THERMAL RADIATION MODEL:
        Number of Rays = 12
        Option = Discrete Transfer
        Radiation Transfer Mode = Participating Media
        SCATTERING MODEL:
          Option = None
        END
        SPECTRAL MODEL:
          Option = Gray
        END
      END
      TURBULENCE MODEL:
        Option = SST
      END
      TURBULENT WALL FUNCTIONS:
        Option = Automatic
      END
    END
  END
END
