7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for cf3::Euler"
11 #include <boost/test/unit_test.hpp>
28 BOOST_AUTO_TEST_SUITE( Euler_Suite )
39 prim << 1.225, 30, 101300;
47 BOOST_CHECK_CLOSE( flux[0] , p.
rho*p.
u , 1
e-10);
48 BOOST_CHECK_CLOSE( flux[1] , p.
rho*p.
u*p.
u + p.
p , 1
e-10);
49 BOOST_CHECK_CLOSE( flux[2] , (p.
rho*p.
E+p.
p)*p.
u , 1
e-6);
59 pL.
R=287.05; pR.
R=287.05;
65 BOOST_CHECK_EQUAL(pL.
rho,4.696);
66 BOOST_CHECK_EQUAL(pL.
u,0);
67 BOOST_CHECK_EQUAL(pL.
p,404400);
68 BOOST_CHECK_CLOSE(pL.
c2, (pL.
gamma-1.)*(pL.
H-0.5*pL.
u2),1
e-8);
74 std::cout << flux_pos << std::endl;
77 std::cout << flux_neg << std::endl;
79 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
82 std::cout << flux_pos << std::endl;
85 std::cout << flux_neg << std::endl;
87 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
90 std::cout << flux_pos << std::endl;
93 std::cout << flux_neg << std::endl;
95 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
108 prim << 1.225, 30, 30, 101300;
116 Real un = p.
U.dot(normal);
117 BOOST_CHECK_CLOSE( flux[0] , p.
rho*un , 1
e-10);
118 BOOST_CHECK_CLOSE( flux[1] , p.
rho*p.
U[
XX]*un + p.
p*normal[
XX] , 1
e-10);
119 BOOST_CHECK_CLOSE( flux[2] , p.
rho*p.
U[
YY]*un + p.
p*normal[
YY] , 1
e-10);
120 BOOST_CHECK_CLOSE( flux[3] , (p.
rho*p.
E+p.
p)*un , 1
e-6);
130 pL.
R=287.05; pR.
R=287.05;
136 BOOST_CHECK_EQUAL(pL.
rho,4.696);
137 BOOST_CHECK_EQUAL(pL.
U[
XX],0);
138 BOOST_CHECK_EQUAL(pL.
U[
YY],0);
139 BOOST_CHECK_EQUAL(pL.
p,404400);
140 BOOST_CHECK_CLOSE(pL.
c2, (pL.
gamma-1.)*(pL.
H-0.5*pL.
U2),1
e-8);
146 std::cout << flux_pos << std::endl;
149 std::cout << flux_neg << std::endl;
151 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
154 std::cout << flux_pos << std::endl;
157 std::cout << flux_neg << std::endl;
159 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
162 std::cout << flux_pos << std::endl;
165 std::cout << flux_neg << std::endl;
167 BOOST_CHECK_EQUAL ( flux_pos, -flux_neg );
176 pL.
R=287.05; pR.
R=287.05;
188 BOOST_CHECK_EQUAL( pL.
rho , rho );
189 BOOST_CHECK_EQUAL( pL.
p , p );
194 BOOST_CHECK_EQUAL( pAvg.
gamma , 1.4 );
195 BOOST_CHECK_EQUAL( pAvg.
rho , rho );
196 BOOST_CHECK_EQUAL( pAvg.
H , pL.
H );
197 BOOST_CHECK_EQUAL( pAvg.
U[
XX] , 0. );
198 BOOST_CHECK_EQUAL( pAvg.
U[
YY] , v );
199 BOOST_CHECK_EQUAL( pAvg.
U2 , v*v );
209 std::cout <<
"convective_flux left = " << fluxL << std::endl;
211 std::cout <<
"convective_flux right = " << fluxR << std::endl;
212 flux = 0.5*(fluxL+fluxR);
215 std::cout <<
"symmetry_wall_flux (Central) = " << flux << std::endl;
216 BOOST_CHECK_EQUAL( fluxL[0] , (rho*u) );
217 BOOST_CHECK_EQUAL( fluxL[1] , (rho*u)*u + p);
218 BOOST_CHECK_EQUAL( fluxL[2] , (rho*u)*v );
219 BOOST_CHECK_EQUAL( fluxL[3] , (rho*u)*H );
221 BOOST_CHECK_EQUAL( fluxR[0] , (-rho*u) );
222 BOOST_CHECK_EQUAL( fluxR[1] , (-rho*u)*(-u) + p);
223 BOOST_CHECK_EQUAL( fluxR[2] , (-rho*u)*v );
224 BOOST_CHECK_EQUAL( fluxR[3] , (-rho*u)*H );
226 BOOST_CHECK_EQUAL( flux[0] , 0. );
227 BOOST_CHECK_EQUAL( flux[1] , rho*u*u + p );
228 BOOST_CHECK_EQUAL( flux[2] , 0. );
229 BOOST_CHECK_EQUAL( flux[3] , 0. );
232 std::cout <<
"symmetry_wall_flux (Rusanov) = " << flux << std::endl;
235 std::cout <<
"symmetry_wall_flux (Roe) = " << flux << std::endl;
238 std::cout <<
"convective_flux (RoeAvg) = " << flux << std::endl;
246 BOOST_AUTO_TEST_SUITE_END()
boost::proto::terminal< SFOp< NormalOp > >::type const normal
MatrixTypes< NDIM, NEQS >::ColVector_NDIM ColVector_NDIM
void compute_roe_average(const Data &left, const Data &right, Data &roe)
Linearize a left and right state using the Roe average.
void compute_roe_flux(const Data &left, const Data &right, const ColVector_NDIM &normal, RowVector_NEQS &flux, Real &wave_speed)
Roe Approximate Riemann solver.
void compute_convective_flux(const Data &p, const ColVector_NDIM &normal, RowVector_NEQS &flux, Real &wave_speed)
Convective flux in conservative form, and maximum absolute wave speed.
void compute_from_primitive(const RowVector_NEQS &prim)
Compute the data given primitive state.
void compute_from_primitive(const RowVector_NEQS &prim)
Compute the data given primitive state.
Real e()
Definition of the Unit charge [C].
MatrixTypes< NDIM, NEQS >::RowVector_NEQS RowVector_NEQS
Real c2
square of speed of sound, very commonly used
Real c2
square of speed of sound, very commonly used
MatrixTypes< NDIM, NEQS >::ColVector_NDIM ColVector_NDIM
Top-level namespace for coolfluid.
BOOST_AUTO_TEST_CASE(Test_Euler1D_convection)
void compute_rusanov_flux(const Data &left, const Data &right, const ColVector_NDIM &normal, RowVector_NEQS &flux, Real &wave_speed)
Rusanov Approximate Riemann solver.
Real E
specific total energy
Real E
specific total energy
Real u2
velocity along XX squared
Real gamma
specific heat ratio
Real gamma
specific heat ratio
void compute_hlle_flux(const Data &left, const Data &right, const ColVector_NDIM &normal, RowVector_NEQS &flux, Real &wave_speed)
HLLE Approximate Riemann solver.
MatrixTypes< NDIM, NEQS >::RowVector_NEQS RowVector_NEQS
Most basic kernel library.