GithubHelp home page GithubHelp logo

Comments (2)

white-alistair avatar white-alistair commented on July 28, 2024

This topic came up again in #128.

With a growing number of parameters and constants, in particular in relation to the parameterizations, the various structs and constantly unpacking them is becoming a bit messy.

@milankl suggested an example structure like (OUTDATED see below)

struct Constants
    time_integration::TimeConstants
    parametrization::ParametrizationConstants
end

struct ParametrizationConstants
     clouds::CloudConstants
     convection::ConvectionConstants
end

as well as, potentially, some kind of @unpack_all macro for importing a specific struct of macros into a namespace.

In addition, we need to move some numbers from the Parameters struct into the Constants struct in order to avoid type promotions: #128 (comment)

Let's use this issue to do a general overhaul of how we use parameters and constants.

from speedyweather.jl.

milankl avatar milankl commented on July 28, 2024

Picking this up again, with #241 we'll have the following

abstract type AbstractDynamicsConstants{NF} end
abstract type AbstractParameterizationConstants{NF} end

struct DynamicsConstants{NF<:AbstractFloat} <: AbstractDynamicsConstants{NF}
struct ParameterizationConstants{NF<:AbstractFloat} <: AbstractParameterizationConstants{NF}

While it sounds tempting to group both into Constants or something, i don't think it makes sense as BarotropicModel or ShallowWaterModel won't use ParameterizationConstants so we should keep them separate. I'm still in favour of the following distinction between parameters, coefficients, constants. While all are * constant * at runtime

  • parameters are user-facing, have a default value but can be changed through arguments to initialize_speedy, and define together with PrognosticVariables the model run completely.
  • coefficients are bundled parameters, to be used (mostly) within the same function/algorithm; e.g. we have the MagnusCoefficients for the calculation of saturation vapour pressure
  • constants face the dynamical core / parameterizations, are fully determined by all parameters/coefficients, may include some precalculation (e.g. the scaled time step which is not chosen directly as parameter) and conversion to a given number format.

So schematically we have

  • user -> parameters + coefficients -> constants -> dynamical core / parameterizations

from speedyweather.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.