Utilities
ClimaCore.Utilities.PlusHalf
— TypePlusHalf(i)
Represents i + 1/2
, but stored as internally as an integer value. Used for indexing into staggered finite difference meshes: the convention "half" values are indexed at cell faces, whereas centers are indexed at cell centers.
Supports +
, -
and inequalities.
See also half
.
ClimaCore.Utilities.half
— Constantconst half = PlusHalf(0)
Utilities.Cache
ClimaCore.Utilities.Cache
— ModuleUtilities.Cache
ClimaCore maintains an internal cache of topology and grid objects: this ensures that if the constructor with the same arguments is invoked again (e.g. by reading from a file), the cached object will be returned (also known as memoization). This has two main advantages:
topology and metric information can be reused, reducing memory usage.
it is easy to check if two fields live on the same grid: we can just check if the underlying grid objects are the same (
===
), rather than checking all the fields are equal (via==
).
However this means that objects in the cache will not be removed from the garbage collector, so we provide an interface to remove these.
ClimaCore.Utilities.Cache.cached_objects
— FunctionUtilities.Cache.cached_objects()
List all currently cached objects.
ClimaCore.Utilities.Cache.clean_cache!
— FunctionUtilities.Cache.clean_cache!(object)
Remove object
from the cache of created objects.
In most cases, this function should not need to be called, unless you are constructing many grid objects, for example when doing a sweep over grid paramaters.
Utilities.Cache.clean_cache!()
Remove all objects from the cache of created objects.
In most cases, this function should not need to be called, unless you are constructing many grid objects, for example when doing a sweep over grid paramaters.