Skip to content

Commit

Permalink
Use PrecompileTools
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyun committed Apr 14, 2024
1 parent a9c7ea2 commit 9dbcdec
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.1.7-DEV"
[deps]
Cropbox = "a904b226-abf1-11e9-2713-059ba252a964"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"

[compat]
Cropbox = "0.3"
Expand Down
2 changes: 2 additions & 0 deletions src/LeafGasExchange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ export ModelC3BB, ModelC3MD, ModelC4BB, ModelC4MD

include("canopy.jl")

include("precompile.jl")

end
55 changes: 55 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import PrecompileTools

PrecompileTools.@compile_workload begin
ge_weather = :Weather => (
PFD = 1500,
CO2 = 400,
RH = 60,
T_air = 30,
wind = 2.0,
)

ge_spad = :Nitrogen => (
_a = 0.0004,
_b = 0.0120,
_c = 0,
SPAD = 60,
)

ge_water = :StomataTuzet => (
#WP_leaf = 0,
sf = 2.3,
Ψf = -1.2,
)

ge_base = @config(ge_weather, ge_spad, ge_water)

ge_canopy = @config(
ge_base,
:Sun => (;
d = 1,
h = 12,
),
:Canopy => (;
LAI = 5,
),
:Radiation => (;
leaf_angle_factor = 3,
leaf_angle = LeafGasExchange.horizontal,
)
)

xstep = :Weather => :CO2 => 100:100:1000

for m in (ModelC3BB, ModelC3MD, ModelC4BB, ModelC4MD)
for backend in (:UnicodePlots, :Gadfly)
visualize(m, :Ci, :A_net; config = ge_base, xstep, backend)
end
end

for m in (ModelC3BBC, ModelC3MDC, ModelC4BBC, ModelC4MDC)
for backend in (:UnicodePlots, :Gadfly)
visualize(m, "weather.CO2", :A_net; config = ge_canopy, xstep, backend)
end
end
end

0 comments on commit 9dbcdec

Please sign in to comment.