Skip to content

CliMA/ClimaCore.jl

Repository files navigation

ClimaCore.jl Logo

ClimaCore.jl

The dynamical core (dycore) of the CliMA Earth System Model: composable, GPU-capable tools for discretizing and solving partial differential equations on the sphere and in Cartesian domains.

Documentation stable dev
Version version
License license
Tests gha ci buildkite
Code Coverage codecov
Downloads Downloads
DOI zenodo

ClimaCore.jl provides the spatial discretization building blocks for the Climate Modeling Alliance (CliMA) Earth System Model, which is written entirely in Julia. It pairs a high-level API for composing differential operators and defining flexible discretizations with low-level APIs for data layouts, specialized implementations, and threading — targeting both CPU and GPU architectures from a single codebase.

Features

  • Spectral-element horizontal discretizations: continuous (CG) and discontinuous (DG) Galerkin spectral elements.
  • Flexible vertical discretization: staggered finite differences on center/face grids.
  • Multiple geometries: Cartesian and spherical domains, with governing equations expressed in covariant vectors for curvilinear systems and Cartesian vectors for Euclidean spaces.
  • Field abstraction: scalar-, vector-, or struct-valued fields carrying values, geometry, and mesh information, with flexible memory layouts (AoS, SoA, AoSoA) and useful overloads (sum, norm, ...).
  • Composable operators via broadcasting: differential operators (grad, div, interpolate, ...) act like functions when broadcast over a Field, fusing operators and function calls into a single pass.
  • GPU acceleration: broadcast expressions compile to custom CUDA kernels, with specialization on polynomial degree for kernel performance.
  • Time-stepper compatible: works with SciML/OrdinaryDiffEq time steppers.

Quick Example

import ClimaComms
ClimaComms.@import_required_backends
import ClimaCore: Domains, Meshes, Spaces, Fields, Geometry, Operators

FT = Float64

# Build a 1D column: interval domain -> mesh -> finite-difference space
domain = Domains.IntervalDomain(
    Geometry.ZPoint{FT}(0),
    Geometry.ZPoint{FT}(2π),
    boundary_names = (:bottom, :top),
)
mesh = Meshes.IntervalMesh(domain; nelems = 128)
space = Spaces.CenterFiniteDifferenceSpace(ClimaComms.device(), mesh)

# Define a field over the space and differentiate it with a composed operator
z = Fields.coordinate_field(space).z
θ = sin.(z)
grad = Operators.GradientC2F(
    bottom = Operators.SetValue(FT(0)),
    top = Operators.SetValue(FT(0)),
)
∂θ = @. Geometry.WVector(grad(θ))   # face-valued vertical gradient (≈ cos(z))

More runnable examples (column, plane, and sphere configurations) are in the examples/ directory.

Documentation

  • Stable docs — installation, introduction, mathematical framework, and API reference
  • Dev docs — latest development version
  • examples/ — runnable examples across geometries

Integration with CliMA models

ClimaCore.jl is the dynamical core used throughout the CliMA ecosystem, including:

Contributing

Contributors should follow the shared CliMA engineering standards in docs/dev-guides/, which cover architecture, performance, code quality, documentation, and workflows. These are vendored from CliMA/DeveloperGuides. The repo's AGENTS.md is a starting point for AI agents with repo-specific guidance.

Releases

Used by

Contributors

Languages