# API Index

`EarthSciMLBase.AbstractEarthSciMLSystem`

`EarthSciMLBase.Advection`

`EarthSciMLBase.ComposedEarthSciMLSystem`

`EarthSciMLBase.ConnectorSystem`

`EarthSciMLBase.ConstantWind`

`EarthSciMLBase.DomainInfo`

`EarthSciMLBase.EarthSciMLODESystem`

`EarthSciMLBase.ICBCcomponent`

`EarthSciMLBase.MeanWind`

`EarthSciMLBase.constBC`

`EarthSciMLBase.constIC`

`EarthSciMLBase.periodicBC`

`EarthSciMLBase.zerogradBC`

`EarthSciMLBase.add_dims`

`EarthSciMLBase.add_metadata`

`EarthSciMLBase.add_scope`

`EarthSciMLBase.dims`

`EarthSciMLBase.domains`

`EarthSciMLBase.get_mtk`

`EarthSciMLBase.graph`

`EarthSciMLBase.icbc`

`EarthSciMLBase.ivar`

`EarthSciMLBase.operator_compose`

`EarthSciMLBase.param_to_var`

`EarthSciMLBase.partialderivatives_identity`

`EarthSciMLBase.partialderivatives_lonlat2xymeters`

`EarthSciMLBase.pvars`

# API Documentation

`EarthSciMLBase.AbstractEarthSciMLSystem`

— TypeOne or more ModelingToolkit systems of equations. EarthSciML uses custom types to allow automatic composition of different systems together.

`EarthSciMLBase.Advection`

— TypeApply advection to a model.

`EarthSciMLBase.ComposedEarthSciMLSystem`

— TypeA system for composing together other systems using the `+`

operator.

`systems`

: Model components to be composed together`domaininfo`

: Initial and boundary conditions and other domain information`pdefunctions`

: A vector of functions where each function takes as an argument the resulting PDESystem after DomainInfo is added to this sytem, and returns a transformed PDESystem.

`EarthSciMLBase.ConnectorSystem`

— TypeA connector for two systems.

`eqs`

`from`

`to`

`EarthSciMLBase.ConstantWind`

— TypeConstruct a constant wind velocity model component with the given wind speed(s), which should include units. For example, `ConstantWind(t, 1u"m/s", 2u"m/s")`

.

`EarthSciMLBase.DomainInfo`

— TypeDomain information for a ModelingToolkit.jl PDESystem. It can be used with the `+`

operator to add initial and boundary conditions and coordinate transforms to a ModelingToolkit.jl ODESystem or Catalyst.jl ReactionSystem.

**NOTE**: The independent variable (usually time) must be first in the list of initial and boundary conditions.

`partial_derivative_func`

: Function that returns spatial derivatives of the partially-independent variables, optionally performing a coordinate transformation first.Current function options are:

`partialderivatives_identity`

(the default): Returns partial derivatives without performing any coordinate transforms.`partialderivatives_lonlat2xymeters`

: Returns partial derivatives after transforming any variables named`lat`

and`lon`

from degrees to cartesian meters, assuming a spherical Earth.

`icbc`

: The sets of initial and/or boundary conditions.

`EarthSciMLBase.EarthSciMLODESystem`

— TypeA type for actual implementations of ODE systems.

`EarthSciMLBase.ICBCcomponent`

— TypeInitial and boundary condition components that can be combined to create an DomainInfo object.

`EarthSciMLBase.MeanWind`

— TypeA model component that represents the mean wind velocity, where `t`

is the independent variable, `iv`

is the independent variable, and `pvars`

is the partial dependent variables for the domain.

`EarthSciMLBase.constBC`

— TypeConstruct constant boundary conditions equal to the value specified by `val`

.

`val`

: The value of the constant boundary conditions.`partialdomains`

: The partial domains, e.g.`[x ∈ Interval(x_min, x_max), y ∈ Interval(y_min, y_max)]`

.

`EarthSciMLBase.constIC`

— TypeConstruct constant initial conditions equal to the value specified by `val`

.

`val`

: The value of the constant initial conditions.`indepdomain`

: The independent domain, e.g.`t ∈ Interval(t_min, t_max)`

.

`EarthSciMLBase.periodicBC`

— TypeConstruct periodic boundary conditions for the given `partialdomains`

. Periodic boundary conditions are defined as when the value at one side of the domain is set equal to the value at the other side, so that the domain "wraps around" from one side to the other.

`partialdomains`

: The partial domains, e.g.`[x ∈ Interval(x_min, x_max), y ∈ Interval(y_min, y_max)]`

.

`EarthSciMLBase.zerogradBC`

— TypeConstruct zero-gradient boundary conditions for the given `partialdomains`

.

`partialdomains`

: The partial domains, e.g.`[x ∈ Interval(x_min, x_max), y ∈ Interval(y_min, y_max)]`

.

`EarthSciMLBase.add_dims`

— Method```
add_dims(expression, vars, dims)
add_dims(equation, vars, dims)
```

Add the given dimensions to each variable in `vars`

in the given expression or equation. Each variable in `vars`

must be unidimensional, i.e. defined like `@variables u(t)`

rather than `@variables u(..)`

.

**Example:**

```
using EarthSciMLBase, ModelingToolkit
@parameters x y k t
@variables u(t) q(t)
exp = 2u + 3k*q + 1
EarthSciMLBase.add_dims(exp, [u, q], [x, y, t])
# output
1 + 2u(x, y, t) + 3k*q(x, y, t)
```

`EarthSciMLBase.add_metadata`

— MethodAdd the units and description in the variable `from`

to the variable `to`

.

`EarthSciMLBase.add_scope`

— Method```
add_scope(sys, v, iv)
```

Add a system scope to a variable name, for example so that `x`

in system `sys1`

becomes `sys1₊x`

. `iv`

is the independent variable.

`EarthSciMLBase.dims`

— Method```
dims(
icbc::EarthSciMLBase.ICcomponent
) -> Vector{Symbolics.Num}
```

Returns the dimensions of the independent and partial domains associated with these initial or boundary conditions.

`EarthSciMLBase.domains`

— Method```
domains(icbc::EarthSciMLBase.ICcomponent) -> Vector
```

Returns the domains associated with these initial or boundary conditions.

`EarthSciMLBase.get_mtk`

— Method

julia get_mtk(sys::AbstractEarthSciMLSystem)

```
```

Return the ModelingToolkit version of this system.

`EarthSciMLBase.graph`

— MethodCreate a graph from a ComposedEarthSciMLSystem using the MetaGraphsNext package.

`EarthSciMLBase.icbc`

— Method```
icbc(di, states)
```

Return a vector of equations that define the initial and boundary conditions for the given state variables.

`EarthSciMLBase.ivar`

— Method```
ivar(di::DomainInfo) -> Any
```

Return the independent variable associated with these initial and boundary conditions.

`EarthSciMLBase.operator_compose`

— Function```
operator_compose(a, b)
operator_compose(a, b, translate)
```

Compose to systems of equations together by adding the right-hand side terms together of equations that have matching left-hand sides. The left hand sides of two equations will be considered matching if:

- They are both time derivatives of the same variable.
- The first one is a time derivative of a variable and the second one is the variable itself.
- There is an entry in the optional
`translate`

dictionary that maps the dependent variable in the first system to the dependent variable in the second system, e.g.`Dict(sys1.sys.x => sys2.sys.y)`

. - There is an entry in the optional
`translate`

dictionary that maps the dependent variable in the first system to the dependent variable in the second system, with a conversion factor, e.g.`Dict(sys1.sys.x => sys2.sys.y => 6)`

.

`EarthSciMLBase.param_to_var`

— MethodReplace the parameter `p`

in the system `sys`

with a new variable that has the same name, units, and description as `p`

.

```
param_to_var(sys, ps)
```

This can be useful to replace a parameter that does not change in time in a model component with one specified by another system that does change in time (or space). For example, the code below specifies a first-order loss equation, and then changes the temperature (which determines the loss rate) with a temperature value that varies in time. ```

`EarthSciMLBase.partialderivatives_identity`

— Method```
partialderivatives_identity(pvars)
```

Return the partial derivative operators corresponding to each of the given partial-independent variables.

`EarthSciMLBase.partialderivatives_lonlat2xymeters`

— Method```
partialderivatives_lonlat2xymeters(pvars; default_lat)
```

Return the partial derivative operators corresponding to each of the given partial-independent variables after converting variables named `lon`

and `lat`

from degrees to x and y meters, assuming they represent longitude and latitude on a spherical Earth.

`EarthSciMLBase.pvars`

— Method```
pvars(di::DomainInfo) -> Any
```

Return the partial independent variables associated with these initial and boundary conditions.