-
Notifications
You must be signed in to change notification settings - Fork 78
Conversation
@jkozdon's comment that the "sums should be integral approximations (involving quadrature weights and jacobian determinants)" still applies. That is hopefully easier to implement now. |
Codecov Report
@@ Coverage Diff @@
## master #508 +/- ##
==========================================
+ Coverage 68.02% 71.15% +3.13%
==========================================
Files 82 83 +1
Lines 5620 5814 +194
==========================================
+ Hits 3823 4137 +314
+ Misses 1797 1677 -120
Continue to review full report at Codecov.
|
will try it between later today and tomorrow and let you. Thanks for making this a module! |
examples/DGmethods/ex_001_dycoms.jl
Outdated
H = Rm_sfc * T_sfc / grav; | ||
p = P_sfc * exp(-xvert/H); | ||
#Density, Temperature | ||
TS = LiquidIcePotTempSHumEquil_no_ρ(θ_liq, q_pt, p) |
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 will need to be updated after PR #506 is merged. @charleskawczynski can help.
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.
Is it possible to get density here and pass it in? Or do we need a LiquidIcePotTempSHumEquil_given_pressure(θ_liq, q_pt, p)
constructor? I tried looking into this recently and ran into some problems with the equations.
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.
If you can get T
from theta_l
and q_t
using your functions then you can get rho
from the equation of state using p
and T
as I do below in my matlab script (@tapios please, confirm that the operations below would be correct here):
`p = p_sfc * exp(-z / H)
%Exner
exner = (p / p_sfc)^(R_d/cp_d);
%T, Tv
T = exner*theta_liq + Lv0 * q_liq / (cpm*exner);
%Density
rho = p/(Rm*T);
`
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.
If you can get
T
fromtheta_l
andq_t
using your functions then you can getrho
from the equation of state usingp
andT
as I do below in my matlab script (@tapios please, confirm that the operations below would be correct here):`p = p_sfc * exp(-z / H) %Exner exner = (p / p_sfc)^(R_d/cp_d);
This looks ok.
%T, Tv
T = exnertheta_liq + Lv0 * q_liq / (cpmexner);
The second term should not be divided by the Exner function: Just
T = exner*theta_liq + Lv0 * q_liq / (cpm);
(I put the derivations in the design docs; please refer to those.)
@charleskawczynski I think providing a function LiquidIcePotTempSHumEquil_given_pressure(θ_liq, q_pt, p)
would be useful. In essence, this is how @smarras79 is calculating T
.
%Density
rho = p/(Rm*T);
`
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.
Just for reference, we'll have to use LiquidIcePotTempSHumNonEquil_given_pressure
for now until we come up with a consistent constructor for an equilibrium phase.
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 driver is now outdated and needs to be replaced with the currently running one.
Perfect. We speak tomorrow.
On Mon, Nov 4, 2019 at 8:06 PM Tapio Schneider ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In examples/DGmethods/ex_001_dycoms.jl
<#508 (comment)>:
> - #Temperature
- T = exner_dry*θ_liq + LH_v0*q_liq/(cpm*exner_dry);
- #Density
- ρ = P/(Rm*T);
- #Potential Temperature
- θv = virtual_pottemp(T, P, q_pt)
- # energy definitions
- u, v, w = DT(7), DT(-5.5), DT(0)
- U = ρ * u
- V = ρ * v
- W = ρ * w
- e_kin = DT(1//2) * (u^2 + v^2 + w^2)
+ H = Rm_sfc * T_sfc / grav;
+ p = P_sfc * exp(-xvert/H);
+ #Density, Temperature
+ TS = LiquidIcePotTempSHumEquil_no_ρ(θ_liq, q_pt, p)
This will need to be updated after PR #506
<#506> is merged.
@charleskawczynski <https://github.com/charleskawczynski> can help.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#508>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALBNJHJ3SDKMVH23ZX22MULQSDBIFANCNFSM4JG3SJ3Q>
.
--
Please, forgive the typos , I am writing from my phone!
|
src/Diagnostics/Diagnostics.jl
Outdated
|
||
e_int = e̅_tot - 1//2 * (u̅^2 + v̅^2 + w̅^2) - grav * zvals[k,ev] | ||
|
||
ts = PhaseEquil(convert(FT, e_int), q̅_tot, state.ρ) |
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.
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.
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.
Yep, those are the correct structs.
b6fb65d
to
f31d71a
Compare
b6fb65d
to
2c7754d
Compare
25a7df6
to
9ce88cf
Compare
src/Diagnostics/Diagnostics.jl
Outdated
u̅ = state.ρu[1] / state.ρ | ||
v̅ = state.ρu[2] / state.ρ | ||
w̅ = state.ρu[3] / state.ρ | ||
q̅_tot = state.moisture.ρq_tot / state.ρ | ||
ũ = ha.ρu / ha.ρ | ||
ṽ = ha.ρv / ha.ρ | ||
w̃ = ha.ρw / ha.ρ | ||
ẽ = ha.e_tot / ha.ρ | ||
q̃_tot = ha.ρq_tot / ha.ρ | ||
|
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.
I would suggest changing the notation to avoid confusion. The tilde and overbar look too similar and can lead to coding mistakes.
For example:
mean u --> \underline{u}
instantaneous u: --> u
fluctuation of u: --> \tilde{u}
or anything that clearly distinguishes each quantity
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.
I don't have a preference -- your thoughts @akshaysridhar?
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.
Agree with instantaneous u: --> u
, this affects 185 to 188
and quantities dependent on these variables. Fluctuating quantities seem fine with \prime
to me. No preference for the rest.
baebf28
to
1e2d9cd
Compare
src/Diagnostics/diagnostic_vars.jl
Outdated
z::FT | ||
# state and functions of state | ||
u::FT | ||
v::FT | ||
w::FT | ||
q_tot::FT | ||
e_tot::FT | ||
q_liq::FT | ||
θ::FT | ||
θ_liq::FT | ||
θ_v::FT | ||
e_int::FT | ||
# vertical fluxes | ||
w′ρ′::FT | ||
w′u′::FT | ||
w′v′::FT | ||
w′q_tot′::FT | ||
w′q_liq′::FT | ||
w′q_vap′::FT | ||
w′θ′::FT | ||
w′θ_v′::FT | ||
w′θ_liq′::FT | ||
# variances | ||
u′u′::FT | ||
v′v′::FT | ||
w′w′::FT | ||
# skewness | ||
w′w′w′::FT |
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.
Although we use symbols within the main clima code, it would be better to not use symbols for the variables that are written to file.
Not every user may be able to use symbols when calling @kpamnany 's new graph_diagnostics.jl from the command line
(Notice the graph_diagnostics.jl is passed the list of variables to be plotted:
>> julia graph_diagnostics.jl <diagnostic_file.jld2> <diagnostic_name>
where
is a list of the variables to be plotted.
In atmospheric software packages we usually find a combination of short and sometime full names such as:
"TH", "Potential temperature"
"THV", "Virtual potential temperature"
"PRS", "Pressure"
"rho", "Air density"
"qv", "Water vapor mixing ration"
etc. (these are examples from CM1 by Bryan, but they all more or less use a similar convention)
Bottom line, I would totally avoid greek symbols to name the diagnostic variables.
Suggestions (@kpamnany @akshaysridhar @tapios):
<w′θ′>
--> vert_eddy_heat_flx
<wθ>
--> vert_heat_flx
<w′q_tot>′
--> vert_eddy_qt_flx
<wq_tot>
--> vert_qt_flx
<u′u′>
--> uvariance
<u′u′>
--> vvariance
<w′w′>
--> wvariance
<w′u′>
--> vert_eddy_u_flx
<w′u′>
--> vert_eddy_v_flx
etc.
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.
Added altvars_diagnostic
, as a mirror of vars_diagnostic
, with some of the changes suggested here. If you give me a full list of what you'd like changed, I'll make the changes and then update graph_diagnostic.jl
to use altvars_diagnostic
instead, which will allow you to use non-unicode names in post-processing while still allowing the CLIMA code to use unicode.
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.
Not to make this go back and forth but, I think a better solution here would be to write mapping functions for each symbol/expression, and calls to print/show can be intercepted by the mapping funcs, instead of having two structs of the same thing.
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.
Or use something like:
struct VerboseName{T} end
VerboseName(T) = VerboseName{T}()
nice_name(::VerboseName{:θ}) = :theta
nice_name(::VerboseName{:e_int}) = :e_int
struct Foo{FT}
θ::FT
e_int::FT
end
nice_names(f::Foo) = nice_name.(VerboseName.(fieldnames(typeof(f))))
f = Foo(1.0,2.0)
@show nice_names(f)
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.
Agreed. In the diagnostics issue, I outlined what we’ll need in the end: a table that defines short and verbose names for the output fields, and units, to be able to generate self-documenting output. Short names will be variable names in files. May not need to be now, but that’s where we’ll need to go eventually.
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.
Having primes etc. in the code is fine for now though. I wouldn’t go through the trouble to create more conventional variable names in the code right now.
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.
I'll just switch to the conventional variable names now, since we want to do that anyway.
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.
I'll just switch to the conventional variable names now, since we want to do that anyway.
If by conventional you mean the long names @smarras79 suggested, my take is that is not needed right now. There are no general conventions for the names, and your primed notation had the advantage of clarity for now. Most importantly, it think it would be good to get this merged, and then we can refine.
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.
Simone has been working with a modified version of this code with plain text names due to difficulties with specifying the Unicode names we're using. I've just switched to his version; not a difficult thing. I agree on getting this merged ASAP!
1e2d9cd
to
9af3659
Compare
9af3659
to
fc7b168
Compare
01b3fd7
to
26053a1
Compare
@simonbyrne: this is good to go. |
bors r+ |
508: Diagnostics module r=simonbyrne a=kpamnany Refactored implementation of the diagnostics prototyped in #467. This introduces the first version of an infrastructure for gathering diagnostics on the DG grid and moves the diagnostics implemented in #467 onto that infrastructure. It also moves the code into a CLIMA module. Diagnostics gathering is still triggered by the callback mechanism (and must be registered in the driver) until the proper timestepping mechanism is implemented. Output is to JLD2 and `VariableTemplates` can be used with the help of the `*_vars.jl` files introduced here for ease in post-processing. In future PRs: - More abstraction and integration with Oceananigans diagnostics - Reducing MPI communication @slifer50 and @smarras79: please check the output for correctness relative to the previous PR. Cc: @tapios, @sandreza, @christophernhill, @blallen, @glwagner Co-authored-by: Kiran Pamnany <kpamnany@gmail.com>
Build failed |
26053a1
to
3c07aba
Compare
bors r+ |
508: Diagnostics module r=kpamnany a=kpamnany Refactored implementation of the diagnostics prototyped in #467. This introduces the first version of an infrastructure for gathering diagnostics on the DG grid and moves the diagnostics implemented in #467 onto that infrastructure. It also moves the code into a CLIMA module. Diagnostics gathering is still triggered by the callback mechanism (and must be registered in the driver) until the proper timestepping mechanism is implemented. Output is to JLD2 and `VariableTemplates` can be used with the help of the `*_vars.jl` files introduced here for ease in post-processing. In future PRs: - More abstraction and integration with Oceananigans diagnostics - Reducing MPI communication @slifer50 and @smarras79: please check the output for correctness relative to the previous PR. Cc: @tapios, @sandreza, @christophernhill, @blallen, @glwagner Co-authored-by: Kiran Pamnany <kpamnany@gmail.com>
Build failed |
… the state array as well as some notable second moments average along the horizontal plane for each vertical level Refactored into CLIMA.Diagnostics. Add template for post-processing and graphing diagnostics output. Add test case. Support multiple ranks.
3c07aba
to
d0c81ec
Compare
bors r+ |
508: Diagnostics module r=kpamnany a=kpamnany Refactored implementation of the diagnostics prototyped in #467. This introduces the first version of an infrastructure for gathering diagnostics on the DG grid and moves the diagnostics implemented in #467 onto that infrastructure. It also moves the code into a CLIMA module. Diagnostics gathering is still triggered by the callback mechanism (and must be registered in the driver) until the proper timestepping mechanism is implemented. Output is to JLD2 and `VariableTemplates` can be used with the help of the `*_vars.jl` files introduced here for ease in post-processing. In future PRs: - More abstraction and integration with Oceananigans diagnostics - Reducing MPI communication @slifer50 and @smarras79: please check the output for correctness relative to the previous PR. Cc: @tapios, @sandreza, @christophernhill, @blallen, @glwagner Co-authored-by: Kiran Pamnany <kpamnany@gmail.com>
Build succeeded
|
Refactored implementation of the diagnostics prototyped in #467.
This introduces the first version of an infrastructure for gathering diagnostics on the DG grid and moves the diagnostics implemented in #467 onto that infrastructure. It also moves the code into a CLIMA module.
Diagnostics gathering is still triggered by the callback mechanism (and must be registered in the driver) until the proper timestepping mechanism is implemented.
Output is to JLD2 and
VariableTemplates
can be used with the help of the*_vars.jl
files introduced here for ease in post-processing.In future PRs:
@slifer50 and @smarras79: please check the output for correctness relative to the previous PR.
Cc: @tapios, @sandreza, @christophernhill, @blallen, @glwagner