Open ali-ramadhan opened 1 month ago
Hmmm, I think the issue is that nothing happens with the parameters
in convert_diffusivity
if discrete_form = false
.
Looks like it isn't actually supported. We'd need a ContinuousDiffusionFunction
or something like that.
Ah less a bug and more a feature request then. I can clarify what's supported in the docstring. Can always just use the discrete form.
What's needed is something like
struct ContinuousDiffusionFunction{F, P}
func :: F
parameters :: P
end
@inline (K::ContinuousDiffusionFunction)(x, y, z, t) = K.func(x, y, z, t, K.parameters)
@inline function convert_diffusivity(FT, κ; discrete_form=false, loc=(nothing, nothing, nothing), parameters=nothing)
if discrete_form
return DiscreteDiffusionFunction(κ; loc, parameters)
elseif isnothing(parameters)
return ContinuousDiffusionFunction(κ, parameters)
else
return κ
end
end
I think anyways. reduced dimensionality grids may be different
I guess to have a continuous diffusion function that has the same features of the discrete version (with field dependency and parameters), we could implement something very similar to the ContinuousForcing.
That would require a regularization.
Pretty sure what I wrote will work. May need adapt
as well.
I believe the below MWE should work according to the
ScalarDiffusivity
docstring, but from the error it seems to be expectingfunky_diffusion(x, y, z, t)
instead offunky_diffusion(x, y, z, t, p)
.https://github.com/CliMA/Oceananigans.jl/blob/fe056fb44ce7173ce9e7eaa4f5c349d6ee2b61a4/src/TurbulenceClosures/turbulence_closure_implementations/scalar_diffusivity.jl#L12-L67
MWE:
Error: