-
Notifications
You must be signed in to change notification settings - Fork 195
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
Variance dissipation computation #3877
base: main
Are you sure you want to change the base?
Conversation
How about TracerVarianceDissipation, omitting Computation? |
@simone-silvestri this is great! Looking forward to trying this out! One quick question: since this is a diagnostic quantity, would it make sense to include this on Oceanostics instead of Oceananigans? |
# Note: This works only if the callback is called with an IterationInterval(1), if not the | ||
# previous fluxes and velocities will not be correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually enforce this by extending the Callback
constructor
include("VarianceDissipationComputation/VarianceDissipationComputation.jl") | ||
|
||
using .VarianceDissipationComputation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include("VarianceDissipationComputation/VarianceDissipationComputation.jl") | |
using .VarianceDissipationComputation | |
include("VarianceDissipations/VarianceDissipations.jl") | |
using .VarianceDissipations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is explicitly the julia convention for modules whose primary purpose is to introduce a type
|
||
prod_names = Tuple(Symbol(:A, tracer_name, dir) for dir in dirs) | ||
diff_names = Tuple(Symbol(:D, tracer_name, dir) for dir in dirs) | ||
grad_names = Tuple(Symbol(:G, tracer_name, dir) for dir in dirs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wut
diffusive_prod = Tuple(getproperty(D, dir) for dir in dirs) | ||
grad = Tuple(getproperty(G, dir) for dir in dirs) | ||
|
||
return NamedTuple{tuple(prod_names..., diff_names..., grad_names...)}(tuple(advective_prod..., diffusive_prod..., grad...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ummm
you may have meant to write something like
names = tuple(prod_names..., diff_names..., grad_names...)
z = ZFaceField(grid) | ||
|
||
return (; x, y, z) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this help?
|
||
Vⁿ.x[i, j, k] = _diffusive_tracer_flux_x(i, j, k, grid, clo, K, Val(c_id), c, clk, fields, b) * Axᶠᶜᶜ(i, j, k, grid) | ||
Vⁿ.y[i, j, k] = _diffusive_tracer_flux_y(i, j, k, grid, clo, K, Val(c_id), c, clk, fields, b) * Ayᶜᶠᶜ(i, j, k, grid) | ||
Vⁿ.z[i, j, k] = _diffusive_tracer_flux_z(i, j, k, grid, clo, K, Val(c_id), c, clk, fields, b) * Azᶜᶜᶠ(i, j, k, grid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing @inbounds
This PR introduces a metric to compute the implicit dissipation introduced by flux form advection schemes.
This metric has been devised by @jm-c and is still subject of some tests + writeup of the method, so this PR is still very much a work in progress.