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

Bug in vertical integrals? #1224

Closed
ilopezgp opened this issue Jul 15, 2022 · 5 comments · Fixed by #1225
Closed

Bug in vertical integrals? #1224

ilopezgp opened this issue Jul 15, 2022 · 5 comments · Fixed by #1225
Assignees
Labels
bug Something isn't working

Comments

@ilopezgp
Copy link
Contributor

ilopezgp commented Jul 15, 2022

The water paths are defined as the integrals of the corresponding specific humidity multiplied by density. They have units of [M][L]^{-2}.

It seems that the current implementation is an arithmetic sum of the grid-mean values in the column, which would mean that we are missing the product with respect to the local dz, and the result has units [M][L]^{-3}.

If this is not a bug and there is some undecipherable hidden integral in these expressions, we should still change the current implementation to something more human-readable.

cent = TC.Cent(1)
diag_svpc.lwp_mean[cent] = sum(ρ_c .* aux_gm.q_liq)
diag_svpc.iwp_mean[cent] = sum(ρ_c .* aux_gm.q_ice)
diag_svpc.rwp_mean[cent] = sum(ρ_c .* prog_pr.q_rai)
diag_svpc.swp_mean[cent] = sum(ρ_c .* prog_pr.q_sno)

@ilopezgp ilopezgp added the bug Something isn't working label Jul 15, 2022
@trontrytel
Copy link
Member

I think it's some ClimaCore magic?

This is the commit that changed it from explicitly having dz there
c7581fe

@ilopezgp
Copy link
Contributor Author

@trontrytel has found an earlier version where we did multiply by dz, following the rectangle rule of integration: https://github.com/CliMA/TurbulenceConvection.jl/blame/25457ecfbbeb030193b778f057ead1e48b17fc04/diagnostics/compute_diagnostics.jl#L160

@ilopezgp
Copy link
Contributor Author

I think it's some ClimaCore magic?

This is the commit that changed it from explicitly having dz there c7581fe

If this is not a bug, it is not great design to call an integral a sum. We should fix the notation.

@charleskawczynski
Copy link
Member

charleskawczynski commented Jul 15, 2022

We define sum over fields to be, effectively, volume integrals (see here for weighted jacobian). See CC#748 and CC#693 for existing issues to define things more precisely / correctly for what we want.

So, it's technically an issue, but (I think) it should happen to be correct at the moment.

@ilopezgp
Copy link
Contributor Author

We define sum over fields to be, effectively, volume integrals (see here for weighted jacobian). See CC#748 and CC#693 for existing issues to define things more precisely / correctly for what we want.

So, it's technically an issue, but (I think) it should happen to be correct at the moment.

Great, thank you! I will add a comment tracking this just above in the TC code. Here is the definition used, https://github.com/CliMA/ClimaCore.jl/blob/main/src/Fields/mapreduce.jl#L24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants