Skip to content

Commit

Permalink
convert mass fluxes to volume fluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Nov 22, 2024
1 parent bdaf246 commit ee93d4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion experiments/benchmarks/richards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ function setup_prob(t0, tf, Δt; nelements = (101, 15))

# Below, the preprocess_func argument is used to
# 1. Convert precipitation to be negative (as it is downwards)
# 2. Convert mass flux to equivalent liquid water flux
# Precipitation:
precip = TimeVaryingInput(
joinpath(era5_artifact_path, "era5_2008_1.0x1.0.nc"),
"mtpr",
surface_space;
start_date,
regridder_type,
file_reader_kwargs = (; preprocess_func = (data) -> -data),
file_reader_kwargs = (; preprocess_func = (data) -> -data / 1000),
)
atmos = ClimaLand.PrescribedPrecipitation{FT, typeof(precip)}(precip)
bottom_bc = ClimaLand.Soil.WaterFluxBC((p, t) -> 0.0)
Expand Down
4 changes: 2 additions & 2 deletions experiments/standalone/Soil/richards_runoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ era5_artifact_path =

# Below, the preprocess_func argument is used to
# 1. Convert precipitation to be negative (as it is downwards)
# 2. Convert accumulations over an hour to a rate per second
# 2. Convert mass flux to equivalent liquid water flux
start_date = DateTime(2008);
# Precipitation:
precip = TimeVaryingInput(
Expand All @@ -80,7 +80,7 @@ precip = TimeVaryingInput(
surface_space;
start_date,
regridder_type,
file_reader_kwargs = (; preprocess_func = (data) -> -data,),
file_reader_kwargs = (; preprocess_func = (data) -> -data / 1000,),
)
atmos = ClimaLand.PrescribedPrecipitation{FT, typeof(precip)}(precip)
bottom_bc = ClimaLand.Soil.WaterFluxBC((p, t) -> 0.0)
Expand Down
7 changes: 4 additions & 3 deletions src/shared_utilities/drivers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1029,24 +1029,25 @@ function prescribed_forcing_era5(
regridder_type = :InterpolationsRegridder,
)

# Precip is provide as a mass flux; convert to volume flux of liquid water with ρ =1000 kg/m^3
precip = TimeVaryingInput(
era5_ncdata_path,
["mtpr", "msr"],
surface_space;
start_date,
regridder_type,
file_reader_kwargs = (; preprocess_func = (data) -> -data,),
file_reader_kwargs = (; preprocess_func = (data) -> -data / 1000,),
method = time_interpolation_method,
compose_function = (mtpr, msr) -> mtpr - msr,
)

# Precip is provide as a mass flux; convert to volume flux of liquid water with ρ =1000 kg/m^3
snow_precip = TimeVaryingInput(
era5_ncdata_path,
"msr",
surface_space;
start_date,
regridder_type,
file_reader_kwargs = (; preprocess_func = (data) -> -data,),
file_reader_kwargs = (; preprocess_func = (data) -> -data / 1000,),
method = time_interpolation_method,
)

Expand Down

0 comments on commit ee93d4a

Please sign in to comment.