You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/Hydraulic/IsothermalCompressible/components.jl
+7-25
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,16 @@
1
1
2
2
"""
3
-
Cap(; p_int, name)
3
+
Cap(; name)
4
4
5
5
Caps a hydraulic port to prevent mass flow in or out.
6
6
7
-
# Parameters:
8
-
- `p_int`: [Pa] initial pressure (set by `p_int` argument)
9
-
10
7
# Connectors:
11
8
- `port`: hydraulic port
12
9
"""
13
10
@mtkmodel Cap begin
14
-
15
11
@variablesbegin
16
12
p(t), [guess =0]
17
-
end
13
+
end
18
14
19
15
@componentsbegin
20
16
port =HydraulicPort()
@@ -24,22 +20,17 @@ Caps a hydraulic port to prevent mass flow in or out.
24
20
port.p ~ p
25
21
port.dm ~0
26
22
end
27
-
28
23
end
29
24
30
25
"""
31
-
Open(; p_int, name)
26
+
Open(; name)
32
27
33
-
Provides an "open" boundary condition for a hydraulic port such that mass flow `dm` is non-zero. This is opposite from an un-connected hydraulic port or the `Cap` boundary component which sets the mass flow `dm` to zero.
34
-
35
-
# Parameters:
36
-
- `p_int`: [Pa] initial pressure (set by `p_int` argument)
28
+
Provides an "open" boundary condition for a hydraulic port such that mass flow `dm` is non-zero. This is opposite from an un-connected hydraulic port or the `Cap` boundary component which sets the mass flow `dm` to zero.
37
29
38
30
# Connectors:
39
31
- `port`: hydraulic port
40
32
"""
41
33
@mtkmodel Open begin
42
-
43
34
@variablesbegin
44
35
p(t), [guess =0]
45
36
dm(t), [guess =0]
@@ -53,7 +44,6 @@ Provides an "open" boundary condition for a hydraulic port such that mass flow `
53
44
port.p ~ p
54
45
port.dm ~ dm
55
46
end
56
-
57
47
end
58
48
59
49
"""
@@ -230,12 +220,11 @@ end
230
220
@deprecate Pipe Tube
231
221
232
222
"""
233
-
FlowDivider(;p_int, n, name)
223
+
FlowDivider(; n, name)
234
224
235
225
Reduces the flow from `port_a` to `port_b` by `n`. Useful for modeling parallel tubes efficiently by placing a `FlowDivider` on each end of a tube.
236
226
237
227
# Parameters:
238
-
- `p_int`: [Pa] initial pressure
239
228
- `n`: divide flow from `port_a` to `port_b` by `n`
240
229
241
230
# Connectors:
@@ -268,7 +257,6 @@ Reduces the flow from `port_a` to `port_b` by `n`. Useful for modeling parallel
268
257
open.dm ~ dm_a - dm_b # extra flow dumps into an open port
269
258
# port_b.dm ~ dm_b # divided flow goes to port_b
270
259
end
271
-
272
260
end
273
261
274
262
@componentfunctionValveBase(
@@ -362,7 +350,6 @@ Valve with `area` input and discharge coefficient `Cd` defined by https://en.wik
362
350
end
363
351
364
352
@mtkmodel VolumeBase begin
365
-
366
353
@structural_parametersbegin
367
354
Χ1 =1
368
355
Χ2 =1
@@ -392,7 +379,6 @@ end
392
379
rho ~full_density(port, port.p)
393
380
port.dm ~ drho * vol * Χ1 + rho * area * dx * Χ2
394
381
end
395
-
396
382
end
397
383
398
384
"""
@@ -407,7 +393,6 @@ Fixed fluid volume.
407
393
- `port`: hydraulic port
408
394
"""
409
395
@mtkmodel FixedVolume begin
410
-
411
396
@parametersbegin
412
397
vol
413
398
end
@@ -426,7 +411,6 @@ Fixed fluid volume.
426
411
rho ~full_density(port, port.p)
427
412
port.dm ~ drho * vol
428
413
end
429
-
430
414
end
431
415
432
416
"""
@@ -468,7 +452,6 @@ dm ────► │ │ area
468
452
See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
469
453
"""
470
454
@mtkmodel Volume begin
471
-
472
455
@structural_parametersbegin
473
456
direction =1
474
457
end
@@ -512,7 +495,6 @@ See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
Fluid parameter setter for isothermal compressible fluid domain. Defaults given for water at 20°C and 0Pa gage (1atm absolute) reference pressure. Density is modeled using the Tait equation of state. For pressures below the reference pressure, density is linearly interpolated to the gas state (when `let_gas` is set to 1), this helps prevent pressures from going below the reference pressure.
37
+
Fluid parameter setter for isothermal compressible fluid domain. Defaults given for water at 20°C and 0Pa gage (1atm absolute) reference pressure. Density is modeled using the Tait equation of state. For pressures below the reference pressure, density is linearly interpolated to the gas state (when `let_gas` is set to 1), this helps prevent pressures from going below the reference pressure.
42
38
43
39
# Parameters:
44
40
45
41
- `ρ`: [kg/m^3] fluid density at 0Pa reference gage pressure (set by `density` argument)
46
42
- `Β`: [Pa] fluid bulk modulus describing the compressibility (set by `bulk_modulus` argument)
47
43
- `μ`: [Pa*s] or [kg/m-s] fluid dynamic viscosity (set by `viscosity` argument)
48
44
- `n`: density exponent
49
-
- `let_gas`: set to 1 to allow fluid to transition from liquid to gas (for density calculation only)
45
+
- `let_gas`: set to 1 to allow fluid to transition from liquid to gas (for density calculation only)
50
46
- `ρ_gas`: [kg/m^3] density of fluid in gas state at reference gage pressure `p_gas` (set by `gas_density` argument)
51
47
- `p_gas`: [Pa] reference pressure (set by `gas_pressure` argument)
Calculates the friction factor ``f`` for fully developed flow in a tube such that ``Δp = f \\cdot \\rho \\frac{u^2}{2} \\frac{l}{d_h}`` where
79
+
Calculates the friction factor ``f`` for fully developed flow in a tube such that ``Δp = f \\cdot \\rho \\frac{u^2}{2} \\frac{l}{d_h}`` where
84
80
85
81
- ``Δp``: [Pa] is the pressure difference over the tube length ``l``
86
82
- ``\\rho``: [kg/m^3] is the average fluid density
87
83
- ``u``: [m/s] is the average fluid velocity
88
-
- ``l``: [m] is the tube length
84
+
- ``l``: [m] is the tube length
89
85
90
86
The friction factor is calculated for laminar and turbulent flow with a transition region between Reynolds number 2000 to 3000. Turbulent flow equation is for smooth tubes, valid for the Reynolds number range up to 5e6.
0 commit comments