diff --git a/src/wallymodules/PyCanteraTools.jl b/src/wallymodules/PyCanteraTools.jl index 9d6de2298..f96fd0657 100644 --- a/src/wallymodules/PyCanteraTools.jl +++ b/src/wallymodules/PyCanteraTools.jl @@ -87,14 +87,22 @@ function chons_fuel_formula(x, y, z, n, s) return L"%$(formula)" end -function chons_fuel_equation(x, y, z, n, s) - a = (1/2)*(2x + 2s + n + y/2 - z) +function chons_fuel_equation(x, y, z, n, s; burn_nitrogen = false) + a = 2x + 2s + y/2 - z + a = (burn_nitrogen ? a + n : a) / 2 + o2 = "$(@sprintf("%.6f", a)) \\:\\mathrm{O}_{2}" - co2 = "$(@sprintf("%.6f", x)) \\:\\mathrm{CO}_2" - h2o = "$(@sprintf("%.6f", y/2)) \\:\\mathrm{H}_2\\mathrm{O}" - so2 = "$(@sprintf("%.6f", s)) \\:\\mathrm{SO}_2" - no1 = "$(@sprintf("%.6f", n)) \\:\\mathrm{NO}" - return L"\mathrm{HFO} + %$(o2) → %$(co2) + %$(h2o) + %$(so2) + %$(no1)" + co2 = "$(@sprintf("%.6f", x)) \\:\\mathrm{CO}_2" + h2o = "$(@sprintf("%.6f", y/2)) \\:\\mathrm{H}_2\\mathrm{O}" + so2 = "$(@sprintf("%.6f", s)) \\:\\mathrm{SO}_2" + + nit = if burn_nitrogen + "$(@sprintf("%.6f", n)) \\:\\mathrm{NO}" + else + "$(@sprintf("%.6f", n/2)) \\:\\mathrm{N}_2" + end + + return L"\mathrm{HFO} + %$(o2) → %$(co2) + %$(h2o) + %$(so2) + %$(nit)" end ############################################################################## diff --git a/src/wallytoolbox/thermochemistry/combustion.jl b/src/wallytoolbox/thermochemistry/combustion.jl index 3ec3226b3..4ed0ffda9 100644 --- a/src/wallytoolbox/thermochemistry/combustion.jl +++ b/src/wallytoolbox/thermochemistry/combustion.jl @@ -81,7 +81,11 @@ function Base.String(f::EmpiricalFuel) end """ - oxidizer_mass_flow_rate(f::EmpiricalFuel; y_o2 = 0.23) + oxidizer_mass_flow_rate( + f::EmpiricalFuel; + y_o2 = 0.23, + burn_nitrogen = false + ) Computes the required amount of oxidizer to perform complete combustion of 1 kg provided empirical fuel. The value of `y_o2` represents the mass @@ -90,11 +94,15 @@ fraction of oxygen in oxidizer; default value is typical for air. ```jldoctest julia> fuel = EmpiricalFuel([0.937, 0.063, 0.0]; scaler=:C=>10); -julia> oxidizer_mass_flow_rate(fuel) +julia> oxidizer_mass_flow_rate(fuel; burn_nitrogen = true) 13.02691759229764 ``` """ -function oxidizer_mass_flow_rate(f::EmpiricalFuel; y_o2 = 0.23) +function oxidizer_mass_flow_rate( + f::EmpiricalFuel; + y_o2 = 0.23, + burn_nitrogen = false + ) m_o2 = molecularmass(Stoichiometry(; O = 2)) fn = EmpiricalFuel(f.Y; f.elements, scaler=nothing) @@ -106,9 +114,12 @@ function oxidizer_mass_flow_rate(f::EmpiricalFuel; y_o2 = 0.23) get_element(e) = fn.X[findall(==(e), fn.elements) |> first] rhs += -1*((:O in fn.elements) ? get_element(:O) : 0.0) - rhs += 1*((:N in fn.elements) ? get_element(:N) : 0.0) rhs += 2*((:S in fn.elements) ? get_element(:S) : 0.0) + if burn_nitrogen + rhs += 1*((:N in fn.elements) ? get_element(:N) : 0.0) + end + return (1//2) * rhs * m_o2 / y_o2 end diff --git a/tools/vscode/user-data/User/settings.json b/tools/vscode/user-data/User/settings.json index e37a9f284..11ed42e97 100644 --- a/tools/vscode/user-data/User/settings.json +++ b/tools/vscode/user-data/User/settings.json @@ -156,5 +156,6 @@ }, "redhat.telemetry.enabled": false, "git.confirmSync": false, + "git.autofetch": true, } \ No newline at end of file