-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot time step a non-hydrostatic model with default PISCES #224
Comments
Borrowing some code from I'll leave this issue open in case it makes sense to make the default using Oceananigans
using OceanBioME
using Oceananigans.Fields: ConstantField, FunctionField
grid = RectilinearGrid(CPU(), size=(16, 16, 16), extent=(100, 100, 100))
@inline total_light(x, y, z) = 3light(x, y, z)
@inline light(x, y, z) = ifelse(z <= 0, exp(z/10), 2-exp(-z/10))
PAR₁ = PAR₂ = PAR₃ = FunctionField{Center, Center, Center}(light, grid)
PAR = FunctionField{Center, Center, Center}(total_light, grid)
mixed_layer_depth = ConstantField(-25)
light_attenuation = PrescribedPhotosyntheticallyActiveRadiation((; PAR, PAR₁, PAR₂, PAR₃))
biogeochemistry = PISCES(; grid, light_attenuation, mixed_layer_depth)
model = NonhydrostaticModel(; grid, biogeochemistry)
time_step!(model, 1) |
Should also change the API to |
I came across this a few times too. I think this is from when it tries to solve for the calcite saturation which fails when We've discussed it a little before but I'm not sure how best to handle that error (especially on GPU since it produces a really long confusing error). We should make the default work too. |
Also, regarding the warning about it being in development: we think that it's correct and should be able to do what the default version (i.e. not quota/simple/etc) of PISCES does, but I haven't been able to test that it exactly replicates the results of the existing implementations. Our intention is to run a simple configuration of the NEMO version to compare to directly but I haven't had time (and struggled with the FORTRAN stuff when I did try before). I'm going to make an issue for this so |
Yeah I can see it being tricky to handle... If it's just erroring when solving for calcite saturation, can the calculation be skipped with a |
It could be, but my understanding is that this might affect performance on GPU. Since in almost all cases the outcome of the |
There are a few ways, you can use clipping to ensure that you don't get a # Eg store in `Field{Center, Center, Center}(grid, Bool)`
negative_found[i, j, k] = (DIC < 0) | (Alk < 0)
# clip and move on
DIC = max(zero(grid), DIC)
Alk = max(zero(grid), Alk)
# etc Outside the kernel you can check Or you can just set Probably other solutions if you can be creative. Short-circuiting logic should not be necessary. |
Huge push with #178!
I know PISCES is still in early development but I was curious to play around with it.
Is it not supposed to work out of the box with the default, e.g. just
biogeochemistry = PISCES(; grid)
? I'm guessing one of the root solvers does not like zero carbon or calcite concentrations.MWE:
Error:
The text was updated successfully, but these errors were encountered: