-
Notifications
You must be signed in to change notification settings - Fork 211
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
Fix ConjugateGradientPoissonSolver
construction with default pre-conditioner
#3830
Conversation
@testset "ConjugateGradientSolver" begin | ||
for arch in archs | ||
@info "Testing ConjugateGradientSolver [$(typeof(arch))]..." | ||
grid = RectilinearGrid(arch, size=(4, 8, 4), extent=(1, 3, 1)) | ||
run_identity_operator_test(grid) | ||
run_poisson_equation_test(grid) | ||
construct_conjugate_gradient_poisson_solver_with_default_preconditioner(grid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
construct_conjugate_gradient_poisson_solver_with_default_preconditioner(grid) | |
solver = ConjugateGradientPoissonSolver(grid) | |
@test solver isa ConjugateGradientPoissonSolver |
function construct_conjugate_gradient_poisson_solver_with_default_preconditioner(grid) | ||
solver = ConjugateGradientPoissonSolver(grid) | ||
return true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function construct_conjugate_gradient_poisson_solver_with_default_preconditioner(grid) | |
solver = ConjugateGradientPoissonSolver(grid) | |
return true | |
end |
Oof, good catch. Thanks for adding the test. As a temporary fix, we could add a special constructor for I suspect re-ordering the imports will be a larger piece of work that will probably require some work from @simone-silvestri . Technical debt is entrenched. |
To do this, we need to shift the definitions of
This will make the |
It'd be easier to understand the suggestions if you put the links to the source code in your comment. |
Thanks for the suggestions @simone-silvestri! And I noticed you started doing some refactoring in PR #3847 so I'll close this in favor of your PR. |
I added a test that fails due to #3829. I should also test the non-FFT case and test that the proper pre-conditioner was initialized. So the test could be better but it does fail as it should.
What we need is a
using Oceananigans.ImmersedBoundaries
but the solvers module is defined well before the immersed boundaries module.So for a solver to depend on the immersed boundaries module, and really just the
ImmersedBoundaryGrid
type then the immersed boundaries module needs to be included first.Based on these comments maybe it's desirable to change the order of inclusion? But maybe it'll take some work. So otherwise we probably need to define another abstract type in
src/Oceananigans.jl
but this solution isn't ideal.Oceananigans.jl/src/Oceananigans.jl
Lines 214 to 228 in 13bf409
Resolves #3829