diff --git a/docs/src/PlotReferenceStates.jl b/docs/src/PlotReferenceStates.jl index 81fdfb79d..10686a6cb 100644 --- a/docs/src/PlotReferenceStates.jl +++ b/docs/src/PlotReferenceStates.jl @@ -29,7 +29,7 @@ function export_ref_profile(case_name::String) aux = CC.Fields.FieldVector(cent = aux_cent_fields, face = aux_face_fields) state = (; aux) - TC.compute_ref_state!(state, grid, param_set, Stats; ref_params...) + TC.compute_ref_state!(state, grid, param_set; ref_params...) io_nt = TC.io_dictionary_ref_state(state) TC.initialize_io(io_nt, Stats) diff --git a/integration_tests/utils/main.jl b/integration_tests/utils/main.jl index 0e4f14239..abb49e5be 100644 --- a/integration_tests/utils/main.jl +++ b/integration_tests/utils/main.jl @@ -94,6 +94,7 @@ cent_aux_vars_edmf(FT, n_up) = (; q_liq = FT(0), q_ice = FT(0), T = FT(0), + cloud_fraction = FT(0), ), up = ntuple(i -> cent_aux_vars_up(FT), n_up), en = (; @@ -210,7 +211,7 @@ function Simulation1d(namelist) state = State(prog, aux, tendencies, diagnostics) - TC.compute_ref_state!(state, grid, param_set, Stats; ref_params...) + TC.compute_ref_state!(state, grid, param_set; ref_params...) io_nt = (; ref_state = TC.io_dictionary_ref_state(state), diff --git a/src/ReferenceState.jl b/src/ReferenceState.jl index 33920947f..db15deb66 100644 --- a/src/ReferenceState.jl +++ b/src/ReferenceState.jl @@ -6,8 +6,7 @@ compute_ref_state!( state, grid::Grid, - param_set::PS, - Stats::NetCDFIO_Stats; + param_set::PS; Pg::FT, Tg::FT, qtg::FT, @@ -18,17 +17,8 @@ TODO: add better docs once the API converges The reference profiles, given - `grid` the grid - `param_set` the parameter set - - `Stats` the NC file handler struct """ -function compute_ref_state!( - state, - grid::Grid, - param_set::PS, - Stats::NetCDFIO_Stats; - Pg::FT, - Tg::FT, - qtg::FT, -) where {PS, FT} +function compute_ref_state!(state, grid::Grid, param_set::PS; Pg::FT, Tg::FT, qtg::FT) where {PS, FT} p0_c = center_ref_state(state).p0 ρ0_c = center_ref_state(state).ρ0 diff --git a/src/Turbulence_PrognosticTKE.jl b/src/Turbulence_PrognosticTKE.jl index 6c3166d51..4139294fe 100755 --- a/src/Turbulence_PrognosticTKE.jl +++ b/src/Turbulence_PrognosticTKE.jl @@ -12,7 +12,7 @@ function update_cloud_frac(edmf::EDMF_PrognosticTKE, grid, state, gm::GridMeanVa a_up_bulk = aux_tc.bulk.area @inbounds for k in real_center_indices(grid) # update grid-mean cloud fraction and cloud cover aux_gm.cloud_fraction[k] = - aux_en.area[k] * aux_en.cloud_fraction[k] + a_up_bulk[k] * edmf.UpdVar.cloud_fraction[k] + aux_en.area[k] * aux_en.cloud_fraction[k] + a_up_bulk[k] * aux_tc.bulk.cloud_fraction[k] end gm.cloud_cover = min(edmf.EnvVar.cloud_cover + sum(edmf.UpdVar.cloud_cover), 1) end diff --git a/src/diagnostics.jl b/src/diagnostics.jl index 8cc9e6b9b..85d09a2c1 100644 --- a/src/diagnostics.jl +++ b/src/diagnostics.jl @@ -112,6 +112,8 @@ function io_dictionary_aux(state) "qr_mean" => (; dims = ("zc", "t"), group = "profiles", field = center_prog_precipitation(state).qr), + "updraft_cloud_fraction" => (; dims = ("zc", "t"), group = "profiles", field = center_aux_turbconv(state).bulk.cloud_fraction), + ) return io_dict end diff --git a/src/io.jl b/src/io.jl index 962360148..12941b6d9 100644 --- a/src/io.jl +++ b/src/io.jl @@ -63,7 +63,6 @@ function io(precip::PrecipVariables, grid, state, Stats::NetCDFIO_Stats) end function initialize_io(up::UpdraftVariables, Stats::NetCDFIO_Stats) - add_profile(Stats, "updraft_cloud_fraction") add_ts(Stats, "updraft_cloud_cover") add_ts(Stats, "updraft_cloud_base") @@ -74,7 +73,6 @@ function initialize_io(up::UpdraftVariables, Stats::NetCDFIO_Stats) end function io(up::UpdraftVariables, grid, state, Stats::NetCDFIO_Stats) - write_profile(Stats, "updraft_cloud_fraction", up.cloud_fraction) # Note definition of cloud cover : each updraft is associated with a cloud cover equal to the maximum # area fraction of the updraft where ql > 0. Each updraft is assumed to have maximum overlap with respect to # itup (i.e. no consideration of tilting due to shear) while the updraft classes are assumed to have no overlap diff --git a/src/types.jl b/src/types.jl index d8502af98..bf537ecd1 100644 --- a/src/types.jl +++ b/src/types.jl @@ -221,7 +221,6 @@ end mutable struct UpdraftVariables{A1} n_updrafts::Int - cloud_fraction::A1 cloud_base::A1 cloud_top::A1 cloud_cover::A1 @@ -232,8 +231,6 @@ mutable struct UpdraftVariables{A1} n_updrafts = nu # cloud and precipitation diagnostics for output - cloud_fraction = center_field(grid) - cloud_base = zeros(nu) cloud_top = zeros(nu) cloud_cover = zeros(nu) @@ -242,8 +239,8 @@ mutable struct UpdraftVariables{A1} lwp = 0.0 iwp = 0.0 - A1 = typeof(cloud_fraction) - return new{A1}(n_updrafts, cloud_fraction, cloud_base, cloud_top, cloud_cover, updraft_top, lwp, iwp) + A1 = typeof(cloud_base) + return new{A1}(n_updrafts, cloud_base, cloud_top, cloud_cover, updraft_top, lwp, iwp) end end diff --git a/src/update_aux.jl b/src/update_aux.jl index dd03d72ba..9c773c007 100644 --- a/src/update_aux.jl +++ b/src/update_aux.jl @@ -163,10 +163,11 @@ function update_aux!(edmf, gm, grid, state, Case, param_set, TS) aux_tc.bulk.RH[k] = aux_gm.RH[k] # TODO - here we are using previous timestep values aux_tc.bulk.T[k] = aux_gm.T[k] # TODO - here we are using previous timestep values end - if TD.has_condensate(aux_tc.bulk.q_liq[k] + aux_tc.bulk.q_ice[k]) && a_bulk_c > 1e-3 - up.cloud_fraction[k] = 1.0 + has_condensate = TD.has_condensate(aux_tc.bulk.q_liq[k] + aux_tc.bulk.q_ice[k]) + aux_tc.bulk.cloud_fraction[k] = if has_condensate && a_bulk_c > 1e-3 + 1 else - up.cloud_fraction[k] = 0.0 + 0 end val1 = 1 / (1 - a_bulk_c)