-
Notifications
You must be signed in to change notification settings - Fork 2
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
Negative velocities #64
Changes from 4 commits
487141e
3a78bcf
620d61a
7736ae9
561c42a
7417550
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,40 @@ def test_single_point(): | |
assert error < 1e-10, "Numerical error too big" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, the reason I didn't add was because I didn't find any test for the actual alignment implementation either (the current blob tests work both for alignment true and false, without changing expected values) |
||
|
||
|
||
def test_negative_radial_velocity(): | ||
vx = -1 | ||
blob_sp = Blob( | ||
blob_id=0, | ||
blob_shape=BlobShapeImpl("gauss"), | ||
amplitude=1, | ||
width_prop=1, | ||
width_perp=1, | ||
velocity_x=vx, | ||
velocity_y=1, | ||
pos_x=0, | ||
pos_y=6, | ||
t_init=0, | ||
t_drain=10**100, | ||
) | ||
|
||
x = np.arange(-5, 5, 0.1) | ||
y = 0 | ||
t = 2 | ||
|
||
mesh_x, mesh_y = np.meshgrid(x, y) | ||
blob_values = blob_sp.discretize_blob( | ||
x=mesh_x, y=mesh_y, t=t, periodic_y=True, Ly=10 | ||
) | ||
|
||
# The exact analytical expression for the expected values is a bit cumbersome, thus we just check | ||
# that the shape is correct | ||
maxx = np.max(blob_values) | ||
expected_values = maxx * np.exp(-((mesh_x - vx * t) ** 2)) | ||
error = np.max(abs(expected_values - blob_values)) | ||
|
||
assert error < 1e-10, "Numerical error too big" | ||
|
||
|
||
def test_theta_0(): | ||
blob_sp = Blob( | ||
blob_id=0, | ||
|
@@ -137,8 +171,3 @@ def test_kwargs(): | |
blob_sp.discretize_blob(x=mesh_x, y=mesh_y, t=0, periodic_y=True, Ly=10) | ||
|
||
mock_ps.get_pulse_shape_prop.assert_called_with([[0]], lam=0.2) | ||
|
||
|
||
test_initial_blob() | ||
test_periodicity() | ||
test_single_point() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to keep the blob alignment it would probably make sense to access it in the model class. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it there first. I changed it to the forcing class to minimize interface changes since I guess most people will not care whether their blobs are aligned or not. I can add it there, it is just to send it straight to the forcing constructor.