---
url: /dyad/dev/stdlib/MediaComponents/tests/Tests.TestWideThermodynamicState.md
description: >-
  Dyad Tests.TestWideThermodynamicState docs.  Checks wide thermodynamic-state
  arrays and field-based property calls.
---

# `Tests.TestWideThermodynamicState` {#Tests.TestWideThermodynamicState}

Checks wide thermodynamic-state arrays and field-based property calls.

## Usage {#Usage}

`MediaComponents.Tests.TestWideThermodynamicState()`

## Parameters: {#Parameters:}

|          Name | Description | Units |             Default value |
| -------------:| -----------:| -----:| -------------------------:|
| `medium_data` |             |     – | MediaCompon...WaterData() |
|           `n` |             |     – |                         2 |

## Variables {#Variables}

|                            Name | Description |   Units |
| -------------------------------:| -----------:| -------:|
|              `observed_density` |             |   kg/m3 |
|             `observed_pressure` |             |      Pa |
|          `observed_temperature` |             |       K |
|             `observed_enthalpy` |             |    J/kg |
|    `observed_dynamic_viscosity` |             |    Pa.s |
| `observed_thermal_conductivity` |             | W/(m.K) |
|       `observed_prandtl_number` |             |       1 |

## Behavior {#Behavior}

$$ \begin{align}
\frac{\mathrm{d}\mathtt{observed_density}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_pressure}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_temperature}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_enthalpy}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_dynamic_viscosity}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_thermal_conductivity}\left( t \right)}{\mathrm{d}t} &= 0 \\
\frac{\mathrm{d}\mathtt{observed_prandtl_number}\left( t \right)}{\mathrm{d}t} &= 0 \\
\mathtt{states⸺1.p}\left( t \right) &= 100000 \\
\mathtt{states⸺1.T}\left( t \right) &= 300 \\
\mathtt{states⸺1.d}\left( t \right) &= 995.59 \\
\mathtt{states⸺1.h}\left( t \right) &= 4184 ~ \left( -273.15 + \mathtt{states⸺1.T}\left( t \right) \right) \\
\mathtt{states⸺1.X}\_{1}\left( t \right) &= 1 \\
\mathtt{states⸺2.p}\left( t \right) &= 110000 \\
\mathtt{states⸺2.T}\left( t \right) &= 310 \\
\mathtt{states⸺2.d}\left( t \right) &= 995.59 \\
\mathtt{states⸺2.h}\left( t \right) &= 4184 ~ \left( -273.15 + \mathtt{states⸺2.T}\left( t \right) \right) \\
\mathtt{states⸺2.X}\_{1}\left( t \right) &= 1
\end{align}
$$

## Source {#Source}

```dyad
"Checks wide thermodynamic-state arrays and field-based property calls."
test component TestWideThermodynamicState
  # Immutable water definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractMediumData = MediaComponents.Water.ConstantPropertyLiquidWaterData()
  # Number of thermodynamic states [-]
  structural parameter n::Integer(min = 1) = 2
  "Wide thermodynamic states used by the property calls."
  states = [MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data) for i in 1:n]
  # Observed state density [kg/m3]
  variable observed_density::MediaComponents.Types.Density
  # Observed state pressure [Pa]
  variable observed_pressure::MediaComponents.Types.AbsolutePressure
  # Observed state temperature [K]
  variable observed_temperature::MediaComponents.Types.Temperature
  # Observed state specific enthalpy [J/kg]
  variable observed_enthalpy::MediaComponents.Types.SpecificEnthalpy
  # Observed state dynamic viscosity [Pa.s]
  variable observed_dynamic_viscosity::MediaComponents.Types.DynamicViscosity
  # Observed state thermal conductivity [W/(m.K)]
  variable observed_thermal_conductivity::MediaComponents.Types.ThermalConductivity
  # Observed state Prandtl number [-]
  variable observed_prandtl_number::MediaComponents.Types.PrandtlNumber
relations
  for i in 1:n
    states[i].p = 100000 + 10000 * (i - 1)
    states[i].T = 290 + 10 * i
    states[i].d = 995.586
    states[i].h = 4184 * (states[i].T - 273.15)
    states[i].X = [1]
  end
  initial observed_density = MediaComponents.Interfaces.density_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_density) = 0
  initial observed_pressure = MediaComponents.Interfaces.pressure_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_pressure) = 0
  initial observed_temperature = MediaComponents.Interfaces.temperature_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_temperature) = 0
  initial observed_enthalpy = MediaComponents.Interfaces.specificEnthalpy_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_enthalpy) = 0
  initial observed_dynamic_viscosity = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_dynamic_viscosity) = 0
  initial observed_thermal_conductivity = MediaComponents.Interfaces.thermalConductivity_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_thermal_conductivity) = 0
  initial observed_prandtl_number = MediaComponents.Interfaces.prandtlNumber_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_prandtl_number) = 0
metadata {
  "Dyad": {
    "tests": {
      "water": {
        "stop": 1,
        "expect": {
          "initial": {
            "observed_density": 995.586,
            "observed_pressure": 100000,
            "observed_temperature": 300,
            "observed_enthalpy": 112340.4,
            "observed_dynamic_viscosity": 0.001,
            "observed_thermal_conductivity": 0.598,
            "observed_prandtl_number": 6.996655518394649
          },
          "final": {
            "observed_density": 995.586,
            "observed_pressure": 100000,
            "observed_temperature": 300,
            "observed_enthalpy": 112340.4,
            "observed_dynamic_viscosity": 0.001,
            "observed_thermal_conductivity": 0.598,
            "observed_prandtl_number": 6.996655518394649
          }
        }
      }
    }
  }
}
end
```

