From 5e3f3ed6cc2608286e1542a20058c9d9c75f0bc1 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Thu, 29 Aug 2024 10:27:55 -0400 Subject: [PATCH] Fix some conversions --- src/Topologies/dss.jl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Topologies/dss.jl b/src/Topologies/dss.jl index d8ddacbb70..06316dd162 100644 --- a/src/Topologies/dss.jl +++ b/src/Topologies/dss.jl @@ -176,6 +176,15 @@ function dss_transform!( return nothing end +# For DSS of Covariant123Vector, the third component is treated like a scalar +# and is not transformed +@inline drop_vert_dim( + ::Type{T}, + x::Geometry.UVWVector, +) where {T <: Geometry.UVVector} = Geometry.UVVector(x.u, x.v) +@inline drop_vert_dim(::Type{T}, x::T) where {T} = x +@inline drop_vert_dim(::Type{T}, x::Real) where {T <: Real} = x + """ function dss_transform!( ::ClimaComms.AbstractCPUDevice, @@ -215,12 +224,14 @@ function dss_transform!( for (p, (ip, jp)) in enumerate(perimeter) for level in 1:nlevels loc = CI(ip, jp, 1, level, elem) - wt = weight[loc] - perimeter_data[CI(p, 1, 1, level, elem)] = dss_transform( + src = dss_transform( data[loc], local_geometry[CI(ip, jp, 1, level, elem)], - wt, + weight[loc], ) + perimeter_data[CI(p, 1, 1, level, elem)] = + drop_vert_dim(eltype(perimeter_data), src) + end end end