LIBRARY
Tests.TestWideThermodynamicState ​
Checks wide thermodynamic-state arrays and field-based property calls.
Usage ​
MediaComponents.Tests.TestWideThermodynamicState()
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
medium_data | – | MediaCompon...WaterData() | |
n | – | 2 |
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 ​
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
}
}
}
}
}
}
endFlattened 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
}
}
}
}
}
}
endTest Cases ​
Test Case water ​
Related ​
Examples
Experiments
Analyses
Tests