-
Notifications
You must be signed in to change notification settings - Fork 194
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
Error related to conjugate gradient Poisson solver when setting initial condition #3896
Comments
That's a decent minimal example! Are you sure that the error requires I find I can reproduce the error without About the error. The top of the message says
This means that the kernel function julia> f(x, y) = x + y
f (generic function with 1 method)
julia> f(1)
ERROR: MethodError: no method matching f(::Int64)
Closest candidates are:
f(::Any, ::Any)
@ Main REPL[1]:1
Stacktrace:
[1] top-level scope
@ REPL[2]:1 The stacktrace shows
let's look at that line: Oceananigans.jl/src/Solvers/conjugate_gradient_poisson_solver.jl Lines 109 to 110 in 6c40d7e
This uses the Oceananigans utility
we see that the function has 4 arguments, not 3. Hence the error. To summarize the analysis method, the key is to find the function that causes the error in the source code ( Here's an updated MWE from your nice one @liuchihl : using Oceananigans
using Oceananigans.Solvers: ConjugateGradientPoissonSolver, fft_poisson_solver
N = 2
x = y = (0, 1)
z = [0, 0.2, 1]
grid = RectilinearGrid(size=(N, N, N); x, y, z, halo=(2, 2, 2), topology=(Bounded, Periodic, Bounded))
fft_solver = fft_poisson_solver(grid)
pressure_solver = ConjugateGradientPoissonSolver(grid, preconditioner=fft_poisson_solver(grid))
model = NonhydrostaticModel(; grid, pressure_solver)
set!(model, u=1) |
Using that MWE I fixed a number of bugs in this commit: aa0a43e and the MWE now works. |
You are absolutely right! Those are not needed. Thank you so much for the detailed explanation, I get it now :) |
I've received an error possibly related to the preconditioner, and it appears when I set the initial condition, e.g.,
set!(model, u=uᵢ)
:Here's a minimal working example (I tried to make it as minimal as possible, apologies if it's not minimal enough). I set the bottom topography to zero everywhere except for one grid cell, which is set to 0.2. Notably, when I change this value from 0.2 to 0.01, the error no longer appears. It is not clear to me what the issue might be.
The text was updated successfully, but these errors were encountered: