15 bool flag,
int index) {
17 std::cout <<
"DEBUG: Constructing a OneD_TVDLF_Elt object between "
18 << a <<
" and " << b <<
"\n";
24 EXTERNAL_FACE_I = index;
36 cont.face_index = index;
38 CONT_LIST.push_back(cont);
42 std::list< contribution >::iterator c = CONT_LIST.begin();
46 while(c != CONT_LIST.end()) {
48 sum += c -> elt_ptr ->
get_int_Q(c -> s[0], c -> s[1]);
55 std::list< contribution >::iterator c = CONT_LIST.begin();
57 while(c != CONT_LIST.end()) {
59 if(c -> face_index == -1) {
61 const double s = c -> s[ 0 ];
68 double x(c -> elt_ptr ->
get_x(s));
70 c -> elt_ptr ->
system_ptr -> flux_fn(x, q_half_step, flux_in_left);
77 c = CONT_LIST.begin();
78 while(c != CONT_LIST.end()) {
81 if(EXTERNAL_FACE_I < 0) {
86 double x_left(c -> elt_ptr ->
get_x(-1.0));
93 system_ptr -> edge_values(-1, x_left, q_left_half_step, current_time + 0.5*dt);
95 system_ptr -> flux_fn(x_left, q_left_half_step, flux_in_left);
104 std::list< contribution >::iterator c = CONT_LIST.begin();
106 while(c != CONT_LIST.end()) {
108 if(c -> face_index == 1) {
110 const double s = c -> s[ 1 ];
117 double x(c -> elt_ptr ->
get_x(s));
119 c -> elt_ptr ->
system_ptr -> flux_fn(x, q_half_step, flux_out_right);
126 c = CONT_LIST.begin();
127 while(c != CONT_LIST.end()) {
130 if(EXTERNAL_FACE_I > 0) {
135 double x_right(c -> elt_ptr ->
get_x(1.0));
142 system_ptr -> edge_values(1, x_right, q_right_half_step, current_time + 0.5*dt);
144 system_ptr -> flux_fn(x_right, q_right_half_step, flux_out_right);
Specification of a one dimensional linear element for use in a TVD Lax-Friedrichs scheme.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
DenseVector< _Type > multiply(const DenseVector< _Type > &x) const
Right multiply the matrix by a DENSE vector.
An DenseVector class – a dense vector object.
A class to represent a one dimensional hyperbolic system of equations.
void add_contribution(OneD_TVDLF_Elt *ptr, const DenseVector< double > &s_range, int index)
Allow the connection of this element to another element.
OneD_Hyperbolic_System * system_ptr
double get_x(double s) const
Get the global position of the local coordinate.
DenseVector< double > contributed_Q()
Find the integral contributions to this black/red element from the contributed red/black element.
void contributed_flux_in_left(const double &dt, DenseVector< double > &flux_in_left, const double ¤t_time)
Compute the flux into this element through the left face over a given time step.
~OneD_TVDLF_Elt()
An empty destructor.
DenseVector< double > get_Q(double s) const
Get the value of the 'concentration' stored in this element.
double get_dx() const
Get the size of the element.
DenseMatrix< double > get_Jac_flux_fn(const double s) const
Get the Jacobian of the flux function evaluated for the concentration value stored in this elt.
OneD_TVDLF_Elt(double a, double b, OneD_Hyperbolic_System *ptr, bool flag=false, int index=0)
Construct a linear element.
DenseVector< double > get_source_fn(const double s) const
Get the value of the source function term in this element at a given local coordinate.
DenseVector< double > get_slope() const
The concentration is approximated by a linear function in each element.
bool get_external_flag() const
Get the external flag.
DenseVector< double > get_flux_fn(const double s) const
Get the flux function evaluated for the concentration value stored in this elt.
void contributed_flux_out_right(const double &dt, DenseVector< double > &flux_out_right, const double ¤t_time)
Compute the flux out of this element through the right face over a given time step.
DenseVector< double > get_int_Q(const double s0, const double s1)
Get the integral of Q over a sub-element.
double get_max_dt() const
Get the maximum allowable time step for this element by using information about the size of the eleme...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...