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

Grids with T other than the default Float64 are not constructed in a consistent manner #108

Closed
navidcy opened this issue Jun 30, 2019 · 0 comments · Fixed by #109
Closed
Assignees

Comments

@navidcy
Copy link
Member

navidcy commented Jun 30, 2019

There is a problem here:

function TwoDGrid(nx, Lx, ny=nx, Ly=Lx; x0=-Lx/2, y0=-Ly/2, nthreads=Sys.CPU_THREADS, effort=FFTW.MEASURE, T=Float64,
dealias=1/3)
dx = Lx/nx
dy = Ly/ny

If somebody prescribes

Lx=2π

as Float64 and then calls gr=TwoDGrid(nx, Lx, T=Float32), the resulting grid has

julia> typeof(gr.Lx)
Float64

while, e.g,

julia> typeof(gr.x)
Array{Float32,2}

I feel that the solution is to make sure Lx is typed correctly by adding

Lx = T(Lx)
Ly = T(Ly)

in the beginning of TwoDGrid function.

(Similarly in OneDGrid...)

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

Successfully merging a pull request may close this issue.

2 participants