Skip to content

Commit

Permalink
the 4th order solvers are only guaranteed to work with square cells (#…
Browse files Browse the repository at this point in the history
…340)

this asserts that
  • Loading branch information
zingale authored Feb 11, 2025
1 parent 71132d6 commit 2276093
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 49 deletions.
5 changes: 5 additions & 0 deletions pyro/compressible_fv4/simulation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import numpy as np

import pyro.compressible_fv4.fluxes as flx
from pyro import compressible_rk
from pyro.compressible import get_external_sources, get_sponge_factor
Expand Down Expand Up @@ -70,6 +72,9 @@ def preevolve(self):
this solver assumes that the initialization was done to
cell-centers and converts it to cell-averages."""

# this should only work for dx == dy
assert np.abs(self.cc_data.grid.dx - self.cc_data.grid.dy) < 1.e-12 * self.cc_data.grid.dx, "grid cells need to be square"

# we just initialized cell-centers, but we need to store averages
for var in self.cc_data.names:
self.cc_data.from_centers(var)
100 changes: 51 additions & 49 deletions pyro/solver-test.ipynb

Large diffs are not rendered by default.

0 comments on commit 2276093

Please sign in to comment.