Giter Club home page Giter Club logo

Comments (3)

Jamie-Hilditch avatar Jamie-Hilditch commented on September 21, 2024 1

Yes, this change plus adding the code to "enforce" the boundary conditions appears to fix the bug. The fractional indices are truncated in two places - the advection code and in bounce_immersed_particle. I've fixed them both but not done any tests with an immersed boundary. I'll open a PR and you can take a look.

from oceananigans.jl.

glwagner avatar glwagner commented on September 21, 2024

Thank you for opening this @Jamie-Hilditch ! Of course we want to advect particles in Flat geometries :-D

I think this is a bug because apparently there is some attempt to support Flat, since

calls these functions

# To support interpolation on Flat grids
@inline flattened_node((x, y, z), grid) = (x, y, z)
@inline flattened_node((x, y, z), grid::XFlatGrid) = (y, z)
@inline flattened_node((x, y, z), grid::YFlatGrid) = (x, z)
@inline flattened_node((x, y, z), grid::ZFlatGrid) = (x, y)
@inline flattened_node((x, y, z), grid::YZFlatGrid) = tuple(x)
@inline flattened_node((x, y, z), grid::XZFlatGrid) = tuple(y)
@inline flattened_node((x, y, z), grid::XYFlatGrid) = tuple(z)

Something must have broken when we changed fractional_indices...

We may want

# Deal with `nothing` indices, which are output by `fractional_indices` in `Flat` domains
@inline truncate_index(::Nothing) = 1
@inline truncate_index(i) = Base.unsafe_trunc(Int, i)

and then

fi, fj, fk = fractional_indices(X, grid, c, c, c)
i = truncate_index(fi)
j = truncate_index(fj)
k = truncate_index(fk)

Does this solve the problem? (I'm also suggesting a small change in notation to clarify the difference between a "fractional index" and a truncated index.)

@Jamie-Hilditch if you like, you can contribute this change --- or I can add it. Up to you, let us know.

from oceananigans.jl.

glwagner avatar glwagner commented on September 21, 2024

@Jamie-Hilditch great!

We could also change the name of enforce_boundary_conditions or whatever it is now to make it more accurate 😄

from oceananigans.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.