Global shear as in Snoopy
The Snoopy code has an option WITH_SHEAR
for global shear (see also TIME_DEPENDANT_SHEAR
).
There are 3 variables kxt
, k2t
and ik2t
depending on time used to compute the operators.
void kvolve(const double tremap) {
int i, j, k;
for( i = 0; i < NX_COMPLEX/NPROC; i++) {
for( j = 0; j < NY_COMPLEX; j++) {
for( k = 0; k < NZ_COMPLEX; k++) {
kxt[ IDX3D ] = kx[ IDX3D ] + tremap * param.shear * ky[ IDX3D ];
tremap
is a time related to the shear.
From time to time, the fields has to be "remaped" with something like:
void remap(double complex qi[]) {
int i, j, k;
int nx, ny, nxtarget;
for( i = 0; i < NX_COMPLEX; i++) {
nx = fmod( i + (NX_COMPLEX / 2) , NX_COMPLEX ) - NX_COMPLEX / 2 ;
for( j = 0; j < NY_COMPLEX; j++) {
ny = fmod( j + (NY_COMPLEX / 2) , NY_COMPLEX ) - NY_COMPLEX / 2 ;
nxtarget = nx + ny; // We have a negative shear, hence nx plus ny
if( (nxtarget > -NX_COMPLEX / 2) & (nxtarget < NX_COMPLEX/2)) {
if ( nxtarget <0 ) nxtarget = nxtarget + NX_COMPLEX;
for( k = 0; k < NZ_COMPLEX; k++) {
w1[k + NZ_COMPLEX * j + NZ_COMPLEX * NY_COMPLEX * nxtarget] = qi[ IDX3D ];
}
}
}
}