Skip to content

Commit

Permalink
Merge #524
Browse files Browse the repository at this point in the history
524: Cleanup - Remove unused type and repeated computations r=charleskawczynski a=charleskawczynski



Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
  • Loading branch information
bors[bot] and charleskawczynski committed Nov 5, 2021
2 parents c75eb60 + d27bd3b commit d25be1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/EDMF_Precipitation.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Computes the qr advection (down) tendency
"""
function compute_precipitation_advection_tendencies(::PrecipPhysics, grid, state, gm, TS::TimeStepping)
function compute_precipitation_advection_tendencies(grid, state, gm, TS::TimeStepping)
param_set = parameter_set(gm)
Δz = grid.Δz
Δt = TS.dt
Expand Down Expand Up @@ -67,7 +67,7 @@ end
"""
Computes the tendencies to θ_liq_ice, qt and qr due to rain evaporation
"""
function compute_precipitation_sink_tendencies(::PrecipPhysics, grid, state, gm, TS::TimeStepping)
function compute_precipitation_sink_tendencies(grid, state, gm, TS::TimeStepping)
param_set = parameter_set(gm)
Δt = TS.dt
p0_c = center_ref_state(state).p0
Expand Down
15 changes: 3 additions & 12 deletions src/Turbulence_PrognosticTKE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ end

function compute_gm_tendencies!(edmf::EDMF_PrognosticTKE, grid, state, Case, gm, TS)
tendencies_gm = center_tendencies_grid_mean(state)
parent(tendencies_gm.u) .= 0
parent(tendencies_gm.v) .= 0
parent(tendencies_gm.q_tot) .= 0
parent(tendencies_gm.θ_liq_ice) .= 0
param_set = parameter_set(gm)
prog_gm = center_prog_grid_mean(state)
aux_en = center_aux_environment(state)
Expand Down Expand Up @@ -250,21 +246,17 @@ function update(edmf::EDMF_PrognosticTKE, grid, state, gm::GridMeanVariables, Ca
compute_updraft_surface_bc(edmf, grid, state, Case)
update_aux!(edmf, gm, grid, state, Case, param_set, TS)

parent(state.tendencies) .= 0
tendencies_gm = center_tendencies_grid_mean(state)
tendencies_up = center_tendencies_updrafts(state)
tendencies_up_f = face_tendencies_updrafts(state)
tendencies_en = center_tendencies_environment(state)
tendencies_pr = center_tendencies_precipitation(state)
parent(tendencies_gm) .= 0
parent(tendencies_up) .= 0
parent(tendencies_up_f) .= 0
parent(tendencies_en) .= 0
parent(tendencies_pr) .= 0
compute_precipitation_formation_tendencies(grid, state, edmf.UpdVar, edmf.Precip, TS.dt, param_set) # causes division error in dry bubble first time step
microphysics(en_thermo, grid, state, en, edmf.Precip, TS.dt, param_set) # saturation adjustment + rain creation
if edmf.Precip.precipitation_model == "clima_1m"
compute_precipitation_sink_tendencies(edmf.PrecipPhys, grid, state, gm, TS)
compute_precipitation_advection_tendencies(edmf.PrecipPhys, grid, state, gm, TS)
compute_precipitation_sink_tendencies(grid, state, gm, TS)
compute_precipitation_advection_tendencies(grid, state, gm, TS)
end

# compute tendencies
Expand Down Expand Up @@ -472,7 +464,6 @@ function compute_updraft_tendencies(edmf::EDMF_PrognosticTKE, grid, state, gm::G
ρ0_f = face_ref_state(state).ρ0
au_lim = edmf.max_area

parent(tendencies_up) .= 0
@inbounds for i in 1:(up.n_updrafts)
aux_up[i].entr_turb_dyn .= aux_up[i].entr_sc .+ aux_up[i].frac_turb_entr
aux_up[i].detr_turb_dyn .= aux_up[i].detr_sc .+ aux_up[i].frac_turb_entr
Expand Down
6 changes: 0 additions & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ function PrecipVariables(namelist, grid::Grid)
return PrecipVariables(; precipitation_model)
end

struct PrecipPhysics end

mutable struct UpdraftVariables{A1}
n_updrafts::Int
cloud_base::A1
Expand Down Expand Up @@ -479,7 +477,6 @@ mutable struct EDMF_PrognosticTKE{A1, A2}
lambda_stab::Float64
minimum_area::Float64
Precip::PrecipVariables
PrecipPhys::PrecipPhysics
UpdVar::UpdraftVariables
EnvVar::EnvironmentVariables
EnvThermo::EnvironmentThermodynamics
Expand Down Expand Up @@ -572,8 +569,6 @@ mutable struct EDMF_PrognosticTKE{A1, A2}

# Create the class for precipitation
Precip = PrecipVariables(namelist, grid)
# Create the class for precipitation physics
PrecipPhys = PrecipPhysics()

# Create the updraft variable class (major diagnostic and prognostic variables)
UpdVar = UpdraftVariables(n_updrafts, namelist, grid)
Expand Down Expand Up @@ -692,7 +687,6 @@ mutable struct EDMF_PrognosticTKE{A1, A2}
lambda_stab,
minimum_area,
Precip,
PrecipPhys,
UpdVar,
EnvVar,
EnvThermo,
Expand Down

0 comments on commit d25be1b

Please sign in to comment.