Skip to content

Commit

Permalink
format symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Oct 12, 2024
1 parent 7e30a96 commit eb4b8fc
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 81 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ docs/reference
# Figures
*.pdf
.ipynb_checkpoints

__pycache__
4 changes: 2 additions & 2 deletions src/DataType/Soil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ abstract type AbstractSoil end
depth_water ::Cdouble = Cdouble(0)
depth_snow ::Cdouble = Cdouble(0)

r_rain_g ::Cdouble = Cdouble(0)
r_rain_g ::Cdouble = Cdouble(0) # the rainfall rate, un--on understory g--on ground surface m/s
soil_r ::Cdouble = Cdouble(0)
r_drainage ::Cdouble = Cdouble(0)
r_root_decay::Cdouble = Cdouble(0)
r_root_decay::Cdouble = Cdouble(0) # decay_rate_of_root_distribution, 根系分布衰减率
ψ_min ::Cdouble = Cdouble(0)
alpha ::Cdouble = Cdouble(0)
f_soilwater ::Cdouble = Cdouble(0)
Expand Down
28 changes: 14 additions & 14 deletions src/Soil/Init_Soil_Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Initialize soil parameters
- `porosity` : porosity
- `θ_vfc` : field capacity
- `θ_vwp` : wilt point
- `thermal_cond` : thermal conductivity
- `ψ_sat` : water potential at saturate
- `κ` : thermal conductivity (or `thermal_cond`)
"""
function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::Float64, p::Soil)
p.n_layer = 5
Expand Down Expand Up @@ -40,7 +40,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = [0.437, 0.437, 0.437, 0.437, 0.437]# porosity
θ_vfc = [0.09, 0.09, 0.09, 0.09, 0.09] # field capacity
θ_vwp = [0.03, 0.03, 0.03, 0.03, 0.03] # wilt point
thermal_cond = [8.6, 8.6, 8.6, 8.6, 8.6] # thermal conductivity
κ = [8.6, 8.6, 8.6, 8.6, 8.6] # thermal conductivity
ψ_sat = [0.07, 0.08, 0.09, 0.10, 0.12] # water potential at sat

elseif stxt == 2 # loamy sand
Expand All @@ -49,7 +49,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = [0.437, 0.437, 0.437, 0.437, 0.437] # porosity
θ_vfc = [0.21, 0.21, 0.21, 0.21, 0.21] # field capacity
θ_vwp = [0.06, 0.06, 0.06, 0.06, 0.06] # wilt point
thermal_cond = [8.3, 8.3, 8.3, 8.3, 8.3] # thermal conductivity
κ = [8.3, 8.3, 8.3, 8.3, 8.3] # thermal conductivity
ψ_sat = [0.09, 0.10, 0.11, 0.12, 0.14] # water potential at sat

elseif stxt == 3 # sandy loam
Expand All @@ -58,7 +58,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = [0.453, 0.453, 0.453, 0.453, 0.453] # porosity
θ_vfc = [0.21, 0.21, 0.21, 0.21, 0.21] # field capacity
θ_vwp = [0.10, 0.10, 0.10, 0.10, 0.10] # wilt point
thermal_cond = [8.0, 8.0, 8.0, 8.0, 8.0] # thermal conductivity
κ = [8.0, 8.0, 8.0, 8.0, 8.0] # thermal conductivity
ψ_sat = [0.15, 0.16, 0.17, 0.18, 0.20] # water potential at sat

elseif stxt == 4 # loam
Expand All @@ -67,7 +67,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = [0.463, 0.463, 0.463, 0.463, 0.463] # porosity
θ_vfc = [0.27, 0.27, 0.27, 0.27, 0.27] # field capacity
θ_vwp = [0.12, 0.12, 0.12, 0.12, 0.12] # wilt point
thermal_cond = [7.0, 7.0, 7.0, 7.0, 7.0] # thermal conductivity
κ = [7.0, 7.0, 7.0, 7.0, 7.0] # thermal conductivity
ψ_sat = [0.11, 0.12, 0.13, 0.14, 0.16] # water potential at sat

elseif stxt == 5 # silty loam
Expand All @@ -76,7 +76,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = [0.501, 0.501, 0.501, 0.501, 0.501] # porosity
θ_vfc = [0.33, 0.33, 0.33, 0.33, 0.33] # field capacity
θ_vwp = [0.13, 0.13, 0.13, 0.13, 0.13] # wilt point
thermal_cond = [6.3, 6.3, 6.3, 6.3, 6.3] # thermal conductivity
κ = [6.3, 6.3, 6.3, 6.3, 6.3] # thermal conductivity
ψ_sat = [0.21, 0.22, 0.23, 0.24, 0.26] # water potential at sat

elseif stxt == 6 # sandy clay loam
Expand All @@ -85,7 +85,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.398, 5)
θ_vfc = fill(0.26, 5)
θ_vwp = fill(0.15, 5)
thermal_cond = fill(7.0, 5)
κ = fill(7.0, 5)
ψ_sat = [0.28, 0.29, 0.30, 0.31, 0.33]

elseif stxt == 7 # clay loam
Expand All @@ -94,7 +94,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.464, 5)
θ_vfc = fill(0.32, 5)
θ_vwp = fill(0.20, 5)
thermal_cond = [5.8, 5.8, 5.7, 5.8, 5.8]
κ = [5.8, 5.8, 5.7, 5.8, 5.8]
ψ_sat = [0.26, 0.27, 0.28, 0.29, 0.31]

elseif stxt == 8 # silty clay loam
Expand All @@ -103,7 +103,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.471, 5)
θ_vfc = fill(0.37, 5)
θ_vwp = fill(0.32, 5)
thermal_cond = fill(4.2, 5)
κ = fill(4.2, 5)
ψ_sat = [0.33, 0.34, 0.35, 0.36, 0.38]

elseif stxt == 9 # sandy clay
Expand All @@ -112,7 +112,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.430, 5)
θ_vfc = fill(0.34, 5)
θ_vwp = fill(0.24, 5)
thermal_cond = fill(6.3, 5)
κ = fill(6.3, 5)
ψ_sat = [0.29, 0.30, 0.31, 0.32, 0.34]

elseif stxt == 10 # silty clay
Expand All @@ -121,7 +121,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.479, 5)
θ_vfc = fill(0.39, 5)
θ_vwp = fill(0.25, 5)
thermal_cond = fill(4.0, 5)
κ = fill(4.0, 5)
ψ_sat = [0.34, 0.35, 0.36, 0.37, 0.39]

elseif stxt == 11 # clay
Expand All @@ -130,7 +130,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.475, 5)
θ_vfc = fill(0.40, 5)
θ_vwp = fill(0.27, 5)
thermal_cond = fill(4.4, 5)
κ = fill(4.4, 5)
ψ_sat = [0.37, 0.38, 0.39, 0.40, 0.42]

else # default
Expand All @@ -139,7 +139,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
porosity = fill(0.475, 5)
θ_vfc = fill(0.40, 5)
θ_vwp = fill(0.27, 5)
thermal_cond = fill(4.4, 5)
κ = fill(4.4, 5)
ψ_sat = [0.37, 0.38, 0.39, 0.40, 0.42]
end

Expand All @@ -148,7 +148,7 @@ function Init_Soil_Parameters(landcover::Integer, stxt::Integer, r_root_decay::F
p.θ_sat[1:5] .= porosity
p.theta_vfc[1:5] .= θ_vfc
p.θ_vwp[1:5] .= θ_vwp
p.thermal_cond[1:5] .= thermal_cond
p.thermal_cond[1:5] .= κ
p.ψ_sat[1:5] .= ψ_sat

p
Expand Down
3 changes: 2 additions & 1 deletion src/Soil/UpdateSoilMoisture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function UpdateSoilMoisture(p::Soil, kstep::Float64)

n = p.n_layer
@unpack dz, f_water, Ksat, KK, km, b,
ψ_sat, ψ,
ψ_sat, ψ,
θ_sat, θ, θ_prev = p
θ_prev .= θ # assign current soil moisture to prev

Expand All @@ -31,6 +31,7 @@ function UpdateSoilMoisture(p::Soil, kstep::Float64)
end

# Max infiltration calculation
# Ksat * (1 + (θ_sat - θ_prev) / dz * ψ_sat / θ_sat * b )
inf_max = f_water[1] * Ksat[1] * (1 + (θ_sat[1] - θ_prev[1]) / dz[1] * ψ_sat[1] * b[1] / θ_sat[1])
inf = max(f_water[1] * (p.depth_water / kstep + p.r_rain_g), 0)
inf = clamp(inf, 0, inf_max)
Expand Down
Loading

0 comments on commit eb4b8fc

Please sign in to comment.