CppNoddy  0.92
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions
HYP2DRadialDamBreak.cpp File Reference
#include <TwoD_HYP_bundle.h>

Go to the source code of this file.

Classes

class  CppNoddy::Example::Shallow_2d_rad
 Define the system. More...
 

Namespaces

namespace  CppNoddy
 A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechanics.
 
namespace  CppNoddy::Example
 

Enumerations

enum  { h , hu , hv }
 

Functions

double CppNoddy::Example::g (1.0)
 gravitational acceleration More...
 
double CppNoddy::Example::A (1.0)
 initial hump amplitude More...
 
void CppNoddy::Example::Q_init (const double &x, const double &y, DenseVector< double > &q)
 Set the initial state of the system. More...
 
int main ()
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
hu 
hv 

Definition at line 10 of file HYP2DRadialDamBreak.cpp.

10{ h, hu, hv };

Function Documentation

◆ main()

int main ( )

Definition at line 97 of file HYP2DRadialDamBreak.cpp.

98{
99 cout << "\n";
100 cout << "=== Hyperbolic: 2D radial dam-break in Cartesians ===\n";
101 cout << "\n";
102
103 // define the domain/mesh
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;
109 DenseVector<double> faces_x = Utility::power_node_vector( west, east, N, 1.0 );
110 DenseVector<double> faces_y = Utility::power_node_vector( south, north, N, 1.0 );
111
112 std::string dirname("./DATA");
113 mkdir( dirname.c_str(), S_IRWXU );
114 std::string filename_stub( "./DATA/HYP_2D_rad_dam" );
115
116 Example::Shallow_2d_rad conservative_problem;
117 TwoD_TVDLF_Mesh Shallow_2d_mesh( faces_x, faces_y, &conservative_problem, Example::Q_init );
118 Shallow_2d_mesh.set_limiter( 0 );
119
120 int file_counter( 1 );
121 const double t_end = 0.5;
122 DenseVector<double> x1( 2, 0.0 );
123 x1[0] = 0.4;
124 x1[1] = 0.1;
125 DenseVector<double> x2( 2, 0.0 );
126 x2[0] = 0.1;
127 x2[1] = 0.4;
128 do
129 {
130 Shallow_2d_mesh.update( 0.49, std::abs( Shallow_2d_mesh.get_time() - t_end ) );
131 Shallow_2d_mesh.dump_gnu( filename_stub + Utility::stringify( file_counter ) + "_gnu.dat" );
132 file_counter += 1;
133 }
134 while ( Shallow_2d_mesh.get_time() < t_end );
135
136 double h_clawpack( 1.13466 );
137 double theta = M_PI / 4;
138 DenseVector<double> x( 2, 0.0 );
139 x[ 0 ] = 0.5 * cos( theta );
140 x[ 1 ] = 0.5 * sin( theta );
141 double h_diag = Shallow_2d_mesh.get_point_values( x )[ h ];
142 if ( abs( h_diag - h_clawpack ) > 1.e-3 )
143 {
144 cout << "\033[1;31;48m * FAILED \033[0m\n";
145 cout << " deviation from the Clawpack data = " << abs( h_diag - h_clawpack ) << "\n";
146 return 1;
147 }
148 else
149 {
150 cout << "\033[1;32;48m * PASSED \033[0m\n";
151 return 0;
152 }
153}
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
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...
Definition: Utility.cpp:123
std::string stringify(const int &val)
Return an integer value as a string - useful for file naming.
Definition: Utility.cpp:193

References CppNoddy::TwoD_TVDLF_Mesh::dump_gnu(), CppNoddy::TwoD_TVDLF_Mesh::get_point_values(), CppNoddy::TwoD_TVDLF_Mesh::get_time(), h, CppNoddy::Utility::power_node_vector(), CppNoddy::TwoD_TVDLF_Mesh::set_limiter(), CppNoddy::Utility::stringify(), and CppNoddy::TwoD_TVDLF_Mesh::update().

© 2012

R.E. Hewitt