Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRenchon committed Aug 30, 2024
1 parent f1582bd commit db08951
Showing 1 changed file with 7 additions and 78 deletions.
85 changes: 7 additions & 78 deletions docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

### Installation

Installing ClimaLand in Julia is very easy. First, download and install Julia
by following the instructions at [https://julialang.org/downloads/](https://julialang.org/downloads/).
Then, you can add the ClimaLand package by simply doing:
First, download and install Julia by following the instructions at [https://julialang.org/downloads/](https://julialang.org/downloads/).
Then, you can install the ClimaLand package by doing:

```julia
julia> ] # Enter Package REPL mode
Expand All @@ -17,7 +16,7 @@ Julia> using ClimaLand

### Parameterisation

Let's start with an very basic example: compute canopy gross photosynthesis (GPP).
Let's start with an basic example: compute canopy gross photosynthesis (GPP).

```@repl
using ClimaLand
Expand All @@ -35,6 +34,7 @@ canopy.compute_GPP(FT(5.0), FT(0.5), FT(3.0), FT(0.7))
```

Et voilà!

Note that our package [ParamViz](https://github.com/CliMA/ParamViz.jl) allow interactive visualisation of
our parameterisations. See examples in the standalone models pages.

Expand Down Expand Up @@ -118,87 +118,16 @@ root = build_tree(modules)
print_sorted_tree(stdout, root) # hide
```

To explore what function and structure is exported in a particular module, you can use About.jl:
To explore what modules, functions and types are exported in a particular module, you can use About.jl:

```@repl
using ClimaLand
using About
about(ClimaLand.Soil.Biogeochemistry)
```

Where names in red are Module, names in blue are functions, and name in yellow are Types.
Where names in red are module, names in blue are functions, and name in yellow are Types.

To see the documentation about a particular Module, function or type, you can use ? to go in help mode
To see the documentation about a particular module, function or type, you can use ? to go in help mode
in the REPL, or @doc as in [Parameterisation above](#Parameterisation).

#### Artifacts

Artifacts contains... see ClimaArtifacts

#### Diagnostics

Diagnostics contains... see Diagnostics doc page

#### Domains

Domains contains... see xxxx pages (ClimaCore, other pages)

#### Parameters

Parameters contains... see ClimaParams

#### Models

See page X --> this should be its own page...

A ClimaLand standalone model, such as our soil hydrology model, usually advance some state
(i.e., prognostic) variable(s) (e.g., soil moisture), in time and space, and computes cache
(i.e., diagnostic) variable(s) (e.g., ).

State variables are solved via ordinary differential equations (ODEs), and require initial conditions
and a physical domain with discretized layers and boundary conditions, as well as a timestepper to
advance the state in time.

ClimaLand domains are X, and timestepper are Y.

## For Developers

Note: This should be a separate page... to do, WIP

### Multiple Dispatch and ClimaLand modularity

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 db08951

Please sign in to comment.