Skip to content

Commit 7224a10

Browse files
committed
update surface fluxes
1 parent c1c1665 commit 7224a10

File tree

20 files changed

+419
-239
lines changed

20 files changed

+419
-239
lines changed

.buildkite/nightly/pipeline.yml

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ steps:
2323
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
2424

2525
# For this pipeline, use the main branches of certain upstream packages
26-
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaAtmos\", rev=\"main\"))'"
26+
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaAtmos\", rev=\"zs/surface_flux\"))'"
27+
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaLand\", rev=\"kd/update_surface_fluxes\"))'"
2728
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaCore\", rev=\"main\"))'"
2829
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaTimeSteppers\", rev=\"main\"))'"
2930
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"Thermodynamics\", rev=\"main\"))'"
30-
# - "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"SurfaceFluxes\", rev=\"main\"))'"
31+
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"SurfaceFluxes\", rev=\"main\"))'"
3132
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"RRTMGP\", rev=\"main\"))'"
3233
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.resolve()'"
3334

@@ -53,7 +54,7 @@ steps:
5354
command:
5455
- echo "--- Run simulation"
5556
- "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_diagedmf.yml --job_id amip_coarse_diagedmf"
56-
artifact_paths: "experiments/ClimaEarth/output/amip_coarse_diagedmf/artifacts/*"
57+
artifact_paths: "output/amip_coarse_diagedmf/artifacts/*"
5758
timeout_in_minutes: 840
5859
env:
5960
CLIMACOMMS_DEVICE: "CUDA"
@@ -68,7 +69,7 @@ steps:
6869
command:
6970
- echo "--- Run simulation"
7071
- "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_diagedmf_land.yml --job_id amip_coarse_diagedmf_land"
71-
artifact_paths: "experiments/ClimaEarth/output/amip_coarse_diagedmf_land/artifacts/*"
72+
artifact_paths: "output/amip_coarse_diagedmf_land/artifacts/*"
7273
timeout_in_minutes: 840
7374
env:
7475
CLIMACOMMS_DEVICE: "CUDA"
@@ -78,44 +79,44 @@ steps:
7879
slurm_ntasks: 1
7980
slurm_mem: 30GB
8081

81-
- label: "Coarse current AMIP: progedmf + 0M + bucket land"
82-
key: "amip_progedmf"
83-
command:
84-
- echo "--- Run simulation"
85-
- "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_progedmf.yml --job_id amip_coarse_progedmf"
86-
artifact_paths: "experiments/ClimaEarth/output/amip_coarse_progedmf/artifacts/*"
87-
timeout_in_minutes: 840
88-
env:
89-
CLIMACOMMS_DEVICE: "CUDA"
90-
agents:
91-
slurm_gpus_per_task: 1
92-
slurm_cpus_per_task: 4
93-
slurm_ntasks: 1
94-
slurm_mem: 30GB
95-
96-
- label: "Coarse current AMIP without convection: edonly + 0M + bucket land"
97-
key: "amip_edonly"
98-
command:
99-
- echo "--- Run simulation"
100-
- "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_edonly.yml --job_id amip_coarse_edonly"
101-
artifact_paths: "experiments/ClimaEarth/output/amip_coarse_edonly/artifacts/*"
102-
timeout_in_minutes: 840
103-
env:
104-
CLIMACOMMS_DEVICE: "CUDA"
105-
agents:
106-
slurm_gpus_per_task: 1
107-
slurm_cpus_per_task: 4
108-
slurm_ntasks: 1
109-
slurm_mem: 30GB
110-
111-
- label: "Flagship AMIP GPU with prognostic EDMF + 1M + integrated land (16 helems)"
112-
key: "gpu_amip_progedmf_1M_land_he16"
113-
command: "srun julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $BENCHMARK_CONFIG_PATH/amip_progedmf_1m_land_he16.yml --job_id gpu_amip_progedmf_1M_land_he16"
114-
artifact_paths: "experiments/ClimaEarth/output/gpu_amip_progedmf_1M_land_he16/artifacts/*"
115-
env:
116-
CLIMACOMMS_DEVICE: "CUDA"
117-
agents:
118-
slurm_gpus_per_task: 1
119-
slurm_cpus_per_task: 4
120-
slurm_ntasks: 1
121-
slurm_mem: 16GB
82+
# - label: "Coarse current AMIP: progedmf + 0M + bucket land"
83+
# key: "amip_progedmf"
84+
# command:
85+
# - echo "--- Run simulation"
86+
# - "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_progedmf.yml --job_id amip_coarse_progedmf"
87+
# artifact_paths: "experiments/ClimaEarth/output/amip_coarse_progedmf/artifacts/*"
88+
# timeout_in_minutes: 840
89+
# env:
90+
# CLIMACOMMS_DEVICE: "CUDA"
91+
# agents:
92+
# slurm_gpus_per_task: 1
93+
# slurm_cpus_per_task: 4
94+
# slurm_ntasks: 1
95+
# slurm_mem: 30GB
96+
97+
# - label: "Coarse current AMIP without convection: edonly + 0M + bucket land"
98+
# key: "amip_edonly"
99+
# command:
100+
# - echo "--- Run simulation"
101+
# - "julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $CONFIG_PATH/amip_coarse_edonly.yml --job_id amip_coarse_edonly"
102+
# artifact_paths: "experiments/ClimaEarth/output/amip_coarse_edonly/artifacts/*"
103+
# timeout_in_minutes: 840
104+
# env:
105+
# CLIMACOMMS_DEVICE: "CUDA"
106+
# agents:
107+
# slurm_gpus_per_task: 1
108+
# slurm_cpus_per_task: 4
109+
# slurm_ntasks: 1
110+
# slurm_mem: 30GB
111+
112+
# - label: "Flagship AMIP GPU with prognostic EDMF + 1M + integrated land (16 helems)"
113+
# key: "gpu_amip_progedmf_1M_land_he16"
114+
# command: "srun julia --threads=3 --color=yes --project=experiments/ClimaEarth/ experiments/ClimaEarth/run_amip.jl --config_file $BENCHMARK_CONFIG_PATH/amip_progedmf_1m_land_he16.yml --job_id gpu_amip_progedmf_1M_land_he16"
115+
# artifact_paths: "experiments/ClimaEarth/output/gpu_amip_progedmf_1M_land_he16/artifacts/*"
116+
# env:
117+
# CLIMACOMMS_DEVICE: "CUDA"
118+
# agents:
119+
# slurm_gpus_per_task: 1
120+
# slurm_cpus_per_task: 4
121+
# slurm_ntasks: 1
122+
# slurm_mem: 16GB

.buildkite/pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ steps:
3131
- "julia --project -e 'using Pkg; Pkg.status()'"
3232

3333
- echo "--- Instantiate ClimaEarth experiments env"
34-
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.develop(path=\".\")'"
34+
#- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.develop(path=\".\")'"
3535
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
3636
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(\"MPI\")'"
3737
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.precompile()'"
3838
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.status()'"
3939

4040
- echo "--- Instantiate ClimaCore experiments env"
41-
- "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.develop(path=\".\")'"
41+
#- "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.develop(path=\".\")'"
4242
- "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
4343
- "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.add(\"MPI\")'"
4444
- "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.precompile()'"

docs/src/fluxcalculator.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fluxes and the CoupledSimulation object's fluxes fields.
3737
- the Obukhov length, `L_MO`;
3838
- the buoyancy flux, `buoyancy_flux`;
3939
- the roughness lengths for momentum and buoyancy, `z0m` and `z0b`;
40-
- the evaporation scaling factor, `beta`,
4140
- the frictional velocity `ustar`.
4241

4342
!!! note

docs/src/interfacer.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ overwritten or used as-is. These currently include the following:
279279

280280
| Coupler name | Description | Units | Default value |
281281
|---------------|---------------------------------------------------------------------------|-------|---------------|
282-
| `beta` | factor that scales evaporation based on its estimated level of saturation | | 1 |
283282
| `emissivity` | measure of how much energy a surface radiates | | 1 |
284283
| `height_disp` | displacement height relative to the surface | m | 0 |
285284

@@ -300,7 +299,6 @@ coupler.
300299

301300
```
302301
get_field(sim::AbstractSurfaceStub, ::Val{:area_fraction}) = sim.cache.area_fraction
303-
get_field(sim::AbstractSurfaceStub, ::Val{:beta}) = sim.cache.beta
304302
get_field(sim::AbstractSurfaceStub, ::Val{:roughness_buoyancy}) = sim.cache.z0b
305303
get_field(sim::AbstractSurfaceStub, ::Val{:roughness_momentum}) = sim.cache.z0m
306304
get_field(sim::AbstractSurfaceStub, ::Val{:surface_direct_albedo}) = sim.cache.α_direct

experiments/ClimaEarth/Manifest-v1.11.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,9 @@ weakdeps = ["GeoMakie", "Makie"]
453453

454454
[[deps.ClimaAtmos]]
455455
deps = ["Adapt", "ArgParse", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaInterpolations", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "Flux", "ForwardDiff", "Insolation", "Interpolations", "JLD2", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "NullBroadcasts", "RRTMGP", "Random", "SciMLBase", "SparseMatrixColorings", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "UnrolledUtilities", "YAML"]
456-
git-tree-sha1 = "3c5e62e60f8ede3a01ca25f9f3f2be7edcdc606c"
456+
git-tree-sha1 = "6072575cd403938798d9beb7e5720aeae8c8be43"
457+
repo-rev = "zs/surface_flux"
458+
repo-url = "https://github.com/CliMA/ClimaAtmos.jl.git"
457459
uuid = "b2c96348-7fb7-4fe0-8da9-78d88439e717"
458460
version = "0.33.1"
459461

@@ -531,7 +533,9 @@ weakdeps = ["CUDA"]
531533

532534
[[deps.ClimaLand]]
533535
deps = ["Adapt", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LazyBroadcast", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
534-
git-tree-sha1 = "9c21f533594b2a0c8ba80b9eee832bc7b41585e2"
536+
git-tree-sha1 = "f1dd2d9785dadfd2b168ee3987fe02a7dc491fb3"
537+
repo-rev = "kd/update_surface_fluxes"
538+
repo-url = "https://github.com/CliMA/ClimaLand.jl.git"
535539
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
536540
version = "1.3.0"
537541

@@ -3393,7 +3397,9 @@ version = "7.7.0+0"
33933397

33943398
[[deps.SurfaceFluxes]]
33953399
deps = ["RootSolvers", "Thermodynamics"]
3396-
git-tree-sha1 = "bf11863f42e42ff25a4315224cbc0cf2d404879f"
3400+
git-tree-sha1 = "ec413a0c88c12e880fb6cba6c15babee79ecef06"
3401+
repo-rev = "zs/promote"
3402+
repo-url = "https://github.com/CliMA/SurfaceFluxes.jl.git"
33973403
uuid = "49b00bb7-8bd4-4f2b-b78c-51cd0450215f"
33983404
version = "0.14.2"
33993405
weakdeps = ["ClimaParams"]

experiments/ClimaEarth/components/atmosphere/climaatmos.jl

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,28 +367,37 @@ function Interfacer.update_field!(
367367
Interfacer.get_field!(csf.scalar_temp3, sim, Val(:air_density))
368368
ρ_atmos = csf.scalar_temp3
369369

370+
surface_fluxes_params = get_surface_params(sim)
371+
372+
# TODO: fix allocation
373+
csf.scalar_temp4 .=
374+
SF.surface_density.(
375+
surface_fluxes_params,
376+
T_atmos,
377+
ρ_atmos,
378+
csf.T_sfc,
379+
csf.height_int .- csf.height_sfc,
380+
q_atmos,
381+
0,
382+
0,
383+
)
384+
ρ_sfc = csf.scalar_temp4
385+
370386
thermo_params = get_thermo_params(sim)
371387
FluxCalculator.compute_surface_humidity!(
372-
csf.scalar_temp4,
373-
T_atmos,
374-
q_atmos,
375-
ρ_atmos,
388+
csf.scalar_temp1,
376389
csf.T_sfc,
390+
ρ_sfc,
377391
thermo_params,
378392
)
379393

380394
# Remap surface temperature and humidity to atmosphere surface space
381395
# NOTE: This is allocating! If we had 2 more scratch fields, we could avoid this
382396
T_sfc_atmos = Interfacer.remap(atmos_surface_space, csf.T_sfc)
383-
q_sfc_atmos = Interfacer.remap(atmos_surface_space, csf.scalar_temp4)
397+
q_sfc_atmos = Interfacer.remap(atmos_surface_space, csf.scalar_temp1)
384398

385399
# Store `ρ_sfc_atmos` in an atmosphere scratch field on the surface space
386-
temp_field_surface =
387-
FluxCalculator.extrapolate_ρ_to_sfc.(
388-
thermo_params,
389-
sim.integrator.p.precomputed.sfc_conditions.ts,
390-
T_sfc_atmos,
391-
)
400+
temp_field_surface = Interfacer.remap(atmos_surface_space, ρ_sfc)
392401
ρ_sfc_atmos = temp_field_surface
393402

394403
if sim.integrator.p.atmos.moisture_model isa CA.DryModel
@@ -699,6 +708,14 @@ Returns the thermodynamic parameters from the atmospheric model simulation objec
699708
get_thermo_params(sim::ClimaAtmosSimulation) =
700709
CAP.thermodynamics_params(sim.integrator.p.params)
701710

711+
"""
712+
get_surface_params(sim::ClimaAtmosSimulation)
713+
714+
Returns the surface parameters from the atmospheric model simulation object.
715+
"""
716+
get_surface_params(sim::ClimaAtmosSimulation) =
717+
CAP.surface_fluxes_params(sim.integrator.p.params)
718+
702719
"""
703720
dss_state!(sim::ClimaAtmosSimulation)
704721

0 commit comments

Comments
 (0)