40 double u = q[
m ] / q[
rho ];
41 double p = (
gamma - 1. ) * ( q[
E ] - 0.5 * q[
rho ] *
u *
u );
44 f[
E ] =
u * ( q[
E ] +
p );
51 double u = q[
m ] / q[
rho ];
52 double p = (
gamma - 1. ) * ( q[
E ] - 0.5 * q[
rho ] *
u *
u );
55 return std::max(
u + c,
u - c );
86 cout <<
"=== Hyperbolic: 1D Euler gasdynamics shocktube =====\n";
90 const double left = 0.0;
91 const double right = 1.0;
92 const unsigned N = 400;
98 OneD_TVDLF_Mesh Euler_mesh( faces_x, &conservative_problem, Example::Q_init );
102 int loop_counter( 0 );
103 int file_counter( 0 );
105 std::string dirname(
"./DATA");
106 mkdir( dirname.c_str(), S_IRWXU );
107 std::string filename_stub;
108 filename_stub =
"./DATA/HYP_shocktube_sod";
115 if ( loop_counter % 10 == 0 )
122 t += Euler_mesh.
update( 0.499 );
125 while ( ( t < 0.2 ) && ( loop_counter < 1000 ) );
134 if ( ( E1 > 1.e-3 ) || ( E2 > 1.e-3 ) || ( std::abs( I1 - I2 ) > 1.e-8 ) || ( loop_counter >= 1000 ) )
136 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
137 cout << E1 <<
" " << E2 <<
" " << std::abs( I1 - I2 ) <<
" " << loop_counter <<
"\n";
142 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for hyperbolic problems.
An DenseVector class – a dense vector object.
Euler_1d()
One dimemsional Euler problem, so 3rd order.
void flux_fn(const double &x, const DenseVector< double > &q, DenseVector< double > &f) const
Define the vector flux.
double max_charac_speed(const DenseVector< double > &q) const
Bound the shock speed.
A class to represent a one dimensional hyperbolic system of equations.
A one dimensional mesh utility object.
DenseVector< _Type > get_interpolated_vars(const _Xtype &pos) const
Get the variable data at an interpolated position using a first order scheme.
OneD_Node_Mesh< double > get_soln(std::string location="centre", std::string colour="black")
Get a OneD_Mesh<double> object containing the one dimensional data in the usual format.
double update(const double &CFL, const double &max_dt=std::numeric_limits< long double >::max())
Update all the elements in this mesh to a new time step.
void set_limiter(unsigned id)
Set the limiter type to be applied in the slope values.
DenseVector< double > integrate() const
Integrate the concentration values across the entire mesh.
void push_ptr(double *scalar, std::string desc="")
void set_filename(std::string filename)
double gamma(1.4)
Adiabatic index – ratio of specific heats.
void Q_init(const double &x, DenseVector< double > &q)
Set the initial state of the system.
std::string stringify(const int &val)
Return an integer value as a string - useful for file naming.
DenseVector< double > uniform_node_vector(const double &lower, const double &upper, const std::size_t &N)
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bou...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...