Add drifting sources with Doppler shift and Mach cone scenes - #1
Merged
Merged
Conversation
…l positions, reflection off the border and walls
…heir nearest cell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
vx,vy). A drifting source is injected into its four surrounding cells with bilinear weights so it glides instead of hopping, and it reflects off the tank border and any wall it runs into.Why
Moving sources are the other half of what a ripple tank is for: the Doppler shift and the shock cone are hard to picture from formulas and immediate to see here. Bilinear injection matters because a source hopping whole cells at sub-cell speeds injects a stair-stepped signal and spoils the wavefronts.
Tests
Added to the Node suite: fractional-position injection splits evenly between neighbours; a drifting source stays inside the tank and turns around at the border and at walls; a still source is left alone; a zero-crossing count ahead of and behind a moving source shows the Doppler compression; the Doppler and Mach scenes keep the source in bounds and the field finite over 1500 steps.
npm test: 31 passing.Checked in the browser: Doppler shows compressed fronts ahead and stretched ones behind; the Mach scene shows the V-shaped front. Keeping the Mach source under one cell per step avoids the aliasing noise a faster source leaves in its wake.