• No se han encontrado resultados

To solve the final timestep of the Karniadakis method Fourier decomposition[Potter, 1973, p.92] is used. To demonstrate this we first rewrite equation (4.6). Dropping the pressure term and rearranging gives

γ0−→vn+1−ν∆t − → L(−→vn+1) = Ji−1 X q=0 αq−→vn−q+ ∆t Ji−1 X q=0 βq − → N(−→vn−q), (4.8) the right hand side of which relies on information from the current and previous timesteps and is therefore known. For simplicity we rewrite it as a source term. Explicitly writing out the gridpoint indices, equation (4.8) becomes

γ0vi,jn+1−νL(vi,jn+1) =Si,j, (4.9)

which can be written as

P vni,j+1 =Si,j, (4.10)

where P is an operator describing the left hand side of (4.8).

To describe Fourier synthesis we now switch to the CHM case and neglect any linear forcing or damping described by the L term, the numerical code used in this work then evolves the quantity φ−ρ2s∇2φ in time. The finite difference representation of this is

−ρ

2

s

which means that we can write (4.10) as

−ρ2s(φni+1+1,j+φni+11,j−4φni,j+1+φni,j+1+1+φni,j+11) + ∆2φni,j+1= ∆2Si,jn , (4.11) whereS is the source term described earlier. The left hand side of (4.11) is used to defineP, it is the operator that gives

P φi,j=−ρ2s(φi+1,j+φi−1,j−4φi,j+φi,j+1+φi,j−1) + ∆2φi,j, and we therefore have

P φni,j+1 = ∆2Si,jn. (4.12)

P can then be applied to the double Fourier harmonic[Potter, 1973],

si,j(k, l) = ˆφ(k, l)sin( πkj

J )sin( πli

I ), (4.13)

whereI and J are the maximum values ofiand j. This gives

P si,j(k, l) =αk,lsi,j(k, l), (4.14)

whereα is an eigenvalue given by

αk,j =ρ2s(2cos( πl I ) + 2cos( πk J −4))−2∆ 2.

Using the transform

F(φi,j) =X i,j ˆ φ(k, l)sin(πkj J )sin( πli I ) = X i,j si,j and F(Si,j) =X i,j ˆ S(k, l)sin(πkj J )sin( πli I ), equation (4.12) indicates P F(φi,j) =P X i,j si,j = ∆2F(Si,j).

This means that, for each individual mode, the value of ˆφ(k, l)n+1 can be calculated as ˆ φ(k, l)n+1= ∆ 2Sˆ(k, l)n αk,j . (4.15)

Different sets of boundary conditions will require a different sets of Fourier harmon- ics. A different operatorP will lead to different eigenvalues (αk,j), as will including the linear term L. Each equation solved by the numerical codes used in this work has had the relevant formula for eigenvalues calculated analytically.

The steps listed above are a demonstration of the mathematics behind the Fourier decomposition technique. In practice ˆSn is calculated fromS using a fast Fourier transform library, then equation (4.15) is solved for ˆφn+1, and finally an inverse fast Fourier transform is used to findφn+1.

4.7

Summary

The techniques listed above were used to create C++ codes for solving the ex- tended and non-extended versions of the Hasegawa-Mima and Hasegawa-Wakatani equations. The combination of the Arakawa Poisson bracket and the Karniadakis time stepping technique was described in [Naulin, 2003] and tested in [Naulin and Nielsen, 2003], a detailed discussion is given in [Scott, 2008]. Throughout this work they will referred to as ‘full simulations’ or ‘partial differential equation (PDE) sim- ulations’. Both codes have been parallelised using a message passing interface (MPI) library.

The basic structure of the two codes is identical, first the initial values needed to set up the simulations is read from a setup file, this includes constants from the equations as well as constants relevant to the code such as the timestep and grid spacing. All the PDE simulations in this work were carried on on a square domain discretised into 512x512 grid spaces. For the EHM equations solved in chapter 5 the box had sides of length 2π, with the domain running from−π toπ. As the Larmor radius is retained in this chapter the length scales are in SI units. The smallest Larmor radius investigated isρs= 0.35m∼0.06LwhereL is the length of the box, it is approximately 30 times larger than the grid spacing. The largest Larmor radius investigated isρs= 4m∼0.64L In chapters 6 and 7, simulations of the Extended- Hasegawa-Wakatani and driven-Hasegawa-Mima equations respectively, the domain ran from -20 to 20 and lengths were normalised to the Larmor radius. In chapter 6 time was normalised toωi. The initial values for potential and density can be read in from an input file, or, in the case of the modulational instability used in chapter 5, specified in the first setup file.

Once the initial setup is complete quantities that are not part of the time derivative term in equations (3.32) or (3.59) and (3.60) are calculated. Nonlinear terms are calculated using the Arakawa method described in section 4.5. These

newly calculated values are added to versions calculated on the previous time step to calculate the terms under summations in the Karnadakis method, equation (4.6) and hence the source term in equation (4.9).

A fast Fourier transform is then applied to the source term to calculate its k-space representation. The Fourier-decomposition technique described in section 4.6 is then used to step the solution forward in time , find values of potential from vorticity, and in the Hasegawa-Wakatani case, density. An inverse fast Fourier transform is used to calculate new values in real space.

Finally pointers to arrays are moved to store data for use as ‘previous timesteps’ in the Karniadakis method. Output files are generated as specified in the initial setup file and the process is repeated.

Aliasing is not a problem due to the nature of the simulations performed. In 5 the system is initialised with modes that all havek 512

2 . Even though resonant interactions and energy cascades can produce modes with largerk values, these do not approach the 5122 before the simulation is stopped and aliasing is therefore not a concern. For the simulations performed in chapters 6 and 7 the instability and driving profile drops off rapidly with |k| and therefore only causes the growth of modes with k 512

2 . However, as these systems are initialised with white noise, viscosity is applied to suppress higher mode numbers.

Documento similar