Geometry

ClimaCore.Geometry.mul_with_projectionFunction
mul_with_projection(x, y, lg)

Similar to x * y, except that this version automatically projects y to avoid DimensionMismatch errors for Tensors. For example, if x is a covector along the Covariant3Axis (e.g., Covariant3Vector(1)'), then y will be projected onto the Contravariant3Axis. In general, the first axis of y will be projected onto the dual of the last axis of x.

source
ClimaCore.Geometry.mul_return_typeFunction
mul_return_type(X, Y)

Return type of mul_with_projection(x, y, lg). Equivalent to Base._return_type(mul_with_projection, Tuple{X, Y, LG}) but explicit so that MatrixFields' eltype inference always sees a concrete type — internal _return_type can widen to Union/Any and is unstable across Julia versions.

The methods cover six distinct result shapes (scalar×scalar, scalar×tensor, covector×vector, vector×covector, 2-tensor×vector, 2-tensor×2-tensor) where the output ndims goes up, down, or stays the same — no single formula fits all of them.

Future cleanup: try replacing with Base._return_type and keep only methods that fail; collapse the two Tensor{2}*Tensor{N} cases via Base.tail(axes(Y)); move tensor_type/basis1/basis2 to tensors.jl.

source