  #
  # THERMAL.
  #
  - &physicsThermal
    key: &physicsKey physicsThermal
    name: &physicsName Thermal Analysis
    description: Solves heat transfer equation. Both steady and transient solvers available.
    arguments: &argThermal [*propTemperature]

    physicalProperties:
      - &velocityX
        key: Velocity_x
        name: Velocity X component
        symbol: "U_X"
        units: "\\frac{m}{s}"
        baseUnit: siVelocity
        default: 0
        valueTypes: [scalar, table]
        arguments: [*propTime]

      - &velocityY
        key: Velocity_y
        name: Velocity Y component
        symbol: "U_Y"
        units: "\\frac{m}{s}"
        baseUnit: siVelocity
        default: 0
        valueTypes: [scalar, table]
        arguments: [*propTime]

      - &velocityZ
        key: Velocity_z
        name: Velocity Z component
        symbol: "U_Z"
        units: "\\frac{m}{s}"
        baseUnit: siVelocity
        default: 0
        valueTypes: [scalar, table]
        arguments: [*propTime]

      - &angularVelocityZ
        key: Omega_Z
        name: Angular velocity around Z axis
        symbol: "\\Omega_Z"
        units: "\\frac{rad}{s}"
        baseUnit: siAngularVelocity
        default: 0

      - &propQVol
        key: qVol
        name: Volume heat source
        symbol: F
        units: "\\frac{W}{m^3}"
        baseUnit: siHeatSource
        default: 0
        valueTypes: [scalar, table]
        arguments: [*propTemperature, *propTime]

      - &propHeatFlux
        key: heatflux
        name: Heat Flux
        symbol: q
        units: "\\frac{W}{m^2}"
        baseUnit: siHeatFlux

      - &propHeatFlow
        key: heatflow
        name: Integral Heat Flow
        symbol: Q
        hidden: true
        units: "W"
        baseUnit: siHeatFlow

      - &propLambda
        key: lambda
        name: Thermal conductivity
        symbol: "\\lambda"
        units: "\\frac{W}{m K}"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        valueTypes: [scalar, table, expression]
        arguments: [*propTemperature]

      - &propCp
        key: cp
        name: Heat capacity
        symbol: c_p
        units: "\\frac{J}{kg K}"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        valueTypes: [scalar, table]
        arguments: [*propTemperature]

      - &propRho
        key: rho
        name: Density
        symbol: "\\rho"
        units: "\\frac{kg}{m^3}"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        valueTypes: [scalar, table]
        arguments: [*propTemperature]

      - &propHeatTransfer
        key: h
        name: Heat Transfer Coefficient
        symbol: h
        units: "\\frac{W}{m^2 K}"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: false
        valueTypes: [scalar, table, expression]
        arguments: [*propTemperature, *propTime]

      - &propEmissivity
        key: hr
        name: Emissivity
        symbol: "\\epsilon"
        units: "-"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: false
        valueTypes: [scalar, table, expression]
        arguments: [*propTemperature]

      - &propResistance
        key: resistance_thermal
        name: Thermal Contact Resistance
        symbol: R
        units: "\\frac{m^2 K}{W}"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true

    MaxTemperatureCalculation:
      - &propMaxTemp_useModel
        key: _maxTempCalculation
        name: Max Temperature calculation
        default: true
        style: checkbox
        hidden: true

    PhaseModelProperties:
      - &propPhaseChange_useModel
        key: _phaseCalculation
        name: Phase calculation
        default: false
        style: checkbox
        #relevance:
         # - key: physicsThermal
         #   value: true

      - &propPhaseChange_AustenizationTemp1
        #<<: *propAustenizationTemp1
        key: ATemp1
        name: Austenization start temp.
        symbol: "T_{Ac_1}"
        units: "\\degree C"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        description: "Temperature at which austenite begins to form. If unknown - use Ac1 = Ac3"
        relevance:
          - key: _phaseCalculation
            value: true

      - &propPhaseChange_AustenizationTemp3
        #<<: *propAustenizationTemp3
        key: ATemp3
        name: Fully austenized temp.
        symbol: "T_{Ac_3}"
        units: "\\degree C"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        description: "Austenization temperature; the temperature at which structure is fully austenite"
        relevance:
          - key: _phaseCalculation
            value: true

      - &propPhaseChange_MartensiteStartTemp
        #<<: *propMartensiteStartTemp
        key: MartStart
        name: Martensite start temp.
        symbol: "T_{Ms}"
        units: "\\degree C"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        description: "Martensite formation start temperature; belove this temperature martensite phase occur"
        relevance:
          - key: _phaseCalculation
            value: true

      - &propPhaseChange_StartTime
        #<<: *propStartTime
        key: StartTime
        name: Phase change start time
        symbol: "t_s"
        units: "s"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        valueTypes: [table]
        arguments: [*propTemperature]
        description: "Time data for the C-curve which reprezents the begining of phase change (usually when 1% transformation has happened)"
        relevance:
          - key: _phaseCalculation
            value: true

      - &propPhaseChange_EndTime
        #<<: *propEndTime
        key: EndTime
        name: Phase change end time
        symbol: "t_e"
        units: "s"
        baseUnit: siNone #Fixme
        min: 0
        minExclude: true
        valueTypes: [table]
        arguments: [*propTemperature]
        description: "Time data for the C-curve which reprezents the end of phase change (usually when 99% change has happened)"
        relevance:
          - key: _phaseCalculation
            value: true

    boundaryTypes:
      - &bcFixed
        id: 1
        key: fixed
        name: Fixed temperature
        description: Fixed temperature at the surface
        properties:
          - *propTemperature

      - &bcFlux
        id: 2
        key: flux
        name: Heat flux
        description: Define heat flux density at the surface
        properties:
          -
            <<: *propHeatFlux
            key: qSurf
            valueTypes: [scalar, table, expression]
            arguments: [*propTemperature, *propTime]

      - &bcConvection
        id: 3
        key: convection
        name: Convection
        description: |-
            Convective heat transfer
            \( q = h (T-T_{amb}) \)
            Read article 'Heat Exchange' in Cenos Documentation for more information
        properties:
          -
            <<: *propTemperature
            key: tref
            name: Ambient temperature
            symbol: T_{amb}
            default: 22
          -
            <<: *propHeatTransfer
            key: h

      - &bcRadiation
        id: 4
        key: radiation
        name: Radiation
        description: |-
            Thermal radiation to ambient temperature:
            heat flux \( q = \sigma_{SB} \epsilon (T^4 - T_{amb}^4) \)
        properties:
          -
            <<: *propTemperature
            key: tref
            name: Ambient temperature
            symbol: T_{amb}
            default: 22
          - *propEmissivity
          -
            key: _radiation
            name: Radiation
            default: true
            style: checkbox
            sendAlways: true
            hidden: true

      - &bcCombined
        id: 5
        key: combined
        name: Combined
        description: |-
            Allows defining multiple conditions at the surface
        properties:
          - key: _blocker_if_no_checkbox_selected
            hidden: true
            default: false
            sendAlways: true
            relevance:
              - key: _convection
                value: false
              - key: _radiation
                value: false
              - key: _flux
                value: false
              - key: _flow
                value: false
          -
            <<: *propTemperature
            key: tref
            name: Ambient temperature
            symbol: T_{amb}
            sendAlways: true
            default: 22
            relevance:
              - key: _convection
                value: true
              - key: _radiation
                value: false
          -
            <<: *propTemperature
            key: tref
            name: Ambient temperature
            symbol: T_{amb}
            sendAlways: true
            default: 22
            relevance:
              - key: _convection
                value: false
              - key: _radiation
                value: true
          -
            <<: *propTemperature
            key: tref
            name: Ambient temperature
            symbol: T_{amb}
            sendAlways: true
            default: 22
            relevance:
              - key: _convection
                value: true
              - key: _radiation
                value: true
          -
            key: _convection
            name: Convection
            default: false
            style: checkbox
          -
            <<: *propHeatTransfer
            key: h
            sendAlways: false
            # default: 0
            relevance:
              - key: _convection
                value: true
          -
            <<: *propHeatTransfer
            key: h_
            hidden: true
            sendAlways: false
            default: 0
            relevance:
              - key: _convection
                value: false
          -
            key: _radiation
            name: Radiation
            default: false
            style: checkbox

         # -
         #   <<: *propTemperature
         #   key: tref
         #   name: Ambient temperature
         #   symbol: T_{amb}
         #   sendAlways: true
         #   default: 22
         #   relevance:
         #     - key: _radiation
         #       value: true
          -
            <<: *propEmissivity
            key: hr
            sendAlways: false
            # default: 0
            relevance:
              - key: _radiation
                value: true
          -
            <<: *propEmissivity
            key: hr_
            hidden: true
            sendAlways: false
            default: 0
            relevance:
              - key: _radiation
                value: false
          -
            key: _flux
            name: Heat Flux
            default: false
            style: checkbox
            incompatibleWith:
              - _flow
          -
            <<: *propHeatFlux
            key: qSurf
            valueTypes: [scalar, table, expression]
            arguments: [*propTemperature, *propTime]
            sendAlways: false
            # default: 0
            relevance:
              - key: _flux
                value: true
          -
            <<: *propHeatFlux
            key: qSurf_
            sendAlways: false
            hidden: true
            default: 0
            relevance:
              - key: _flux
                value: false
          -
            key: _flow
            name: Heat Flow
            default: false
            hidden: true
            style: checkbox
            incompatibleWith:
              - _flux
          -
            <<: *propHeatFlow
            key: qSurfInt
            sendAlways: false
            # default: 0
            relevance:
              - key: _flow
                value: true
          -
            <<: *propHeatFlow
            key: qSurfInt_
            sendAlways: false
            hidden: true
            default: 0
            relevance:
              - key: _flow
                value: false

      - &bcFlow
        id: 6
        key: flow
        name: Heat flow
        description: Define heat flow (in watts) at the surface
        properties:
          -
            <<: *propHeatFlow
            key: qSurfInt

      - &bcAdiabatic
        id: 7
        key: adiabatic
        name: Adiabatic
        description: |-
            Zero incoming and outgoing heat flux condition at the surface
        properties:
          -
            <<: *propHeatFlux
            key: qSurf
            valueTypes: [scalar, table, expression]
            arguments: [*propTemperature, *propTime]
            default: 0
            sendAlways: true
            hidden: true

      - &bcInterface
        id: 8
        key: interface
        name: Interface
        description: Interface
        isInterfaceType: true
        isOuterType: false

      - &bcResistanceThermal
        id: 9
        key: resistance_thermal
        name: Thermal Contact Resistance
        description: |-
          Define contact resistance as thin layer at interface.
          IMPORTANT: The same condition has to be set on both sides.
          Resistance can be calculated as \( d / \lambda \)
          (\( d \) - thickness, \( \lambda \) - conductivity).
        isInterfaceType: true
        isOuterType: false
        properties:
          -
            <<: *propResistance

    domainTypes:
      - &domainThermal
        id: 1
        key: thermal
        name: Thermal
        properties:
          -
            <<: *propQVol
            hidden: true

          -
            key: _velocityEffects
            name: Motion
            default: false
            style: checkbox
            hidden: true
          -
            <<: *velocityX
            sendAlways: true
            relevance:
              - key: _velocityEffects
                value: true
            hidden: true
          -
            <<: *velocityY
            sendAlways: true
            relevance:
              - key: _velocityEffects
                value: true
            hidden: true
          -
            <<: *velocityZ
            sendAlways: true
            relevance:
              - key: _velocityEffects
                value: true
            hidden: true
          -
            <<: *angularVelocityZ
            sendAlways: true
            relevance:
              - key: _velocityEffects
                value: true
              - key: dimensions
                value: 3
            hidden: true

        boundaryTypes:
          - *bcFixed
          - *bcFlux
         # - *bcFlow
          - *bcConvection
          - *bcRadiation
          - *bcCombined
          - *bcAdiabatic
          - *bcInterface
          - *bcResistanceThermal

        initialConditions:
          properties:
            -
              <<: *propTemperature
              default: 22

        material:
          properties:
            - *propLambda
            - *propCp
            - *propRho
            - *propMaxTemp_useModel
            - *propPhaseChange_useModel
            - *propPhaseChange_AustenizationTemp1
            - *propPhaseChange_AustenizationTemp3
            - *propPhaseChange_MartensiteStartTemp
            - *propPhaseChange_StartTime
            - *propPhaseChange_EndTime

    subPhysicsParts:
      - &subPhysicsThermalGeneral
        key: subPhysicsThermalGeneral
        name: Thermal General Physics
        physicsKey: *physicsKey
        physicsName: *physicsName
        arguments: *argThermal

        resultValues:
          - *propTemperature
          - *propHeatFlux

        timeTypes:
          - *timeTransient
          - *timeSteady

        domainTypes:
          - *domainThermal

    subPhysics:
      - key: subPhysicsThermal
        name: Thermal
        description: Solves heat transfer equation. Both steady and transient solvers available.

        basisList:
          -
            key: subPhysicsThermalGeneral2D
            basis: *mesh2D
            physicsList:
              - *subPhysicsThermalGeneral
          -
            key: subPhysicsThermalGeneral3D
            basis: *mesh3D
            physicsList:
              - *subPhysicsThermalGeneral
