-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into incompressible_simplify
- Loading branch information
Showing
5 changed files
with
55 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from pyro.mesh import reconstruction | ||
|
||
|
||
def linear_interface(a, myg, rp, dt): | ||
|
||
# get the advection velocities | ||
u = rp.get_param("advection.u") | ||
v = rp.get_param("advection.v") | ||
|
||
cx = u*dt/myg.dx | ||
cy = v*dt/myg.dy | ||
|
||
# -------------------------------------------------------------------------- | ||
# monotonized central differences | ||
# -------------------------------------------------------------------------- | ||
|
||
limiter = rp.get_param("advection.limiter") | ||
|
||
ldelta_ax = reconstruction.limit(a, myg, 1, limiter) | ||
ldelta_ay = reconstruction.limit(a, myg, 2, limiter) | ||
|
||
a_x = myg.scratch_array() | ||
|
||
# upwind | ||
if u < 0: | ||
# a_x[i,j] = a[i,j] - 0.5*(1.0 + cx)*ldelta_a[i,j] | ||
a_x.v(buf=1)[:, :] = a.v(buf=1) - 0.5*(1.0 + cx)*ldelta_ax.v(buf=1) | ||
else: | ||
# a_x[i,j] = a[i-1,j] + 0.5*(1.0 - cx)*ldelta_a[i-1,j] | ||
a_x.v(buf=1)[:, :] = a.ip(-1, buf=1) + 0.5*(1.0 - cx)*ldelta_ax.ip(-1, buf=1) | ||
|
||
# y-direction | ||
a_y = myg.scratch_array() | ||
|
||
# upwind | ||
if v < 0: | ||
# a_y[i,j] = a[i,j] - 0.5*(1.0 + cy)*ldelta_a[i,j] | ||
a_y.v(buf=1)[:, :] = a.v(buf=1) - 0.5*(1.0 + cy)*ldelta_ay.v(buf=1) | ||
else: | ||
# a_y[i,j] = a[i,j-1] + 0.5*(1.0 - cy)*ldelta_a[i,j-1] | ||
a_y.v(buf=1)[:, :] = a.jp(-1, buf=1) + 0.5*(1.0 - cy)*ldelta_ay.jp(-1, buf=1) | ||
|
||
return u, v, a_x, a_y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters