  #
  # ELECTROMAGNETICS.
  #
  - &physicsMicrowaves
    key: &physicsKey physicsMicrowaves
    name: &physicsName Antenna Design
    description: Electromagnetics for Antenna Design
    arguments: &argMicrowaves [*propMagFlux]

    physicalProperties:

      - &propVoltage
        key: volt
        name: Voltage
        symbol: U
        units: V
        default: 1
        baseUnits: siVolt
        relevance:
          - key: autoFeedParams
            value: false

      - &propGap
        key: gap
        name: Gap
        symbol: \delta
        units: m
        min: 0
        minExclude: true
        baseUnits: siLenght
        relevance:
          - key: autoFeedParams
            value: false

      - &propRadius
        key: radius
        name: Radius
        symbol: r
        units: m
        min: 0
        minExclude: true
        baseUnits: siLenght
        relevance:
          - key: autoFeedParams
            value: false

      - &propEfield
        key: Efield
        name: Electric field
        symbol: E
        units: V/m
        default: 0
        baseUnits: siVoltOnMeter

      - &propImpedance
        key: impedance
        name: Impedance
        symbol: Z
        units: Ohm
        default: 50
        baseUnits: siImpedance

      - &propMagneticPermeability
        key: mu
        name: Magnetic permeability
        symbol: "\\mu_r"
        units: "-"
        baseUnits: siNone
        min: 0
        minExclude: true

      - &propDielectricConstant
        key: epsilon
        name: Dielectric constant
        symbol: "\\epsilon_r"
        units: "-"
        baseUnits: siNone
        min: 0
        minExclude: true

      - &propElectricConductivity
        key: sigma
        name: Electric Conductivity
        symbol: "\\sigma"
        units: "\\frac{S}{m}"
        baseUnits: siSimensOnMeter
        min: 0
        minExclude: false

      - &propLossTangent
        key: tan_delta
        name: Dielectric loss tangent
        symbol: "tan(\\delta)"
        units: "-"
        baseUnits: siNone
        min: 0
        minExclude: false

      - &propEx
        key: eDirX
        name: Feed vector X
        symbol: E_x
        units: "-"
        default: 0
        min: -1
        max: 1
        baseUnits: siNone
        valueTypes: [scalar, expression]
        relevance:
          - key: autoFeedParams
            value: false

      - &propEy
        key: eDirY
        name: Feed vector Y
        symbol: E_y
        units: "-"
        default: 0
        min: -1
        max: 1
        baseUnits: siNone
        valueTypes: [scalar, expression]
        relevance:
          - key: autoFeedParams
            value: false

      - &propEz
        key: eDirZ
        name: Feed vector Z
        symbol: E_z
        units: "-"
        default: 1
        min: -1
        max: 1
        baseUnits: siNone
        valueTypes: [scalar, expression]
        relevance:
          - key: autoFeedParams
            value: false

      - &automaticFeedFlag
        key: autoFeedParams
        name: Automatic Feed Parameters
        default: true
        style: checkbox

      - &phaseFlag
        key: hasPhaseShift
        name: Phase shift
        default: false
        style: checkbox

      - &roughnessFlag
        key: roughFlag
        name: Rough conductor
        default: false
        style: checkbox

      - &propPhase
        key: phase
        name: Phase shift angle
        symbol: \theta
        units: deg
        default: 0
        baseUnits: siAngle
        relevance:
          - key: hasPhaseShift
            value: true

      - &propPortNumber
        key: numberPort
        name: Port Number
        symbol: N
        valueKind: integer
        min: 1
        default: 1



    boundaryTypes:
      - &uniformPort
        id: 1
        key: uniformPort
        name: Uniform port 
        description: Port for planar feed
        isInterfaceType: true
        isOuterType: true
        properties:
          -
            <<: *propPortNumber
          -
            <<: *propImpedance
          -
            <<: *automaticFeedFlag
          -
            <<: *propVoltage
          -
            <<: *propGap
          -
            <<: *propEx
          -
            <<: *propEy
          -
            <<: *propEz
          -
            <<: *propEfield
            key: Efield_port
            hidden: true
            default: 0
          -
            <<: *propPhase
          -
            <<: *phaseFlag


      - &coaxialPort
        id: 2
        key: coaxialPort
        name: Coaxial Port
        description: Port for coaxial feed
        isInterfaceType: true
        isOuterType: true
        properties:
          -
            <<: *propImpedance
          -
            <<: *automaticFeedFlag
          -
            <<: *propVoltage
          -
            <<: *propRadius
            key: radius_in
            name: "Inner radius"
            symbol: r_{in}
          -
            <<: *propRadius
            key: radius_out
            name: "Outer radius"
            symbol: r_{out}
          -
            <<: *propEfield
            key: Efield_port
            hidden: true
            default: 0
          -
            <<: *propPhase
          -
            <<: *phaseFlag

      - &perfectConductor
        id: 3
        key: perfectConductor
        name: Perfect Electric Conductor
        description: Electric field is perpendicular to this boundary
        isInterfaceType: true
        isOuterType: true
        properties:
          -
            <<: *propEfield
            hidden: true
            default: 0

      - &radiationBoundary
        id: 4
        key: radiationBoundary
        name: Radiation Boundary
        description: Silver-Muller absorbing condition, prevents reflection
        properties:

      - &interface
        id: 5
        key: interface
        name: Interface
        isInterfaceType: true
        isOuterType: false

      - &groundPEC
        id: 6
        key: groundPEC
        name: Ground
        description: Ground as perfect electric conductor
        properties:
          -
            <<: *propEfield
            hidden: true
            default: 0

      - &conductingBoundary
        id: 7
        key: conductingBoundary
        name: Conductor
        description: Conducting boundary
        isInterfaceType: true
        isOuterType: true
        properties:
          -
            <<: *roughnessFlag
          -
             key: height
             name: Height
             symbol: h
             units: m
             hidden: false
             default: 0
             relevance:
                - key: roughFlag
                  value: true
        material:
          properties:
            - *propMagneticPermeability
            - *propDielectricConstant
            - *propLossTangent
            - *propElectricConductivity

    domainTypes:
      # Non-conductive domain
      - &domainEMNonConductive
        id: 1
        key: em_nc
        name: Non-conductive
        material:
          properties:
            - *propMagneticPermeability
            - *propDielectricConstant
            - *propLossTangent
        boundaryTypes:
          
          - *uniformPort
          - *coaxialPort
          - *perfectConductor
          - *interface
          - *conductingBoundary

      # Perfectly conductive domain
      - &domainEMPerfectlyConductive
        id: 2
        key: em_pec
        name: Perfect conductor
        material:
          properties: []
            # - *propMagneticPermeability
            # - *propDielectricConstant
            # - *propElectricConductivity
        boundaryTypes:
          
          - *uniformPort
          - *coaxialPort
          - *perfectConductor
          - *interface
          - *conductingBoundary

      # Conductive domain
      - &domainEMConductive
        id: 3
        key: em_cc
        name: Conductive
        material:
          properties:
            - *propMagneticPermeability
            - *propDielectricConstant
            - *propElectricConductivity
        boundaryTypes:
          
          - *uniformPort
          - *coaxialPort
          - *perfectConductor
          - *interface
          - *conductingBoundary

      # Open air domain
      - &domainEMOpenAir
        id: 4
        key: em_open
        name: Open-Air
        material:
          properties:
            - *propMagneticPermeability
            - *propDielectricConstant
            - *propLossTangent
        boundaryTypes:
          - *uniformPort
          - *coaxialPort
          - *perfectConductor
          - *radiationBoundary
          - *interface
          - *conductingBoundary

    subPhysicsParts:
      #
      #Microwaves General.
      #
      - &subPhysicsMicrowavesGeneral
        key: subPhysicsMicrowavesGeneral
        name: Electromagnetics
        description: "Solver of Electromagnetics for Antenna Design"
        physicsKey: *physicsKey
        physicsName: *physicsName
        arguments: *argElectromagnetics

        resultValues:

        timeTypes:
          -
            <<: *timeHarmonicWithoutTime
            name: Single Frequency
          -
            <<: *timeMultipleFrequency


        domainTypes:
          - *domainEMNonConductive
          - *domainEMPerfectlyConductive
          - *domainEMConductive
          - *domainEMOpenAir

    subPhysics:
      - key: subPhysicsMicrowavesGeneral
        name: Antenna Design
        description: "Solver for microwaves computation in frequency domain"

        basisList:
          -
            key: subPhysicsMicrowavesGeneral2D
            basis: *mesh2D
            physicsList:
              - *subPhysicsMicrowavesGeneral
          -
            key: subPhysicsMicrowavesGeneral3D
            basis:
              <<: *mesh3D
              symmetryTypes: # Keep Full 3D only.
                - key: full
                  name: Full 3D model

            physicsList:
              - *subPhysicsMicrowavesGeneral

