Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bucket albedo map experiments #482

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 58 additions & 16 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,39 +78,81 @@ steps:
command: "julia --color=yes --project=experiments experiments/standalone/Soil/water_conservation.jl"
artifact_paths: "experiments/standalone/Soil/water_conservation*png"

- label: "Global Bucket on CPU"
key: "global_bucket_cpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket.jl"
artifact_paths: "experiments/standalone/Bucket/artifacts/*cpu*"

- label: "Compare GPU bucket with CPU bucket"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/compare_gpu_cpu_output.jl"
depends_on:
- "global_bucket_cpu"
- "global_bucket_gpu"

- group: "lib/ClimaLandSimulations"
- group: "ClimaLandSimulations"
steps:
- label: "Ozark figures Makie"
command: "julia --color=yes --project=lib/ClimaLandSimulations lib/ClimaLandSimulations/experiments/ozark.jl"
artifact_paths: "figures/*pdf"

- group: "GPU"
- group: "CPU: global bucket"
steps:
- label: "Global Bucket on CPU (functional albedo)"
key: "global_bucket_function_cpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_function.jl"
artifact_paths: "experiments/standalone/Bucket/artifacts/*cpu*"

- label: "Global Bucket on CPU (static map albedo)"
key: "global_bucket_staticmap_cpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_staticmap.jl"
artifact_paths: "experiments/standalone/Bucket/artifacts_staticmap/*cpu*"

- label: "Global Bucket on CPU (temporal map albedo)"
key: "global_bucket_temporalmap_cpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_temporalmap.jl"
artifact_paths: "experiments/standalone/Bucket/artifacts_temporalmap/*cpu*"

- group: "GPU: unit tests and global bucket"
steps:
- label: "GPU runtests"
command: "julia --color=yes --project=test test/runtests.jl"
agents:
slurm_mem_per_cpu: 8G
slurm_gpus: 1

- label: "Global Bucket on GPU"
key: "global_bucket_gpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket.jl"
- label: "Global Bucket on GPU (functional albedo)"
key: "global_bucket_function_gpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_function.jl"
agents:
slurm_mem: 8G
slurm_gpus: 1
artifact_paths: "experiments/standalone/Bucket/artifacts/*gpu*"

- label: "Global Bucket on GPU (static map albedo)"
key: "global_bucket_staticmap_gpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_staticmap.jl"
agents:
slurm_mem: 8G
slurm_gpus: 1
artifact_paths: "experiments/standalone/Bucket/artifacts_staticmap/*gpu*"

- label: "Global Bucket on GPU (temporal map albedo)"
key: "global_bucket_temporalmap_gpu"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/global_bucket_temporalmap.jl"
agents:
slurm_mem: 8G
slurm_gpus: 1
artifact_paths: "experiments/standalone/Bucket/artifacts_temporalmap/*gpu*"

- group: "CPU/GPU comparisons"
steps:
- label: "Compare GPU bucket with CPU bucket (functional albedo)"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/compare_gpu_cpu_output.jl"
depends_on:
- "global_bucket_function_cpu"
- "global_bucket_function_gpu"

- label: "Compare GPU bucket with CPU bucket (static map albedo)"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/compare_gpu_cpu_output.jl"
depends_on:
- "global_bucket_staticmap_cpu"
- "global_bucket_staticmap_gpu"

- label: "Compare GPU bucket with CPU bucket (temporal map albedo)"
command: "julia --color=yes --project=experiments experiments/standalone/Bucket/compare_gpu_cpu_output.jl"
depends_on:
- "global_bucket_temporalmap_cpu"
- "global_bucket_temporalmap_gpu"

- wait

