Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectral element operator patterns (possible improvements) #1915

Open
akshaysridhar opened this issue Aug 8, 2024 · 0 comments
Open

Spectral element operator patterns (possible improvements) #1915

akshaysridhar opened this issue Aug 8, 2024 · 0 comments

Comments

@akshaysridhar
Copy link
Member

akshaysridhar commented Aug 8, 2024

Following a review comment by charleskawczynski, I'll leave this suggestion in an issue for future visibility - we currently use @simd in the spectral operator blocks, but an alternative is as follows:

        e1 = length(input)  1 ? (mapreduce(k -> D[i, k]  input[1][k, j, vt], , 1:Nq), mapreduce(k -> D[j, k]  input[1][i, k, vt], , 1:Nq)) : ()
        e2 = length(input)  2 ? (mapreduce(k -> D[i, k]  input[2][k, j, vt], , 1:Nq), mapreduce(k -> D[j, k]  input[2][i, k, vt], , 1:Nq)) : ()
        e3 = length(input)  3 ? (mapreduce(k -> D[i, k]  input[3][k, j, vt], , 1:Nq), mapreduce(k -> D[j, k]  input[3][i, k, vt], , 1:Nq)) : ()
        t = (e1...,e2...,e3...)

        if length(input) == 1 # check types
            return Geometry.Covariant12Vector(t...)
        elseif length(input) == 2
            return Geometry.AxisTensor((Geometry.Covariant12Axis(), Geometry.UVAxis()), t)
        else
            return Geometry.AxisTensor((Geometry.Covariant12Axis(), Geometry.UVWAxis()), t)
        end

Originally posted by @charleskawczynski in #1736 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant