Closed jagoosw closed 1 year ago
This is slightly more complicated than I thought because we want to set the top point to $PAR_0(2 - A_0)$, and then have the normal fill_halo_regions!
behaviour so I think I need to make the PAR fields its own type and then over load fill_halo_regions!
Probably easiest to give the PAR field a special boundary condition and then overload _fill_top_halo!
?
Hi Both, Thanks for spotting this Si.  Jago: does it work to just set the PAR in the halo cells to the value of PAR at the first grid point?  I don’t think that It should matter very much whether we use the exponentially decaying form of the function because PAR is very unlikely to be a limiting factor at the surface (i.e. the growth function is very likely to be saturated in terms of PAR).
John On Feb 7, 2023 at 10:20 PM +0000, Jago Strong-Wright @.***>, wrote:
Probably easiest to give the PAR field a special boundary condition and then overload _fill_top_halo!? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Can you use ValueBoundaryCondition
?
Can you use
ValueBoundaryCondition
?
Yeah I realised this this morning, thanks!
@glwagner have you got any idea what I'm doing wrong here? If I set the field to be:
field = CenterField(grid; boundary_conditions = regularize_field_boundary_conditions(FieldBoundaryConditions(top = ValueBoundaryCondition(surface_PAR)), grid, :PAR))
where surface_PAR
is a function of x, y, t
. When I call fill_halo_regions!
I get this error:
I've tried a few different things but can't get this to work with a function.
Never mind, worked this out now!
Never mind, worked this out now!
What did you have to change to make it work?
I thought it was because you were using this function regularize_field_boundary_conditions
Never mind, worked this out now!
What did you have to change to make it work? I thought it was because you were using this function
regularize_field_boundary_conditions
If I don't use that it fails to build the field because it tries to set a default boundary condition in the periodic directions. The issue was that I wasn't using fill_halo_regions!
correctly (was doing fill_halo_regions!(field)
not fill_halo_regions!(field, model.clock, fields(model))
.
It might be more robust to use a discrete form boundary condition here so you don't have to regularize
The other issue is that regularize_field_boundary_conditions
is not supposed to be user facing so it could change...
More broadly I think this use case motivates rethinking how we initialize boundary conditions in Oceananigans to make user code more robust / easier to write
@syou83syou83 has noticed that interpolating the PAR field at a point above the top center point gives a value lower than that at the top point. This is probably because we've not been filling the halo region so its interpolating between [top value] and 0, the default for the halo region.
This should be easily fixed by filling the top halo points with the surface value, or surface ^ 2 / top point so that interpoalting to the surface will give the correct value. I will do this tomorrow.