38 f[
hu ] = q[
hu ] * q[
hu ] / q[
h ] +
g * q[
h ] * q[
h ] / 2;
45 const double c( sqrt(
g * q[
h ] ) );
47 const double u( q[
hu ] / q[
h ] );
49 return std::max( std::abs(
u + c ), std::abs(
u - c ) );
54 r[
h ] = -q[
hu ] / x;
55 r[
hu ] = -q[
hu ] * q[
hu ] / ( q[
h ] * x );
64 q[
h ] = 1 + 0.5 * ( 1 - std::tanh( 100 * xi ) );
78 cout <<
"=== Hyperbolic: Shallow water radial dam break ======\n";
85 const double left = 1.e-4;
86 const double right = 2.5;
87 const unsigned N = 2001;
96 OneD_TVDLF_Mesh Shallow_mesh( faces_x, &conservative_problem, Example::Q_init );
100 int loop_counter( 0 );
101 int file_counter( 0 );
103 std::string dirname(
"./DATA");
104 mkdir( dirname.c_str(), S_IRWXU );
105 std::string filename_stub;
106 filename_stub =
"./DATA/HYP_shallow_rad";
113 if ( loop_counter % 50 == 0 )
120 t += Shallow_mesh.
update( 0.499, t_end - t );
123 while ( ( t < t_end ) && ( loop_counter < 3000 ) );
127 double h_clawpack( 1.13466 );
129 if ( abs( h_test - h_clawpack ) > 1.e-3 )
131 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
132 cout <<
" deviation from the Clawpack data = " << abs( h_test - h_clawpack ) <<
"\n";
137 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for hyperbolic problems.
An DenseVector class – a dense vector object.
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.
void source_fn(const double &x, const DenseVector< double > &q, const DenseVector< double > &slope, DenseVector< double > &r) const
Shallow_1d_rad()
One dimemsional constant coefft acoustic problem.
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.
void push_ptr(double *scalar, std::string desc="")
void set_filename(std::string filename)
void Q_init(const double &x, DenseVector< double > &q)
Set the initial state of the system.
double A(1.0)
initial hump amplitude
double g(1.0)
gravitational acceleration
DenseVector< double > power_node_vector(const double &lower, const double &upper, const std::size_t &N, const double &power)
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower...
std::string stringify(const int &val)
Return an integer value as a string - useful for file naming.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...