```dyad
"Checks wide thermodynamic-state arrays and field-based property calls."
test component TestWideThermodynamicState
  # Immutable water definition selected at model construction [-]
  structural parameter medium_data::MediaComponents.Interfaces.AbstractMediumData = MediaComponents.Water.ConstantPropertyLiquidWaterData()
  # Number of thermodynamic states [-]
  structural parameter n::Integer(min = 1) = 2
  "Wide thermodynamic states used by the property calls."
  states = [MediaComponents.Interfaces.ThermodynamicState(medium_data = medium_data) for i in 1:n]
  # Observed state density [kg/m3]
  variable observed_density::MediaComponents.Types.Density
  # Observed state pressure [Pa]
  variable observed_pressure::MediaComponents.Types.AbsolutePressure
  # Observed state temperature [K]
  variable observed_temperature::MediaComponents.Types.Temperature
  # Observed state specific enthalpy [J/kg]
  variable observed_enthalpy::MediaComponents.Types.SpecificEnthalpy
  # Observed state dynamic viscosity [Pa.s]
  variable observed_dynamic_viscosity::MediaComponents.Types.DynamicViscosity
  # Observed state thermal conductivity [W/(m.K)]
  variable observed_thermal_conductivity::MediaComponents.Types.ThermalConductivity
  # Observed state Prandtl number [-]
  variable observed_prandtl_number::MediaComponents.Types.PrandtlNumber
relations
  for i in 1:n
    states[i].p = 100000 + 10000 * (i - 1)
    states[i].T = 290 + 10 * i
    states[i].d = 995.586
    states[i].h = 4184 * (states[i].T - 273.15)
    states[i].X = [1]
  end
  initial observed_density = MediaComponents.Interfaces.density_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_density) = 0
  initial observed_pressure = MediaComponents.Interfaces.pressure_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_pressure) = 0
  initial observed_temperature = MediaComponents.Interfaces.temperature_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_temperature) = 0
  initial observed_enthalpy = MediaComponents.Interfaces.specificEnthalpy_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_enthalpy) = 0
  initial observed_dynamic_viscosity = MediaComponents.Interfaces.dynamicViscosity_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_dynamic_viscosity) = 0
  initial observed_thermal_conductivity = MediaComponents.Interfaces.thermalConductivity_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_thermal_conductivity) = 0
  initial observed_prandtl_number = MediaComponents.Interfaces.prandtlNumber_state(medium_data, states[1].p, states[1].T, states[1].d, states[1].h, states[1].X)
  der(observed_prandtl_number) = 0
metadata {
  "Dyad": {
    "tests": {
      "water": {
        "stop": 1,
        "expect": {
          "initial": {
            "observed_density": 995.586,
            "observed_pressure": 100000,
            "observed_temperature": 300,
            "observed_enthalpy": 112340.4,
            "observed_dynamic_viscosity": 0.001,
            "observed_thermal_conductivity": 0.598,
            "observed_prandtl_number": 6.996655518394649
          },
          "final": {
            "observed_density": 995.586,
            "observed_pressure": 100000,
            "observed_temperature": 300,
            "observed_enthalpy": 112340.4,
            "observed_dynamic_viscosity": 0.001,
            "observed_thermal_conductivity": 0.598,
            "observed_prandtl_number": 6.996655518394649
          }
        }
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `water` {#Test-Case-water}

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`ThermodynamicState`](Tests.TestWideThermodynamicState.md)
