Skip to content

Commit

Permalink
Fix Orszag Tang pgen (and add intput file) (#72)
Browse files Browse the repository at this point in the history
* Fix OT pgen

* Add comment to OT pgen
  • Loading branch information
pgrete authored Jul 14, 2023
1 parent 4cfa786 commit f25cd01
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
61 changes: 61 additions & 0 deletions inputs/orszag_tang.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# AthenaPK - a performance portable block structured AMR MHD code
# Copyright (c) 2023, Athena Parthenon Collaboration. All rights reserved.
# Licensed under the BSD 3-Clause License (the "LICENSE");

<comment>
problem = Orszag-Tang vortex # Orszag,S. & Tang,W., J. Fluid Mech., 90, 129 (1998)

<job>
problem_id = orszag_tang

<parthenon/mesh>
refinement = none
nghost = 3

nx1 = 256
x1min = -0.5
x1max = 0.5
ix1_bc = periodic
ox1_bc = periodic

nx2 = 256
x2min = -0.5
x2max = 0.5
ix2_bc = periodic
ox2_bc = periodic

nx3 = 1
x3min = -0.5
x3max = 0.5
ix3_bc = periodic
ox3_bc = periodic

<parthenon/meshblock>
nx1 = 64
nx2 = 256
nx3 = 1

<parthenon/time>
integrator = vl2
cfl = 0.4
tlim = 1.0
nlim = -1
perf_cycle_offset = 2 # number of inital cycles not to be included in perf calc

<hydro>
fluid = glmmhd
eos = adiabatic
riemann = hlld
reconstruction = ppm
gamma = 1.666666666666667 # gamma = C_p/C_v
first_order_flux_correct = true

<parthenon/output0>
file_type = hdf5
dt = 0.01
id = prim
variables = prim

<parthenon/output1>
file_type = hst
dt = 0.1
9 changes: 7 additions & 2 deletions src/pgen/orszag_tang.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

//========================================================================================
// AthenaPK - a performance portable block structured AMR MHD code
// Copyright (c) 2021, Athena Parthenon Collaboration. All rights reserved.
// Copyright (c) 2021-2023, Athena Parthenon Collaboration. All rights reserved.
// Licensed under the 3-Clause License (the "LICENSE")
//========================================================================================
//! \file orszag_tang.cpp
Expand Down Expand Up @@ -41,11 +42,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
"ProblemGenerator: Orszag-Tang", kb.s, kb.e, jb.s, jb.e, ib.s, ib.e,
KOKKOS_LAMBDA(const int k, const int j, const int i) {
u(IDN, k, j, i) = d0;
// Note the different signs in this pgen compared to the the eqn mentioned in the
// original paper (and other codes).
// They are related to our domain going from -0.5 to 0.5 (for symmetry reason)
// rather than 0 to 2pi (i.e., the sign for single wave sinus is flipped).
u(IM1, k, j, i) = d0 * v0 * std::sin(2.0 * M_PI * coords.Xc<2>(j));
u(IM2, k, j, i) = -d0 * v0 * std::sin(2.0 * M_PI * coords.Xc<1>(i));
u(IM3, k, j, i) = 0.0;

u(IB1, k, j, i) = -B0 * std::sin(2.0 * M_PI * coords.Xc<2>(j));
u(IB1, k, j, i) = B0 * std::sin(2.0 * M_PI * coords.Xc<2>(j));
u(IB2, k, j, i) = B0 * std::sin(4.0 * M_PI * coords.Xc<1>(i));
u(IB3, k, j, i) = 0.0;

Expand Down

0 comments on commit f25cd01

Please sign in to comment.