Skip to content

Commit

Permalink
examples: avoid too tight cfl for elastic
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Sep 9, 2024
1 parent 4526d35 commit 99f692b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 90 deletions.
4 changes: 2 additions & 2 deletions examples/seismic/elastic/elastic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def run(shape=(50, 50), spacing=(20.0, 20.0), tn=1000.0,
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_elastic(dtype):
_, _, _, [rec1, rec2, v, tau] = run(dtype=dtype)
assert np.isclose(norm(rec1), 19.25636, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.6276, atol=1e-3, rtol=0)
assert np.isclose(norm(rec1), 19.75840, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.6441, atol=1e-3, rtol=0)


@pytest.mark.parametrize('shape', [(51, 51), (16, 16, 16)])
Expand Down
2 changes: 1 addition & 1 deletion examples/seismic/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _cfl_coeff(self):
if 'lam' in self._physical_parameters or 'vs' in self._physical_parameters:
coeffs = fd_w(1, range(-self.space_order//2+1, self.space_order//2+1), .5)
c_fd = sum(np.abs(coeffs[-1][-1])) / 2
return np.sqrt(self.dim) / self.dim / c_fd
return .95 * np.sqrt(self.dim) / self.dim / c_fd
a1 = 4 # 2nd order in time
coeffs = fd_w(2, range(-self.space_order, self.space_order+1), 0)[-1][-1]
return np.sqrt(a1/float(self.grid.dim * sum(np.abs(coeffs))))
Expand Down
125 changes: 41 additions & 84 deletions examples/seismic/tutorials/06_elastic_varying_parameters.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/seismic/tutorials/09_viscoelastic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
{
"data": {
"text/plain": [
"150"
"158"
]
},
"execution_count": 12,
Expand Down
4 changes: 2 additions & 2 deletions examples/seismic/viscoelastic/viscoelastic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def run(shape=(50, 50), spacing=(20.0, 20.0), tn=1000.0,
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_viscoelastic(dtype):
_, _, _, [rec1, rec2, v, tau] = run(dtype=dtype)
assert np.isclose(norm(rec1), 12.28040, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.312462, atol=1e-3, rtol=0)
assert np.isclose(norm(rec1), 12.60212, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.320817, atol=1e-3, rtol=0)


@pytest.mark.parametrize('shape', [(51, 51), (16, 16, 16)])
Expand Down

0 comments on commit 99f692b

Please sign in to comment.