Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 266 additions & 7 deletions docs/src/equation_sets.md

Large diffs are not rendered by default.

80 changes: 78 additions & 2 deletions docs/src/plume.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,47 @@ the initial concentration is calculated from the mass flowrate and volumetric fl

Suppose we wish to model the dispersion of gaseous propane using the same scenario, `scn`, worked out above.

```jldoctest gaussplume; output = true, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"
```jldoctest gaussplume; output = false, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"
j = plume(scn, SimpleJet())

# output

Plume model - subtype simple_jet:
k2: 6.0
k3: 5.0
angle: -0.0 rad
Substance: propane
MW: 0.044096 kg/mol
P_v: GasDispersion.Antoine{Float64}(9.773719865868816, 2257.9247634130143, 0.0) Pa
ρ_g: 1.864931992847327 kg/m^3
ρ_l: 526.13 kg/m^3
T_ref: 288.15 K
P_ref: 101325.0 Pa
k: 1.142
T_b: 231.02 K
Δh_v: 425740 J/kg
Cp_g: 1678 J/kg/K
Cp_l: 2520 J/kg/K
HorizontalJet release:
ṁ: 0.08991798763471508 kg/s
Δt: Inf s
d: 0.01 m
u: 208.10961399327573 m/s
h: 3.5 m
P: 288765.2212333958 Pa
T: 278.3846872082166 K
f_l: 0.0
SimpleAtmosphere atmosphere:
P: 101325.0 Pa
T: 298.15 K
u: 1.5 m/s
h: 10.0 m
rh: 0.0 %
stability: ClassF()

```

```jldoctest gaussplume; output = true, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"
j(100,0,2)

# output
Expand Down Expand Up @@ -394,9 +433,46 @@ SimpleAtmosphere atmosphere:

Generating a solution using the Britter-McQuaid model is quite simple

```jldoctest burro; output = true, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"
```jldoctest burro; output = false, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"
bm = plume(scn, BritterMcQuaidPlume())

# output

Plume model - subtype brittermcquaid:
Substance: LNG
MW: 0.01604 kg/mol
P_v: GasDispersion.Antoine{Float64}(8.814018574933064, 983.6444729625298, 0.0) Pa
ρ_g: 1.76 kg/m^3
ρ_l: 425.6 kg/m^3
T_ref: 111.14999999999998 K
P_ref: 101325.0 Pa
k: 1.4
T_b: 111.6 K
Δh_v: 509880.0 J/kg
Cp_g: 2240.0 J/kg/K
Cp_l: 3349.0 J/kg/K
HorizontalJet release:
ṁ: 97.888 kg/s
Δt: 174.0 s
d: 1.0 m
u: 70.81526849717933 m/s
h: 0.0 m
P: 101325.0 Pa
T: 111.14999999999998 K
f_l: 0.0
SimpleAtmosphere atmosphere:
P: 101325.0 Pa
T: 298.0 K
u: 10.9 m/s
h: 10.0 m
rh: 0.0 %
stability: ClassF()


```

```jldoctest burro; output = true, filter = r"(\d*)\.(\d{4})\d+" => s"\1.\2***"

bm(367,0,0)

# output
Expand Down
72 changes: 68 additions & 4 deletions docs/src/puff.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,43 @@ g = puff(scn, GaussianPuff())

# output

GasDispersion.GaussianPuffSolution{Float64, BasicEquationSet{DefaultWind, CCPSPuffσx, CCPSPuffσy, CCPSPuffσz}}(Scenario{Substance{String, Float64, GasDispersion.Antoine{Float64}, Float64, Float64, Int64, Int64, Int64}, HorizontalJet{Float64}, SimpleAtmosphere{Float64, ClassF}}(Substance{String, Float64, GasDispersion.Antoine{Float64}, Float64, Float64, Int64, Int64, Int64}("propane", 0.044096, GasDispersion.Antoine{Float64}(9.773719865868816, 2257.9247634130143, 0.0), 1.864931992847327, 526.13, 288.15, 101325.0, 1.142, 231.02, 425740, 1678, 2520), HorizontalJet{Float64}(0.08991798763471508, 10.0, 0.01, 208.10961399327573, 3.5, 288765.2212333958, 278.3846872082166, 0.0), SimpleAtmosphere{Float64, ClassF}(101325.0, 298.15, 1.5, 10.0, 0.0, ClassF())), :gaussian, 0.8991798763471508, 1.8023818673116125, 3.5, 1.150112899011524, BasicEquationSet{DefaultWind, CCPSPuffσx, CCPSPuffσy, CCPSPuffσz}(DefaultWind(), CCPSPuffσx(), CCPSPuffσy(), CCPSPuffσz()))
Gaussian Puff model - subtype gaussian:
total mass: 0.8991798763471508 kg
release windspeed: 1.150112899011524 m/s
release height: 3.5 m
Basic Equation Set:
wind equation: DefaultWind()
σx equation: CCPSPuffσx()
σy equation: CCPSPuffσy()
σz equation: CCPSPuffσz()
Substance: propane
MW: 0.044096 kg/mol
P_v: GasDispersion.Antoine{Float64}(9.773719865868816, 2257.9247634130143, 0.0) Pa
ρ_g: 1.864931992847327 kg/m^3
ρ_l: 526.13 kg/m^3
T_ref: 288.15 K
P_ref: 101325.0 Pa
k: 1.142
T_b: 231.02 K
Δh_v: 425740 J/kg
Cp_g: 1678 J/kg/K
Cp_l: 2520 J/kg/K
HorizontalJet release:
ṁ: 0.08991798763471508 kg/s
Δt: 10.0 s
d: 0.01 m
u: 208.10961399327573 m/s
h: 3.5 m
P: 288765.2212333958 Pa
T: 278.3846872082166 K
f_l: 0.0
SimpleAtmosphere atmosphere:
P: 101325.0 Pa
T: 298.15 K
u: 1.5 m/s
h: 10.0 m
rh: 0.0 %
stability: ClassF()

```

Expand Down Expand Up @@ -273,7 +309,35 @@ ig = puff(scn, IntPuff(); n=100)

# output

GasDispersion.IntPuffSolution{Float64, Int64, BasicEquationSet{DefaultWind, CCPSPuffσx, CCPSPuffσy, CCPSPuffσz}}(Scenario{Substance{String, Float64, GasDispersion.Antoine{Float64}, Float64, Float64, Int64, Int64, Int64}, HorizontalJet{Float64}, SimpleAtmosphere{Float64, ClassF}}(Substance{String, Float64, GasDispersion.Antoine{Float64}, Float64, Float64, Int64, Int64, Int64}("propane", 0.044096, GasDispersion.Antoine{Float64}(9.773719865868816, 2257.9247634130143, 0.0), 1.864931992847327, 526.13, 288.15, 101325.0, 1.142, 231.02, 425740, 1678, 2520), HorizontalJet{Float64}(0.08991798763471508, 10.0, 0.01, 208.10961399327573, 3.5, 288765.2212333958, 278.3846872082166, 0.0), SimpleAtmosphere{Float64, ClassF}(101325.0, 298.15, 1.5, 10.0, 0.0, ClassF())), :intpuff, 0.08991798763471508, 1.8023818673116125, 10.0, 3.5, 1.150112899011524, 100, BasicEquationSet{DefaultWind, CCPSPuffσx, CCPSPuffσy, CCPSPuffσz}(DefaultWind(), CCPSPuffσx(), CCPSPuffσy(), CCPSPuffσz()))
Puff model - subtype intpuff:
Substance: propane
MW: 0.044096 kg/mol
P_v: GasDispersion.Antoine{Float64}(9.773719865868816, 2257.9247634130143, 0.0) Pa
ρ_g: 1.864931992847327 kg/m^3
ρ_l: 526.13 kg/m^3
T_ref: 288.15 K
P_ref: 101325.0 Pa
k: 1.142
T_b: 231.02 K
Δh_v: 425740 J/kg
Cp_g: 1678 J/kg/K
Cp_l: 2520 J/kg/K
HorizontalJet release:
ṁ: 0.08991798763471508 kg/s
Δt: 10.0 s
d: 0.01 m
u: 208.10961399327573 m/s
h: 3.5 m
P: 288765.2212333958 Pa
T: 278.3846872082166 K
f_l: 0.0
SimpleAtmosphere atmosphere:
P: 101325.0 Pa
T: 298.15 K
u: 1.5 m/s
h: 10.0 m
rh: 0.0 %
stability: ClassF()
```

At the same point as above the concentration has dropped
Expand All @@ -287,7 +351,7 @@ ig(100,0,2,86)
```

```@setup propaneleak
ig = puff(scn, IntPuff; n=100)
ig = puff(scn, IntPuff(); n=100)
```

```@example propaneleak
Expand All @@ -299,7 +363,7 @@ plot(ig, 86; xlims=(90,110), ylims=(-10,10), aspect_ratio=:equal)
For short duration releases the model approximates the integral when $n \to \infty$ this is the default behaviour or when `n=Inf`

```@example propaneleak
ig_inf = puff(scn, IntPuff)
ig_inf = puff(scn, IntPuff())

plot(ig_inf, 86; xlims=(90,110), ylims=(-10,10), aspect_ratio=:equal)
```
Expand Down
24 changes: 23 additions & 1 deletion src/base/base_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,29 @@ struct BasicEquationSet{WIND,SIGMAX,SIGMAY,SIGMAZ} <: EquationSet
sigmaz::SIGMAZ
end

function Base.show(io::IO, mime::MIME"text/plain", eqs::BasicEquationSet)
print(io, "Basic Equation Set:\n")
print(io, " wind equation: $(eqs.wind)\n")
print(io, " σx equation: $(eqs.sigmax)\n")
print(io, " σy equation: $(eqs.sigmay)\n")
print(io, " σz equation: $(eqs.sigmaz)\n")
end

_wind_equation(eqs::BasicEquationSet) = eqs.wind
_sigma_x(eqs::BasicEquationSet) = eqs.sigmax
_sigma_y(eqs::BasicEquationSet) = eqs.sigmay
_sigma_z(eqs::BasicEquationSet) = eqs.sigmaz
_sigma_z(eqs::BasicEquationSet) = eqs.sigmaz


