---
url: /dyad/dev/stdlib/FluidComponents/components/Valves.ValveIncompressible.md
description: >-
  Dyad Valves.ValveIncompressible docs.  Valve for liquids and other fluids
  whose density changes little across the valve.
---

# `Valves.ValveIncompressible` {#Valves.ValveIncompressible}

Valve for liquids and other fluids whose density changes little across the valve.

The valve follows the IEC 534/ISA S.75 incompressible pressure-flow relation. It supports reversible flow, one-directional flow, and check-valve behavior.

This component extends from [`FluidComponents.Valves.BaseClasses.PartialValve`](../types/PartialValve.md)

## Usage {#Usage}

`FluidComponents.Valves.ValveIncompressible(showDesignFlowDirection=true, dp_start=dp_nominal, m_flow_start=m_flow_nominal, m_flow_small, Av=m_flow_nominal / FluidComponents.sqrt(rho_nominal * dp_nominal) * FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_nominal), Kv=0, Cv=0, dp_nominal, m_flow_nominal, rho_nominal=FluidComponents.MediaComponents.Interfaces.density_pTX(medium_data, FluidComponents.MediaComponents.Interfaces.medium_p_default(medium_data), FluidComponents.MediaComponents.Interfaces.medium_T_default(medium_data), FluidComponents.MediaComponents.Interfaces.medium_X_default(medium_data)), opening_nominal=1, riseTime=1, leakageOpening=1e-3, dp_small, Kv2Av=27.7e-6, Cv2Av=24.0e-6, effective_Av=__dyad_isa_variant(CvData, FluidComponents.Types.CvTypes.Av) ? Av : (__dyad_isa_variant(CvData, FluidComponents.Types.CvTypes.Kv) ? Kv * Kv2Av : (__dyad_isa_variant(CvData, FluidComponents.Types.CvTypes.Cv) ? Cv * Cv2Av : m_flow_nominal / (FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_nominal) * FluidComponents.sqrt(rho_nominal) * FluidComponents.regRoot(dp_nominal, dp_small)))), Re_turbulent=4000)`

## Parameters: {#Parameters:}

|                      Name | Description | Units |             Default value |
| -------------------------:| -----------:| -----:| -------------------------:|
|             `medium_data` |             |     – |                           |
|       `allowFlowReversal` |             |     – |                           |
|     `port_a_exposesState` |             |     – |                     false |
|     `port_b_exposesState` |             |     – |                     false |
|                      `nX` |             |     – | FluidCompon...edium_data) |
|                     `nXi` |             |     – | FluidCompon...edium_data) |
|                      `nC` |             |     – | FluidCompon...edium_data) |
|                `reducedX` |             |     – | FluidCompon...edium_data) |
|                  `fixedX` |             |     – | FluidCompon...edium_data) |
|                  `show_T` |             |     – |                      true |
|             `show_V_flow` |             |     – |                      true |
|                  `CvData` |             |     – | FluidCompon...s.OpPoint() |
|         `filteredOpening` |             |     – |                     false |
|              `checkValve` |             |     – |                     false |
|     `valveCharacteristic` |             |     – | FluidCompon...ic.linear() |
|                  `use_Re` |             |     – |                           |
| `showDesignFlowDirection` |             |     – |                      true |
|                `dp_start` |             |    Pa |                dp_nominal |
|            `m_flow_start` |             |  kg/s |            m_flow_nominal |
|            `m_flow_small` |             |  kg/s |                           |
|                      `Av` |             |    m2 | m_flow_nomi...ng_nominal) |
|                      `Kv` |             |     – |                         0 |
|                      `Cv` |             |     – |                         0 |
|              `dp_nominal` |             |    Pa |                           |
|          `m_flow_nominal` |             |  kg/s |                           |
|             `rho_nominal` |             | kg/m3 | FluidCompon...dium_data)) |
|         `opening_nominal` |             |     – |                         1 |
|                `riseTime` |             |     s |                         1 |
|          `leakageOpening` |             |     – |                      1e-3 |
|                `dp_small` |             |    Pa |                           |

## Connectors {#Connectors}

