diff --git a/Project.toml b/Project.toml index 2c922e89b..f420f20f9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OceanBioME" uuid = "a49af516-9db8-4be4-be45-1dad61c5a376" authors = ["Jago Strong-Wright and contributors"] -version = "0.11.1" +version = "0.11.2" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/examples/data_assimilation.jl b/examples/data_assimilation.jl index c30212ea0..d4ee7b0ab 100644 --- a/examples/data_assimilation.jl +++ b/examples/data_assimilation.jl @@ -24,6 +24,8 @@ using Distributions using EnsembleKalmanProcesses using EnsembleKalmanProcesses.ParameterDistributions +using Oceananigans.Fields: FunctionField + const year = years = 365day rng_seed = 41 @@ -34,22 +36,26 @@ rng = Random.MersenneTwister(rng_seed) @inline PAR⁰(t) = 60 * (1 - cos((t + 15days) * 2π / year)) * (1 / (1 + 0.2 * exp(-((mod(t, year) - 200days) / 50days)^2))) + 2 z = -10 # nominal depth of the box for the PAR profile -@inline PAR(t) = PAR⁰(t) * exp(0.2z) # Modify the PAR based on the nominal depth and exponential decay +@inline PAR_func(t) = PAR⁰(t) * exp(0.2z) # Modify the PAR based on the nominal depth and exponential decay function run_box_simulation(initial_photosynthetic_slope, base_maximum_growth, nutrient_half_saturation, phyto_base_mortality_rate, j) + grid = BoxModelGrid() + clock = Clock(; time = zero(grid)) - biogeochemistry = NutrientPhytoplanktonZooplanktonDetritus(; grid = BoxModelGrid(), + PAR = FunctionField{Center, Center, Center}(PAR_func, grid; clock) + + biogeochemistry = NutrientPhytoplanktonZooplanktonDetritus(; grid, initial_photosynthetic_slope, base_maximum_growth, nutrient_half_saturation, phyto_base_mortality_rate, - light_attenuation_model = nothing) + light_attenuation_model = PrescribedPhotosyntheticallyActiveRadiation(PAR)) - model = BoxModel(; biogeochemistry, forcing = (; PAR)) + model = BoxModel(; biogeochemistry, clock) set!(model, N = 10.0, P = 0.1, Z = 0.01)