#include <stdlib.h>

#include <stdio.h>

#include <stddef.h>

#include <math.h>

#include <omp.h>

#include "hdf5.h"

#include "hdf5_hl.h"

#include "CPyH5_V4.c"

#define RANK 100

void advection2dEq(double U[][RANK], double dt, double dx, double dy, double v_x, double v_y, int LB, int RB, int BB, int TB)

{

// Variables for use in U

int i, j, x, y;

double C_x = v_x * dt / dx;

double C_y = v_y * dt / dy;

double aM1 = C_x / 2 * (C_x + 1);

double a0 = 1 - pow(C_x, 2);

double aP1 = C_x / 2 * (C_x - 1);

double bM1 = C_y / 2 * (C_y + 1);

double b0 = 1 - pow(C_y, 2);

double bP1 = C_y / 2 * (C_y - 1);

// Creating boundary conditions

for (i = 0; i < RANK; i++)

{

U[0]

*= LB;*

U[RANK - 1]

U[RANK - 1]

*= RB;*

UU

*[0] = BB;*

UU

*[RANK - 1] = TB;*

}

// Updating every element in the array using the 2d advection equation with Lax-Wendroff numerical scheme

for (x = 0; x < RANK - 1; ++x)

{

for (y = 0; y < RANK - 1; ++y)

{

U = aM1 * U[x - 1][y] + a0 * U[x][y] + aP1 * U[x + 1][y] + bM1 * U[x][y - 1] + b0 * U[x][y] + bP1 * U[x][y + 1];

}

}

}

void initCond(double sigma, double x0, double y0)

{

double U, x, y, x_0, y_0;

U = exp((-pow((x - x_0), 2) - pow((y - y_0), 2))) / (2 * pow(sigma, 2));

}

int main(void)

{

// variables and setup user inputs

char file[10] = "Lab_01.h5";

double t = 0;

double nt = 121;

double dt = 0.01;

double v_x = 1 / sqrt(2);

double v_y = -(1 / sqrt(2));

double U[RANK][RANK] = {0};

double x0 = 0.5;

double y0 = 0.5;

double sigma = 0.05;

// memory allocation for array of doubles, U

//double **U = (double **)malloc(U[RANK] * U[RANK] * sizeof(double));

// calling functions to set up initial conditions then perform time advance

initCond(sigma, x0, y0);

// advection2dEq(U, dt, dx, dy, v_x, v_y, LB, RB, TB, BB);

}}

// Updating every element in the array using the 2d advection equation with Lax-Wendroff numerical scheme

for (x = 0; x < RANK - 1; ++x)

{

for (y = 0; y < RANK - 1; ++y)

{

U = aM1 * U[x - 1][y] + a0 * U[x][y] + aP1 * U[x + 1][y] + bM1 * U[x][y - 1] + b0 * U[x][y] + bP1 * U[x][y + 1];

}

}

}

void initCond(double sigma, double x0, double y0)

{

double U, x, y, x_0, y_0;

U = exp((-pow((x - x_0), 2) - pow((y - y_0), 2))) / (2 * pow(sigma, 2));

}

int main(void)

{

// variables and setup user inputs

char file[10] = "Lab_01.h5";

double t = 0;

double nt = 121;

double dt = 0.01;

double v_x = 1 / sqrt(2);

double v_y = -(1 / sqrt(2));

double U[RANK][RANK] = {0};

double x0 = 0.5;

double y0 = 0.5;

double sigma = 0.05;

// memory allocation for array of doubles, U

//double **U = (double **)malloc(U[RANK] * U[RANK] * sizeof(double));

// calling functions to set up initial conditions then perform time advance

initCond(sigma, x0, y0);

// advection2dEq(U, dt, dx, dy, v_x, v_y, LB, RB, TB, BB);

}