|
1 | | -from pyro.mesh import reconstruction |
| 1 | +def unsplit_fluxes(my_data, rp, dt, scalar_name, interface): |
2 | 2 |
|
3 | | - |
4 | | -def unsplit_fluxes(my_data, rp, dt, scalar_name): |
5 | 3 | r""" |
6 | 4 | Construct the fluxes through the interfaces for the linear advection |
7 | 5 | equation: |
@@ -53,45 +51,11 @@ def unsplit_fluxes(my_data, rp, dt, scalar_name): |
53 | 51 | """ |
54 | 52 |
|
55 | 53 | myg = my_data.grid |
56 | | - |
57 | 54 | a = my_data.get_var(scalar_name) |
58 | 55 |
|
59 | | - # get the advection velocities |
60 | | - u = rp.get_param("advection.u") |
61 | | - v = rp.get_param("advection.v") |
62 | | - |
63 | | - cx = u*dt/myg.dx |
64 | | - cy = v*dt/myg.dy |
65 | | - |
66 | | - # -------------------------------------------------------------------------- |
67 | | - # monotonized central differences |
68 | | - # -------------------------------------------------------------------------- |
69 | | - |
70 | | - limiter = rp.get_param("advection.limiter") |
71 | | - |
72 | | - ldelta_ax = reconstruction.limit(a, myg, 1, limiter) |
73 | | - ldelta_ay = reconstruction.limit(a, myg, 2, limiter) |
| 56 | + #Compute the velocities on each direction and the interface states a_{i+1/2}^{n+1/2}. |
74 | 57 |
|
75 | | - a_x = myg.scratch_array() |
76 | | - |
77 | | - # upwind |
78 | | - if u < 0: |
79 | | - # a_x[i,j] = a[i,j] - 0.5*(1.0 + cx)*ldelta_a[i,j] |
80 | | - a_x.v(buf=1)[:, :] = a.v(buf=1) - 0.5*(1.0 + cx)*ldelta_ax.v(buf=1) |
81 | | - else: |
82 | | - # a_x[i,j] = a[i-1,j] + 0.5*(1.0 - cx)*ldelta_a[i-1,j] |
83 | | - a_x.v(buf=1)[:, :] = a.ip(-1, buf=1) + 0.5*(1.0 - cx)*ldelta_ax.ip(-1, buf=1) |
84 | | - |
85 | | - # y-direction |
86 | | - a_y = myg.scratch_array() |
87 | | - |
88 | | - # upwind |
89 | | - if v < 0: |
90 | | - # a_y[i,j] = a[i,j] - 0.5*(1.0 + cy)*ldelta_a[i,j] |
91 | | - a_y.v(buf=1)[:, :] = a.v(buf=1) - 0.5*(1.0 + cy)*ldelta_ay.v(buf=1) |
92 | | - else: |
93 | | - # a_y[i,j] = a[i,j-1] + 0.5*(1.0 - cy)*ldelta_a[i,j-1] |
94 | | - a_y.v(buf=1)[:, :] = a.jp(-1, buf=1) + 0.5*(1.0 - cy)*ldelta_ay.jp(-1, buf=1) |
| 58 | + u, v, a_x, a_y = interface(a, myg, rp, dt) |
95 | 59 |
|
96 | 60 | # compute the transverse flux differences. The flux is just (u a) |
97 | 61 | # HOTF |
|
0 commit comments