Skip to main content

FreeCESM

A small, readable Python OOP prototype of the CESM/CAM call graph — not a numerical model, but a structural sketch: every class is named after its Fortran component, every method after what the process does, with the Fortran call-site name kept in the docstring/trace for cross-reference.

It mirrors the PI-atm end-to-end control-flow graph published at coverage.vegavoid.com — a coverage-instrumented trace of the real CESM/CAM Fortran source for a pre-industrial, atmosphere-active case.

Install

pip install -e .

Quick start

from freecesm import Driver

driver = Driver(case="PI-atm", nsteps=10)
trace = driver.execute()

print(f"{len(trace)} call-graph nodes executed")
print(driver.cam.state.summary())

Architecture

  • Driver — mirrors cesm_driver: pre_initinitrun (the cesm_run coupling loop, with restart/history gates) → final.
  • Coupler — dispatches component_run on each active component in call-graph order (ice → lnd → rof → ocn → atm) and stands in for the component_exch flux exchange.
  • FreeCAM — the only component with real internal structure. Its entire per-step running order — physics, the coupling exchange, dynamics, output — lives as one explicit, editable list: FreeCAM.workflow.
  • Parameterization — one physics process per subclass (DryAdjustment, DeepConvection, Radiation, Chemistry, ...), each just implementing a tendency(state).
  • Dynamics — the spectral-element dycore, collapsed to one run().
  • CaseConfig / CASES — CESM's real "compset" idea, in miniature: a dataclass naming a factory for every component slot (atmosphere included — nothing is special-cased), so a run can be an atmosphere-only PI case, a fully coupled case, or something built on the fly, e.g. an ocean-only case with a data atmosphere (FreeDATM) instead of FreeCAM.

Other components — FreeCLM, FreeCICE (prescribed or active), FreeDOCN, FreePOP, FreeRTM, FreeDATM, StubComponent (GLC/WAV) — are lightweight stand-ins, each with a one-line run().

Extending the workflow

Adding a new physical process is two steps: subclass Parameterization with a tendency, then edit FreeCAM.workflow — it's a plain Python list.

from freecesm import Parameterization

class VolcanicAerosol(Parameterization):
    name = "volcanic_aerosol (custom)"

    def tendency(self, state):
        state.T -= 0.15

driver.cam.workflow.insert(3, VolcanicAerosol())

Building a custom case

from freecesm import CaseConfig, Driver, FreeCICE, FreeDOCN

my_case = CaseConfig(
    name="PI-dataocean",
    description="Coupled atmosphere/land/ice, but a data ocean instead of POP.",
    forcing="1850, fixed preindustrial",
    make_ice=lambda: FreeCICE(mode="active"),
    make_ocn=FreeDOCN,
)
driver = Driver(case=my_case, nsteps=5)

Tests

pip install -e ".[test]"
pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freecesm-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freecesm-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file freecesm-0.1.0.tar.gz.

File metadata

  • Download URL: freecesm-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for freecesm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 092ce4fe8277d5c852ce0f79c0282ffe09fdb6722138e131449a2b696c6e9348
MD5 b38140a7013e8b023f2b69fda3b8e978
BLAKE2b-256 5c3cade64aec7ad4c34452d54920989362493ab47334c11f199f0d76607fd06d

See more details on using hashes here.

File details

Details for the file freecesm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: freecesm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for freecesm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 750e4ec6536a651d870ecd6303ac88da57b5ba6a277381b7bab0d35c1808c37c
MD5 939ef3c1dfd6705feb4631bb1c80ddc2
BLAKE2b-256 20c784c2bc74420d9436b6e02ae72f9fa11d5c8e6966b45e41d9291a4044dd6d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page