Skip to content

Sponge layer not behaving as expected #1488

Discussion options

You must be logged in to vote

Apparently running on GPUs has a few caveats even after you guys did most of the hard work in Oceananigans

@tomchor the reason your code did not compile is because this function

function bottom_mask_func(x, y, z)
    sponge_one = -grid.Lz/2; sponge_zero = sponge_one + grid.Lz/10
    return heaviside(-(z-sponge_zero)) * (z - sponge_zero)^2 / (sponge_one - sponge_zero)^2
end

references grid.Lz as a global variable. Global variables can only be used inside functions on the GPU if they are declared const as @ali-ramadhan has done.

One strategy to avoid having to use const is to build callable objects like GaussianMask that store their parameters. This is why a parameterized GaussianMask cal…

Replies: 25 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 24, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 24, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 25, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 25, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 25, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 25, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by tomchor
Comment options

tomchor
Nov 26, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

tomchor
Nov 26, 2020
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tomchor
Comment options

tomchor Mar 17, 2021
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #1203 on March 17, 2021 03:11.