Velocity profile of channel flow case has difference with log-law #3264
Replies: 13 comments
-
Hello, Given that you probably need to specify the drag at the top and bottom (unless drag is only for roughness), also const z₁ = -1*znodes(Center,grid)[1] # Closest grid center to the bottom Let me know if that works |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply! And apologies for have not been clear. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Here are a couple of comments that come to mind when looking at your code.
This isn't the best way to define julia> grid = RectilinearGrid(CPU(), size=(64,64,64), extent=(π*H, π*H, H))
64×64×64 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo
├── Periodic x ∈ [1.54466e-16, 47.1239) regularly spaced with Δx=0.736311
├── Periodic y ∈ [1.54466e-16, 47.1239) regularly spaced with Δy=0.736311
└── Bounded z ∈ [-15.0, 0.0] regularly spaced with Δz=0.234375
julia> using Oceananigans.Grids: zspacing
julia> zspacing(1, 1, 1, grid, Center(), Center(), Center())/2 # Half the distance around a center point
0.1171875 This is clearer, and will give you the correct value even if you change the grid in the future. Note that in the call to Also note that the code above is written for the most recent Oceananigans version (for which you'll need Julia 1.9).
That said, there are things I personally would try:
@Tinydog8 @chabbymark Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@glwagner @tomchor I used to use the SGS model based on the Lagrangian-averaged scale-dependent dynamic model (LASD) (https://pubs.aip.org/aip/pof/article/17/2/025105/895722/A-scale-dependent-Lagrangian-dynamic-model-for). @tomchor is very familiar with this SGS model. The performance of the LASD close to the wall is usually good, as you can see here I guess the problem of AMD is partly solved in reference Yang et al. (2017). Now the problem is that if someone can implement this filtering in the code or not. I am stilling learning the Oceananigans and Julia. I hope that someday in the future, I am able to implement this technique. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@Tinydog8 let me know if you're ok to convert this to discussion. Here's a sketch of how to accumulate u_wall_model = XFaceField(grid, indices=(:, :, 1)) # It's purely a niceity to specify `indices` properly here --- the only thing we really need is a 2D array
# Also define other velocity components as needed
# Define drag boundary condition in terms of u_wall_model, other velocity components, etc using the `discrete_form=true`
# This function is meant to be used in a callback
function compute_wall_model_velocity!(sim)
u, v, w = sim.model.velocities
filtering_time_scale = 1.0 # seconds --- for example
ϵ = sim.Δt / filtering_time_scale
u_wm = interior(u_wall_model, :, :, 1) # extract a view to broadcast over
u_LES = interior(u, :, :, 1) # a view into the LES velocity within the first grid cell
@. u_wm = (1 - ϵ) * u_wm + ϵ * u_LES
# Compute other components as needed
return nothing
end
simulation.callbacks[:wall_model] = Callback(compute_wall_model_velocity!) An even more slick approach would build new auxiliary fields for the wall model velocities. In that case (if I'm not mistaken), then the wall model velocities are accessible from the argument to the boundary condition function (and don't have to be referenced as global variables). |
Beta Was this translation helpful? Give feedback.
-
@glwagner if this works (i.e. if AMD with this change indeed reproduces the log-law better) this would make a pretty cool example for the docs. |
Beta Was this translation helpful? Give feedback.
-
We can put it on the list though I'd be hesitant to move too quickly because our docs will probably be getting a lot heavier in the near future with sphere examples, and examples with more complex bathymetry. Perhaps you can make the tilted bottom boundary layer 3D and add it into that one, so we don't pay the price of a new independent example? |
Beta Was this translation helpful? Give feedback.
-
Is this still an issue? Should we convert this to a discussion? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay! Yes, that is still a problem and you can convert this to a discussion. I will try to use higher order advcetion scheme later. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Hey @Tinydog8, |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I have met some strange things in a simple channel flow case, the velocity profile is larger than the log-low profile, and the momentum flux of the second and third points are obviously lower than bottom boundary condition (or other point near the bottom boundary). The code is written below, what causes this difference?
Beta Was this translation helpful? Give feedback.
All reactions