/*
This file is part of EZRide.
Copyright 2007 Dwight Barkley,
Copyright 2010 Vadim Biktashev & Andrew Foulkes.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include "ezride.h"
#include "ezstep.h"
#include
#include
/* -------------------------------------------------------------------------
* We use many pre-processor macros to make the time-stepping flexible.
* See ezstep.h for the definitions.
* ------------------------------------------------------------------------- */
static void Average_periodic_directions (void);
static int s1, s2;
static const Real zero = 0.;
static const Real half = 0.5;
static const Real third = 1./3.;
static const Real one = 1.;
static const Real two = 2.;
static const Real four = 4.;
static const Real twenty = 20.;
/* ========================================================================= */
Real u_root, v_root;
int NBC;
/* ========================================================================= */
void Step (void)
{
register int i, j;
register int index, index_1, index_2;
#if FHN
Real uu,vv;
#else
Real u_thresh;
#endif
/* Interchange s1 and s2 */
s1 = 1-s1;
s2 = 1-s2;
/* -------------------------------------
* Main Loop (almost all work done here)
* ------------------------------------- */
for(j=1;j<=NY;j++) {
index = INDEX(0,j);
index_1 = index + s1*field_size;
index_2 = index + s2*field_size;
for(i=1;i<=NX;i++) {
index++; index_1++; index_2++;
#if SPLIT /* (split=1 is best for large time steps, else use split=0) */
u[index] += U_DIFFUSION(index_1);
v[index] += V_DIFFUSION(index_1);
ZERO_USED_SUMS(index_1);
#endif
#if FHN
uu = u[index];
vv = v[index];
v[index] = V_KINETICS(uu,vv);
u[index] = U_KINETICS(uu,vv);
#if !SPLIT
u[index] += U_DIFFUSION(index_1);
v[index] += V_DIFFUSION(index_1);
#endif
ADD_TO_U_SUM(index,index_2);
ADD_TO_V_SUM(index,index_2);
ZERO_USED_SUMS(index_1);
#else
if(u[index]