<commit_before>#include "../swirl_user.h"

#include <fc2d_cudaclaw.h>
#include <fclaw_base.h>  /* Needed for SC_MIN, SC_MAX */

__device__ double psi(double x, double y)
{
    return (pow(sin(M_PI*x), 2) * pow(sin(M_PI*y),2)) / M_PI;
} 

__device__ void swirl_b4step2_test(int mbc, int mx, int my, int meqn, double q[],
                              double xlower, double ylower, double dx, double dy, 
                              double time, double dt, int maux, 
                              double aux[], int ipatch, int jpatch, double tperiod)
{
    double vt;
    double xll, yll;

    xll = xlower + ipatch*dx;
    yll = ylower + jpatch*dx;

    vt = cos(2*M_PI*(time+dt/2.0)/tperiod);
    aux[0] = (psi(xll,yll+dy) - psi(xll,yll)) / dy;
    aux[1] = - (psi(xll+dx,yll) - psi(xll,yll)) / dx;
<commit_msg>(cudaclaw/swirl) Fix to b4step2 routine - fix indexing<commit_after>#include "../swirl_user.h"

#include <fc2d_cudaclaw.h>
#include <fclaw_base.h>  /* Needed for SC_MIN, SC_MAX */

__device__ double psi(double x, double y)
{
    return (pow(sin(M_PI*x), 2) * pow(sin(M_PI*y),2)) / M_PI;
} 

__device__ void swirl_b4step2_test(int mbc, int mx, int my, int meqn, double q[],
                              double xlower, double ylower, double dx, double dy, 
                              double time, double dt, int maux, 
                              double aux[], int ipatch, int jpatch, double tperiod)
{
    double vt;
    double xll, yll;

    xll = xlower + (ipatch-1)*dx;
    yll = ylower + (jpatch-1)*dy;

    vt = cos(2*M_PI*(time+dt/2.0)/tperiod);
    aux[0] = (psi(xll,yll+dy) - psi(xll,yll)) / dy;
    aux[1] = - (psi(xll+dx,yll) - psi(xll,yll)) / dx;

{'fraction_non_alphanumeric': 0.15026833631484796, 'fraction_numerical': 0.014311270125223614, 'mean_word_length': 2.3694779116465865, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3434295', 'n_tokens_mistral': 679, 'n_tokens_neox': 665, 'n_words': 158}