USER_PROBLEM: Make the perturbation periodic if zlen /= xlen.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2021-08-18 14:28:46 -03:00
parent 0a10b48678
commit e8366aac74

View File

@ -110,7 +110,7 @@ module user_problem
use constants , only : pi
#endif /* NDIMS == 3 */
use constants , only : pi2
use coordinates, only : ng => nghosts, ady
use coordinates, only : ng => nghosts, ady, xlen, zlen
use equations , only : magnetized, csnd, csnd2
use helpers , only : print_section, print_parameter
use parameters , only : get_parameter
@ -129,7 +129,7 @@ module user_problem
! local variables
!
character(len=64) :: perturbation = "noise"
integer :: n
integer :: n, kd
real(kind=8) :: thh, fc, ka
#if NDIMS == 3
real(kind=8) :: thv, tx, ty, tz, tt
@ -299,6 +299,7 @@ module user_problem
! choose random wave vector directions
!
kd = int(xlen / zlen)
fc = 1.0d+00 / sqrt(1.0d+00 * nper)
do n = 1, nper
thh = pi2 * randuni()
@ -309,7 +310,7 @@ module user_problem
tz = sin(thv)
kx(n) = pi2 * nint(kper * tx)
ky(n) = pi2 * nint(kper * ty)
kz(n) = pi2 * nint(kper * tz)
kz(n) = pi2 * nint(kper * tz / kd) * kd
tt = 0.0d+00
do while(tt < 1.0d-08)
thh = pi2 * randuni()