* `port_a` - Generic fluid connector at the design inlet. ([`FluidPort_a`](@ref))

* `port_b` - Generic fluid connector at the design outlet. ([`FluidPort_b`](@ref))

* `opening` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `opening_filtered` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Variables {#Variables}

|                      Name | Description | Units |
| -------------------------:| -----------:| -----:|
|                  `m_flow` |             |  kg/s |
|                      `dp` |             |    Pa |
|                  `V_flow` |             |  m3/s |
|                `port_a_T` |             |     K |
|                `port_b_T` |             |     K |
|        `port_a_outflow_X` |             | kg/kg |
|        `port_b_outflow_X` |             | kg/kg |
|         `opening_limited` |             |     – |
|          `opening_actual` |             |     – |
| `relativeFlowCoefficient` |             |     – |
|            `dp_turbulent` |             |    Pa |
|                    `mu_a` |             |  Pa.s |
|                    `mu_b` |             |  Pa.s |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Valve for liquids and other fluids whose density changes little across the
valve.

The valve follows the IEC 534/ISA S.75 incompressible pressure-flow relation.
It supports reversible flow, one-directional flow, and check-valve behavior.
"""
component ValveIncompressible
  extends FluidComponents.Valves.BaseClasses.PartialValve()
  # Reynolds number at the onset of turbulent valve flow [-]
  final parameter Re_turbulent::ReynoldsNumber = 4000
  # Whether the turbulent transition is determined from Reynolds number [-]
  structural parameter use_Re::Boolean
  # Relative valve-flow coefficient [-]
  variable relativeFlowCoefficient::Real
  # Pressure drop at the onset of turbulent valve flow [Pa]
  variable dp_turbulent::Pressure
  # Dynamic viscosity of fluid entering through port_a [Pa.s]
  variable mu_a::MediaComponents.Types.DynamicViscosity
  # Dynamic viscosity of fluid entering through port_b [Pa.s]
  variable mu_b::MediaComponents.Types.DynamicViscosity
relations
  mu_a = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, state_a.p, state_a.T, state_a.d, state_a.h, state_a.X)
  mu_b = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, state_b.p, state_b.T, state_b.d, state_b.h, state_b.X)
  relativeFlowCoefficient = FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_actual)
  if use_Re
    dp_turbulent = max(dp_small, (mu_a + mu_b) ^ 2 * pi / 8 * Re_turbulent ^ 2 / (max(relativeFlowCoefficient, 0.001) * effective_Av * (state_a.d + state_b.d)))
  else
    dp_turbulent = dp_small
  end
  if checkValve
    m_flow = relativeFlowCoefficient * effective_Av * sqrt(state_a.d) * FluidComponents.regRoot2(dp, dp_turbulent, 1, 0, true, 0)
  elseif !allowFlowReversal
    m_flow = relativeFlowCoefficient * effective_Av * sqrt(state_a.d) * FluidComponents.regRoot(dp, dp_turbulent)
  else
    m_flow = relativeFlowCoefficient * effective_Av * FluidComponents.regRoot2(dp, dp_turbulent, state_a.d, state_b.d, false, 1)
  end
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
    "icons": {"default": "dyad://FluidComponents/icons/ValveIncompressible.svg"}
  }
}
end
```

```dyad
"""
Valve for liquids and other fluids whose density changes little across the
valve.

The valve follows the IEC 534/ISA S.75 incompressible pressure-flow relation.
It supports reversible flow, one-directional flow, and check-valve behavior.
"""
component ValveIncompressible
  # Immutable medium definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractPartialMediumData
  # Whether flow may reverse from the positive design direction [-]
  structural parameter allowFlowReversal::Boolean
  # Fluid connector at the design inlet [-]
  port_a = FluidComponents.Interfaces.FluidPort_a(medium_data = medium_data) {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      }
    }
  }
  # Fluid connector at the design outlet [-]
  port_b = FluidComponents.Interfaces.FluidPort_b(medium_data = medium_data) {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      }
    }
  }
  # Whether port_a exposes the state of an internal fluid volume [-]
  structural parameter port_a_exposesState::Boolean = false
  # Whether port_b exposes the state of an internal fluid volume [-]
  structural parameter port_b_exposesState::Boolean = false
  # Whether to show the positive design-flow direction [-]
  parameter showDesignFlowDirection::Boolean = true
  # Number of mass fractions [-]
  final structural parameter nX::Integer = MediaComponents.Interfaces.medium_nX(medium_data)
  # Number of independent mass fractions [-]
  final structural parameter nXi::Integer = MediaComponents.Interfaces.medium_nXi(medium_data)
  # Number of extra transported properties [-]
  final structural parameter nC::Integer = MediaComponents.Interfaces.medium_nC(medium_data)
  # Whether the medium mass fractions sum to one [-]
  final structural parameter reducedX::Boolean = MediaComponents.Interfaces.medium_reducedX(medium_data)
  # Whether the medium composition is fixed [-]
  final structural parameter fixedX::Boolean = MediaComponents.Interfaces.medium_fixedX(medium_data)
  # Start value of the pressure difference [Pa]
  parameter dp_start::Pressure
  # Start value of the mass flow rate [kg/s]
  parameter m_flow_start::MediaComponents.Types.MassFlowRate
  # Small mass flow rate used to regularize flow-direction changes [kg/s]
  parameter m_flow_small::MediaComponents.Types.MassFlowRate
  # Whether port temperatures are computed for diagnostics [-]
  structural parameter show_T::Boolean = true
  # Whether volume flow rate is computed for diagnostics [-]
  structural parameter show_V_flow::Boolean = true
  "Thermodynamic state of fluid entering through port_a."
  state_a = MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data)
  "Thermodynamic state of fluid entering through port_b."
  state_b = MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data)
  # Mass flow rate in the design-flow direction [kg/s]
  variable m_flow::MediaComponents.Types.MassFlowRate(min = allowFlowReversal ? -Inf : 0)
  # Pressure difference between port_a and port_b [Pa]
  variable dp::Pressure
  # Volume flow rate at the inflowing port [m3/s]
  variable V_flow::VolumeFlowRate if show_V_flow
  # Temperature close to port_a [K]
  variable port_a_T::Temperature if show_T
  # Temperature close to port_b [K]
  variable port_b_T::Temperature if show_T
  # Outflow composition used by the port_a temperature diagnostic [kg/kg]
  variable port_a_outflow_X::MediaComponents.Types.MassFraction[nX] if show_T
  # Outflow composition used by the port_b temperature diagnostic [kg/kg]
  variable port_b_outflow_X::MediaComponents.Types.MassFraction[nX] if show_T
  # Selection of the valve flow-coefficient representation [-]
  structural parameter CvData::FluidComponents.Types.CvTypes = FluidComponents.Types.CvTypes.OpPoint()
  # Metric flow coefficient [m2]
  parameter Av::Area = m_flow_nominal / sqrt(rho_nominal * dp_nominal) * FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_nominal)
  # Metric Kv flow coefficient [m3/h]
  parameter Kv::Real = 0
  # US Cv flow coefficient [USG/min]
  parameter Cv::Real = 0
  # Nominal pressure drop [Pa]
  parameter dp_nominal::Pressure
  # Nominal mass flow rate [kg/s]
  parameter m_flow_nominal::MediaComponents.Types.MassFlowRate
  # Nominal inlet density [kg/m3]
  parameter rho_nominal::MediaComponents.Types.Density = MediaComponents.Interfaces.density_pTX(medium_data, MediaComponents.Interfaces.medium_p_default(medium_data), MediaComponents.Interfaces.medium_T_default(medium_data), MediaComponents.Interfaces.medium_X_default(medium_data))
  # Nominal valve opening [-]
  parameter opening_nominal::Real(min = 0, max = 1) = 1
  # Whether the opening command is filtered [-]
  structural parameter filteredOpening::Boolean = false
  # Time for a filtered opening step to reach 99.6 percent [s]
  parameter riseTime::Time = 1
  # Minimum opening supplied to the actuator filter [-]
  parameter leakageOpening::Real(min = 0, max = 1) = 1e-3
  # Whether reverse flow is stopped [-]
  structural parameter checkValve::Boolean = false
  # Inherent valve-flow characteristic [-]
  structural parameter valveCharacteristic::FluidComponents.Valves.BaseClasses.ValveCharacteristic = FluidComponents.Valves.BaseClasses.ValveCharacteristic.linear()
  # Pressure-drop regularization scale [Pa]
  parameter dp_small::Pressure
  # Conversion factor from Kv to Av [m2]
  final parameter Kv2Av::Area = 27.7e-6
  # Conversion factor from Cv to Av [m2]
  final parameter Cv2Av::Area = 24.0e-6
  # Effective metric flow coefficient [m2]
  final parameter effective_Av::Area = case(CvData, FluidComponents.Types.CvTypes.Av) ? Av : (case(CvData, FluidComponents.Types.CvTypes.Kv) ? Kv * Kv2Av : (case(CvData, FluidComponents.Types.CvTypes.Cv) ? Cv * Cv2Av : m_flow_nominal / (FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_nominal) * sqrt(rho_nominal) * FluidComponents.regRoot(dp_nominal, dp_small))))
  "Commanded valve opening in the range zero to one."
  opening = RealInput(min = 0, max = 1) {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 90}
      }
    }
  }
  "Filtered valve opening."
  opening_filtered = RealOutput(min = 0, max = 1) if filteredOpening {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 750, "y1": 150, "x2": 850, "y2": 250, "rot": 0}
      }
    }
  }
  "Critically damped second-order valve actuator."
  opening_filter = BlockComponents.Continuous.SecondOrder(k = 1, w = 5 / riseTime, d = 1) if filteredOpening
  # Valve opening after leakage limiting [-]
  variable opening_limited::Real if filteredOpening
  # Valve opening used by the flow characteristic [-]
  variable opening_actual::Real
  # Reynolds number at the onset of turbulent valve flow [-]
  final parameter Re_turbulent::ReynoldsNumber = 4000
  # Whether the turbulent transition is determined from Reynolds number [-]
  structural parameter use_Re::Boolean
  # Relative valve-flow coefficient [-]
  variable relativeFlowCoefficient::Real
  # Pressure drop at the onset of turbulent valve flow [Pa]
  variable dp_turbulent::Pressure
  # Dynamic viscosity of fluid entering through port_a [Pa.s]
  variable mu_a::MediaComponents.Types.DynamicViscosity
  # Dynamic viscosity of fluid entering through port_b [Pa.s]
  variable mu_b::MediaComponents.Types.DynamicViscosity
relations
  guess m_flow = m_flow_start
  guess dp = dp_start
  state_a.p = port_a.p
  state_a.h = instream(port_a.h_outflow)
  state_b.p = port_b.p
  state_b.h = instream(port_b.h_outflow)
  if fixedX
    state_a.X = MediaComponents.Interfaces.medium_reference_X(medium_data)
    state_b.X = MediaComponents.Interfaces.medium_reference_X(medium_data)
  elseif reducedX
    if nXi > 0
      for j in 1:nXi
        state_a.X[j] = instream(port_a.Xi_outflow[j])
        state_b.X[j] = instream(port_b.Xi_outflow[j])
      end
      state_a.X[nX] = 1 - sum(instream(port_a.Xi_outflow))
      state_b.X[nX] = 1 - sum(instream(port_b.Xi_outflow))
    else
      state_a.X[nX] = 1
      state_b.X[nX] = 1
    end
  else
    for j in 1:nX
      state_a.X[j] = instream(port_a.Xi_outflow[j])
      state_b.X[j] = instream(port_b.Xi_outflow[j])
    end
  end
  state_a.T = MediaComponents.Interfaces.temperature_phX(medium_data, state_a.p, state_a.h, state_a.X)
  state_a.d = MediaComponents.Interfaces.density_phX(medium_data, state_a.p, state_a.h, state_a.X)
  state_b.T = MediaComponents.Interfaces.temperature_phX(medium_data, state_b.p, state_b.h, state_b.X)
  state_b.d = MediaComponents.Interfaces.density_phX(medium_data, state_b.p, state_b.h, state_b.X)
  dp = port_a.p - port_b.p
  m_flow = port_a.m_flow
  port_a.m_flow + port_b.m_flow = 0
  if nXi > 0
    for j in 1:nXi
      port_a.Xi_outflow[j] = instream(port_b.Xi_outflow[j])
      port_b.Xi_outflow[j] = instream(port_a.Xi_outflow[j])
    end
  else
    port_a.Xi_outflow[1] = 0
    port_b.Xi_outflow[1] = 0
  end
  if nC > 0
    for j in 1:nC
      port_a.C_outflow[j] = instream(port_b.C_outflow[j])
      port_b.C_outflow[j] = instream(port_a.C_outflow[j])
    end
  else
    port_a.C_outflow[1] = 0
    port_b.C_outflow[1] = 0
  end
  if show_V_flow
    V_flow = m_flow / FluidComponents.regStep(m_flow, state_a.d, state_b.d, m_flow_small)
  end
  if show_T
    if fixedX
      port_a_outflow_X = MediaComponents.Interfaces.medium_reference_X(medium_data)
      port_b_outflow_X = MediaComponents.Interfaces.medium_reference_X(medium_data)
    elseif reducedX
      if nXi > 0
        for j in 1:nXi
          port_a_outflow_X[j] = port_a.Xi_outflow[j]
          port_b_outflow_X[j] = port_b.Xi_outflow[j]
        end
        port_a_outflow_X[nX] = 1 - sum(port_a.Xi_outflow)
        port_b_outflow_X[nX] = 1 - sum(port_b.Xi_outflow)
      else
        port_a_outflow_X[nX] = 1
        port_b_outflow_X[nX] = 1
      end
    else
      for j in 1:nX
        port_a_outflow_X[j] = port_a.Xi_outflow[j]
        port_b_outflow_X[j] = port_b.Xi_outflow[j]
      end
    end
    port_a_T = FluidComponents.regStep(port_a.m_flow, state_a.T, MediaComponents.Interfaces.temperature_phX(medium_data, port_a.p, port_a.h_outflow, port_a_outflow_X), m_flow_small)
    port_b_T = FluidComponents.regStep(port_b.m_flow, state_b.T, MediaComponents.Interfaces.temperature_phX(medium_data, port_b.p, port_b.h_outflow, port_b_outflow_X), m_flow_small)
  end
  port_a.h_outflow = instream(port_b.h_outflow)
  port_b.h_outflow = instream(port_a.h_outflow)
  if filteredOpening
    opening_limited = max(leakageOpening, opening)
    opening_filter.u = opening_limited
    opening_filtered = opening_filter.y
    opening_actual = opening_filter.y
    initial der(opening_filter.x) = 0
    initial der(opening_filter.xd) = 0
  else
    opening_actual = opening
  end
  mu_a = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, state_a.p, state_a.T, state_a.d, state_a.h, state_a.X)
  mu_b = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, state_b.p, state_b.T, state_b.d, state_b.h, state_b.X)
  relativeFlowCoefficient = FluidComponents.Valves.BaseClasses.valveCharacteristic(valveCharacteristic, opening_actual)
  if use_Re
    dp_turbulent = max(dp_small, (mu_a + mu_b) ^ 2 * pi / 8 * Re_turbulent ^ 2 / (max(relativeFlowCoefficient, 0.001) * effective_Av * (state_a.d + state_b.d)))
  else
    dp_turbulent = dp_small
  end
  if checkValve
    m_flow = relativeFlowCoefficient * effective_Av * sqrt(state_a.d) * FluidComponents.regRoot2(dp, dp_turbulent, 1, 0, true, 0)
  elseif !allowFlowReversal
    m_flow = relativeFlowCoefficient * effective_Av * sqrt(state_a.d) * FluidComponents.regRoot(dp, dp_turbulent)
  else
    m_flow = relativeFlowCoefficient * effective_Av * FluidComponents.regRoot2(dp, dp_turbulent, state_a.d, state_b.d, false, 1)
  end
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 950, "rot": 0, "layer": "icon"}],
    "icons": {"default": "dyad://FluidComponents/icons/ValveIncompressible.svg"}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
