/
solverwa.hpp
147 lines (112 loc) · 2.61 KB
/
solverwa.hpp
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#ifndef _SOLVERWA_HPP_
#define _SOLVERWA_HPP_
#include "solver.hpp"
class solverwa : public solver{
protected:
/**
* @a: analitic solution
*/
hyd a;
/**
* Relative and absolute difference.
*/
std::vector<dtype> rd, ad;
/**
* @XYVW: scale variables.
*/
dtype X, Y, V, W;
/**
* Speed of sound.
*/
dtype cs2;
/**
* Init values.
*/
struct iv_t {dtype rho0, p0;} iv;
/**
* Analitic solution.
*/
virtual void analitic(const uint&, const uint&);
/**
* Calulate errors.
*/
void error(const uint&, const uint&);
/**
* Start/End time step calc function.
*/
virtual void start_step();
virtual void end_step();
/**
* Loop index.
*/
uint ik;
/**
* Energy correction.
*/
dtype energy_s_corr;
public:
solverwa(io*);
virtual ~solverwa() = 0;
/**
* Initialization function.
*/
void init();
/**
* Forwarder functions.
*/
friend void fw_calc(void *, const uint&, const uint&);
};
/**
* Symmetric exact solution.
* @rho = rho0*(X0/X)^2*exp(-(x^2+y^2)/X^2)
* @v = dX/dt * (x,y)
* @eps = eps0*(X0/X)^(2+2cs2)*exp(-(x^2+y^2)/X^2)
* @X = X0*sqrt(1+t^2)
* This module contain shocktube test! (initvalue_type1)
*/
class symsol : public solverwa{
dtype X0;
void start_step();
void end_step();
void analitic(const uint&, const uint&);
public:
symsol(io*);
};
/**
* Asymmetric exact solution.
* @rho = rho0*(V0/V)*exp(-s)
* @v = (X'*x/X,Y'*y/Y)
* @eps = eps0*(V0/V)^(1+cs2)*exp(-s)
* @V = X*Y
* @s = x^2/X^2+y^2/Y^2
* @XY : X''X=Y''Y=(T0/m)*(V0/V)^(1/kappa)
*/
class asymsol : public solverwa{
dtype X0, Y0;
dtype k1, k2, l1, l2, p1, p2, q1, q2;
dtype alpha;
void start_step();
void end_step();
void numeric_XY();
void analitic(const uint&, const uint&);
public:
asymsol(io*);
};
/**
* New asymmetric exact solution with const preasure.
* @rho = rho0*(V0/V)*exp(-s)
* @v = (V0/X * x, W0/Y * y)
* @p = p0*(V0/V)^(1+cs2)
* @s = r^2/R^2 * (1+eps_N*cos(N*fi))
* @XY : X=V0*t, Y=W0*t
*/
class nassol : public solverwa {
dtype X0, Y0, s;
dtype R2i, E2, E3, E4;
void start_step();
void end_step();
void analitic(const uint&, const uint&);
public:
nassol(io*);
};
#endif // _SOLVERWA_HPP_