FluidSystemTest
IconFluidSystemTest
Models a test fluid system where a step-defined pressure source drives flow through a pipe into a fixed volume.
This FluidSystemTest
component models the dynamic behavior of a fluid flowing from a pressure source through a pipe into a fixed volume. The pressure at the source is defined by a step input signal signal.y
. The fluid is characterized by the medium
properties, which are isothermal and compressible. The tube
component accounts for frictional losses and optionally fluid inertia, with its geometry defined by tube_area
and length
. The vol
component represents a terminal volume where fluid accumulates or is discharged.
Usage
FluidSystemTest(tube_area=0.01, add_inertia=true, tube_perimeter=2 * sqrt(tube_area * pi))
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
tube_area | Cross-sectional area of the tube. | m2 | 0.01 |
add_inertia | Boolean flag to include fluid inertia in the tube model. | – | true |
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathtt{signal.y}\left( t \right) = \mathtt{src.p}\left( t \right) \\ \mathrm{connect}\left( src_{+}port, tube_{+}port_{a} \right) \\ \mathrm{connect}\left( tube_{+}port_{b}, vol_{+}port \right) \\ \mathtt{signal.y}\left( t \right) = ifelse\left( t \geq \mathtt{signal.start\_time}, \mathtt{signal.height} + \mathtt{signal.offset}, \mathtt{signal.offset} \right) \\ \mathtt{src.port.p}\left( t \right) = \mathtt{src.p}\left( t \right) \\ \mathtt{vol.rho}\left( t \right) = density\left( \mathtt{vol.port\_\_medium}, \mathtt{vol.p}\left( t \right) \right) \\ \mathtt{vol.m}\left( t \right) = \mathtt{vol.vol} \mathtt{vol.rho}\left( t \right) \\ \mathtt{vol.port.m\_flow}\left( t \right) = \frac{\mathrm{d} \mathtt{vol.m}\left( t \right)}{\mathrm{d}t} \\ \mathtt{vol.port.p}\left( t \right) = \mathtt{vol.p}\left( t \right) \\ \mathtt{tube.port\_a.m\_flow}\left( t \right) + \mathtt{tube.port\_b.m\_flow}\left( t \right) = 0 \\ \mathtt{tube.{\Delta}p}\left( t \right) = \mathtt{tube.port\_a.p}\left( t \right) - \mathtt{tube.port\_b.p}\left( t \right) \\ \mathtt{tube.rho}\left( t \right) = density\left( \mathtt{tube.port\_a\_\_medium}, \mathtt{tube.port\_a.p}\left( t \right) \right) \\ \mathtt{tube.mu}\left( t \right) = viscosity\left( \mathtt{tube.port\_a\_\_medium} \right) \\ \mathtt{tube.velocity}\left( t \right) = \frac{\mathtt{tube.m\_flow}\left( t \right)}{\mathtt{tube.area} \mathtt{tube.rho}\left( t \right)} \\ \mathtt{tube.ff}\left( t \right) = friction\_factor\left( \mathtt{tube.m\_flow}\left( t \right), \mathtt{tube.area}, \mathtt{tube.d\_h}, \mathtt{tube.mu}\left( t \right), \mathtt{tube.shape\_factor} \right) \\ \mathtt{tube.sheer}\left( t \right) = \frac{0.5 \mathtt{tube.head\_factor} \mathtt{tube.length} reg\_pow\left( \mathtt{tube.velocity}\left( t \right), 2 \right) \mathtt{tube.ff}\left( t \right) \mathtt{tube.rho}\left( t \right)}{\mathtt{tube.d\_h}} \\ \mathtt{tube.{\Delta}p}\left( t \right) = ifelse\left( \mathtt{tube.add\_inertia}, \frac{\mathtt{tube.length} \frac{\mathrm{d} \mathtt{tube.m\_flow}\left( t \right)}{\mathrm{d}t}}{\mathtt{tube.area}} + \mathtt{tube.sheer}\left( t \right), \mathtt{tube.sheer}\left( t \right) \right) \\ \mathtt{tube.m\_flow}\left( t \right) = \mathtt{tube.port\_a.m\_flow}\left( t \right) \\ \end{array} \right] \end{equation} \]
Source
# Models a test fluid system where a step-defined pressure source drives flow through a pipe into a fixed volume.
#
# This `FluidSystemTest` component models the dynamic behavior of a fluid flowing from a pressure source
# through a pipe into a fixed volume. The pressure at the source is defined by a step input signal `signal.y`.
# The fluid is characterized by the `medium` properties, which are isothermal and compressible.
# The `tube` component accounts for frictional losses and optionally fluid inertia, with its geometry
# defined by `tube_area` and `length`. The `vol` component represents a terminal volume where fluid
# accumulates or is discharged.
test component FluidSystemTest
# Step input signal dictating the boundary pressure.
signal = BlockComponents.Step(height = 1e6, start_time = 0.5)
# Boundary pressure source.
src = BoundaryPressure()
# Fixed volume reservoir.
vol = FixedVolume(vol = 10.0, p0 = 0.0)
# Fluid conduit (pipe) with friction and optional inertia.
tube = TubeBase(area = tube_area, head_factor = 1, length = 50, shape_factor = 64, add_inertia = add_inertia, perimeter = 2 * sqrt(tube_area * pi), m_flow0 = 0)
# Cross-sectional area of the tube.
parameter tube_area::Area = 0.01
# Boolean flag to include fluid inertia in the tube model.
parameter add_inertia::Boolean = true
# Wetted perimeter of the tube, calculated from tube_area assuming a circular cross-section.
final parameter tube_perimeter::Length = 2 * sqrt(tube_area * pi)
# Path defining the properties of the working fluid (isothermal, compressible).
path medium::AbstractMedium = IsothermalCompressible(bulk_modulus = 1e9, let_gas = false)
relations
connect(signal.y, src.p)
connect(src.port, tube.port_a)
connect(tube.port_b, vol.port)
continuity(medium, vol.port.medium)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 2,
"atol": {"vol.rho": 0.001, "vol.port.p": 1, "tube.m_flow": 0.001},
"expect": {"signals": ["vol.rho", "vol.port.p", "tube.m_flow"]}
}
}
}
}
end
Flattened Source
# Models a test fluid system where a step-defined pressure source drives flow through a pipe into a fixed volume.
#
# This `FluidSystemTest` component models the dynamic behavior of a fluid flowing from a pressure source
# through a pipe into a fixed volume. The pressure at the source is defined by a step input signal `signal.y`.
# The fluid is characterized by the `medium` properties, which are isothermal and compressible.
# The `tube` component accounts for frictional losses and optionally fluid inertia, with its geometry
# defined by `tube_area` and `length`. The `vol` component represents a terminal volume where fluid
# accumulates or is discharged.
test component FluidSystemTest
# Step input signal dictating the boundary pressure.
signal = BlockComponents.Step(height = 1e6, start_time = 0.5)
# Boundary pressure source.
src = BoundaryPressure()
# Fixed volume reservoir.
vol = FixedVolume(vol = 10.0, p0 = 0.0)
# Fluid conduit (pipe) with friction and optional inertia.
tube = TubeBase(area = tube_area, head_factor = 1, length = 50, shape_factor = 64, add_inertia = add_inertia, perimeter = 2 * sqrt(tube_area * pi), m_flow0 = 0)
# Cross-sectional area of the tube.
parameter tube_area::Area = 0.01
# Boolean flag to include fluid inertia in the tube model.
parameter add_inertia::Boolean = true
# Wetted perimeter of the tube, calculated from tube_area assuming a circular cross-section.
final parameter tube_perimeter::Length = 2 * sqrt(tube_area * pi)
# Path defining the properties of the working fluid (isothermal, compressible).
path medium::AbstractMedium = IsothermalCompressible(bulk_modulus = 1e9, let_gas = false)
relations
connect(signal.y, src.p)
connect(src.port, tube.port_a)
connect(tube.port_b, vol.port)
continuity(medium, vol.port.medium)
metadata {
"Dyad": {
"tests": {
"case1": {
"stop": 2,
"atol": {"vol.rho": 0.001, "vol.port.p": 1, "tube.m_flow": 0.001},
"expect": {"signals": ["vol.rho", "vol.port.p", "tube.m_flow"]}
}
}
}
}
end
Test Cases
Test Case case1
plt
plt
plt
Related
- Examples
- Experiments
- Analyses
- Tests