2 #include <athena/athena.hpp>
3 #include <athena/athena_arrays.hpp>
4 #include <athena/coordinates/coordinates.hpp>
5 #include <athena/mesh/mesh.hpp>
6 #include <athena/parameter_input.hpp>
18 std::cout <<
"===Note===: Affine coordinates activated" << std::endl;
26 for (
int i = il - ng; i <= iu + ng; ++i) {
27 x1v(i) = 0.5 * (x1f(i + 1) + x1f(i));
29 for (
int i = il - ng; i <= iu + ng - 1; ++i) {
30 if (pmb->block_size.x1rat != 1.0) {
31 dx1v(i) = x1v(i + 1) - x1v(i);
40 if (pmb->block_size.nx2 == 1) {
41 x2v(jl) = 0.5 * (x2f(jl + 1) + x2f(jl));
44 for (
int j = jl - ng;
j <= ju + ng; ++
j) {
45 x2v(
j) = 0.5 * (x2f(
j + 1) + x2f(
j));
47 for (
int j = jl - ng;
j <= ju + ng - 1; ++
j) {
48 if (pmb->block_size.x2rat != 1.0) {
49 dx2v(
j) = x2v(
j + 1) - x2v(
j);
59 if (pmb->block_size.nx3 == 1) {
60 x3v(kl) = 0.5 * (x3f(kl + 1) + x3f(kl));
63 for (
int k = kl - ng; k <= ku + ng; ++k) {
64 x3v(k) = 0.5 * (x3f(k + 1) + x3f(k));
66 for (
int k = kl - ng; k <= ku + ng - 1; ++k) {
67 if (pmb->block_size.x3rat != 1.0) {
68 dx3v(k) = x3v(k + 1) - x3v(k);
78 for (
int i = il - ng; i <= iu + ng; ++i) {
90 if (pmb->block_size.nx2 == 1) {
96 for (
int j = jl - ng;
j <= ju + ng; ++
j) {
105 g_.NewAthenaArray(NMETRIC, nc1 + 1);
106 gi_.NewAthenaArray(NMETRIC, nc1 + 1);
122 for (
int i = il; i <= iu; ++i) {
123 Real &area_i = area(i);
132 for (
int i = il; i <= iu; ++i) {
133 Real &area_i = area(i);
134 area_i = dx1f(i) * dx3f(k);
142 for (
int i = il; i <= iu; ++i) {
143 Real &area_i = area(i);
144 area_i = dx1f(i) * dx2f(
j);
157 return dx1f(i) * dx3f(k);
161 return dx1f(i) * dx2f(
j);
170 const int il,
const int iu,
173 for (
int i = il; i <= iu; ++i) {
174 Real &area_i = area(i);
181 const int il,
const int iu,
184 for (
int i = il; i <= iu; ++i) {
185 Real &area_i = area(i);
186 area_i = dx1v(i) * dx3v(k);
192 const int il,
const int iu,
195 for (
int i = il; i <= iu; ++i) {
196 Real &area_i = area(i);
197 area_i = dx1v(i) * dx2v(
j);
207 for (
int i = il; i <= iu; ++i) {
227 for (
int i = il; i <= iu; ++i) {
229 Real &g11 = g(I11, i);
230 Real &g22 = g(I22, i);
231 Real &g33 = g(I33, i);
233 Real &gi11 = g_inv(I11, i);
234 Real &gi22 = g_inv(I22, i);
235 Real &gi33 = g_inv(I33, i);
237 Real &g12 = g(I12, i);
238 Real &g13 = g(I13, i);
239 Real &g23 = g(I23, i);
261 for (
int i = il; i <= iu; ++i) {
265 Real &g11 = g(I11, i);
266 Real &g22 = g(I22, i);
267 Real &g33 = g(I33, i);
269 Real &gi11 = g_inv(I11, i);
270 Real &gi22 = g_inv(I22, i);
271 Real &gi33 = g_inv(I33, i);
273 Real &g12 = g(I12, i);
274 Real &g13 = g(I13, i);
275 Real &g23 = g(I23, i);
297 for (
int i = il; i <= iu; ++i) {
301 Real &g11 = g(I11, i);
302 Real &g22 = g(I22, i);
303 Real &g33 = g(I33, i);
305 Real &gi11 = g_inv(I11, i);
306 Real &gi22 = g_inv(I22, i);
307 Real &gi33 = g_inv(I33, i);
309 Real &g12 = g(I12, i);
310 Real &g13 = g(I13, i);
311 Real &g23 = g(I23, i);
333 for (
int i = il; i <= iu; ++i) {
337 Real &g11 = g(I11, i);
338 Real &g22 = g(I22, i);
339 Real &g33 = g(I33, i);
341 Real &gi11 = g_inv(I11, i);
342 Real &gi22 = g_inv(I22, i);
343 Real &gi33 = g_inv(I33, i);
345 Real &g12 = g(I12, i);
346 Real &g13 = g(I13, i);
347 Real &g23 = g(I23, i);
387 for (
int i = il; i <= iu; ++i) {
401 Real uu1_l = prim_left(IVX, i);
402 Real uu2_l = prim_left(IVY, i);
403 Real uu3_l = prim_left(IVZ, i);
404 Real uu1_r = prim_right(IVX, i);
405 Real uu2_r = prim_right(IVY, i);
406 Real uu3_r = prim_right(IVZ, i);
437 prim_left(IVX, i) = ux_l;
438 prim_left(IVY, i) = uy_l;
439 prim_left(IVZ, i) = uz_l;
440 prim_right(IVX, i) = ux_r;
441 prim_right(IVY, i) = uy_r;
442 prim_right(IVZ, i) = uz_r;
458 for (
int i = il; i <= iu; ++i) {
472 Real uu1_l = prim_left(IVX, i);
473 Real uu2_l = prim_left(IVY, i);
474 Real uu3_l = prim_left(IVZ, i);
475 Real uu1_r = prim_right(IVX, i);
476 Real uu2_r = prim_right(IVY, i);
477 Real uu3_r = prim_right(IVZ, i);
508 prim_left(IVX, i) = ux_l;
509 prim_left(IVY, i) = uy_l;
510 prim_left(IVZ, i) = uz_l;
511 prim_right(IVX, i) = ux_r;
512 prim_right(IVY, i) = uy_r;
513 prim_right(IVZ, i) = uz_r;
534 const int k,
const int j,
const int il,
const int iu,
542 for (
int i = il; i <= iu; ++i) {
557 const Real txx = flux(IM1, k,
j, i);
558 const Real txy = flux(IM2, k,
j, i);
559 const Real txz = flux(IM3, k,
j, i);
574 Real &t1_1 = flux(IM1, k,
j, i);
575 Real &t1_2 = flux(IM2, k,
j, i);
576 Real &t1_3 = flux(IM3, k,
j, i);
587 const int k,
const int j,
const int il,
const int iu,
595 for (
int i = il; i <= iu; ++i) {
610 const Real txx = flux(IM1, k,
j, i);
611 const Real txy = flux(IM2, k,
j, i);
612 const Real txz = flux(IM3, k,
j, i);
627 Real &t1_1 = flux(IM1, k,
j, i);
628 Real &t1_2 = flux(IM2, k,
j, i);
629 Real &t1_3 = flux(IM3, k,
j, i);
Real GetCellVolume(const int k, const int j, const int i)
void Face1Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final
void PrimToLocal3(const int k, const int j, const int il, const int iu, const AthenaArray< Real > &b1_vals, AthenaArray< Real > &prim_left, AthenaArray< Real > &prim_right, AthenaArray< Real > &bx)
void Face3Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final
void FluxToGlobal3(const int k, const int j, const int il, const int iu, const AthenaArray< Real > &cons, const AthenaArray< Real > &bbx, AthenaArray< Real > &flux, AthenaArray< Real > &ey, AthenaArray< Real > &ez)
Real GetFace3Area(const int k, const int j, const int i) final
void Face1Metric(const int k, const int j, const int il, const int iu, AthenaArray< Real > &g, AthenaArray< Real > &g_inv)
void CellMetric(const int k, const int j, const int il, const int iu, AthenaArray< Real > &g, AthenaArray< Real > &g_inv)
void VolCenterFace1Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final
void VolCenterFace3Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final
void CellVolume(const int k, const int j, const int il, const int iu, AthenaArray< Real > &vol)
void PrimToLocal2(const int k, const int j, const int il, const int iu, const AthenaArray< Real > &b1_vals, AthenaArray< Real > &prim_left, AthenaArray< Real > &prim_right, AthenaArray< Real > &bx)
void FluxToGlobal2(const int k, const int j, const int il, const int iu, const AthenaArray< Real > &cons, const AthenaArray< Real > &bbx, AthenaArray< Real > &flux, AthenaArray< Real > &ey, AthenaArray< Real > &ez)
Real GetFace2Area(const int k, const int j, const int i) final
void Face2Metric(const int k, const int j, const int il, const int iu, AthenaArray< Real > &g, AthenaArray< Real > &g_inv)
AffineCoordinate(MeshBlock *pmb, ParameterInput *pin, bool flag)
Cartesian coordinates constructor.
void Face3Metric(const int k, const int j, const int il, const int iu, AthenaArray< Real > &g, AthenaArray< Real > &g_inv)
Real GetFace1Area(const int k, const int j, const int i) final
void Face2Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final
void VolCenterFace2Area(const int k, const int j, const int il, const int iu, AthenaArray< Real > &area) final