Skip to content
Open
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bb948fb
setting ppm interface reconstruction
aisclark91 Mar 4, 2023
cb1d11b
solving typos
aisclark91 Mar 7, 2023
1e6e661
adding advection_ppm setup
aisclark91 Mar 7, 2023
4d9921c
fixing bugs and lake8 issues
aisclark91 Mar 9, 2023
d595455
adding fluxes
aisclark91 Mar 11, 2023
6e573a7
now ppm is running
aisclark91 Mar 15, 2023
b6b361b
Merge branch 'main' of github.com:python-hydro/pyro2 into ppm
aisclark91 Mar 23, 2023
0fea5aa
solving ppm bugs
aisclark91 Mar 31, 2023
9487f4e
Merge branch 'main' of github.com:python-hydro/pyro2 into ppm
aisclark91 Mar 31, 2023
b0dadaa
init.py
aisclark91 Mar 31, 2023
0a140c1
flake8 issues
aisclark91 Mar 31, 2023
c0c8e33
isort fix
aisclark91 Mar 31, 2023
a1589b2
fixing upwind bugs
aisclark91 Mar 31, 2023
cffeee4
adding changes in the main driver
aisclark91 Mar 31, 2023
cd8a15e
flake8 issues
aisclark91 Mar 31, 2023
7b76afa
reverting changes for solver_test.ipynb
aisclark91 Mar 31, 2023
642c443
isort issue
aisclark91 Mar 31, 2023
cd02206
isort issue
aisclark91 Mar 31, 2023
25714fe
isort again
aisclark91 Mar 31, 2023
d569bc3
Evolving the simulation class from advection.Simulation
aisclark91 Mar 31, 2023
64f84e7
Merge branch 'main' of github.com:python-hydro/pyro2 into ppm
aisclark91 Mar 31, 2023
87f6160
adding solver-test.ipnyb modifications
aisclark91 Mar 31, 2023
615228a
modifying test.py
aisclark91 Apr 1, 2023
7234277
solving pytest issues
aisclark91 Apr 1, 2023
211f8cf
adding metadata
aisclark91 Apr 2, 2023
8b56a93
timing the ppm solver
aisclark91 Apr 7, 2023
fc76036
adding convergence test results
aisclark91 Apr 14, 2023
dd7341d
adding ppm test
aisclark91 Apr 14, 2023
ab7b923
adding compare file
aisclark91 Apr 14, 2023
4d239bb
fixing flake8
aisclark91 Apr 14, 2023
7ff629b
more flake8
aisclark91 Apr 14, 2023
f0b879e
fixing pylint
aisclark91 Apr 14, 2023
5d146b1
Merge branch 'main' into ppm
aisclark91 Apr 14, 2023
8860884
more pylint
aisclark91 Apr 14, 2023
05c0b20
dealing with isort
aisclark91 Apr 14, 2023
3fbc2c3
more isort
aisclark91 Apr 14, 2023
e0735da
Adding docs
aisclark91 Apr 14, 2023
f645ad7
solving docs issues
aisclark91 Apr 14, 2023
0b65e75
more cleaning
aisclark91 Apr 17, 2023
4745a9f
adding soft links
aisclark91 Apr 17, 2023
03638ea
adding description
aisclark91 Apr 17, 2023
b1852ba
flake8
aisclark91 Apr 17, 2023
4f52483
more cleaning
aisclark91 Apr 17, 2023
651e919
cleaning
aisclark91 Apr 17, 2023
609d59a
Merge branch 'main' into pr-134
aisclark91 Apr 17, 2023
7b2654d
Merge branch 'main' into pr-134
aisclark91 Apr 19, 2023
cf85356
Merge branch 'main' into pr-134
aisclark91 Apr 20, 2023
24417d0
Merge branch 'main' of github.com:python-hydro/pyro2 into pr-134
aisclark91 Apr 20, 2023
8f9f795
adding new softlinks
aisclark91 Apr 20, 2023
f6652c2
Merge branch 'pr-134' of github.com:aisclark91/pyro2 into pr-134
aisclark91 Apr 20, 2023
8d87e5e
creating an interface module to the advection problem
aisclark91 Apr 20, 2023
1452316
creating an interface module to the advection_ppm problem
aisclark91 Apr 20, 2023
6d82ee1
erasing redundant module
aisclark91 Apr 20, 2023
a70f49a
Merge branch 'main' into pr-134
zingale May 3, 2023
08e9199
Merge branch 'main' into pr-134
aisclark91 May 3, 2023
107e5e0
Merge branch 'main' into pr-134
aisclark91 Aug 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adding fluxes
  • Loading branch information
aisclark91 committed Mar 11, 2023
commit d595455e0a93e27b14492920547b89181284cdf2
111 changes: 109 additions & 2 deletions pyro/advection_ppm/fluxes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,114 @@
import numpy as np
import pyro.mesh.patch as patch
from pyro.mesh.reconstruction import ppm_reconstruction
import pyro.mesh.array_indexer as ai

