Skip to content

Commit

Permalink
Added precompiling - runs case 1
Browse files Browse the repository at this point in the history
  • Loading branch information
markowkes committed Jun 19, 2024
1 parent 8cbd7a2 commit 760a530
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand Down
2 changes: 2 additions & 0 deletions src/Biofilm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ include("solver.jl")
include("parameters.jl")
include("computes.jl")
include("postprocess.jl")
include("precompile.jl")


end
4 changes: 2 additions & 2 deletions src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ function checkType_setDef(err,d,type,name; default=nothing)
@reset d[name] = (d[name], )
end
end
# Check type
type(d[name])
# Enforce type
@reset d[name] = type(d[name])
catch
err = printError(err,"Parameter $name should be of type $type")
end
Expand Down
64 changes: 64 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using PrecompileTools: @setup_workload, @compile_workload
@setup_workload begin
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.

@compile_workload begin
# all calls in this block will be precompiled, regardless of whether
# they belong to your package or not (on Julia 1.8 and higher)
# Input parameters
mumax = 20; KM = 3;
p = (
# --------------------- #
# Simulation Parameters #
# --------------------- #
Title = "Single Solute and Particulate Case",
tFinal = 1.0, # Simulation time [days]
tol = 1e-2, # Tolerance
outPeriod =0.1, # Time between outputs [days]
makePlots = true,
savePlots = true,

# ---------------------- #
# Particulate Parameters #
# ---------------------- #
XNames =["Heterotroph"], # Particulate names
Xto = [10.0], # Tank particulate concentration initial condition(s)
Pbo = [0.08], # Biofilm particulates volume fraction initial condition(s)
rho = [2.0E4], # Particulate densities
Kdet = 20000.0, # Particulates detachment coefficient
srcX = [(S,X,Lf,t,z,p) -> 0.0], # Source of particulates
# Growthrates for each particulate
mu = [(S,X,Lf,t,z,p) -> (mumax * S[1]) ./ (KM .+ S[1])],

# ----------------- #
# Solute Parameters #
# ----------------- #
SNames =["Nutrient"], # Solute names
Sin = [(t) -> 100], # Solute inflow (can be function of time)
Sto = [10.0], # Tank solute concentration initial condition(s)
Sbo = [0.0], # Biofilm solutes concentration initial condition(s)
Yxs = [2.646], # Biomass yield coefficient on solute
Dt = [4.0E-5], # Aquious solute diffusion through tank fluid
Db = [6.9E-5], # Effective solute diffusion through biofilm
srcS = [(S,X,Lf,t,z,p) -> 0.0], # Source of solutes

# --------------- #
# Tank Parameters #
# --------------- #
V = 0.1, # Volume of tank [m³]
A = 1, # Surface area of biofilm [m²]
Q = 1, # Flowrate through tank [m³/d]

# ------------------ #
# Biofilm Parameters #
# ------------------ #
Nz = 50, # Number of grid points in biofilm
Lfo = 1.0E-5, # Biofilm initial thickness [m]
LL = 1.00E-7, # Boundary layer thickness [m]
)

t,zm,Xt,St,Pb,Sb,Lf,sol = BiofilmSolver(p) # Run solver
biofilm_plot(sol,p) # Plot final results
end
end

0 comments on commit 760a530

Please sign in to comment.