Skip to content

Commit 2b80923

Browse files
committed
Fixed major GCHP implementation bug
1 parent b8b8bdb commit 2b80923

103 files changed

Lines changed: 46852 additions & 410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"env": {
3+
"JULIA_MCP_API_KEY": "kaimon_52d97e7eaf81a66178ae5516a4690c8b7bd01762",
4+
"JULIA_MCP_PORT": "1206",
5+
"JULIA_MCP_REPL_ID": "AtmosTransportModel"
6+
},
7+
"permissions": {
8+
"allow": [
9+
"WebFetch(domain:kahliburke.github.io)",
10+
"Bash(gh api:*)",
11+
"Bash(curl:*)",
12+
"Bash(grep:*)",
13+
"Bash(~/.juliaup/bin/julia:*)",
14+
"Read(//home/cfranken/data/**)",
15+
"Read(//kiwi-data/Data/groupMembers/cfranken/AtmosTransport/catrine/**)",
16+
"Bash(ls:*)",
17+
"Bash(do echo:*)",
18+
"mcp__julia__julia_eval",
19+
"Bash(ncdump:*)",
20+
"Bash(/tmp/analyze_halo_coverage.jl:*)",
21+
"Bash(/tmp/check_stencil_requirements.jl:*)",
22+
"WebSearch",
23+
"WebFetch(domain:www.gfdl.noaa.gov)",
24+
"WebFetch(domain:noaa-emc.github.io)",
25+
"WebFetch(domain:raw.githubusercontent.com)",
26+
"WebFetch(domain:arxiv.org)",
27+
"WebFetch(domain:www.sciencedirect.com)",
28+
"mcp__julia__julia_restart",
29+
"WebFetch(domain:data.nas.nasa.gov)",
30+
"Bash(julia:*)",
31+
"Bash(AT_DIR=/temp2/catrine-runs/output/linrood OUT_GIF=catrine_linrood_vs_geoschem_fossil_co2.gif julia:*)",
32+
"Bash(AT_DIR=/temp2/catrine-runs/output/linrood OUT_GIF=catrine_linrood_vs_geoschem_co2.gif julia:*)"
33+
]
34+
},
35+
"enableAllProjectMcpServers": true,
36+
"enabledMcpjsonServers": [
37+
"kaimon",
38+
"julia"
39+
]
40+
}

.mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"julia": {
4+
"command": "/home/cfranken/.local/bin/uv",
5+
"args": ["run", "--directory", "/home/cfranken/code/gitHub/julia-mcp", "python", "server.py", "--startup-file=yes"]
6+
}
7+
}
8+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
22
"fortran.fortls.disabled": true
3+
}
4+
5+
{
6+
"vscode-remote-control.allowedCommands": [
7+
"workbench.action.files.saveAll",
8+
"editor.action.formatDocument",
9+
"workbench.action.debug.start"
10+
]
311
}

CLAUDE.md

Lines changed: 197 additions & 51 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# AtmosTransport.jl
22

3+
> **Work in Progress.** This project is under rapid active development. We regularly break things and fix them afterwards. The code is not yet intended for external users — APIs, file formats, and physics implementations may change without notice. If you are interested in contributing or following along, feel free to open an issue.
4+
35
[![Documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://RemoteSensingTools.github.io/AtmosTransport/dev/)
46

57
A Julia-based atmospheric transport model for GPU and CPU, inspired by TM5 and designed with
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ===========================================================================
2+
# Spectral mass-flux preprocessing — ERA5 CATRINE December 2021
3+
#
4+
# Converts ERA5 spectral VO/D/LNSP GRIB data to mass fluxes on a regular
5+
# lat-lon grid for the first month of CATRINE D7.1.
6+
#
7+
# Usage:
8+
# julia --project=. -p 8 scripts/preprocessing/preprocess_spectral_massflux.jl \
9+
# config/preprocessing/catrine_spectral_dec2021.toml
10+
# ===========================================================================
11+
12+
[input]
13+
spectral_dir = "~/data/AtmosTransport/met/era5/spectral"
14+
coefficients = "config/era5_L137_coefficients.toml"
15+
surface_dir = "~/data/AtmosTransport/met/era5/surface"
16+
cmfmc_dir = "~/data/AtmosTransport/met/era5/cmfmc"
17+
18+
[output]
19+
directory = "/temp1/atmos_transport/era5_spectral_catrine"
20+
21+
[grid]
22+
nlon = 720 # target longitude count (720 → 0.5°)
23+
nlat = 361 # target latitude count (361 → 0.5°)
24+
level_top = 1 # topmost model level (1 = TOA)
25+
level_bot = 137 # bottommost model level (137 = surface)
26+
27+
[numerics]
28+
float_type = "Float32"
29+
dt = 900.0 # advection sub-step [s]
30+
met_interval = 21600.0 # met data interval [s] (6-hourly)
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# ===========================================================================
2+
# CATRINE D7.1 — ERA5 Spectral 0.5° Lat-Lon (1-Week Test)
3+
#
4+
# 4-tracer intercomparison: CO2, fossil CO2, SF6, 222Rn
5+
# Period: 1 Dec 2021 — 7 Dec 2021 (28 windows = 7 days × 4 windows/day)
6+
# Met data: ERA5 spectral mass fluxes, preprocessed to 720×361×137
7+
# Output: 3-hourly, full 3D fields + column mass (BinaryOutputWriter)
8+
#
9+
# Preprocessing:
10+
# julia --project=. scripts/preprocessing/preprocess_spectral_massflux.jl \
11+
# config/preprocessing/catrine_spectral_dec2021.toml
12+
#
13+
# Usage:
14+
# julia --threads=2 --project=. scripts/run.jl \
15+
# config/runs/catrine_era5_spectral_1week.toml
16+
# ===========================================================================
17+
18+
[architecture]
19+
use_gpu = true
20+
float_type = "Float32"
21+
22+
[grid]
23+
type = "latlon"
24+
met_source = "era5"
25+
size = [720, 361, 137] # 0.5° × 0.5°, full 137 levels
26+
27+
[met_data]
28+
driver = "preprocessed_latlon"
29+
directory = "/temp1/atmos_transport/era5_spectral_catrine"
30+
dt = 300 # advection sub-step [s] (Prather needs CFL<1)
31+
max_windows = 28 # 7 days × 4 windows/day
32+
33+
# --- Initial conditions ---
34+
# CO2 and SF6 from LSCE inversions (1 Dec 2021 00:00 UTC)
35+
# Bilinear horizontal + log-pressure vertical interpolation
36+
# from LMDZ 360×180×79 → ERA5 720×361×137
37+
# fossil_co2 and rn222 start from zero (no IC entry needed)
38+
[initial_conditions]
39+
co2.file = "~/data/AtmosTransport/catrine/InitialConditions/startCO2_202112010000.nc"
40+
co2.variable = "CO2"
41+
sf6.file = "~/data/AtmosTransport/catrine/InitialConditions/startSF6_202112010000.nc"
42+
sf6.variable = "SF6"
43+
44+
# --- Tracers ---
45+
46+
[tracers.co2]
47+
emission = "prebuilt"
48+
file = "~/data/AtmosTransport/catrine/output/era5_spectral_1week/emissions_prebuild/co2_720x361.bin"
49+
species = "co2"
50+
51+
[tracers.fossil_co2]
52+
emission = "prebuilt"
53+
file = "~/data/AtmosTransport/catrine/output/era5_spectral_1week/emissions_prebuild/fossil_co2_720x361.bin"
54+
species = "fossil_co2"
55+
56+
[tracers.sf6]
57+
emission = "edgar_sf6"
58+
file = "~/data/AtmosTransport/catrine/Emissions/edgar_v8/v8.0_FT2022_GHG_SF6_2022_TOTALS_emi.nc"
59+
noaa_growth_file = "~/data/AtmosTransport/catrine/Emissions/sf6_gr_gl.txt"
60+
year = 2022
61+
scale_year = 2022
62+
63+
[tracers.rn222]
64+
emission = "prebuilt"
65+
file = "~/data/AtmosTransport/catrine/output/era5_spectral_1week/emissions_prebuild/rn222_720x361.bin"
66+
chemistry = "decay"
67+
half_life = 330350.4 # 3.8235 days in seconds
68+
69+
# --- Chemistry (222Rn radioactive decay) ---
70+
[chemistry]
71+
type = "composite"
72+
73+
# --- Advection ---
74+
[advection]
75+
scheme = "slopes"
76+
77+
# --- Convection ---
78+
# NOTE: Tiedtke convection requires CMFMC fields, which are not yet merged
79+
# into the preprocessed spectral mass flux files. Enable once surface fields
80+
# are integrated via merge_era5_surface_to_massflux.jl.
81+
#[convection]
82+
#type = "tiedtke"
83+
84+
# --- Diffusion ---
85+
[diffusion]
86+
type = "pbl"
87+
beta_h = 15.0
88+
Kz_bg = 0.1
89+
Kz_min = 0.01
90+
#Kz_max = 500.0
91+
92+
# --- Output (3-hourly, full 3D + column mass) ---
93+
[output]
94+
filename = "~/data/AtmosTransport/catrine/output/era5_spectral_1week/catrine_era5_week"
95+
interval = 10800 # 3 hours
96+
auto_convert = true
97+
format = "binary"
98+
split = "daily"
99+
100+
[output.fields]
101+
co2_3d = {type = "full_3d", species = "co2"}
102+
fossil_co2_3d = {type = "full_3d", species = "fossil_co2"}
103+
sf6_3d = {type = "full_3d", species = "sf6"}
104+
rn222_3d = {type = "full_3d", species = "rn222"}
105+
co2_column_mass = {type = "column_mass", species = "co2"}
106+
fco2_column_mass = {type = "column_mass", species = "fossil_co2"}
107+
sf6_column_mass = {type = "column_mass", species = "sf6"}
108+
rn222_column_mass = {type = "column_mass", species = "rn222"}
109+
surface_pressure = "surface_pressure"
110+
111+
[buffering]
112+
strategy = "double"
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# ===========================================================================
2+
# CATRINE D7.1 — ERA5 Spectral 0.5° Lat-Lon (December 2021)
3+
#
4+
# 4-tracer intercomparison: CO2, fossil CO2, SF6, 222Rn
5+
# Period: 1 Dec 2021 — 31 Dec 2021
6+
# Met data: ERA5 spectral mass fluxes, preprocessed to 720x361x137
7+
# Output: 3-hourly, full 3D fields + column mass (BinaryOutputWriter)
8+
#
9+
# Preprocessing:
10+
# julia --project=. -p 8 scripts/preprocessing/preprocess_spectral_massflux.jl \
11+
# config/preprocessing/catrine_spectral_dec2021.toml
12+
#
13+
# Usage:
14+
# julia --threads=2 --project=. scripts/run.jl config/runs/catrine_era5_spectral_dec2021.toml
15+
# ===========================================================================
16+
17+
[architecture]
18+
use_gpu = true
19+
float_type = "Float32"
20+
21+
[grid]
22+
type = "latlon"
23+
met_source = "era5"
24+
size = [720, 361, 137] # 0.5° x 0.5°, full 137 levels
25+
26+
[met_data]
27+
driver = "preprocessed_latlon"
28+
directory = "/temp1/atmos_transport/era5_spectral_catrine"
29+
dt = 900 # advection sub-step [s]
30+
31+
# --- Initial conditions ---
32+
# CO2 and SF6 from LSCE inversions (1 Dec 2021 00:00 UTC)
33+
# fossil_co2 and rn222 start from zero (no IC entry needed)
34+
[initial_conditions]
35+
co2.file = "~/data/AtmosTransport/catrine/InitialConditions/startCO2_202112010000.nc"
36+
co2.variable = "CO2"
37+
sf6.file = "~/data/AtmosTransport/catrine/InitialConditions/startSF6_202112010000.nc"
38+
sf6.variable = "SF6"
39+
40+
# --- Tracers ---
41+
42+
[tracers.co2]
43+
emission = "lmdz_co2"
44+
dir = "~/data/AtmosTransport/catrine/Emissions/LMDZ_fluxes"
45+
species = "co2"
46+
flux_var = "flux_apos"
47+
start_date = "2021-12-01"
48+
end_date = "2021-12-31"
49+
50+
[tracers.fossil_co2]
51+
emission = "gridfed"
52+
dir = "~/data/AtmosTransport/catrine/Emissions/gridfed"
53+
species = "fossil_co2"
54+
year = 2021
55+
56+
[tracers.sf6]
57+
emission = "edgar_sf6"
58+
file = "~/data/AtmosTransport/catrine/Emissions/edgar_v8/v8.0_FT2022_GHG_SF6_2022_TOTALS_emi.nc"
59+
noaa_growth_file = "~/data/AtmosTransport/catrine/Emissions/sf6_gr_gl.txt"
60+
year = 2022
61+
scale_year = 2022
62+
63+
[tracers.rn222]
64+
emission = "zhang_rn222"
65+
dir = "~/data/AtmosTransport/catrine/Emissions/ZHANG_Rn222/"
66+
chemistry = "decay"
67+
half_life = 330350.4 # 3.8235 days in seconds
68+
69+
# --- Chemistry (222Rn radioactive decay) ---
70+
[chemistry]
71+
type = "composite"
72+
73+
# --- Advection ---
74+
[advection]
75+
scheme = "ppm"
76+
ppm_order = 7
77+
78+
# --- Convection ---
79+
# TODO: Tiedtke requires CMFMC in met data. Need to merge ERA5 CMFMC
80+
# into the preprocessed mass flux files or use a separate surface driver.
81+
#[convection]
82+
#type = "tiedtke"
83+
84+
# --- Diffusion ---
85+
# TODO: PBL diffusion requires surface fields (PBLH, SSHF, T2M, U10, V10)
86+
# merged into the preprocessed files via merge_era5_surface_to_massflux.jl.
87+
#[diffusion]
88+
#type = "pbl"
89+
#beta_h = 15.0
90+
#Kz_bg = 0.1
91+
#Kz_min = 0.01
92+
#Kz_max = 500.0
93+
94+
# --- Output (3-hourly, full 3D + column mass) ---
95+
[output]
96+
filename = "~/data/AtmosTransport/catrine/output/era5_spectral_dec2021/catrine_era5_spectral.bin"
97+
interval = 10800 # 3 hours
98+
99+
[output.fields]
100+
co2_3d = {type = "full_3d", species = "co2"}
101+
fossil_co2_3d = {type = "full_3d", species = "fossil_co2"}
102+
sf6_3d = {type = "full_3d", species = "sf6"}
103+
rn222_3d = {type = "full_3d", species = "rn222"}
104+
co2_column_mass = {type = "column_mass", species = "co2"}
105+
fco2_column_mass = {type = "column_mass", species = "fossil_co2"}
106+
sf6_column_mass = {type = "column_mass", species = "sf6"}
107+
rn222_column_mass = {type = "column_mass", species = "rn222"}
108+
surface_pressure = "surface_pressure"
109+
110+
[buffering]
111+
strategy = "double"

0 commit comments

Comments
 (0)