@@ -185,8 +185,8 @@ foreach_gs_tracer(f::F, Y_or_similar_values...) where {F} =
185
185
Computes a smooth, monotonic weight function `w(a)` that ranges from 0 to 1.
186
186
187
187
This function is used as the interpolation weight in the regularized `specific`
188
- function. It ensures a numerically stable and smooth transition between a subgrid-scale
189
- (SGS) quantity and its grid-mean counterpart, especially when the SGS area fraction `a`
188
+ function. It ensures a numerically stable and smooth transition between a subgrid-scale
189
+ (SGS) quantity and its grid-mean counterpart, especially when the SGS area fraction `a`
190
190
is small.
191
191
192
192
**Key Properties:**
@@ -195,7 +195,7 @@ is small.
195
195
- `w(a_half) = 0.5`.
196
196
- The function is continuously differentiable, with derivatives equal to zero at
197
197
`a = 0` and `a = 1`, which ensures smooth blending.
198
- - The functions grows very rapidly near `a = a_half`, and grows very slowly at all other
198
+ - The functions grows very rapidly near `a = a_half`, and grows very slowly at all other
199
199
values of `a`.
200
200
- For small `a_half`, the weight rapidly approaches 1 for values of `a` that are
201
201
a few times larger than `a_half`.
@@ -210,7 +210,7 @@ constructed in two main steps to satisfy the key properties:
210
210
2. **Midpoint Control**: To ensure the function passes through the control point
211
211
`(a_half, 0.5)`, the input `a` is first transformed by a specially designed
212
212
power function (`1 - (1 - a)^k`) before being passed to the bounded sigmoid.
213
- This transformation maps `a_half` to `0.5` while preserving differentiability
213
+ This transformation maps `a_half` to `0.5` while preserving differentiability
214
214
at the boundaries.
215
215
216
216
Arguments:
@@ -246,11 +246,11 @@ draft_sum(f, sgsʲs) = unrolled_sum(f, sgsʲs)
246
246
"""
247
247
ᶜenv_value(grid_scale_value, f_draft, gs, turbconv_model)
248
248
249
- Computes the value of a quantity `ρaχ` in the environment subdomain by subtracting
249
+ Computes the value of a quantity `ρaχ` in the environment subdomain by subtracting
250
250
the sum of its values in all draft subdomains from the grid-scale value. Available
251
251
for general variables in PrognosticEDMFX and environmental area (ᶜρa⁰) in DiagnosticEDMFX.
252
252
253
- This is based on the domain decomposition principle for density-area weighted
253
+ This is based on the domain decomposition principle for density-area weighted
254
254
quantities: `GridMean(ρχ) = Env(ρaχ) + Sum(Drafts(ρaχ))`.
255
255
256
256
The function handles both PrognosticEDMFX and DiagnosticEDMFX models:
@@ -315,21 +315,7 @@ function ᶜspecific_env_value(::Val{χ_name}, Y, p) where {χ_name}
315
315
ᶜρa⁰ = @. lazy (ρa⁰ (Y. c. ρ, Y. c. sgsʲs, turbconv_model))
316
316
317
317
elseif turbconv_model isa DiagnosticEDMFX || turbconv_model isa EDOnlyEDMFX
318
- ᶜχʲs = getproperty (p. precomputed, Symbol (:ᶜ , χ_name, :ʲs ))
319
- n = n_mass_flux_subdomains (turbconv_model)
320
-
321
- # Σ ρaʲ * χʲ
322
- ᶜρaχʲs_sum = p. scratch. ᶜtemp_scalar_3
323
- @. ᶜρaχʲs_sum = 0
324
- for j in 1 : n
325
- ᶜρaʲ = p. precomputed. ᶜρaʲs.:($ j)
326
- ᶜχʲ = ᶜχʲs.:($ j)
327
- @. ᶜρaχʲs_sum += ᶜρaʲ * ᶜχʲ
328
- end
329
-
330
- ᶜρaχ⁰ = @. lazy (ᶜρχ - ᶜρaχʲs_sum)
331
- # Denominator: ρa⁰ = ρ - Σ ρaʲ, assume ᶜρa⁰ = ρ
332
- ᶜρa⁰ = Y. c. ρ
318
+ error (" Not implemented. You should use grid mean values." )
333
319
end
334
320
335
321
return @. lazy (specific (
@@ -414,9 +400,9 @@ Computes the specific moist static energy (`mse`) in the environment (`mse⁰`).
414
400
415
401
This is a specialized helper function because `mse` is not a grid-scale prognostic
416
402
variable. It first computes the grid-scale moist static energy density (`ρmse`)
417
- from other grid-scale quantities (`ρ`, total specific enthalpy `h_tot`, specific
418
- kinetic energy `K`). It then uses the `ᶜenv_value` helper to compute the environment's
419
- portion of `ρmse` and `ρa` via domain decomposition, and finally calculates the specific
403
+ from other grid-scale quantities (`ρ`, total specific enthalpy `h_tot`, specific
404
+ kinetic energy `K`). It then uses the `ᶜenv_value` helper to compute the environment's
405
+ portion of `ρmse` and `ρa` via domain decomposition, and finally calculates the specific
420
406
value using the regularized `specific` function.
421
407
422
408
Arguments:
473
459
Computes the environment vertical velocity `u₃⁰`.
474
460
475
461
This function calculates the environment's total vertical momentum (`ρa⁰u₃⁰`) and
476
- its total area-weighted density (`ρa⁰`) using the domain decomposition principle
477
- (GridMean = Env + Sum(Drafts)). It then computes the final specific velocity `u₃⁰`
478
- using the regularized `specific` function to ensure numerical stability when the
462
+ its total area-weighted density (`ρa⁰`) using the domain decomposition principle
463
+ (GridMean = Env + Sum(Drafts)). It then computes the final specific velocity `u₃⁰`
464
+ using the regularized `specific` function to ensure numerical stability when the
479
465
environment area fraction `a⁰` is small.
480
466
481
467
Arguments:
@@ -499,7 +485,7 @@ u₃⁰(ρaʲs, u₃ʲs, ρ, u₃, turbconv_model) = specific(
499
485
A wrapper for Julia's `mapreduce` function that automatically determines
500
486
the initial value (`init`) for the reduction.
501
487
502
- This is useful for iterators whose elements are custom structs or
488
+ This is useful for iterators whose elements are custom structs or
503
489
`ClimaCore.Geometry.AxisTensor`s, where the zero element cannot be inferred
504
490
as a simple scalar. It uses `ClimaCore.RecursiveApply` tools (`rzero`,
505
491
`rpromote_type`) to create a type-stable, correctly-structured zero element
@@ -523,7 +509,7 @@ Computes the dot product of two `Tuple`s (`a` and `b`) using a recursive,
523
509
manually unrolled implementation.
524
510
525
511
This function is designed to be type-stable and efficient for CUDA kernels,
526
- where standard `mapreduce` implementations can otherwise suffer from type-inference
512
+ where standard `mapreduce` implementations can otherwise suffer from type-inference
527
513
failures.
528
514
529
515
It uses `ClimaCore.RecursiveApply` operators (`⊞` for addition, `⊠` for
0 commit comments