-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinc_problems.h
More file actions
83 lines (73 loc) · 3.3 KB
/
inc_problems.h
File metadata and controls
83 lines (73 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef INC_PROBLEMS_H
#define INC_PROBLEMS_H
#include "FluentTwoDMesh.h"
#include <map>
/* Setup B.C. */
//static std::map<int, bool> has_U_BC = {{1, true}, {2, true}, {3, false}, {4, true}, {5, true}};
static std::map<int, bool> has_U_BC = {{1, true}, {2, false}, {3, false}, {4, false}, {5, true}};
static std::map<int, bool> has_V_BC = {{1, true}, {2, true}, {3, false}, {4, true}, {5, true}};
static std::map<int, bool> has_p_BC = {{1, false}, {2, false}, {3, true}, {4, false}, {5, false}};
//static std::map<int, double> U_BC = {{1, 1.0}, {2, 0.0}, {4, 0.0}, {5, 0.0}};
static std::map<int, double> U_BC = {{1, 1.0}, {5, 0.0}};
static std::map<int, double> V_BC = {{1, 0.0}, {2, 0.0}, {4, 0.0}, {5, 0.0}};
static std::map<int, double> p_BC = {{3, 0.0}};
/*
has_U_BC[2] = true; has_U_BC[3] = true; has_U_BC[4] = true; has_U_BC[5] = true;
has_V_BC[2] = true; has_V_BC[3] = true; has_V_BC[4] = true; has_V_BC[5] = true;
has_p_BC[2] = false; has_p_BC[3] = false; has_p_BC[4] = false; has_p_BC[5] = false;
U_BC[2] = 0.0; U_BC[3] = 0.0; U_BC[4] = 0.0; U_BC[5] = 1.0;
V_BC[2] = 0.0; V_BC[3] = 0.0; V_BC[4] = 0.0; V_BC[5] = 0.0;
p_BC[2] = -1e6; p_BC[3] = -1e6; p_BC[4] = -1e6; p_BC[5] = -1e6;*/
/* End of B.C. setting */
static double DT = 0.05;
static double VISC = 0.001;
class StreamFunctionNode
{
public:
StreamFunctionNode(Node * node, std::vector<StreamFunctionNode *> & parent_vec, double * F_face) :
_node(node), _has_computed(false), _stream_function_value(0.0), _parent_vec(parent_vec), _F_face(F_face)
{}
~StreamFunctionNode()
{}
void computeStreamFunction(double value);
double getSFValue() { return _stream_function_value; }
void setSFValue(double val) { _stream_function_value = val; }
bool hasComputed() { return _has_computed; }
protected:
Node * _node;
bool _has_computed;
double _stream_function_value;
std::vector<StreamFunctionNode *> & _parent_vec;
double * _F_face;
};
struct GRAD;
void updateAdvectionOperator(FluentTwoDMesh * p_mesh, Vec F_face_star, Vec b_USTAR, Vec b_VSTAR, Mat M_USTAR, Mat M_VSTAR);
void updateMassVeclocities(FluentTwoDMesh * p_mesh, Vec u_STAR, Vec v_STAR, Vec F_0f_star, Vec b_p);
void updateFfaceStar(FluentTwoDMesh * p_mesh, Vec F_face_star, Vec F_0f_star, Vec p, Vec gradP_x, Vec gradP_y);
void evaluatePressureGradientValues(FluentTwoDMesh * p_mesh, Vec p, Vec gradP_x, Vec gradP_y, GRAD * grad_p);
//void updatePressureGradientAsSource(FluentTwoDMesh * p_mesh, Vec p, Vec p_src_x, Vec p_src_y, GRAD * grad_p);
void updatePressureGradientAsSource(FluentTwoDMesh * p_mesh, Vec b_USTAR, Vec b_VSTAR, Vec grad_p_x, Vec grad_p_y);
void writeOutputFile(int time_step, FluentTwoDMesh * p_mesh, Vec u, Vec v, Vec p, Vec F_face_star, bool computeStreamFunction);
struct GRAD
{
int size;
long int cell_id[4];
double coef_x[4], coef_y[4];
double bc_x, bc_y;
GRAD()
{
size = 0;
cell_id[0] = -1; cell_id[1] = -1; cell_id[2] = -1; cell_id[3] = -1;
coef_x[0] = 0.0; coef_x[1] = 0.0; coef_x[2] = 0.0; coef_x[3] = 0.0;
coef_y[0] = 0.0; coef_y[1] = 0.0; coef_y[2] = 0.0; coef_y[3] = 0.0;
bc_x = 0.0; bc_y = 0.0;
}
void addCoef(int loc, long int id, double x_val, double y_val)
{
cell_id[loc] = id;
coef_x[loc] += x_val;
coef_y[loc] += y_val;
}
void addBCContribution(double x_val, double y_val) { bc_x += x_val; bc_y += y_val; }
};
#endif // INC_PROBLEMS_H