Skip to content

Commit de2fd48

Browse files
authored
Avoid use of at-doc macro inside structs (#642)
In Julia v1.13, using at-doc inside struct to attach the docstring to an inner constructor causes an extra hidden field to be added to the struct itself, due to macro expansion rules. Doesn't look like this is going to be changed upstream, so we have to work around it: luckily the fix is backward compatible, we only lose the convenience of having the docstring right above the constructor definition.
1 parent 34ea2e2 commit de2fd48

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

src/Microphysics/bulk_microphysics.jl

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,39 @@ AtmosphereModels.negative_moisture_correction(bμp::BulkMicrophysics) = bμp.neg
4141

4242
Base.summary(::BulkMicrophysics) = "BulkMicrophysics"
4343

44-
struct NonEquilibriumCloudFormation{L, I}
45-
liquid :: L
46-
ice :: I
44+
"""
45+
NonEquilibriumCloudFormation(liquid, ice=nothing)
4746
48-
@doc"""
49-
NonEquilibriumCloudFormation(liquid, ice=nothing)
47+
A cloud formation scheme where cloud liquid and ice are prognostic variables
48+
that evolve via condensation/evaporation and deposition/sublimation tendencies,
49+
rather than being diagnosed instantaneously via saturation adjustment.
5050
51-
A cloud formation scheme where cloud liquid and ice are prognostic variables
52-
that evolve via condensation/evaporation and deposition/sublimation tendencies,
53-
rather than being diagnosed instantaneously via saturation adjustment.
51+
The condensation/evaporation and deposition/sublimation tendencies are commonly modeled as **relaxation toward
52+
saturation** with timescale `τ_relax`, including a latent-heat (psychrometric/thermal) correction factor; see
53+
[Morrison and Grabowski (2008)](@cite Morrison2008novel), Appendix Eq. (A3), and standard cloud microphysics
54+
texts such as [Pruppacher and Klett (2010)](@cite pruppacher2010microphysics) or
55+
[Rogers and Yau (1989)](@cite rogers1989short).
5456
55-
The condensation/evaporation and deposition/sublimation tendencies are commonly modeled as **relaxation toward
56-
saturation** with timescale `τ_relax`, including a latent-heat (psychrometric/thermal) correction factor; see
57-
[Morrison and Grabowski (2008)](@cite Morrison2008novel), Appendix Eq. (A3), and standard cloud microphysics
58-
texts such as [Pruppacher and Klett (2010)](@cite pruppacher2010microphysics) or
59-
[Rogers and Yau (1989)](@cite rogers1989short).
57+
For some bulk schemes (e.g. the CloudMicrophysics 1M extension), `liquid` and `ice` may be set to `nothing`
58+
and used purely as **phase indicators** (warm-phase vs mixed-phase), with any relaxation timescales sourced
59+
from the scheme's precipitation/category parameters instead.
6060
61-
For some bulk schemes (e.g. the CloudMicrophysics 1M extension), `liquid` and `ice` may be set to `nothing`
62-
and used purely as **phase indicators** (warm-phase vs mixed-phase), with any relaxation timescales sourced
63-
from the scheme's precipitation/category parameters instead.
61+
# Fields
62+
- `liquid`: Parameters for cloud liquid (contains relaxation timescale `τ_relax`)
63+
- `ice`: Parameters for cloud ice (contains relaxation timescale `τ_relax`), or `nothing` for warm-phase only
6464
65-
# Fields
66-
- `liquid`: Parameters for cloud liquid (contains relaxation timescale `τ_relax`)
67-
- `ice`: Parameters for cloud ice (contains relaxation timescale `τ_relax`), or `nothing` for warm-phase only
65+
# References
6866
69-
# References
67+
* Morrison, H. and Grabowski, W. W. (2008). A novel approach for representing ice
68+
microphysics in models: Description and tests using a kinematic framework.
69+
J. Atmos. Sci., 65, 1528–1548. https://doi.org/10.1175/2007JAS2491.1
70+
* Pruppacher, H. R. and Klett, J. D. (2010). Microphysics of Clouds and Precipitation (2nd ed.).
71+
* Rogers, R. R. and Yau, M. K. (1989). A Short Course in Cloud Physics (3rd ed.).
72+
"""
73+
struct NonEquilibriumCloudFormation{L, I}
74+
liquid :: L
75+
ice :: I
7076

71-
* Morrison, H. and Grabowski, W. W. (2008). A novel approach for representing ice
72-
microphysics in models: Description and tests using a kinematic framework.
73-
J. Atmos. Sci., 65, 1528–1548. https://doi.org/10.1175/2007JAS2491.1
74-
* Pruppacher, H. R. and Klett, J. D. (2010). Microphysics of Clouds and Precipitation (2nd ed.).
75-
* Rogers, R. R. and Yau, M. K. (1989). A Short Course in Cloud Physics (3rd ed.).
76-
"""
7777
function NonEquilibriumCloudFormation(liquid, ice=nothing)
7878
return new{typeof(liquid), typeof(ice)}(liquid, ice)
7979
end

0 commit comments

Comments
 (0)