Skip to content
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

Allow for data-dependent filters #76

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

angus-g
Copy link
Owner

@angus-g angus-g commented Nov 12, 2021

The previously-added spatially-varying filter (#70) supports variable filter frequencies that are statically initialised. It may also be the case that we want to filter based on some kind of time-varying variable, such as the vorticity. Here, we'll teach the filter library how to handle this case.

General tasks

  • Split out the filters to individual files
  • Generalise the sample_kernel to optionally support sampling more variables in the initial condition stage than the advection stage
  • Read the data from the initial_kernel by teaching the particle cache about "once variables"
  • Pass the extra sampled data through apply_filter
  • Construct the filters in apply_filter, based on the extra data, and apply them as usual

Tests

  • Test the initial data kernel works as expected
    • Read data off the particle class directly
    • Make sure the data is written to the advection cache (before the first advection step after the sampling pass)
  • Test that the initial data is passed through to apply_filter in a usable manner

Documentation

  • Example for vorticity-based cutoff
  • General API for alternative filters (i.e. attaching them as the .inertial_filter member)

With the impending addition of yet another filter, it will get a bit
too confusing to have them all in a single file. This change shouldn't
affect functionality, even if the filters were being accessed
directly.
@angus-g angus-g force-pushed the vorticity-filtering branch 4 times, most recently from fea0208 to 074cc81 Compare November 16, 2021 07:35
Instead of sampling these variables every timestep during the
advection phase, these variables (e.g. for data-dependent filtering)
only need to be sampled once, at the "middle" timestep. We mkae sure
they're present in our particle class and the initial sampling kernel,
but they're not stored as part of our advection.

Currently, this implementation does nothing more than populate this
variable on the particles.
This uses a bit of a complicated system, with a Placeholder class that
denotes a variable is slated to be written, but hasn't yet been
written. When it has been written, we distinguish between what will be
continuously written by noticing it has two dimensions.
These variables could be used to construct on-the-fly filters.
We also export all the filters in __all__, so they can be picked up by
`from filter import *`, and perhaps more importantly, by sphinx.
Currently fails because the initially sampled data is all zero!
This isn't a particularly functional test: we just ensure that if we
specify a data-dependent filter, it is able to actually filter some
input data according to a statically-sampled variable, and create the
filters on-the-fly.
@angus-g angus-g marked this pull request as ready for review November 18, 2021 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant