Skip to content

Commit

Permalink
move the 4th order reconstruction into mesh (#302)
Browse files Browse the repository at this point in the history
this is consistent with the other reconstruction routines
  • Loading branch information
zingale authored Nov 22, 2024
1 parent 9f497fa commit c4a7799
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion examples/mesh/bc_demo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# test the boundary fill routine


import numpy as np

import pyro.mesh.boundary as bnd
import pyro.mesh.patch as patch
import numpy as np


def doit():
Expand Down
6 changes: 3 additions & 3 deletions pyro/advection_fv4/fluxes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pyro.mesh.array_indexer as ai
from pyro.advection_fv4 import interface
from pyro.mesh import fourth_order


def fluxes(my_data, rp):
Expand Down Expand Up @@ -72,13 +72,13 @@ def fluxes(my_data, rp):
1./12.*(a.jp(-2, buf=1) + a.jp(1, buf=1))

else:
a_l, a_r = interface.states(a, myg.ng, 1)
a_l, a_r = fourth_order.states(a, myg.ng, 1)
if u > 0:
a_x = ai.ArrayIndexer(d=a_l, grid=myg)
else:
a_x = ai.ArrayIndexer(d=a_r, grid=myg)

a_l, a_r = interface.states(a, myg.ng, 2)
a_l, a_r = fourth_order.states(a, myg.ng, 2)
if v > 0:
a_y = ai.ArrayIndexer(d=a_l, grid=myg)
else:
Expand Down
5 changes: 2 additions & 3 deletions pyro/compressible_fv4/fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import pyro.compressible as comp
import pyro.mesh.array_indexer as ai
from pyro.advection_fv4 import interface
from pyro.compressible import riemann
from pyro.mesh import reconstruction
from pyro.mesh import fourth_order, reconstruction


def flux_cons(ivars, idir, gamma, q):
Expand Down Expand Up @@ -104,7 +103,7 @@ def fluxes(myd, rp, ivars):

else:
for n in range(ivars.nq):
q_l[:, :, n], q_r[:, :, n] = interface.states(q_avg[:, :, n], myg.ng, idir)
q_l[:, :, n], q_r[:, :, n] = fourth_order.states(q_avg[:, :, n], myg.ng, idir)

# apply flattening
for n in range(ivars.nq):
Expand Down
2 changes: 1 addition & 1 deletion pyro/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
necessary to work with finite-volume data.
"""

__all__ = ['patch', 'integration', 'reconstruction']
__all__ = ['patch', 'fourth_order', 'integration', 'reconstruction']

from .array_indexer import ArrayIndexer, ArrayIndexerFC
from .boundary import BC, bc_is_solid, define_bc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Reconstruction routines for 4th order finite-volume methods"""

import numpy as np
from numba import njit

Expand Down Expand Up @@ -84,7 +86,7 @@ def states(a, ng, idir):
# this lives on the interface
d3a[i, j] = d2ac[i, j] - d2ac[i - 1, j]

# this is a look over cell centers, affecting
# this is a loop over cell centers, affecting
# i-1/2,R and i+1/2,L
for i in range(ilo - 1, ihi + 1):
for j in range(jlo - 1, jhi + 1):
Expand Down

0 comments on commit c4a7799

Please sign in to comment.