You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The soil model requires, when setting boundary conditions, the values of the state and certain derived properties (temperature, specific humidity, etc) at the surface.
which takes the top center value as the surface value, and creates a field on the surface space. This is allocating, and resolution dependent since the value at the top center depends on resolution.
The first method, as far as I can tell, allocates and does what #1 does, but in a cleaner way. The second method is for when we have a scalar (not depth dependent) argument and so we dont need to interpolate.
In a recent PR, we introduced linear_interpolation_to_surface!(sfc_field, center_field, z) which allocates when we create the \Delta z field, but does not allocate the surface field otherwise (but instead modifies the values at a preallocated spot). The benefit to this is that it should be less resolution dependent.
Desired solution
A single function for extrapolating from the center field values to the surface (we could support both nearest neighbor and linear extrapolation, but Im not sure we need to, as the first is resolution dependent and the latter is less so).
We still need to support this handling scalar input
All methods non-allocating (this will require adding scratch space) to p. This may require adding \Delta z fields and z to p as well.
Impacts
Since we use this functionality (center to surface extrapolation) a lot when computing BC, especially the "atmos driven ones" this might tie into performance work @Sbozzolo is doing on turbulent_fluxes. These same functions also will show up in the jacobian boundary contribution terms that @juliasloan25 is working on
We may also need to think about where scratch space is stored. is p.soil.sfc_scratch1, p.soil.sfc_scratch2 reasonable? or should we do p.soil.scratch.sfc1? idk. will think more and we can discuss
The text was updated successfully, but these errors were encountered:
Purpose
Reduce allocations and remove duplicate code
Description
The soil model requires, when setting boundary conditions, the values of the state and certain derived properties (temperature, specific humidity, etc) at the surface.
We currently use
top_center_to_surface
ClimaLand.jl/src/shared_utilities/Domains.jl
Line 660 in f36042f
which takes the top center value as the surface value, and creates a field on the surface space. This is allocating, and resolution dependent since the value at the top center depends on resolution.
We also have
ClimaLand.jl/src/standalone/Soil/boundary_conditions.jl
Line 27 in f36042f
ClimaLand.jl/src/standalone/Soil/boundary_conditions.jl
Line 48 in f36042f
The first method, as far as I can tell, allocates and does what #1 does, but in a cleaner way. The second method is for when we have a scalar (not depth dependent) argument and so we dont need to interpolate.
linear_interpolation_to_surface!(sfc_field, center_field, z)
which allocates when we create the \Delta z field, but does not allocate the surface field otherwise (but instead modifies the values at a preallocated spot). The benefit to this is that it should be less resolution dependent.Desired solution
p
. This may require adding \Delta z fields andz
top
as well.Impacts
Since we use this functionality (center to surface extrapolation) a lot when computing BC, especially the "atmos driven ones" this might tie into performance work @Sbozzolo is doing on
turbulent_fluxes
. These same functions also will show up in the jacobian boundary contribution terms that @juliasloan25 is working onWe may also need to think about where scratch space is stored. is p.soil.sfc_scratch1, p.soil.sfc_scratch2 reasonable? or should we do p.soil.scratch.sfc1? idk. will think more and we can discuss
The text was updated successfully, but these errors were encountered: