Skip to content

Commit

Permalink
Update name and format
Browse files Browse the repository at this point in the history
  • Loading branch information
ctessum committed Feb 18, 2024
1 parent 83f2245 commit 68db407
Show file tree
Hide file tree
Showing 13 changed files with 458 additions and 459 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using DepositionMTK
DocMeta.setdocmeta!(DepositionMTK, :DocTestSetup, :(using DepositionMTK); recursive=true)
doctest(DepositionMTK)'
using AtmosphericDeposition
DocMeta.setdocmeta!(AtmosphericDeposition, :DocTestSetup, :(using AtmosphericDeposition); recursive=true)
doctest(AtmosphericDeposition)'
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "DepositionMTK"
name = "AtmosphericDeposition"
uuid = "1a52f20c-0d16-41d8-a00a-b2996d86a462"
authors = ["EarthSciML authors and contributors"]
version = "0.1.0"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# DepositionMTK
# AtmosphericDeposition

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://earthsciml.github.io/DepositionMTK.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://earthsciml.github.io/DepositionMTK.jl/dev)
[![Build Status](https://github.com/EarthSciML/DepositionMTK.jl/workflows/CI/badge.svg)](https://github.com/earthsciml/DepositionMTK.jl/actions)
[![Coverage](https://codecov.io/gh/EarthSciML/DepositionMTK.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/earthsciml/DepositionMTK.jl)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://earthsciml.github.io/AtmosphericDeposition.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://earthsciml.github.io/AtmosphericDeposition.jl/dev)
[![Build Status](https://github.com/EarthSciML/AtmosphericDeposition.jl/workflows/CI/badge.svg)](https://github.com/earthsciml/AtmosphericDeposition.jl/actions)
[![Coverage](https://codecov.io/gh/EarthSciML/AtmosphericDeposition.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/earthsciml/AtmosphericDeposition.jl)
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[deps]
DepositionMTK = "1a52f20c-0d16-41d8-a00a-b2996d86a462"
AtmosphericDeposition = "1a52f20c-0d16-41d8-a00a-b2996d86a462"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
16 changes: 8 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using DepositionMTK
using AtmosphericDeposition
using Documenter

DocMeta.setdocmeta!(DepositionMTK, :DocTestSetup, :(using DepositionMTK); recursive=true)
DocMeta.setdocmeta!(AtmosphericDeposition, :DocTestSetup, :(using AtmosphericDeposition); recursive=true)

makedocs(;
modules=[DepositionMTK],
authors="Chris Tessum <[email protected]> and contributors",
repo="https://github.com/ctessum/DepositionMTK.jl/blob/{commit}{path}#{line}",
sitename="DepositionMTK.jl",
modules=[AtmosphericDeposition],
authors="EarthSciML authors and contributors",
repo="https://github.com/earthsciml/AtmosphericDeposition.jl/blob/{commit}{path}#{line}",
sitename="AtmosphericDeposition.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://ctessum.github.io/DepositionMTK.jl",
canonical="https://earthciml.github.io/AtmosphericDeposition.jl",
assets=String[],
),
pages=[
Expand All @@ -19,5 +19,5 @@ makedocs(;
)

deploydocs(;
repo="github.com/ctessum/DepositionMTK.jl",
repo="github.com/earthsciml/AtmosphericDeposition.jl",
)
8 changes: 4 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
```@meta
CurrentModule = DepositionMTK
CurrentModule = AtmosphericDeposition
```

# DepositionMTK
# AtmosphericDeposition

Documentation for [DepositionMTK](https://github.com/EarthSciML/DepositionMTK.jl).
Documentation for [AtmosphericDeposition](https://github.com/EarthSciML/AtmosphericDeposition.jl).

```@index
```
Expand Down Expand Up @@ -40,5 +40,5 @@ and variations of uptake characteristics by individual plant species within the


```@autodocs
Modules = [DepositionMTK]
Modules = [AtmosphericDeposition]
```
84 changes: 42 additions & 42 deletions src/dry_deposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export defaults, ra, mu, mfp, cc, vs, dParticle, dH2O, sc, stSmooth, stVeg, RbGa
@constants g = 9.81 [unit = u"m*s^-2", description = "gravitational acceleration"]
@constants κ = 0.4 # von Karman constant
@constants k = 1.3806488e-23 [unit = u"m^2*kg*s^-2/K", description = "Boltzmann constant"]
@constants M_air = 28.97e-3 [unit = u"kg/mol", description = "molecular weight of air"]
@constants R = 8.3144621 [unit = u"kg*m^2*s^−2*K^-1*mol^-1", description = "Gas constant"]
@constants M_air = 28.97e-3 [unit = u"kg/mol", description = "molecular weight of air"]
@constants R = 8.3144621 [unit = u"kg*m^2*s^−2*K^-1*mol^-1", description = "Gas constant"]

@constants unit_m = 1 [unit = u"m"]
"""
Expand All @@ -14,12 +14,12 @@ Based on Seinfeld and Pandis (2006) [Seinfeld, J.H. and Pandis, S.N. (2006) Atmo
equation 19.13 & 19.14.
"""
function ra(z, z₀, u_star, L)
ζ = IfElse.ifelse((L/unit_m == 0), 0, z/L)
ζ₀ = IfElse.ifelse((L/unit_m == 0), 0, z₀/L)
rₐ_1 = IfElse.ifelse((0 < ζ) &< 1), 1/*u_star)*(log(z/z₀)+4.7*-ζ₀)), 1/*u_star)*log(z/z₀))
η₀=(1-15*ζ₀)^1/4
η =(1-15*ζ)^1/4
rₐ = IfElse.ifelse((-1 < ζ) &< 0), 1/*u_star)*[log(z/z₀)+log(((η₀^2+1)*(η₀+1)^2)/((η^2+1)*+1)^2))+2*(atan(η)-atan(η₀))][1], rₐ_1)
ζ = IfElse.ifelse((L / unit_m == 0), 0, z / L)
ζ₀ = IfElse.ifelse((L / unit_m == 0), 0, z₀ / L)
rₐ_1 = IfElse.ifelse((0 < ζ) &< 1), 1 /* u_star) * (log(z / z₀) + 4.7 *- ζ₀)), 1 /* u_star) * log(z / z₀))
η₀ = (1 - 15 * ζ₀)^1 / 4
η = (1 - 15 * ζ)^1 / 4
rₐ = IfElse.ifelse((-1 < ζ) &< 0), 1 /* u_star) * [log(z / z₀) + log(((η₀^2 + 1) * (η₀ + 1)^2) / ((η^2 + 1) *+ 1)^2)) + 2 * (atan(η) - atan(η₀))][1], rₐ_1)
return rₐ
end

Expand All @@ -29,26 +29,26 @@ end
Function mu calculates the dynamic viscosity of air [kg m-1 s-1] where T is temperature [K].
"""
function mu(T)
return (1.458*10^-6*(T/unit_T)^(3/2)/((T/unit_T)+110.4))*unit_convert_mu
return (1.458 * 10^-6 * (T / unit_T)^(3 / 2) / ((T / unit_T) + 110.4)) * unit_convert_mu
end

"""
Function mfp calculates the mean free path of air [m]
where T is temperature [K] P is pressure [Pa], and Mu is dynamic viscosity [kg/(m s)].
From Seinfeld and Pandis (2006) equation 9.6
"""
function mfp(T,P,μ)
return 2*μ/(P*(8*M_air/(pi*R*T))^0.5)
function mfp(T, P, μ)
return 2 * μ / (P * (8 * M_air / (pi * R * T))^0.5)
end

"""
Function cc calculates the Cunnningham slip correction factor
where Dp is particle diameter [m], T is temperature [K], and P is pressure [Pa].
From Seinfeld and Pandis (2006) equation 9.34.
"""
function cc(Dₚ,T,P,μ)
λ = mfp(T,P,μ)
return 1+2*λ/Dₚ*(1.257+0.4*exp(-1.1*Dₚ/(2*λ)))
function cc(Dₚ, T, P, μ)
λ = mfp(T, P, μ)
return 1 + 2 * λ / Dₚ * (1.257 + 0.4 * exp(-1.1 * Dₚ / (2 * λ)))
end

@constants unit_v = 1 [unit = u"m/s"]
Expand All @@ -58,7 +58,7 @@ particle where Dp is particle diameter [m], ρₚ is particle density [kg/m3], C
From equation 9.42 in Seinfeld and Pandis (2006).
"""
function vs(Dₚ, ρₚ, Cc, μ)
IfElse.ifelse((Dₚ > 20.e-6*unit_m), 99999999*unit_v, Dₚ^2*ρₚ*g*Cc/(18*μ))
IfElse.ifelse((Dₚ > 20.e-6 * unit_m), 99999999 * unit_v, Dₚ^2 * ρₚ * g * Cc / (18 * μ))
# Particle diameter Dₚ greater than 20um; Stokes settling no longer applies.
end

Expand All @@ -67,26 +67,26 @@ Function dParticle calculates the brownian diffusivity of a particle [m2/s] usin
(Seinfeld and Pandis eq. 9.73)
where T is air temperature [K], P is pressure [Pa], Dp is particle diameter [m], and μ is air dynamic viscosity [kg/(s m)]
"""
function dParticle(T,P,Dₚ,Cc,μ)
return k*T*Cc/(3*pi*μ*Dₚ)
function dParticle(T, P, Dₚ, Cc, μ)
return k * T * Cc / (3 * pi * μ * Dₚ)
end

@constants T_unitless = 1 [unit = u"K^-1"]
@constants unit_dH2O = 1 [unit = u"m^2/s"]
"""
Function dH2O calculates molecular diffusivity of water vapor in air [m2/s] where T is temperature [K]
using a regression fit to data in Bolz and Tuve (1976) found here: http://www.cambridge.org/us/engineering/author/nellisandklein/downloads/examples/EXAMPLE_9.2-1.pdf
"""
"""
function dH2O(T)
return (-2.775e-6 + 4.479e-8*T*T_unitless + 1.656e-10*(T*T_unitless)^2)*unit_dH2O
return (-2.775e-6 + 4.479e-8 * T * T_unitless + 1.656e-10 * (T * T_unitless)^2) * unit_dH2O
end

"""
Function sc computes the dimensionless Schmidt number,
where μ is dynamic viscosity of air [kg/(s m)], ρ is air density [kg/m3], and D is the molecular diffusivity of the gas speciesof interest [m2/s]
"""
function sc(μ, ρ, D)
return μ/*D)
return μ /* D)
end

"""
Expand All @@ -95,7 +95,7 @@ where vs is settling velocity [m/s], u_star is friction velocity [m/s], μ is dy
based on Seinfeld and Pandis (2006) equation 19.23.
"""
function stSmooth(vₛ, u_star, μ, ρ)
return vₛ*u_star^2*ρ/(g*μ)
return vₛ * u_star^2 * ρ / (g * μ)
end

"""
Expand All @@ -104,7 +104,7 @@ where vs is settling velocity [m/s], u_star is friction velocity [m/s], and A is
based on Seinfeld and Pandis (2006) equation 19.24.
"""
function stVeg(vₛ, u_star, A)
return vₛ*u_star/(g*A)
return vₛ * u_star / (g * A)
end

"""
Expand All @@ -113,7 +113,7 @@ where Sc is the dimensionless Schmidt number and u_star is the friction velocity
From Seinfeld and Pandis (2006) equation 19.17.
"""
function RbGas(Sc, u_star)
return 5*Sc^(2/3)/u_star
return 5 * Sc^(2 / 3) / u_star
end

"""
Expand Down Expand Up @@ -163,15 +163,15 @@ where Sc is the dimensionless Schmidt number, u_star is the friction velocity [m
Dp is particle diameter [m], and iSeason and iLandUse are season and land use indexes, respectively.
From Seinfeld and Pandis (2006) equation 19.27.
"""
function RbParticle(Sc, u_star, St, Dₚ, iSeason::Int, iLandUse::Int)
function RbParticle(Sc, u_star, St, Dₚ, iSeason::Int, iLandUse::Int)
α = α_table[iLandUse]
γ = γ_table[iLandUse]
A = (A_table[iSeason,iLandUse]*10^(-3))*unit_m
A = (A_table[iSeason, iLandUse] * 10^(-3)) * unit_m
R1 = exp(-St^0.5)
term_1 = Sc^(-γ)
term_2 = (St/+St))^2
term_3 = 1/2*(Dₚ/A)^2
return 1/(3*u_star*(term_1+term_2+term_3)*R1)
term_2 = (St /+ St))^2
term_3 = 1 / 2 * (Dₚ / A)^2
return 1 / (3 * u_star * (term_1 + term_2 + term_3) * R1)
end

@constants G_unitless = 1 [unit = u"m^2/W"]
Expand All @@ -185,14 +185,14 @@ irradiation [W m-2], Θ is the slope of the local terrain [radians], iSeason and
dew and rain indicate whether there is dew or rain on the ground, and isSO2 and isO3 indicate whether the gas species of interest is either SO2 or O3, respectively.
Based on Seinfeld and Pandis (2006) equation 19.2.
"""
function DryDepGas(z, z₀, u_star, L, ρA, gasData::GasData, G, Ts, θ, iSeason::Int, iLandUse::Int, rain::Bool, dew::Bool, isSO2::Bool, isO3::Bool)
function DryDepGas(z, z₀, u_star, L, ρA, gasData::GasData, G, Ts, θ, iSeason::Int, iLandUse::Int, rain::Bool, dew::Bool, isSO2::Bool, isO3::Bool)
Ra = ra(z, z₀, u_star, L)
μ = mu(Ts)
Dg = dH2O(Ts)/gasData.Dh2oPerDx # Diffusivity of gas of interest [m2/s]
Sc = sc(μ,ρA, Dg)
Dg = dH2O(Ts) / gasData.Dh2oPerDx # Diffusivity of gas of interest [m2/s]
Sc = sc(μ, ρA, Dg)
Rb = RbGas(Sc, u_star)
Rc = SurfaceResistance(gasData, G*G_unitless, (Ts*T_unitless-273), θ, iSeason::Int, iLandUse::Int, rain::Bool, dew::Bool, isSO2::Bool, isO3::Bool)*Rc_unit
return 1/(Ra+Rb+Rc)
Rc = SurfaceResistance(gasData, G * G_unitless, (Ts * T_unitless - 273), θ, iSeason::Int, iLandUse::Int, rain::Bool, dew::Bool, isSO2::Bool, isO3::Bool) * Rc_unit
return 1 / (Ra + Rb + Rc)
end

"""
Expand All @@ -208,14 +208,14 @@ function DryDepParticle(z, z₀, u_star, L, Dp, Ts, P, ρParticle, ρA, iSeason:
Cc = cc(Dp, Ts, P, μ)
Vs = vs(Dp, ρParticle, Cc, μ)
if iLandUse == 4 # dessert
St = stSmooth(Vs, u_star, μ, ρA)
St = stSmooth(Vs, u_star, μ, ρA)
else
St = stVeg(Vs, u_star, (A_table[iSeason,iLandUse]*10^(-3))*unit_m)
St = stVeg(Vs, u_star, (A_table[iSeason, iLandUse] * 10^(-3)) * unit_m)
end
D = dParticle(Ts, P, Dp, Cc, μ)
Sc = sc(μ, ρA, D)
Rb = RbParticle(Sc, u_star, St, Dp, iSeason, iLandUse)
return 1/(Ra+Rb+Ra*Rb*Vs)+Vs
return 1 / (Ra + Rb + Ra * Rb * Vs) + Vs
end

defaults = [g => 9.81, κ => 0.4, k => 1.3806488e-23, M_air => 28.97e-3, R => 8.3144621, unit_T => 1, unit_convert_mu => 1, T_unitless => 1, unit_dH2O => 1, unit_m => 1, G_unitless => 1, Rc_unit => 1, unit_v => 1]
Expand Down Expand Up @@ -243,10 +243,10 @@ struct DrydepositionG <: EarthSciMLODESystem
iLandUse = 10
rain = false
dew = false
@parameters z = 50 [unit = u"m"]
@parameters z₀ = 0.04 [unit = u"m"]
@parameters u_star = 0.44 [unit = u"m/s"]
@parameters L = 0 [unit = u"m"]
@parameters z = 50 [unit = u"m"]
@parameters z₀ = 0.04 [unit = u"m"]
@parameters u_star = 0.44 [unit = u"m/s"]
@parameters L = 0 [unit = u"m"]
@parameters ρA = 1.2 [unit = u"kg*m^-3"]
@parameters G = 300 [unit = u"W*m^-2"]
@parameters T = 298 [unit = u"K"]
Expand All @@ -262,7 +262,7 @@ struct DrydepositionG <: EarthSciMLODESystem
@variables CH2O(t) [unit = u"ppb"]

eqs = [
D(SO2) ~ -DryDepGas(z, z₀, u_star, L, ρA, So2Data, G, T, θ, iSeason, iLandUse, rain, dew, true, false) / z * SO2
D(SO2) ~ -DryDepGas(z, z₀, u_star, L, ρA, So2Data, G, T, θ, iSeason, iLandUse, rain, dew, true, false) / z * SO2
D(O3) ~ -DryDepGas(z, z₀, u_star, L, ρA, O3Data, G, T, θ, iSeason, iLandUse, rain, dew, false, true) / z * O3
D(NO2) ~ -DryDepGas(z, z₀, u_star, L, ρA, No2Data, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * NO2
D(NO) ~ -DryDepGas(z, z₀, u_star, L, ρA, NoData, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * NO
Expand All @@ -272,5 +272,5 @@ struct DrydepositionG <: EarthSciMLODESystem

new(ODESystem(eqs, t, [SO2, O3, NO2, NO, H2O2, CH2O], [z, z₀, u_star, L, ρA, G, T, θ]; name=:DrydepositionG))
end
end
end

Loading

0 comments on commit 68db407

Please sign in to comment.