CppNoddy
0.92
|
A Linear Element class. More...
#include <TwoD_TVDLF_Elt.h>
Public Member Functions | |
TwoD_TVDLF_Elt (double west, double east, double south, double north, TwoD_Hyperbolic_System *ptr, bool flag=false, std::set< int > faces=std::set< int >()) | |
Construct a linear rectangular element. More... | |
~TwoD_TVDLF_Elt () | |
An empty destructor. More... | |
bool | face_is_external (const int &index) const |
Test to see if a face index of an element is external to the mesh. More... | |
bool | face_is_internal (const int &index) const |
Test to see if a face index of an element is internal to the mesh. More... | |
void | set_ptrs (const int &index, TwoD_TVDLF_Elt *ptr) |
Each element stores pointers to any adjacent elements in the four compass directions 0,1,2,3 for S,E,N,W. More... | |
TwoD_TVDLF_Elt * | get_ptrs (const int &index) const |
Return a pointer to an element in the given compass direction. More... | |
void | add_contribution (TwoD_TVDLF_Elt *ptr, const DenseVector< double > &sw, const DenseVector< double > &ne, std::set< int > indices) |
Add a contribution to this element from another element. More... | |
void | dump () const |
Dump the details of this element. More... | |
void | clear_contributions () |
Reset the contributions to this element. More... | |
DenseVector< double > | contributed_Q () const |
Find the integral contributions to this black/red element from the corresponding contributing red/black element. More... | |
void | add_flux_contributions (const double &dt) |
Adds the contribution of each face's flux to the correction for this element unless it has already been added by a flux computation across the same face in an adjacent elt. More... | |
void | contributed_flux_in_west (const double &dt, DenseVector< double > &flux_in_west) |
Compute the flux into this element across the western face. More... | |
void | contributed_flux_in_south (const double &dt, DenseVector< double > &flux_in_south) |
Compute the flux into this element across the southern face. More... | |
void | contributed_flux_out_east (const double &dt, DenseVector< double > &flux_out_east) |
Compute the flux out of this element across the eastern face. More... | |
void | contributed_flux_out_north (const double &dt, DenseVector< double > &flux_out_north) |
Compute the flux out of this element across the northern face. More... | |
DenseVector< double > | get_s (const DenseVector< double > &x) const |
Get the local coordinate that corresponds to a given global coordinate. More... | |
DenseVector< double > | get_x (DenseVector< double > s) const |
Get the global position of a local coordinate in this element. More... | |
DenseVector< double > | get_x_mid () const |
Get the global position of a central node in this element. More... | |
DenseVector< double > | get_dx () const |
Get the size of the element as a vector (delta_x, delta_y). More... | |
double | get_dA () const |
Get the area of the element. More... | |
void | set_external_flag (bool flag) |
Set the external flag. More... | |
bool | get_external_flag () const |
Get the external flag. More... | |
std::set< int > | get_external_faces () const |
Get a set of indices of faces that are external. More... | |
DenseVector< double > | get_Q (const DenseVector< double > &s) const |
Get the value of the 'concentration' stored in this element. More... | |
DenseVector< double > | get_int_Q (const DenseVector< double > &sw, const DenseVector< double > &ne) const |
Get the integral of Q over a sub-element. More... | |
void | add_external_face (const int &i) |
Add an external face to the stored stl::set. More... | |
void | remove_external_face (const int &i) |
Remove an external face to the stored stl::set. More... | |
void | set_Q_mid (const DenseVector< double > &value) |
Set the value of the vector 'concentration' stored in this element. More... | |
DenseVector< double > | get_Q_mid () const |
Get the nodal concentration. More... | |
void | set_slope_x (const DenseVector< double > &value) |
Set the x-slope vector for this element. More... | |
void | set_slope_y (const DenseVector< double > &value) |
Set the y-slope vector for this element. More... | |
DenseVector< double > | get_slope_x () const |
The concentration is approximated by a linear function in each element. More... | |
DenseVector< double > | get_slope_y () const |
The concentration is approximated by a linear function in each element. More... | |
DenseVector< double > | get_Q_Taylor_series (const DenseVector< double > &s, const double &dt) const |
Get the Taylor series expansion of the concentration for a given time step and local coordinate for this element. More... | |
DenseVector< double > | get_source_contribution (const double &dt) const |
Evaluate the contribution to this element by the hyperbolic system's source function over a given time step using a mid-point in time evaluation. 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... | |
DenseVector< double > | get_flux_fn_x (const DenseVector< double > &s) const |
Get the flux function in the x direction evaluated for the concentration value stored in this elt. More... | |
DenseVector< double > | get_flux_fn_y (const DenseVector< double > &s) const |
Get the flux function in the y direction evaluated for the concentration value stored in this elt. More... | |
DenseMatrix< double > | get_Jac_flux_fn_x (const DenseVector< double > &s) const |
Get the Jacobian of the x flux function evaluated for the concentration value stored in this elt. More... | |
DenseMatrix< double > | get_Jac_flux_fn_y (const DenseVector< double > &s) const |
Get the Jacobian of the y flux function evaluated for the concentration value stored in this elt. More... | |
DenseVector< double > | get_source_fn (const DenseVector< double > &s) const |
Get the source function evaluated for the concentration value stored in this elt. More... | |
Public Attributes | |
TwoD_Hyperbolic_System * | p_system |
A Linear Element class.
Definition at line 19 of file TwoD_TVDLF_Elt.h.
CppNoddy::TwoD_TVDLF_Elt::TwoD_TVDLF_Elt | ( | double | west, |
double | east, | ||
double | south, | ||
double | north, | ||
TwoD_Hyperbolic_System * | ptr, | ||
bool | flag = false , |
||
std::set< int > | faces = std::set<int>() |
||
) |
Construct a linear rectangular element.
west | The western face location |
east | The eastern face location |
south | The western face location |
north | The eastern face location |
ptr | A pointer to the hyperbolic system |
flag | A boolean indicator to specify an elt with an external face |
faces | A set of indices of the external faces |
Definition at line 17 of file TwoD_TVDLF_Elt.cpp.
References p_system.
CppNoddy::TwoD_TVDLF_Elt::~TwoD_TVDLF_Elt | ( | ) |
void CppNoddy::TwoD_TVDLF_Elt::add_contribution | ( | TwoD_TVDLF_Elt * | ptr, |
const DenseVector< double > & | sw, | ||
const DenseVector< double > & | ne, | ||
std::set< int > | indices | ||
) |
Add a contribution to this element from another element.
ptr | A pointer to the element that contributes to this one |
sw | The SW local coordinate in the contributory element |
ne | The NE local coordinate in the contributory element |
indices | A set of indices of faces that this element contributes to |
Definition at line 99 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::add_external_face | ( | const int & | i | ) |
Add an external face to the stored stl::set.
i | The index of the external face 0,1,2,3 for S,E,N,W. |
Definition at line 460 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::add_flux_contributions | ( | const double & | dt | ) |
Adds the contribution of each face's flux to the correction for this element unless it has already been added by a flux computation across the same face in an adjacent elt.
dt | The time step over which the flux is to be computed |
Definition at line 72 of file TwoD_TVDLF_Elt.cpp.
References contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), contributed_flux_out_north(), get_source_contribution(), and p_system.
void CppNoddy::TwoD_TVDLF_Elt::clear_contributions | ( | ) |
Reset the contributions to this element.
Definition at line 142 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::contributed_flux_in_south | ( | const double & | dt, |
DenseVector< double > & | flux_in_south | ||
) |
Compute the flux into this element across the southern face.
dt | The time step over which the flux is to be computed |
flux_in_south | A vector flux that is overwritten by this method and returned containing the appropriate flux values. |
Definition at line 220 of file TwoD_TVDLF_Elt.cpp.
References face_is_external(), face_is_internal(), get_Q_Taylor_series(), get_x(), and p_system.
Referenced by add_flux_contributions().
void CppNoddy::TwoD_TVDLF_Elt::contributed_flux_in_west | ( | const double & | dt, |
DenseVector< double > & | flux_in_west | ||
) |
Compute the flux into this element across the western face.
dt | The time step over which the flux is to be computed |
flux_in_west | A vector flux that is overwritten by this method and returned containing the appropriate flux values. |
Definition at line 159 of file TwoD_TVDLF_Elt.cpp.
References face_is_external(), face_is_internal(), get_Q_Taylor_series(), get_x(), and p_system.
Referenced by add_flux_contributions().
void CppNoddy::TwoD_TVDLF_Elt::contributed_flux_out_east | ( | const double & | dt, |
DenseVector< double > & | flux_out_east | ||
) |
Compute the flux out of this element across the eastern face.
dt | The time step over which the flux is to be computed |
flux_out_east | A vector flux that is overwritten by this method and returned containing the appropriate flux values. |
Definition at line 281 of file TwoD_TVDLF_Elt.cpp.
References face_is_external(), face_is_internal(), get_Q_Taylor_series(), get_x(), and p_system.
Referenced by add_flux_contributions().
void CppNoddy::TwoD_TVDLF_Elt::contributed_flux_out_north | ( | const double & | dt, |
DenseVector< double > & | flux_out_north | ||
) |
Compute the flux out of this element across the northern face.
dt | The time step over which the flux is to be computed |
flux_out_north | A vector flux that is overwritten by this method and returned containing the appropriate flux values. |
Definition at line 342 of file TwoD_TVDLF_Elt.cpp.
References face_is_external(), face_is_internal(), get_Q_Taylor_series(), get_x(), and p_system.
Referenced by add_flux_contributions().
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::contributed_Q | ( | ) | const |
Find the integral contributions to this black/red element from the corresponding contributing red/black element.
Definition at line 146 of file TwoD_TVDLF_Elt.cpp.
References get_int_Q(), and p_system.
void CppNoddy::TwoD_TVDLF_Elt::dump | ( | ) | const |
Dump the details of this element.
Definition at line 134 of file TwoD_TVDLF_Elt.cpp.
References get_Q().
bool CppNoddy::TwoD_TVDLF_Elt::face_is_external | ( | const int & | index | ) | const |
Test to see if a face index of an element is external to the mesh.
index | The face index to test (0,1,2,3) for (S,E,N,W) |
Definition at line 52 of file TwoD_TVDLF_Elt.cpp.
Referenced by contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), contributed_flux_out_north(), and face_is_internal().
bool CppNoddy::TwoD_TVDLF_Elt::face_is_internal | ( | const int & | index | ) | const |
Test to see if a face index of an element is internal to the mesh.
index | The face index to test (0,1,2,3) for (S,E,N,W) |
Definition at line 60 of file TwoD_TVDLF_Elt.cpp.
References face_is_external().
Referenced by contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), and contributed_flux_out_north().
double CppNoddy::TwoD_TVDLF_Elt::get_dA | ( | ) | const |
Get the area of the element.
Definition at line 444 of file TwoD_TVDLF_Elt.cpp.
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_dx | ( | ) | const |
Get the size of the element as a vector (delta_x, delta_y).
Definition at line 437 of file TwoD_TVDLF_Elt.cpp.
std::set< int > CppNoddy::TwoD_TVDLF_Elt::get_external_faces | ( | ) | const |
Get a set of indices of faces that are external.
Definition at line 456 of file TwoD_TVDLF_Elt.cpp.
bool CppNoddy::TwoD_TVDLF_Elt::get_external_flag | ( | ) | const |
Get the external flag.
Definition at line 452 of file TwoD_TVDLF_Elt.cpp.
|
inline |
Get the flux function in the x direction evaluated for the concentration value stored in this elt.
s | The local vector coordinate at which to evaluate |
Definition at line 233 of file TwoD_TVDLF_Elt.h.
|
inline |
Get the flux function in the y direction evaluated for the concentration value stored in this elt.
s | The local vector coordinate at which to evaluate |
Definition at line 243 of file TwoD_TVDLF_Elt.h.
|
inline |
Get the integral of Q over a sub-element.
sw | A vector containing the SW local coordinates |
ne | A vector containing the NE local coordinates |
Definition at line 348 of file TwoD_TVDLF_Elt.h.
References get_Q().
Referenced by contributed_Q().
|
inline |
Get the Jacobian of the x flux function evaluated for the concentration value stored in this elt.
s | The local coordinate at which to evaluate |
Definition at line 253 of file TwoD_TVDLF_Elt.h.
|
inline |
Get the Jacobian of the y flux function evaluated for the concentration value stored in this elt.
s | The local coordinate at which to evaluate |
Definition at line 263 of file TwoD_TVDLF_Elt.h.
|
inline |
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 in the two principle directions.
Definition at line 354 of file TwoD_TVDLF_Elt.h.
References get_Q_mid(), get_x(), and p_system.
TwoD_TVDLF_Elt * CppNoddy::TwoD_TVDLF_Elt::get_ptrs | ( | const int & | index | ) | const |
Return a pointer to an element in the given compass direction.
index | The appropriate index of the direction 0,1,2,3 for S,E,N,W |
Definition at line 68 of file TwoD_TVDLF_Elt.cpp.
|
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 319 of file TwoD_TVDLF_Elt.h.
Referenced by dump(), get_flux_fn_x(), get_flux_fn_y(), get_int_Q(), get_Jac_flux_fn_x(), get_Jac_flux_fn_y(), get_Q_Taylor_series(), and get_source_fn().
|
inline |
Get the nodal concentration.
Definition at line 328 of file TwoD_TVDLF_Elt.h.
Referenced by get_max_dt().
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_Q_Taylor_series | ( | const DenseVector< double > & | s, |
const double & | dt | ||
) | const |
Get the Taylor series expansion of the concentration for a given time step and local coordinate for this element.
s | The local coordinate |
dt | The time step |
Definition at line 468 of file TwoD_TVDLF_Elt.cpp.
References get_Q(), get_x(), CppNoddy::DenseMatrix< _Type >::multiply(), and p_system.
Referenced by contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), contributed_flux_out_north(), and get_source_contribution().
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_s | ( | const DenseVector< double > & | x | ) | const |
Get the local coordinate that corresponds to a given global coordinate.
If the global coordinate is outside this element, an exception is thrown.
x | The global coordinate |
Definition at line 408 of file TwoD_TVDLF_Elt.cpp.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function in the x-direction is found through this method.
Definition at line 340 of file TwoD_TVDLF_Elt.h.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function in the y-direction is found through this method.
Definition at line 344 of file TwoD_TVDLF_Elt.h.
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_source_contribution | ( | const double & | dt | ) | const |
Evaluate the contribution to this element by the hyperbolic system's source function over a given time step using a mid-point in time evaluation.
dt | The time step over which source function is to be integrated |
Definition at line 495 of file TwoD_TVDLF_Elt.cpp.
References get_Q_Taylor_series(), get_x(), and p_system.
Referenced by add_flux_contributions().
|
inline |
Get the source function evaluated for the concentration value stored in this elt.
s | The local coordinate at which to evaluate |
Definition at line 274 of file TwoD_TVDLF_Elt.h.
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_x | ( | DenseVector< double > | s | ) | const |
Get the global position of a local coordinate in this element.
s | The local coordinate |
Definition at line 423 of file TwoD_TVDLF_Elt.cpp.
Referenced by contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), contributed_flux_out_north(), get_flux_fn_x(), get_flux_fn_y(), get_Jac_flux_fn_x(), get_Jac_flux_fn_y(), get_max_dt(), get_Q_Taylor_series(), get_source_contribution(), and get_source_fn().
DenseVector< double > CppNoddy::TwoD_TVDLF_Elt::get_x_mid | ( | ) | const |
Get the global position of a central node in this element.
Definition at line 430 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::remove_external_face | ( | const int & | i | ) |
Remove an external face to the stored stl::set.
i | The index of the external face 0,1,2,3 for S,E,N,W. |
Definition at line 464 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::set_external_flag | ( | bool | flag | ) |
Set the external flag.
flag | is the value to set |
Definition at line 448 of file TwoD_TVDLF_Elt.cpp.
void CppNoddy::TwoD_TVDLF_Elt::set_ptrs | ( | const int & | index, |
TwoD_TVDLF_Elt * | ptr | ||
) |
Each element stores pointers to any adjacent elements in the four compass directions 0,1,2,3 for S,E,N,W.
index | The index of the direction to set the pointer for |
ptr | A pointer to the element in the chosen direction |
Definition at line 64 of file TwoD_TVDLF_Elt.cpp.
|
inline |
Set the value of the vector 'concentration' stored in this element.
To second order, this is the value of the concentration at the mid-point of the element.
value | The vector value to be assigned to the concentration member data Q |
Definition at line 324 of file TwoD_TVDLF_Elt.h.
|
inline |
Set the x-slope vector for this element.
value | The slope vector to be set |
Definition at line 332 of file TwoD_TVDLF_Elt.h.
|
inline |
Set the y-slope vector for this element.
value | The slope vector to be set |
Definition at line 336 of file TwoD_TVDLF_Elt.h.
TwoD_Hyperbolic_System* CppNoddy::TwoD_TVDLF_Elt::p_system |
Definition at line 281 of file TwoD_TVDLF_Elt.h.
Referenced by add_flux_contributions(), contributed_flux_in_south(), contributed_flux_in_west(), contributed_flux_out_east(), contributed_flux_out_north(), contributed_Q(), get_flux_fn_x(), get_flux_fn_y(), get_Jac_flux_fn_x(), get_Jac_flux_fn_y(), get_max_dt(), get_Q_Taylor_series(), get_source_contribution(), get_source_fn(), and TwoD_TVDLF_Elt().
© 2012
R.E. Hewitt