Replies: 1 comment 6 replies
-
I think the issue here is that you really would like to impose boundary conditions on You can try that: bz_bcs = FieldBoundaryConditions(grid, (Center, Center, Face);
top = OpenBoundaryCondition(-model.tracers.b.boundary_conditions.top.condition / model.closure[1].κ.b))
bz = Field(∂z(b)), boundary_conditions=bz_bcs)
bz_ccc_op = @at (Center, Center, Center) bz # I _think_ this will work, but you may have to define this interpolation manually
bz_ccc = Field(bz_ccc_op) Probably a more efficient solution is something like κ = 1e-5
bz_top = 3e-9 / κ # or whatever this needs to be
# create model with `FluxBoundaryCondition` on `b` as above
# Create an "auxiliary" buoyancy field with `GradientBoundaryCondition`:
bz_top_bc = GradientBoundaryCondition(bz_top)
auxiliary_b_bcs = FieldBoundaryConditions(grid, (Center, Center, Center); top = bz_top_bc)
b_gradient_bc = CenterField(grid; data=model.tracers.b, boundary_conditions=auxiliary_b_bcs)
# The desired field:
dbdz = Field(@at (Center, Center, Center) ∂z(b_gradient_bcs)) The above approach may only work if I think though what is really desired here is to set the boundary conditions on the AMD effective diffusivity to so you can try adding the boundary condition κₑ_b_bcs = FieldBoundaryConditions(grid, (Center, Center, Center), top=ValueBoundaryCondition(0))
boundary_conditions = (b=b_bcs, κₑ=(; b=κₑ_b_bcs)) Not the easiest to use interface... perhaps we can brainstorm on how to make this a little easier for users. |
Beta Was this translation helpful? Give feedback.
-
I have a LES set-up kinda similar to the ocean mixing example, and the important part is that I'm setting a flux as the top BC for buoyancy. One of the things I'm trying to calculate is the vertical buoyancy gradient, but with boundary conditions that are as close to correct as possible. So basically I'm trying to get:
with "proper" boundary conditions. (It's important that it's on cell centers.)
However, I haven't been able to do that properly. The first question that comes in mind is: Is it possible to have an appropriate BC for db/dz when the only closure is an LES? (By that, I mean without any constant background viscosity/diffusivity.) I can't think of a way to do it without estimating the eddy diffusivity at the boundary, where it isn't defined, so I'd say that the answer is no. However, I'm interested to see if anyone has ideas or anything to add here that I may be missing.
With that said, I believe a physically-correct way to do it would need a constant eddy viscosity in the background (molecular or not). Then we could use only that viscosity at the boundary to get the gradient (by inverting the flux-gradient relationship since we have the flux at the boundary).
But even if I take this approach, it doesn't appear to have any effect on the result. For example, in the MWE below I'm setting up a model with a surface buoyancy flux and then I'm calculating
∂z(b)
in two ways:dbdz1
just naively calculates∂z(b)
without any boundary conditionsdbdz2
tries to impose the BCs in the way I described above.Here's what this looks like for me (sorry if it's a bit convoluted):
However, it appears the boundary condition doesn't take any effect. After running this MWE I get:
Note that
5.0e-6
is exactly half of the the initial stratification, indicating that this is just a linear interpolation between the interior stratification and zero.Am I missing something in setting the BC?
Beta Was this translation helpful? Give feedback.
All reactions