23 double r( std::sqrt( x*x + y*y ) - 0.5 );
24 q[
h ] = 1 + 0.5 * ( 1 - std::tanh( 500 * r ) );
42 f[
hu ] = q[
hu ] * q[
hu ] / q[
h ] +
g * q[
h ] * q[
h ] / 2.;
43 f[
hv ] = q[
hu ] * q[
hv ] / q[
h ];
49 f[
hu ] = q[
hu ] * q[
hv ] / q[
h ];
50 f[
hv ] = q[
hv ] * q[
hv ] / q[
h ] +
g * q[
h ] * q[
h ] / 2.;
57 J( 1,
h ) = - q[
hu ] * q[
hu ] / ( q[
h ] * q[
h ] ) +
g * q[
h ];
58 J( 1,
hu ) = 2 * q[
hu ] / q[
h ];
59 J( 2,
h ) = - q[
hu ] * q[
hv ] / ( q[
h ] * q[
h ] );
60 J( 2,
hu ) = q[
hv ] / q[
h ];
61 J( 2,
hv ) = q[
hu ] / q[
h ];
67 J( 1,
h ) = - q[
hu ] * q[
hv ] / ( q[
h ] * q[
h ] );
68 J( 1,
hu ) = q[
hv ] / q[
h ];
69 J( 1,
hv ) = q[
hu ] / q[
h ];
70 J( 2,
h ) = - q[
hv ] * q[
hv ] / ( q[
h ] * q[
h ] ) +
g * q[
h ];
71 J( 2,
hv ) = 2 * q[
hv ] / q[
h ];
78 double cc = sqrt(
g * q[
h ] );
80 double U = q[
hu ] / q[
h ];
81 double V = q[
hv ] / q[
h ];
83 c[ 0 ] = std::max( std::abs(
U + cc ), std::abs(
U - cc ) );
84 c[ 1 ] = std::max( std::abs(
V + cc ), std::abs(
V - cc ) );
100 cout <<
"=== Hyperbolic: 2D radial dam-break in Cartesians ===\n";
104 const double west = -1;
105 const double east = 1;
106 const double south = -1;
107 const double north = 1;
108 const unsigned N = 151;
112 std::string dirname(
"./DATA");
113 mkdir( dirname.c_str(), S_IRWXU );
114 std::string filename_stub(
"./DATA/HYP_2D_rad_dam" );
117 TwoD_TVDLF_Mesh Shallow_2d_mesh( faces_x, faces_y, &conservative_problem, Example::Q_init );
120 int file_counter( 1 );
121 const double t_end = 0.5;
130 Shallow_2d_mesh.
update( 0.49, std::abs( Shallow_2d_mesh.
get_time() - t_end ) );
134 while ( Shallow_2d_mesh.
get_time() < t_end );
136 double h_clawpack( 1.13466 );
137 double theta = M_PI / 4;
139 x[ 0 ] = 0.5 * cos( theta );
140 x[ 1 ] = 0.5 * sin( theta );
142 if ( abs( h_diag - h_clawpack ) > 1.e-3 )
144 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
145 cout <<
" deviation from the Clawpack data = " << abs( h_diag - h_clawpack ) <<
"\n";
150 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for hyperbolic problems.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
Shallow_2d_rad()
One dimemsional constant coefft acoustic problem.
void Jac_flux_fn_y(const DenseVector< double > &x, const DenseVector< double > &q, DenseMatrix< double > &J) const
A virtual function function to define the Jacobian of the y-flux function.
void max_charac_speed(const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
Bound the wave speed.
void flux_fn_y(const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
A virtual flux function for the y-derivative.
void flux_fn_x(const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
Define the vector flux.
void Jac_flux_fn_x(const DenseVector< double > &x, const DenseVector< double > &q, DenseMatrix< double > &J) const
A virtual function function to define the Jacobian of the x-flux function.
A class to represent a two-dimensional hyperbolic system of equations.
DenseVector< double > get_point_values(const DenseVector< double > &x)
Get the vector of unknowns at a point in the 2D mesh.
void dump_gnu(std::string filename)
Dump the data to a given filename in a gnuplot format.
const double & get_time() const
Get a const reference to the time value for the current mesh.
double update(const double &CFL, const double &max_dt=std::numeric_limits< long double >::max())
Update the mesh object.
void set_limiter(const unsigned &id)
Set the limiter type to be applied in the slope values.
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...