Skip to content

Commit

Permalink
Use the right grid resolution for coarse grid calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
H0R5E committed Nov 20, 2024
1 parent da4d3cb commit c91770c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pass `"coarse"` as the second optional argument:

```python
>>> convergence.get_resolution(0.001, "coarse")
0.49157306062118994
0.9831461212423799

```

Expand Down
4 changes: 3 additions & 1 deletion src/convergence/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,16 @@ def get_resolution(self, gci, estimate="fine"):

if estimate == "fine":
gci12 = self[0].fine.gci_fine
h1 = self._grids[0][0]
elif estimate == "coarse":
gci12 = self[0].fine.gci_coarse
h1 = self._grids[1][0]
else:
raise ValueError("Unrecognised value passed to estimate. Should "
"be one of 'fine' or 'coarse'")

p = self[0].coarse.p
h1 = self._grids[0][0]


return required_resolution(gci, gci12, p, h1)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_convergence_anal_str(convergence_anal):

@pytest.mark.parametrize("estimate, expected", [
("fine", 0.9831461212423797),
("coarse", 0.49157306062118994)])
("coarse", 0.9831461212423799)])
def test_get_resolution(convergence, estimate, expected):
assert convergence.get_resolution(0.001, estimate) == expected

Expand Down

0 comments on commit c91770c

Please sign in to comment.