CppNoddy
0.92
|
A Linear Element class. More...
#include <OneD_TVDLF_Elt.h>
Public Member Functions | |
OneD_TVDLF_Elt (double a, double b, OneD_Hyperbolic_System *ptr, bool flag=false, int index=0) | |
Construct a linear element. More... | |
~OneD_TVDLF_Elt () | |
An empty destructor. More... | |
void | add_contribution (OneD_TVDLF_Elt *ptr, const DenseVector< double > &s_range, int index) |
Allow the connection of this element to another element. More... | |
void | clear_contributions () |
Clear the record of contributions to this element. More... | |
DenseVector< double > | contributed_Q () |
Find the integral contributions to this black/red element from the contributed red/black element. More... | |
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. More... | |
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. More... | |
double | get_s (double x) const |
Convert a global coordinate into a local coordinate within this element If the global coordinate is outside the element, then we throw an exception. More... | |
double | get_x (double s) const |
Get the global position of the local coordinate. More... | |
double | get_dx () const |
Get the size of the element. More... | |
bool | get_external_flag () const |
Get the external flag. More... | |
void | set_external_flag (bool flag) |
Set the external flag. More... | |
int | get_external_face_i () const |
Get the exterior boundary number. More... | |
void | set_external_face_i (int i) |
Set the local coordinate of the external face. More... | |
DenseVector< double > | get_Q (double s) const |
Get the value of the 'concentration' stored in this element. More... | |
DenseVector< double > | get_int_Q (const double s0, const double s1) |
Get the integral of Q over a sub-element. More... | |
void | set_Q_mid (const DenseVector< double > value) |
Set the value of the 'concentration' stored in this element. More... | |
void | set_slope (const DenseVector< double > value) |
The concentration is approximated by a linear function in each element. More... | |
DenseVector< double > | get_slope () const |
The concentration is approximated by a linear function in each element. More... | |
DenseVector< double > | get_flux_fn (const double s) const |
Get the flux function evaluated for the concentration value stored in this elt. More... | |
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. More... | |
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. More... | |
double | get_max_dt () const |
Get the maximum allowable time step for this element by using information about the size of the element and the maximum wave speed set in the conservative system. More... | |
Public Attributes | |
OneD_Hyperbolic_System * | system_ptr |
A Linear Element class.
Definition at line 15 of file OneD_TVDLF_Elt.h.
CppNoddy::OneD_TVDLF_Elt::OneD_TVDLF_Elt | ( | double | a, |
double | b, | ||
OneD_Hyperbolic_System * | ptr, | ||
bool | flag = false , |
||
int | index = 0 |
||
) |
Construct a linear element.
a | The left hand edge |
b | The right hand edge |
ptr | A pointer to the hyperbolic system for this element |
flag | A boolean indicator to specify an elt with an external face |
index | Index of the external face if flag=true |
Definition at line 13 of file OneD_TVDLF_Elt.cpp.
References system_ptr.
CppNoddy::OneD_TVDLF_Elt::~OneD_TVDLF_Elt | ( | ) |
void CppNoddy::OneD_TVDLF_Elt::add_contribution | ( | OneD_TVDLF_Elt * | ptr, |
const DenseVector< double > & | s_range, | ||
int | index | ||
) |
Allow the connection of this element to another element.
ptr | A pointer to another element of the same type |
s_range | A vector range of local coordinates (s_min,s_max) in this 1D case. |
index | An index to indicate which face of the current elt this contribution is associated with for flux computations -1=left, +1=right, 0=none |
Definition at line 32 of file OneD_TVDLF_Elt.cpp.
|
inline |
Clear the record of contributions to this element.
Definition at line 46 of file OneD_TVDLF_Elt.h.
void CppNoddy::OneD_TVDLF_Elt::contributed_flux_in_left | ( | const double & | dt, |
DenseVector< double > & | flux_in_left, | ||
const double & | current_time | ||
) |
Compute the flux into this element through the left face over a given time step.
dt | The time step to compute the flux over |
flux_in_left | A vector to return the flux components in |
current_time | The current mesh time level |
Definition at line 54 of file OneD_TVDLF_Elt.cpp.
References get_external_flag(), get_Jac_flux_fn(), get_Q(), get_source_fn(), get_x(), CppNoddy::DenseMatrix< _Type >::multiply(), and system_ptr.
void CppNoddy::OneD_TVDLF_Elt::contributed_flux_out_right | ( | const double & | dt, |
DenseVector< double > & | flux_out_right, | ||
const double & | current_time | ||
) |
Compute the flux out of this element through the right face over a given time step.
dt | The time step to compute the flux over |
flux_out_right | A vector to return the flux components in |
current_time | The current mesh time level |
Definition at line 103 of file OneD_TVDLF_Elt.cpp.
References get_external_flag(), get_Jac_flux_fn(), get_Q(), get_source_fn(), get_x(), CppNoddy::DenseMatrix< _Type >::multiply(), and system_ptr.
DenseVector< double > CppNoddy::OneD_TVDLF_Elt::contributed_Q | ( | ) |
Find the integral contributions to this black/red element from the contributed red/black element.
Definition at line 41 of file OneD_TVDLF_Elt.cpp.
References get_int_Q(), and system_ptr.
|
inline |
Get the size of the element.
Definition at line 181 of file OneD_TVDLF_Elt.h.
Referenced by get_int_Q(), get_max_dt(), and get_x().
|
inline |
Get the exterior boundary number.
Definition at line 193 of file OneD_TVDLF_Elt.h.
|
inline |
Get the external flag.
Definition at line 189 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
DenseVector< double > CppNoddy::OneD_TVDLF_Elt::get_flux_fn | ( | const double | s | ) | const |
Get the flux function evaluated for the concentration value stored in this elt.
s | The local coordinate at which to evaluate |
Definition at line 152 of file OneD_TVDLF_Elt.cpp.
References f, get_Q(), get_x(), and system_ptr.
|
inline |
Get the integral of Q over a sub-element.
s0 | The left local coordinate |
s1 | The right local coordinate |
Definition at line 201 of file OneD_TVDLF_Elt.h.
References get_dx(), and get_Q().
Referenced by contributed_Q().
DenseMatrix< double > CppNoddy::OneD_TVDLF_Elt::get_Jac_flux_fn | ( | const double | s | ) | const |
Get the Jacobian of the flux function evaluated for the concentration value stored in this elt.
s | The local coordinate at which to evaluate |
Definition at line 159 of file OneD_TVDLF_Elt.cpp.
References get_Q(), get_x(), and system_ptr.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
double CppNoddy::OneD_TVDLF_Elt::get_max_dt | ( | ) | const |
Get the maximum allowable time step for this element by using information about the size of the element and the maximum wave speed set in the conservative system.
The time step is guranteed to satisfy the CFL < 0.5 constraint.
Definition at line 173 of file OneD_TVDLF_Elt.cpp.
References get_dx(), get_Q(), and system_ptr.
|
inline |
Get the value of the 'concentration' stored in this element.
s | The local coordinate in the elt at which Q is requested |
Definition at line 197 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), get_flux_fn(), get_int_Q(), get_Jac_flux_fn(), get_max_dt(), and get_source_fn().
|
inline |
Convert a global coordinate into a local coordinate within this element If the global coordinate is outside the element, then we throw an exception.
x | The global coordinate to convert |
Definition at line 72 of file OneD_TVDLF_Elt.h.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function is got through this method.
Definition at line 222 of file OneD_TVDLF_Elt.h.
Referenced by get_source_fn().
DenseVector< double > CppNoddy::OneD_TVDLF_Elt::get_source_fn | ( | const double | s | ) | const |
Get the value of the source function term in this element at a given local coordinate.
s | The local coordinate to evaluate at |
Definition at line 166 of file OneD_TVDLF_Elt.cpp.
References get_Q(), get_slope(), get_x(), and system_ptr.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
|
inline |
Get the global position of the local coordinate.
s | The local coordinate |
Definition at line 185 of file OneD_TVDLF_Elt.h.
References get_dx().
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), get_flux_fn(), get_Jac_flux_fn(), and get_source_fn().
|
inline |
Set the local coordinate of the external face.
Only one face can be external.
i | The index of the external face -1=left, +1=right |
Definition at line 210 of file OneD_TVDLF_Elt.h.
|
inline |
Set the external flag.
flag | is the value to set |
Definition at line 206 of file OneD_TVDLF_Elt.h.
|
inline |
Set the value of the 'concentration' stored in this element.
To second order, this is the value of the concentration at the mid-point of the element.
value | The value to be assigned to the concentration member data Q |
Definition at line 214 of file OneD_TVDLF_Elt.h.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function is set through this method.
value | The value to be assigned to the member data 'slope' |
Definition at line 218 of file OneD_TVDLF_Elt.h.
OneD_Hyperbolic_System* CppNoddy::OneD_TVDLF_Elt::system_ptr |
Definition at line 165 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), contributed_Q(), get_flux_fn(), get_Jac_flux_fn(), get_max_dt(), get_source_fn(), and OneD_TVDLF_Elt().
© 2012
R.E. Hewitt