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

New version: CLIMAParameters v0.2.0 #44410

Merged
merged 1 commit into from
Sep 7, 2021

Conversation

JuliaRegistrator
Copy link
Contributor

UUID: 6eacf6c3-8458-43b9-ae03-caf5306d3d53
Repo: https://github.com/CliMA/CLIMAParameters.jl.git
Tree: 0801216ee1670a1e5280cdb0e5fda60cc4b992ca

Registrator tree SHA: c7e033175c3b9b466fb2cc8beab47042878a66b0
JuliaRegistrator referenced this pull request in CliMA/ClimaParams.jl Sep 7, 2021
54: Remove microphysics types r=charleskawczynski a=charleskawczynski

We ran into some issues as TurbulenceConvection.jl began using CLIMAParameters more heavily-- specifically with the microphysics parameters:

For planet parameters, we might use a runtime behavior like:
```julia
import CLIMAParameters
CLIMAParameters.Planet.grav(ps::AbstractEarthParameterSet) = ps.grav
```
This same approach for certain microphysics parameters is awkward:
```julia
CLIMAParameters.Planet.Microphysics.E(::AbstractLiquidParameterSet, ::AbstractRainParameterSet) = ?
```
The issue is, which struct should hold the value if we want it tuned? This seems arbitrary and generally problematic with this design.

This PR makes _all_ (microphysics) methods accept a single parameter set, and we can locally define extra helper methods to dispatch in convenient ways:

```julia
# How to add convenience methods for handling combinations

abstract type Phase end
struct Liquid <: Phase end
struct Rain   <: Phase end
struct Snow   <: Phase end

E(earth::AbstractEarthParameterSet, ::Liquid, ::Rain) = CLIMAParameters.Planet.Microphysics.E_liq_rai(earth)
E(earth::AbstractEarthParameterSet, ::Liquid, ::Snow) = CLIMAParameters.Planet.Microphysics.E_liq_sno(earth)

struct EarthParamSet <: AbstractEarthParameterSet end

earth = EarthParamSet()

# locally, in the implementation, we'll have:
E_liq_rai = E(earth, Liquid(), Rain())
E_liq_sno = E(earth, Liquid(), Snow())
```

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch September 7, 2021 23:33 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2021

Your new version pull request met all of the guidelines for auto-merging and is scheduled to be merged in the next round.


If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text [noblock] in your comment.

@JuliaTagBot JuliaTagBot merged commit 5499168 into master Sep 7, 2021
@JuliaTagBot JuliaTagBot deleted the registrator/climaparameters/6eacf6c3/v0.2.0 branch September 7, 2021 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants