Skip to content

Commit

Permalink
Merge pull request #215 from OceanBioME/jsw/fix-data-assimilation-exa…
Browse files Browse the repository at this point in the history
…mple

Fixs data assimilation example
  • Loading branch information
jagoosw authored Oct 2, 2024
2 parents 3c287d6 + f8436e0 commit daebb41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OceanBioME"
uuid = "a49af516-9db8-4be4-be45-1dad61c5a376"
authors = ["Jago Strong-Wright <[email protected]> and contributors"]
version = "0.11.1"
version = "0.11.2"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
14 changes: 10 additions & 4 deletions examples/data_assimilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ using Distributions
using EnsembleKalmanProcesses
using EnsembleKalmanProcesses.ParameterDistributions

using Oceananigans.Fields: FunctionField

const year = years = 365day

rng_seed = 41
Expand All @@ -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)

Expand Down

2 comments on commit daebb41

@jagoosw
Copy link
Collaborator Author

@jagoosw jagoosw commented on daebb41 Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/116465

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.2 -m "<description of version>" daebb411a5f4cea62bc23e5ddb2a9456daede89a
git push origin v0.11.2

Please sign in to comment.