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

add climaparams to update_aux #974

Closed
wants to merge 1 commit into from

Conversation

costachris
Copy link
Member

Use parameter boxes in update_aux.jl and propagate down where needed

Copy link

@odunbar odunbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Costa - this looks great!
3 points.

  1. As we now do our type enforcement when we get parameter values out of the toml struct, we no longer should need any of these alpha::FT or FT(alpha(param_set)) type expressions. These can be removed so we just call alpha = param_set.alpha.
  2. For now i think it will be good practice to always give param_set a type: some are missing in e.g. entr_detr.jl function definitions.
  3. In theory we should have no calls to something like param_set.box.parameter (only ever param_set.parameter). Where these appear - this indicates that either the dispatching is off (e.g. the code should wrap the code in a new function), or maybe the parameter needs to be put in param_set - we can deal with these in a case-by-case basis offline.

@@ -1,7 +1,7 @@
#### Entrainment-Detrainment kernels

function compute_turbulent_entrainment(param_set, a_up::FT, w_up::FT, tke::FT, H_up::FT) where {FT}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param_set type here?

@@ -15,7 +15,7 @@ end
function compute_inverse_timescale(param_set, b_up::FT, b_en::FT, w_up::FT, w_en::FT, tke::FT) where {FT}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param_set type here?

@@ -25,7 +25,8 @@ end

function get_Δw(param_set, w_up::FT, w_en::FT) where {FT}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param_set type here?

molmass_ratio::FT = CPP.molmass_ratio(param_set)
vkc::FT = CPSGS.von_karman_const(param_set)
function mixing_length(param_set::EDMFPS, ml_model::MinDisspLen{FT}) where {FT}
c_m::FT = param_set.c_m
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our param_set object automatically types all the parameters into FT thus you should remove all ::FT here.

@@ -1,8 +1,8 @@
#### Non-dimensional Entrainment-Detrainment functions
function max_area_limiter(param_set, max_area, a_up)
FT = eltype(a_up)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, we already type our parameters in param_set. We should be able to remove all the FT(param_set) and just have param_set.

μ_0 = FT(CPEDMF.μ_0(param_set))
β = FT(CPEDMF.β(param_set))
χ = FT(CPEDMF.χ(param_set))
c_ε = FT(param_set.c_ε)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again can remove the FT(...)

updraft_top = compute_updraft_top(grid, state, i)
return max(updraft_top, H_up_min)
end

function compute_up_stoch_tendencies!(edmf::EDMFModel, grid::Grid, state::State, param_set::APS, surf::SurfaceBase)
function compute_up_stoch_tendencies!(edmf::EDMFModel, grid::Grid, state::State, param_set::EDMFPS, surf::SurfaceBase)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be param_set::AbstractStochasticEntrainmentClosureParameters (or some abbreviation)?

@charleskawczynski
Copy link
Member

Can we first get CP 62 in mergeable shape?

@charleskawczynski
Copy link
Member

charleskawczynski commented May 17, 2022

@trontrytel is working on internalizing / isolating TC's ClimaParameters in #1000, so we should be able to revert all of the source code changes except for the parameter boxes, and only focus on the parameter boxes in this PR.

@odunbar
Copy link

odunbar commented May 17, 2022

@charleskawczynski The internal climaparameters do not actually help us.

They are a method of going from a Hierarchical storage of CP (currently in CP) to a flat box in the code source (ICP).

The new climaparameters interface is the opposite, going from flat storage of CP (toml files) to a hierarchical deployment in the code source (Parameter boxes).

[Besides we are effectively done already]

@charleskawczynski
Copy link
Member

Superseded by #1192.

@charleskawczynski charleskawczynski deleted the cc/integrate_climaparams branch June 21, 2022 19:18
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.

3 participants