- command: "compact_depot"
6 changes: 3 additions & 3 deletions docs/tutorials/standalone/Bucket/bucket_tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ ref_time = DateTime(2005);
precip = (t) -> 0;
snow_precip = (t) -> -5e-7 * (t > 3 * 86400) * (t < 4 * 86400);
# Diurnal temperature variations:
T_atmos = (t) -> 275.0 + 5.0 * sin(2.0 * π * t / 86400 + 7200);
T_atmos = (t) -> 275.0 + 5.0 * sin(2.0 * π * t / 86400 - π / 2);
# Constant otherwise:
u_atmos = (t) -> 3.0;
q_atmos = (t) -> 0.005;
Expand All @@ -264,8 +264,8 @@ bucket_atmos = PrescribedAtmosphere(
# peak at local noon, and a prescribed downwelling LW radiative
# flux, assuming the air temperature is on average 275 degrees
# K with a diurnal amplitude of 5 degrees K:
SW_d = (t) -> @. max(1361 * sin(2π * t / 86400 + 7200));
LW_d = (t) -> 5.67e-8 * (275.0 + 5.0 * sin(2.0 * π * t / 86400 + 7200))^4;
SW_d = (t) -> @. max(1361 * sin(2π * t / 86400 - π / 2));
LW_d = (t) -> 5.67e-8 * (275.0 + 5.0 * sin(2.0 * π * t / 86400 - π / 2))^4;
bucket_rad = PrescribedRadiativeFluxes(
FT,
TimeVaryingInput(SW_d),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# # Global bucket run using analytic albedo

# The code sets up and runs the bucket for 7 days using analytic albedo as
# a function of space, and analytic atmospheric and radiative forcings.
# This is the simplest global bucket run we test, and it is used to verify
# that the model can run on both CPU and GPU devices, with only minor
# computational differences between the results.

# Outputs:
# The final state of the simulation is saved to a CSV file so we can compare
# between CPU and GPU runs.
# Plots of the temporal evolution of water content, snow cover fraction,
# surface temperature, evaporation, and surface energy flux.

import SciMLBase
using CairoMakie
using Dates
Expand Down Expand Up @@ -85,7 +99,7 @@ ref_time = DateTime(2005);
precip = (t) -> 0;
snow_precip = (t) -> -5e-7 * (t < 1 * 86400);
# Diurnal temperature variations:
T_atmos = (t) -> 275.0 + 5.0 * sin(2.0 * π * t / 86400 + 7200);
T_atmos = (t) -> 275.0 + 5.0 * sin(2.0 * π * t / 86400 - π / 2);
# Constant otherwise:
u_atmos = (t) -> 3.0;
q_atmos = (t) -> 0.001;
Expand All @@ -107,8 +121,8 @@ bucket_atmos = PrescribedAtmosphere(
# peak at local noon, and a prescribed downwelling LW radiative
# flux, assuming the air temperature is on average 275 degrees
# K with a diurnal amplitude of 5 degrees K:
SW_d = (t) -> max(1361 * sin(2π * t / 86400 + 7200));
LW_d = (t) -> 5.67e-8 * (275.0 + 5.0 * sin(2.0 * π * t / 86400 + 7200))^4;
SW_d = (t) -> max(1361 * sin(2π * t / 86400 - π / 2), 0.0);
LW_d = (t) -> 5.67e-8 * (275.0 + 5.0 * sin(2.0 * π * t / 86400 - π / 2))^4;
bucket_rad = PrescribedRadiativeFluxes(
FT,
TimeVaryingInput(SW_d),
Expand Down Expand Up @@ -233,8 +247,13 @@ for (i, (field_ts, field_name)) in enumerate(
end
end
# Plot the timeseries of the mean value as well.
xlabel = i == 5 ? "Time" : ""
ax2 = Axis(fig_ts[i, 1], xlabel = xlabel, ylabel = field_name)
xlabel = i == 5 ? "Time (days)" : ""
ax2 = Axis(
fig_ts[i, 1],
xlabel = xlabel,
ylabel = field_name,
title = "Global bucket with analytic albedo",
)
CairoMakie.lines!(ax2, sol.t ./ 3600 ./ 24, [mean(x) for x in field_ts])
end
outfile = joinpath(outdir, string("ts_$device_suffix.png"))
Expand Down
Loading
Loading