Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRenchon committed Aug 23, 2024
1 parent 0d9ed32 commit b09d0b3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,35 @@ Note: This should be a separate page... to do, WIP
explain FT
explain AbstractModel and why, etc.

Existing Earth System Models and Land Surface Models are monolythique and the scientific community
has asked for modularity in those models for a long time, as currently making modifications in
existing models is a task requiring a lot of time and money.

ClimaLand takes advantage of Julia multiple dispatch to build a modular model.

You can find detailed explanation on Julia multiple dispatch here, but I will give a brief overview
and explain how we use it to build a modular land model in ClimaLand.

The core idea is that functions can have multiple methods depending on their arguments number or type.

For example, leaf transpiration is a function of stomatal conductance. Many models exists for stomatal conductance,
such as the Medlyn optimality model or the Ball-Berry model.

We are going to create a new type, that we call "Abstract" type because it is not a fundamental type
(Number, Real, Float, Integer...), but a subtype. For example:

```jl
abstract type AbstractStomatalConductanceModel{FT} <: AbstractModel{FT} end
abstract type MedlynConductanceModel <: AbstractStomatalConductanceModel{FT} end
abstract type BallBerryConductanceModel <: AbstractStomatalConductanceModel{FT} end
```

now, when we call the function `function leaf_transpiration(conductance::AbstractStomatalConductanceModel)`,
conductance can be either Medlyn of BallBerry.

ClimaLand does this at multiple level, for example, our AbstractCanopyModel is made of photosynthesis, conductance, hydraulics, etc.
Similarly to AbstractConductanceModel, the AbstractCanopyModel can have multiple configurations that the rest of the model can dispatch
on, without changing anything.

This approach allow us to build ClimaLand as a puzzle, where we assemble pieces of many sizes, and can swap them easily.

0 comments on commit b09d0b3

Please sign in to comment.