GithubHelp home page GithubHelp logo

Comments (1)

milankl avatar milankl commented on June 30, 2024

I just printed the time step and time for dynamics and particle advection (PA)

julia> run!(simulation, period=Day(1));
[ Info: (0, DateTime("2000-01-01T00:00:00"))
[ Info: ("PA:", 0, DateTime("2000-01-01T00:00:00"))
[ Info: (0, DateTime("2000-01-01T00:15:00"))
[ Info: (1, DateTime("2000-01-01T00:30:00"))
[ Info: (2, DateTime("2000-01-01T01:00:00"))
[ Info: (3, DateTime("2000-01-01T01:30:00"))
[ Info: (4, DateTime("2000-01-01T02:00:00"))
[ Info: (5, DateTime("2000-01-01T02:30:00"))
[ Info: (6, DateTime("2000-01-01T03:00:00"))
[ Info: (7, DateTime("2000-01-01T03:30:00"))
[ Info: (8, DateTime("2000-01-01T04:00:00"))
[ Info: ("PA:", 8, DateTime("2000-01-01T04:00:00"))
[ Info: (9, DateTime("2000-01-01T04:30:00"))
[ Info: (10, DateTime("2000-01-01T05:00:00"))
[ Info: (11, DateTime("2000-01-01T05:30:00"))
[ Info: (12, DateTime("2000-01-01T06:00:00"))
[ Info: (13, DateTime("2000-01-01T06:30:00"))
[ Info: (14, DateTime("2000-01-01T07:00:00"))
[ Info: (15, DateTime("2000-01-01T07:30:00"))
[ Info: (16, DateTime("2000-01-01T08:00:00"))
[ Info: ("PA:", 16, DateTime("2000-01-01T08:00:00"))
[ Info: (17, DateTime("2000-01-01T08:30:00"))
[ Info: (18, DateTime("2000-01-01T09:00:00"))
[ Info: (19, DateTime("2000-01-01T09:30:00"))
[ Info: (20, DateTime("2000-01-01T10:00:00"))
[ Info: (21, DateTime("2000-01-01T10:30:00"))
[ Info: (22, DateTime("2000-01-01T11:00:00"))
[ Info: (23, DateTime("2000-01-01T11:30:00"))
[ Info: (24, DateTime("2000-01-01T12:00:00"))
[ Info: ("PA:", 24, DateTime("2000-01-01T12:00:00"))
[ Info: (25, DateTime("2000-01-01T12:30:00"))
[ Info: (26, DateTime("2000-01-01T13:00:00"))
[ Info: (27, DateTime("2000-01-01T13:30:00"))
[ Info: (28, DateTime("2000-01-01T14:00:00"))
[ Info: (29, DateTime("2000-01-01T14:30:00"))
[ Info: (30, DateTime("2000-01-01T15:00:00"))
[ Info: (31, DateTime("2000-01-01T15:30:00"))
[ Info: (32, DateTime("2000-01-01T16:00:00"))
[ Info: ("PA:", 32, DateTime("2000-01-01T16:00:00"))
[ Info: (33, DateTime("2000-01-01T16:30:00"))
[ Info: (34, DateTime("2000-01-01T17:00:00"))
[ Info: (35, DateTime("2000-01-01T17:30:00"))
[ Info: (36, DateTime("2000-01-01T18:00:00"))
[ Info: (37, DateTime("2000-01-01T18:30:00"))
[ Info: (38, DateTime("2000-01-01T19:00:00"))
[ Info: (39, DateTime("2000-01-01T19:30:00"))
[ Info: (40, DateTime("2000-01-01T20:00:00"))
[ Info: ("PA:", 40, DateTime("2000-01-01T20:00:00"))
[ Info: (41, DateTime("2000-01-01T20:30:00"))
[ Info: (42, DateTime("2000-01-01T21:00:00"))
[ Info: (43, DateTime("2000-01-01T21:30:00"))
[ Info: (44, DateTime("2000-01-01T22:00:00"))
[ Info: (45, DateTime("2000-01-01T22:30:00"))
[ Info: (46, DateTime("2000-01-01T23:00:00"))
[ Info: (47, DateTime("2000-01-01T23:30:00"))

As you can see the first Euler step starts with 0, the "2nd" time step (the first Leapfrog step) isn't counted, so that after time step 1 30min, time step 2 1h, timestep 3 1h30min, etc. The particle advection is then done after each 8 (by default but that's a parameter you can choose) timesteps correctly skipping the not counted first time steps.

The 48th time step that would step from 24h to 24h30 is not executed as the simulation period is set to Day(1). So I am indeed wondering whether we should do the particle advection after time step -1, 7, 15, 23, 31, 39, 47, instead of after 0, 8, 16, 24, 32, 40, 48 (which is right now not executed). I also realised that we're technically using the velocities at n+1 (i.e. 1, 9, 17, 25, ...) because particle_advection! is currently called after gridded! which transforms the spectral state at the end of a time step (i.e. the new time step) to grid-point space. Maybe that should be changed too. The decision when to execute the particle advection is made here

# escape immediately if advection not on this timestep
clock.timestep_counter % particle_advection.every_n_timesteps == 0 || return nothing
# don't do particle advection on the 2nd time step (which is half a leapfrog step that isn't counted)
clock.timestep_counter == 0 && lf == 2 && return nothing

and particle_advection! is called here

particle_advection!(progn, diagn, lf2, model.particle_advection)

Feel free to put some more thought into when to call particle advection and createa pull request for it!

from speedyweather.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.