Skip to content
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

Update Smagorinsky-Lilly model #1908

Merged
merged 9 commits into from
Jul 29, 2021
Merged

Update Smagorinsky-Lilly model #1908

merged 9 commits into from
Jul 29, 2021

Conversation

tomchor
Copy link
Collaborator

@tomchor tomchor commented Jul 29, 2021

Closes #1907

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

I realized that Julia's \Upsilon is pretty much identical to a Y, so I changed the docs to match the code instead

src/Oceananigans.jl Outdated Show resolved Hide resolved
@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

I made one extra change which is that I don't call N^2 / S^2 a Richardson number anymore. Since the denominator is a strain rate, not the vertical shear, I think it's odd to call it Ri. Also that variable (whatever you call it) only appears 3 times briefly so there's no need to give it a name.

It appears that our buoyancy modification doesn't really match Pressel's or Lilly's since we use an arbitrary C_b while they proposed to use 1/Pr_t. @glwagner Is there any reference for that?

@glwagner
Copy link
Member

glwagner commented Jul 29, 2021

I don't mind if we call it "Ri" or not. The Richardson number has several interpretations and formulations; one interpretation is that it generally measures the ratio between potential energy and kinetic energy in the flow (this physical interpretation motivates its use in the "stability correction" proposed by Lilly 1962). The "rate of strain definition" limits to the "typical" oceanographic definition (also the quantity that arises in Kelvin-Helmholtz instability) for parallel laminar flow.

Lilly 1962 used "Richardson number" and the symbol "Ri" to refer to this quantity:

image

For me, it's a natural generalization of the Richarsdon number that applies in unidirectional / laminar flow, so I feel it's nice notation. But not using it is ok too.

@glwagner
Copy link
Member

glwagner commented Jul 29, 2021

I made one extra change which is that I don't call N^2 / S^2 a Richardson number anymore. Since the denominator is a strain rate, not the vertical shear, I think it's odd to call it Ri. Also that variable (whatever you call it) only appears 3 times briefly so there's no need to give it a name.

It appears that our buoyancy modification doesn't really match Pressel's or Lilly's since we use an arbitrary C_b while they proposed to use 1/Pr_t. @glwagner Is there any reference for that?

I don't quite understand the question --- what would you like a reference for?

It looks like for Cb=0, the reference is the original Smagorinsky paper, whereas for Cb=1/Pr one uses the model proposed by Lilly (1962). A number in between represents something different from either --- are you wondering if there are papers out there that have used Cb other than 0 or 1/Pr? As to that I don't know.

We could change the default from Cb=1 to Cb=1/Pr or Cb=0... ? The default Pr is Pr=1 but I suppose one might inadvertently change Pr but leave Cb=1 which would lead to a different LES model than proposed by Lilly (1962).

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

I don't quite understand the question --- what would you like a reference for? C_b=0 does not use the modification term whereas C_b=1 is the model proposed by Lilly, I think...

If I understand correctly, here's Lilly's and Pressel's model formulation:
pressel

And here's our formulation:

ours

So it seems that our model has an extra degree of freedom that neither Lilly nor Pressel propose. To match their model, we'd need to set C_b = 1/Pr_t. I'm not arguing that that's a bad thing, but if we can't find a source for that then we possibly need to be more careful about how to present that to the user.

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

I made one extra change which is that I don't call N^2 / S^2 a Richardson number anymore. Since the denominator is a strain rate, not the vertical shear, I think it's odd to call it Ri. Also that variable (whatever you call it) only appears 3 times briefly so there's no need to give it a name.
It appears that our buoyancy modification doesn't really match Pressel's or Lilly's since we use an arbitrary C_b while they proposed to use 1/Pr_t. @glwagner Is there any reference for that?

I don't quite understand the question --- what would you like a reference for?

It looks like for Cb=0, the reference is the original Smagorinsky paper, whereas for Cb=1/Pr one uses the model proposed by Lilly (1962). A number in between represents something different from either --- are you wondering if there are papers out there that have used Cb other than 0 or 1/Pr? As to that I don't know.

We could change the default from Cb=1 to Cb=1/Pr or Cb=0... ? The default Pr is Pr=1 but I suppose one might inadvertently change Pr but leave Cb=1 which would lead to a different LES model than proposed by Lilly (1962).

Apparently my explanation wasn't needed! Yes, that's what I mean.

I propose we either get rid of C_b and just use 1/Pr_t or make it clear in the docs and docstring that we offer an extra degree of freedom, but that the model as proposed has C_b=1/Pr_t. I'm not sure which one is best since I do like the idea of Oceananigans allowing for easy (customization), but also that favors mistakes by un-attentive users (such as myself haha).

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

It seems like these tests are failing because they compare the LES models with some pre-computed solutions:

solution₀, Gⁿ₀, G⁻₀ = get_fields_from_checkpoint(initial_filename)

If I followed the code correctly, the LES models are looped through here:

for closure in closures
@eval begin
using Oceananigans.TurbulenceClosures: $closure
end
end

which means that those are always run with the default values. Since we're comparing with pre-computed solutions, it'd be good to explicitly specify every closure's parameters, no? The downside is that we won't be able to automatically loop through th closure like this and have to specify them by hand.

@glwagner
Copy link
Member

glwagner commented Jul 29, 2021

So it seems that our model has an extra degree of freedom that neither Lilly nor Pressel propose.

Quite! Though Lilly admits that his model amounts to "little more than a scaling argument" and that both Pr_t and the model "constant" are themselves unknown functions. So I actually think there is room to interpret Lilly as proposing a whole family of models. Since time is finite only one has been tested I guess (and also the structure of the model is questionable, so people have moved on to other formulations...)

I propose we either get rid of C_b and just use 1/Pr_t or make it clear in the docs and docstring that we offer an extra degree of freedom, but that the model as proposed has C_b=1/Pr_t. I'm not sure which one is best since I do like the idea of Oceananigans allowing for easy (customization), but also that favors mistakes by un-attentive users (such as myself haha).

Does the default Cb = 1/Pr both retain flexibility and also reduce the chances of unexpected behavior / mistakes?

If we get rid of Cb then we may want to introduce an alternative way to eliminate the buoyancy correction entirely (currently achievable with Cb=0).

A further caveat is that using 1/Pr only applies if Pr is the same for all tracers and if a linear equation of state links tracers to buoyancy. With nonlinear equations of state it's unclear what to use for Cb. I believe we also allow a different Pr for every tracer. In this case the default Cb=1/Pr will throw an error (probably a good thing, since you'd have to decide what to use for Cb in this case).

@glwagner
Copy link
Member

glwagner commented Jul 29, 2021

It seems like these tests are failing because they compare the LES models with some pre-computed solutions:

solution₀, Gⁿ₀, G⁻₀ = get_fields_from_checkpoint(initial_filename)

~If I followed the code correctly, the LES models are looped through here: ~

for closure in closures
@eval begin
using Oceananigans.TurbulenceClosures: $closure
end
end

which means that those are always run with the default values. Since we're comparing with pre-computed solutions, it'd be good to explicitly specify every closure's parameters, no? The downside is that we won't be able to automatically loop through th closure like this and have to specify them by hand.

True, we have to regenerate the test data to make this change to the default if we want to continue using the default in the regression test. As a quick fix we could change the regression test to use C=0.23.

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

Does the default Cb = 1/Pr both retain flexibility and also reduce the chances of unexpected behavior / mistakes?

If we get rid of Cb then we may want to introduce an alternative way to eliminate the buoyancy correction entirely (currently achievable with Cb=0).

A further caveat is that using 1/Pr only applies if Pr is the same for all tracers and if a linear equation of state links tracers to buoyancy. With nonlinear equations of state it's unclear what to use for Cb. I believe we also allow a different Pr for every tracer. In this case the default Cb=1/Pr will throw an error (probably a good thing, since you'd have to decide what to use for Cb in this case).

Good points. Based on these points I'd argue for us to keep things as it is but include a comment about this in the docstring / docs.

Agreed?

@glwagner
Copy link
Member

You can change the closure used in the regression test by changing this line:

for closure in (AnisotropicMinimumDissipation=1.05e-6, κ=1.46e-7), ConstantSmagorinsky=1.05e-6, κ=1.46e-7))

@tomchor
Copy link
Collaborator Author

tomchor commented Jul 29, 2021

You can change the closure used in the regression test by changing this line:

for closure in (AnisotropicMinimumDissipation=1.05e-6, κ=1.46e-7), ConstantSmagorinsky=1.05e-6, κ=1.46e-7))

Just did 2 min ago :)

@glwagner
Copy link
Member

Does the default Cb = 1/Pr both retain flexibility and also reduce the chances of unexpected behavior / mistakes?
If we get rid of Cb then we may want to introduce an alternative way to eliminate the buoyancy correction entirely (currently achievable with Cb=0).
A further caveat is that using 1/Pr only applies if Pr is the same for all tracers and if a linear equation of state links tracers to buoyancy. With nonlinear equations of state it's unclear what to use for Cb. I believe we also allow a different Pr for every tracer. In this case the default Cb=1/Pr will throw an error (probably a good thing, since you'd have to decide what to use for Cb in this case).

Good points. Based on these points I'd argue for us to keep things as it is but include a comment about this in the docstring / docs.

Agreed?

Fine by me. I also think Cb=1/Pr would be a good choice and retains current defaults.

Co-authored-by: Gregory L. Wagner <wagner.greg@gmail.com>
@tomchor tomchor merged commit 9ecddac into master Jul 29, 2021
@tomchor tomchor deleted the tc/update-smagorisnky branch July 29, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Choice of constant for the Smagorinsky model
2 participants