Skip to content

Fields interpolation on lagrangian particle trajectories #3297

Discussion options

You must be logged in to vote

Hi Roger,

You could do this by making a custom particle, using tracked fields to set the particle properties, and saving the particles the normal way. For example:

using Oceananigans
using Oceananigans.Fields: VelocityFields
using StructArrays

struct TrackingParticle{FT}
    x :: FT
    y :: FT
    z :: FT
    u :: FT
    v :: FT
    w :: FT
    b :: FT
end

grid = RectilinearGrid(; size = (128, 128, 128), extent = (100, 100, 100))

n = 100

x₀, y₀, z₀, u₀, v₀, w₀, b₀ = [zeros(n) for i in 1:7]

particles = StructArray{TrackingParticle}((x₀, y₀, z₀, u₀, v₀, w₀, b₀))

u, v, w = VelocityFields(grid)

b = CenterField(grid)

lagrangian_particles = LagrangianParticles(particles, tracked_fields =

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
8 replies
@glwagner
Comment options

@weigwu
Comment options

@jagoosw
Comment options

jagoosw Sep 28, 2023
Collaborator

@jagoosw
Comment options

jagoosw Sep 28, 2023
Collaborator

@glwagner
Comment options

Answer selected by weigwu
Comment options

You must be logged in to vote
2 replies
@glwagner
Comment options

@glwagner
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants