-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Description
Hi guys,
Thanks for all of your outstanding work on Oceananigans, really happy to be working with you :)
For unit testing in our land model, I would like to be able to apply a simple periodic upper boundary condition to the temperature field. I figured this would be possible with ValueBoundaryCondition(f)
where f
is the function. This works fine for FluxBoudnaryCondition
, as indicated in the docs. However, with ValueBoundaryCondition
, I get an error. Here is the MWE:
using Oceananigans
using Oceananigans.BoundaryConditions: FieldBoundaryConditions, ValueBoundaryCondition, NoFluxBoundaryCondition, fill_halo_regions!
f(x, z, t) = sin(2π*t)
bc = ValueBoundaryCondition(f)
grid = RectilinearGrid(CPU(), size=(1,10), x=(0,1), z=(0,1), topology=(Periodic,Flat,Bounded))
field_bc = FieldBoundaryConditions(grid, (Center, Center, Nothing), top=bc, bottom=NoFluxBoundaryCondition())
field = CenterField(grid, boundary_conditions=field_bc)
fill_halo_regions!(field)
Error:
ERROR: MethodError: objects of type Oceananigans.BoundaryConditions.ContinuousBoundaryFunction{Nothing, Nothing, Nothing, Nothing, typeof(f), Nothing, Tuple{}, Nothing, Nothing} are not callable
Stacktrace:
[1] getbc
@ ~/.julia/packages/Oceananigans/bKiml/src/BoundaryConditions/boundary_condition.jl:113 [inlined]
[2] getbc
@ ~/.julia/packages/Oceananigans/bKiml/src/BoundaryConditions/boundary_condition.jl:112 [inlined]
[3] right_gradient
@ ~/.julia/packages/Oceananigans/bKiml/src/BoundaryConditions/fill_halo_regions_value_gradient.jl:13 [inlined]
@glwagner mentioned that regularize_field_boundary_conditions
might fix this, but it didn't seem to work when I tried it.
Metadata
Metadata
Assignees
Labels
No labels