Skip to content

Commit

Permalink
🐛 Fix get_resolution using coarse GCI (#16)
Browse files Browse the repository at this point in the history
When using the coarse GCI to calculate the required resolution using `get_resolution`, $h_1$ was set to the fine grid resolution, rather than the coarse grid.
  • Loading branch information
H0R5E authored Nov 20, 2024
1 parent 0c39bef commit 4e94653
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ downloading the source code, and using the command prompt as follows:

```
cd /path/to/convergence
python setup.py install
pip install --editable .
```

Note that the stable version may not contain all of the features found in the
Expand Down 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 4e94653

Please sign in to comment.