def ctu_unsplit_fluxes(a):
def riemman(myg, u, v, ar, al, idim):
"""Here we write the riemmann problem for the advection equation. The solution
is trivial: from ql and qr, we choose the upwind case."""

a
#create an array with all the discontinuities
r = myg.scratch_array()

if idim == 1:
if u > 0:
r.v(buf=2)[:, :] = al.v(buf=2)
else:
r.v(buf=2)[:, :] = ar.ip(1, buf=2)
elif idim == 2:
if v > 0:
r.v(buf=2)[:, :] = al.v(buf=2)
else:
r.v(buf=2)[:, :] = ar.jp(1, buf=2)

return r


def ctu_unsplit_fluxes(data, rp, dt, scalar_name):
"""
From here we plan to unsplit the fluxes according to the CTU method, but using a PPM reconstruction.
In order to compute the fluxes states a_{i+1/2,j}^{n+1/2} we:

1. Compute all the normal states for each interface. store them in a_xr[:] amd a_xl[:].

"""

#We start by calling our data first.
myg = data.grid
a = data.get_var(scalar_name)

#Now,let's call the velocity parameters
#and compute the cfl number of each dimesnion
u = rp.get_params("advection.u")
v = rp.get_params("advection.v")

cx = u*dt / myg.dx
cy = v*dt / myg.dy

#Now, using ar and al, we have to construct the normal states on each interface limit.

#Let us start with idir == 1:
delta_ax = myg.scratch_array()
a6x = myg.scratch_array()

_ar, _al = ppm_reconstruction(a,myg,idir=1)
ar = ai.ArrayIndexer(_ar, myg)
al = ai.ArrayIndexer(_al, myg)

delta_ax.v(buf=2)[:,:] = ar.v(buf=2) - al.v(buf=2)
a6x.v(buf=2)[:,:] = 6.0 * (a.v(buf=2) - 0.5*(ar.v(buf=2) + al.v(buf=2)))

ax_normal_l = myg.scratch_array()
ax_normal_r = myg.scratch_array()

ax_normal_l(buf=2)[:,:] = al.v(buf=2) - cx * (delta_ax.v(buf=2) - (1 - 2.0 * cx / 3.0)*a6x.v(buf=2))
ax_normal_r(buf=2)[:,:] = ar.ip(1, buf=2) + cx * (delta_ax.ip(1, buf=2) + (1 - 2*cx/3.0) * a6x.ip(1,buf=2))

#Let us now move to idir==2:
delta_ay = myg.scratch_array()
a6y = myg.scratch_array()

_ar, _al = ppm_reconstruction(a, myg, idir=2)
ar = ai.ArrayIndexer(_ar, myg)
al = ai.ArrayIndexer(_ar, myg)

delta_ay.v(buf=2)[:,:] = ar.v(buf=2) - al.v(buf=2)
a6y.v(buf=2)[:,:] = 6.0 * (a.v(buf=2) - 0.5*(ar.v(buf=2) + al.v(buf=2)))

ay_normal_l = myg.scratch_array()
ay_normal_r = myg.scratch_array()

ay_normal_l(buf=2)[:,:] = al.v(buf=2) - cx * (delta_ay.v(buf=2) - (1 - 2.0 * cx / 3.0)*a6y.v(buf=2))
ay_normal_r(buf=2)[:,:] = ar.jp(1, buf=2) + cx * (delta_ay.jp(1, buf=2) + (1 - 2*cx/3.0) * a6y.jp(1,buf=2))

#Now we compute the Riemman Problem between to states, in order to compute the transverse states
ax_T = myg.scratch_array()
ay_T = myg.scratch_array()

ax_T = riemman(myg, u, v, ax_normal_l, ax_normal_r, idim=1)
ay_T = riemman(myg, u, v, ay_normal_l, ay_normal_r, idim=2)

#Let's move to performing the flux tranverse corrections
ax_l = myg.scratch_array()
ax_r = myg.scratch_array()
ay_l = myg.scratch_array()
ay_r = myg.scratch_array()

ax_l = ax_normal_l - 0.5 * cy * (ay_T.v(buf=2) - ay_T.jp(-1))
ax_r = ax_normal_r - 0.5 * cy * (ay_T.ip(1, buf=2) - ay_T.ip_jp(1, -1, buf=2))

ay_l = ay_normal_l - 0.5 * cx * (ax_T.v(buf=2) - ax_T.ip(-1, buf=2))
ay_r = ay_normal_r - 0.5 * cx * (ax_T.jp(1, buf=2) - ay_T.ip_jp(-1, 1 ,buf=2))

#Finally we may perform another sequence of riemman problems
ax = riemman(myg, u, v, ax_l, ax_r, idim=1)
ay = riemman(myg, u, v, ay_l, ay_r, idim=2)

#From here we may compute the fluxes terms.
Fx = myg.myg.scratch_array()
Fy = myg.scratch_array()

Fx.v(buf=2)[:, :] = u*ax.v(buf=2)
Fy.v(buf=2)[:, :] = v*ay.v(buf=2)

return Fx, Fy