2023-02-05 07:34:23 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 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 __SOLVER_H_
|
|
|
|
#define __SOLVER_H_
|
|
|
|
|
|
|
|
#include "grid.h"
|
|
|
|
#include "parameter.h"
|
|
|
|
|
2023-10-12 17:46:33 +02:00
|
|
|
enum OBJECTBOUNDARY {
|
|
|
|
NONE = 0,
|
|
|
|
/* Front Corners */
|
|
|
|
FRONTTOPLEFTCORNER,
|
|
|
|
FRONTTOPRIGHTCORNER,
|
|
|
|
FRONTBOTTOMLEFTCORNER,
|
|
|
|
FRONTBOTTOMRIGHTCORNER,
|
|
|
|
/* Back Corners */
|
|
|
|
BACKTOPLEFTCORNER,
|
|
|
|
BACKTOPRIGHTCORNER,
|
|
|
|
BACKBOTTOMLEFTCORNER,
|
|
|
|
BACKBOTTOMRIGHTCORNER,
|
|
|
|
/* Faces */
|
|
|
|
FRONTFACE,
|
|
|
|
BACKFACE,
|
|
|
|
LEFTFACE,
|
|
|
|
RIGHTFACE,
|
|
|
|
TOPFACE,
|
|
|
|
BOTTOMFACE,
|
|
|
|
/* Front Lines remaining after Corners and Faces */
|
|
|
|
FRONTLEFTLINE,
|
|
|
|
FRONTRIGHTLINE,
|
|
|
|
FRONTTOPLINE,
|
|
|
|
FRONTBOTTOMLINE,
|
|
|
|
/* Bottom Lines remaining after Corners and Faces */
|
|
|
|
BACKLEFTLINE,
|
|
|
|
BACKRIGHTLINE,
|
|
|
|
BACKTOPLINE,
|
|
|
|
BACKBOTTOMLINE,
|
|
|
|
/* Mid Lines remaining after Corners and Faces */
|
|
|
|
MIDTOPLEFTLINE,
|
|
|
|
MIDTOPRIGHTLINE,
|
|
|
|
MIDBOTTOMLEFTLINE,
|
|
|
|
MIDBOTTOMRIGHTLINE,
|
|
|
|
/* Local where its an object but not a boundary */
|
|
|
|
LOCAL
|
|
|
|
};
|
2023-02-05 07:34:23 +01:00
|
|
|
enum BC { NOSLIP = 1, SLIP, OUTFLOW, PERIODIC };
|
2023-10-12 17:46:33 +02:00
|
|
|
/// @brief
|
|
|
|
enum SHAPE { NOSHAPE = 0, RECT, CIRCLE };
|
2023-02-05 07:34:23 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* geometry and grid information */
|
|
|
|
Grid grid;
|
|
|
|
/* arrays */
|
|
|
|
double *p, *rhs;
|
|
|
|
double *f, *g, *h;
|
|
|
|
double *u, *v, *w;
|
2023-10-12 17:46:33 +02:00
|
|
|
int* seg;
|
2023-02-05 07:34:23 +01:00
|
|
|
/* parameters */
|
2023-07-05 20:38:50 +02:00
|
|
|
double eps, omega, rho;
|
2023-02-05 07:34:23 +01:00
|
|
|
double re, tau, gamma;
|
|
|
|
double gx, gy, gz;
|
|
|
|
/* time stepping */
|
|
|
|
int itermax;
|
|
|
|
double dt, te;
|
|
|
|
double dtBound;
|
|
|
|
char* problem;
|
|
|
|
int bcLeft, bcRight, bcBottom, bcTop, bcFront, bcBack;
|
|
|
|
} Solver;
|
|
|
|
|
|
|
|
extern void initSolver(Solver*, Parameter*);
|
|
|
|
extern void computeRHS(Solver*);
|
|
|
|
extern void solve(Solver*);
|
2023-06-17 09:19:04 +02:00
|
|
|
extern void solveRB(Solver*);
|
2023-07-05 20:38:50 +02:00
|
|
|
extern void solveRBA(Solver*);
|
2023-02-05 07:34:23 +01:00
|
|
|
extern void normalizePressure(Solver*);
|
|
|
|
extern void computeTimestep(Solver*);
|
|
|
|
extern void setBoundaryConditions(Solver*);
|
2023-10-12 17:46:33 +02:00
|
|
|
extern void setObjectBoundaryCondition(Solver*);
|
2023-02-05 07:34:23 +01:00
|
|
|
extern void setSpecialBoundaryCondition(Solver*);
|
|
|
|
extern void computeFG(Solver*);
|
|
|
|
extern void adaptUV(Solver*);
|
|
|
|
extern void writeResult(Solver*);
|
2023-10-12 17:46:33 +02:00
|
|
|
extern void printGrid(Solver*, int*);
|
|
|
|
|
2023-02-05 07:34:23 +01:00
|
|
|
#endif
|