/*
 * Copyright (C)  NHR@FAU, University Erlangen-Nuremberg.
 * All rights reserved. This file is part of nusif-solver.
 * Use of this source code is governed by a MIT style
 * license that can be found in the LICENSE file.
 */
#ifndef __DISCRETIZATION_H_
#define __DISCRETIZATION_H_
#include "comm.h"
#include "grid.h"
#include "parameter.h"

enum BC { NOSLIP = 1, SLIP, OUTFLOW, PERIODIC };

typedef struct {
    /* geometry and grid information */
    Grid grid;
    /* arrays */
    double *p, *rhs;
    double *f, *g;
    double *u, *v;
    /* parameters */
    double re, tau, gamma;
    double gx, gy;
    /* time stepping */
    double dt, te;
    double dtBound;
    char* problem;
    int bcLeft, bcRight, bcBottom, bcTop;
    /* communication */
    Comm comm;
} Discretization;

void initDiscretiztion(Discretization*, Parameter*);
void computeRHS(Discretization*);
void normalizePressure(Discretization*);
void computeTimestep(Discretization*);
void setBoundaryConditions(Discretization*);
void setSpecialBoundaryCondition(Discretization*);
void computeFG(Discretization*);
void adaptUV(Discretization*);
void writeResult(Discretization* s, double* u, double* v, double* p);
#endif
