29 f[ 0 ] = q[ 0 ] * q[ 0 ] / 2;
36 return std::abs( q[ 0 ] );
42 std::vector<bool> inflow( q.
size(),
false );
44 if ( face_index == -1 )
49 if ( face_index == 1 )
62 q[ 0 ] = std::sin( 2 * M_PI * x );
75 cout <<
"=== Hyperbolic: 1D nonlinear advection equation ====\n";
79 const double left = 0.0;
80 const double right = 1.0;
81 const unsigned N = 141;
87 OneD_TVDLF_Mesh NlinAdv_mesh( faces_x, &conservative_problem, Example::Q_init );
91 int loop_counter( 5 );
93 std::string dirname(
"./DATA");
94 mkdir( dirname.c_str(), S_IRWXU );
104 double dt = NlinAdv_mesh.
update( 0.475 );
108 if ( loop_counter % 10 == 0 )
117 while ( ( t < 0.4 ) && ( loop_counter < 1000 ) );
124 if ( ( asym > 1.e-10 ) || ( std::abs( I1 - I2 ) > 1.e-8 ) || ( loop_counter >= 1000 ) )
126 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
127 cout <<
"asymmetry = " << asym <<
"\n";
128 cout <<
"integral difference = " << I1 - I2 <<
"\n";
129 cout <<
"loop counter = " << loop_counter <<
"\n";
134 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for hyperbolic problems.
An DenseVector class – a dense vector object.
std::size_t size() const
A pass-thru definition to get the size of the vector.
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.
NlinAdv()
One dimemsional inviscid Burgers problem.
std::vector< bool > edge_values(const int face_index, const double &x, DenseVector< double > &q, const double &t) const
Define the edge boundary conditions.
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 Q_init(const double &x, DenseVector< double > &q)
Set the initial state of the system.
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...