# Plume and Puff utils
function Base.show(io::IO, mime::MIME"text/plain", p::Plume)
p_type = string(p.model)
print(io, "Plume model - subtype $p_type:\n")
show(io,mime,p.scenario)
end

function Base.show(io::IO, mime::MIME"text/plain", p::Puff)
p_type = string(p.model)
print(io, "Puff model - subtype $p_type:\n")
show(io,mime,p.scenario)
end
11 changes: 11 additions & 0 deletions src/models/gaussian_plume.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ struct GaussianPlumeSolution{F<:Number,C<:GaussianCrossTerm,V<:GaussianVerticalT
end
GaussianPlumeSolution(s,m,Q,c,ρ,u,h_eff,cross,vert,pr,es,dom) = GaussianPlumeSolution(s,m,promote(Q,c,ρ,u,h_eff)...,cross,vert,pr,es,dom)

function Base.show(io::IO, mime::MIME"text/plain", p::GaussianPlumeSolution)
p_type = string(p.model)
print(io, "Gaussian Plume model - subtype $p_type:\n")
print(io, " mass rate: $(p.rate) kg/s\n")
print(io, " windspeed: $(p.windspeed) m/s\n")
print(io, " effective stack height: $(p.effective_stack_height) m\n")
print(io, " plume rise model: $(p.plumerise)\n")
show(io,mime,p.equationset)
show(io,mime,p.scenario)
end

struct SimpleCrossTerm <: GaussianCrossTerm end
cross_term(y, σy, ::SimpleCrossTerm) = exp(-0.5*(y/σy)^2)/(√(2π)*σy)

Expand Down
10 changes: 10 additions & 0 deletions src/models/gaussian_puff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ struct GaussianPuffSolution{F<:Number,E<:EquationSet} <: Puff
end
GaussianPuffSolution(s,m,q,ρ,h,u,es) = GaussianPuffSolution(s,m,promote(q,ρ,h,u)...,es)

function Base.show(io::IO, mime::MIME"text/plain", p::GaussianPuffSolution)
p_type = string(p.model)
print(io, "Gaussian Puff model - subtype $p_type:\n")
print(io, " total mass: $(p.mass) kg\n")
print(io, " release windspeed: $(p.windspeed) m/s\n")
print(io, " release height: $(p.height) m\n")
show(io,mime,p.equationset)
show(io,mime,p.scenario)
end

# for reverse compatibility
function puff(s::Scenario, ::Type{<:GaussianPuff}, eqs=DefaultPuffSet; kwargs...)
@warn "puff(scenario, GaussianPuff, eqs) is deprecated, use puff(scenario, GaussianPuff(), eqs) instead."
Expand Down
9 changes: 9 additions & 0 deletions src/models/simple_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ struct SimpleJetSolution{F<:Number} <: Plume
end
SimpleJetSolution(s,m,d,h,θ,c0,kd,k2,k3) = SimpleJetSolution(s,m,promote(d,h,θ,c0,kd,k2,k3)...)

function Base.show(io::IO, mime::MIME"text/plain", p::SimpleJetSolution)
p_type = string(p.model)
print(io, "Plume model - subtype $p_type:\n")
print(io, " k2: $(p.k2)\n")
print(io, " k3: $(p.k3)\n")
print(io, " angle: $(p.angle) rad\n")
show(io,mime,p.scenario)
end

_release_angle(::HorizontalJet) = 0.0
_release_angle(::VerticalJet) = π/2

Expand Down
4 changes: 2 additions & 2 deletions src/models/slab_puff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function puff(scenario::Scenario, ::SLAB, eqs::EquationSet=DefaultSet;
# since v8.0.1 this causes DataInterpolations to error
xperm = sortperm(out.cc.x)
tperm = sortperm(out.cc.t)
return SLABSolution(scenario,:SLAB,inp,out,c_max,
return SLABSolution(scenario,:SLAB_HorizontalJet,inp,out,c_max,
AkimaInterpolation(out.cc.cc[xperm], out.cc.x[xperm]),
AkimaInterpolation(out.cc.b[xperm], out.cc.x[xperm]),
AkimaInterpolation(out.cc.betac[xperm], out.cc.x[xperm]),
Expand Down Expand Up @@ -188,7 +188,7 @@ function puff(scenario::Scenario{<:AbstractSubstance,<:VerticalJet,<:Atmosphere}
# since v8.0.1 this causes DataInterpolations to error
xperm = sortperm(out.cc.x)
tperm = sortperm(out.cc.t)
return SLABSolution(scenario,:SLAB,inp,out,c_max,
return SLABSolution(scenario,:SLAB_VerticalJet,inp,out,c_max,
AkimaInterpolation(out.cc.cc[xperm], out.cc.x[xperm]),
AkimaInterpolation(out.cc.b[xperm], out.cc.x[xperm]),
AkimaInterpolation(out.cc.betac[xperm], out.cc.x[xperm]),
Expand Down
Loading