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 12, 2024
1 parent d6006ae commit 20313d8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 49 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 @@ -39,8 +39,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.43005, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.6345, atol=1e-3, rtol=0)
assert np.isclose(norm(rec1), 19.9367, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.6512, 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 @@ -356,7 +356,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
86 changes: 43 additions & 43 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 @@ -41,8 +41,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.30114, atol=1e-3, rtol=0)
assert np.isclose(norm(rec2), 0.312462, atol=1e-3, rtol=0)
assert np.isclose(norm(rec1), 12.62339, 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 20313d8

Please sign in to comment.