dg_elements.h
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 //Header functions for classes that define Discontinuous Galerkin elements
31 
32 //Include guards to prevent multiple inclusion of the header
33 #ifndef OOMPH_DG_ELEMENT_HEADER
34 #define OOMPH_DG_ELEMENT_HEADER
35 
36 // Config header generated by autoconfig
37 #ifdef HAVE_CONFIG_H
38  #include <oomph-lib-config.h>
39 #endif
40 
41 //Oomph-lib header
42 #include "elements.h"
43 #include "mesh.h"
44 
45 namespace oomph
46 {
47 //=============================================================
48 /// \short Base class for Discontinuous Galerkin Faces.
49 /// These are responsible for calculating the normal fluxes
50 /// that provide the communication between the discontinuous
51 /// elements.
52 //===============================================================
53 class DGFaceElement : public virtual FaceElement
54  {
55  /// Vector of neighbouring face elements at the integration points
57 
58  /// Vector of neighbouring local coordinates at the integration points
60 
61  /// Vector of the vectors that will store the number of the
62  /// bulk external data that correspond to the dofs in the neighbouring face
63  /// This is only used if we are using implict timestepping and wish
64  /// to assemble the jacobian matrix. In order that the data be correctly
65  /// set up DGMesh::setup_face_neighbour_info() must be called with the
66  /// boolean flag set to true.
68 
69  protected:
70 
71  /// \short Return the index at which the i-th unknown flux is stored.
72  // The default return is suitable for single-physics problem
73  virtual inline unsigned flux_index(const unsigned &i) const {return i;}
74 
75  /// Set the number of flux components
76  virtual unsigned required_nflux() {return 0;}
77 
78  public:
79 
80  /// Empty Constructor
82 
83  /// Empty Destructor
84  virtual ~DGFaceElement() {}
85 
86  /// Access function for neighbouring face information
87  FaceElement* neighbour_face_pt(const unsigned &i)
88  {return Neighbour_face_pt[i];}
89 
90  /// Setup information from the neighbouring face, return a set
91  /// of nodes (as data) in the neighour. The boolean flag
92  /// is used to determine whether the data in the neighbour are
93  /// added as external data to the bulk element --- required when
94  /// computing the jacobian of the system
95  void setup_neighbour_info(const bool &add_neighbour_data_to_bulk);
96 
97  ///Output information about the present element and its neighbour
98  void report_info();
99 
100  //Get the value of the unknowns
101  virtual void interpolated_u(const Vector<double> &s, Vector<double> &f);
102 
103  ///\short Get the data that are used to interpolate the unkowns
104  ///in the element. These must be returned in order.
105  virtual void get_interpolation_data(Vector<Data*> &interpolation_data);
106 
107 
108  ///\short Calculate the normal numerical flux at the integration point.
109  ///This is the most general interface that can be overloaded if desired
110  virtual void numerical_flux_at_knot(const unsigned &ipt,
111  const Shape &psi,
112  Vector<double> &flux,
113  DenseMatrix<double> &dflux_du_int,
114  DenseMatrix<double> &dflux_du_ext,
115  unsigned flag);
116 
117  ///\short Calculate the normal flux, which is the dot product of our
118  ///approximation to the flux with the outer unit normal
119  virtual void numerical_flux(const Vector<double> &n_out,
120  const Vector<double> &u_int,
121  const Vector<double> &u_ext,
122  Vector<double> &flux)
123  {
124  std::ostringstream error_stream;
125  error_stream
126  << "Empty numerical flux function called\n"
127  << "This function should be overloaded with a specific flux\n"
128  << "that is appropriate to the equations being solved.\n";
129  throw OomphLibError(error_stream.str(),
130  OOMPH_CURRENT_FUNCTION,
131  OOMPH_EXCEPTION_LOCATION);
132  }
133 
134  ///\short Calculate the derivative of the
135  ///normal flux, which is the dot product of our
136  ///approximation to the flux with the outer unit normal,
137  ///with respect to the interior and exterior variables
138  ///Default is to use finite differences
139  virtual void dnumerical_flux_du(const Vector<double> &n_out,
140  const Vector<double> &u_int,
141  const Vector<double> &u_ext,
142  DenseMatrix<double> &dflux_du_int,
143  DenseMatrix<double> &dflux_du_ext);
144 
145 
146  ///\short Add the contribution from integrating the numerical flux
147  //over the face to the residuals
148  void add_flux_contributions(Vector<double> &residuals,
149  DenseMatrix<double> &jacobian,
150  unsigned flag);
151 
152  };
153 
154 class DGMesh;
155 class SlopeLimiter;
156 
157 //==================================================================
158 /// A Base class for DGElements
159 //=================================================================
160 class DGElement : public virtual FiniteElement
161 {
162 protected:
163 
164  ///\short The DGFaceElement requires access to the nodal local equation
165  ///information, so it's a friend
166  friend class DGFaceElement;
167 
168  ///\short Vector of pointers to faces of the element
170 
171  ///Pointer to Mesh, which will be responsible for the neighbour finding
173 
174  ///\short Pointer to storage for a mass matrix that can be recycled if
175  ///desired
177 
178  /// \short Pointer to storage for the average values of the of the
179  /// variables over the element
180  double *Average_value;
181 
182  ///\short Boolean flag to indicate whether to reuse the mass matrix
184 
185  ///\short Boolean flag to indicate whether the mass matrix has been
186  ///computed
188 
189  ///\short Boolean flag to indicate whether the mass matrix can be
190  ///deleted (i.e. was it created by this element)
192 
193  /// Set the number of flux components
194  virtual unsigned required_nflux() {return 0;}
195 
196  public:
197 
198  ///Constructor, initialise the pointers to zero
199  DGElement() : DG_mesh_pt(0), M_pt(0), Average_value(0),
200  Mass_matrix_reuse_is_enabled(false),
201  Mass_matrix_has_been_computed(false),
202  Can_delete_mass_matrix(true) { }
203 
204  ///\short Virtual destructor, destroy the mass matrix, if we created it
205  ///Clean-up storage associated with average values
206  virtual ~DGElement()
207  {
208  if((M_pt!=0) && Can_delete_mass_matrix) {delete M_pt;}
209  if(this->Average_value!=0) {delete[] Average_value; Average_value=0;}
210  }
211 
212  ///\short Access function for the boolean to indicate whether the
213  ///mass matrix has been computed
214  bool mass_matrix_has_been_computed() {return Mass_matrix_has_been_computed;}
215 
216  ///Function that allows the reuse of the mass matrix
218  {
219  Mass_matrix_reuse_is_enabled=true;
220  Mass_matrix_has_been_computed=false;
221  }
222 
223  ///Function that disables the reuse of the mass matrix
225  {
226  //If we are using another element's mass matrix then reset our pointer
227  //to zero
228  if(!Can_delete_mass_matrix) {M_pt = 0;}
229  //Otherwise we do not reuse the mass matrix
230  Mass_matrix_reuse_is_enabled = false;
231  //Recalculate the mass matrix
232  Mass_matrix_has_been_computed=false;
233  }
234 
235 
236  ///Set the mass matrix to point to one in another element
237  virtual void set_mass_matrix_from_element(DGElement* const &element_pt)
238  {
239  //If the element's mass matrix has not been computed, compute it!
240  if(!element_pt->mass_matrix_has_been_computed())
241  {
242  element_pt->pre_compute_mass_matrix();
243  }
244 
245  //Now set the mass matrix in this element to address that
246  //of element_pt
247  this->M_pt = element_pt->M_pt;
248  //We must reuse the mass matrix, or there will be trouble
249  //Because we will recalculate it in the original element
250  Mass_matrix_reuse_is_enabled=true;
251  Mass_matrix_has_been_computed=true;
252  //We cannot delete the mass matrix
253  Can_delete_mass_matrix = false;
254  }
255 
256  ///\short Function that computes and stores the (inverse) mass matrix
257  void pre_compute_mass_matrix();
258 
259  //Function that is used to construct all the faces of the DGElement
260  virtual void build_all_faces()=0;
261 
262  ///\short Function that returns the current value of the residuals multiplied
263  ///by the inverse mass matrix (virtual so that it can be overloaded
264  ///specific elements in which time saving tricks can be applied)
265  virtual void get_inverse_mass_matrix_times_residuals(
266  Vector<double> &minv_res);
267 
268  ///\short Construct all nodes and faces of the element.
269  ///The vector of booleans boundary should be the same size
270  ///as the number of nodes and if any entries are true
271  ///that node will be constructed as a boundary node.
273  std::vector<bool> &boundary_flag,
275  {
276  //Construct the nodes (This should not be used in a base class)
277  const unsigned n_node = this->nnode();
278 #ifdef PARANOID
279  if(boundary_flag.size() != n_node)
280  {
281  std::ostringstream error_stream;
282  error_stream
283  << "Size of boundary_flag vector is "
284  << boundary_flag.size() << "\n"
285  << "It must be the same as the number of nodes in the element "
286  << n_node << "\n";
287 
288  throw OomphLibError(error_stream.str(),
289  OOMPH_CURRENT_FUNCTION,
290  OOMPH_EXCEPTION_LOCATION);
291  }
292 #endif
293 
294  //Loop over the nodes
295  for(unsigned n=0;n<n_node;n++)
296  {
297  //If the node is marked on a boundary construct a boundary node
298  if(boundary_flag[n])
299  {
300  (void)this->construct_boundary_node(n,time_stepper_pt);
301  }
302  //Otherwise, construct a normal node
303  else
304  {
305  (void)this->construct_node(n,time_stepper_pt);
306  }
307  }
308 
309  //Make the faces
310  this->build_all_faces();
311 
312  //Set the Mesh pointer
313  DG_mesh_pt = mesh_pt;
314  }
315 
316 
317  ///Construct the nodes and faces of the element
318  void construct_nodes_and_faces(DGMesh* const &mesh_pt,
320  {
321  //Loop over the nodes
322  const unsigned n_node = this->nnode();
323  for(unsigned n=0;n<n_node;n++)
324  {
325  //Construct the node and ignore the return value
326  (void) this->construct_node(n,time_stepper_pt);
327  }
328 
329  //Make the faces
330  this->build_all_faces();
331 
332  //Set the Mesh pointer
333  DG_mesh_pt = mesh_pt;
334  }
335 
336  //Set the mesh pointer of the element
337  void set_mesh_pt(DGMesh* &mesh_pt) {DG_mesh_pt = mesh_pt;}
338 
339  /// Return the number of faces
340  unsigned nface() const {return Face_element_pt.size();}
341 
342  ///Access function for the faces
343  DGFaceElement* face_element_pt(const unsigned &i)
344  {return dynamic_cast<DGFaceElement*>(Face_element_pt[i]);}
345 
346  ///Output the faces of the element
347  void output_faces(std::ostream &outfile)
348  {
349  //Loop over the faces
350  unsigned n_face = nface();
351  for(unsigned f=0;f<n_face;f++)
352  {
353  face_element_pt(f)->output(outfile);
354  }
355  }
356 
357  ///Return the neighbour info
358  void get_neighbouring_face_and_local_coordinate(const int &face_index,
359  const Vector<double> &s,
360  FaceElement* &face_element_pt,
361  Vector<double> &s_face);
362 
363  //Setup the face information
364  ///The boolean flag determines whether the data from the neighbouring
365  ///elements is added as external data to the element (required for
366  ///correct computation of the jacobian)
367  void setup_face_neighbour_info(const bool &add_face_data_as_external)
368  {
369  unsigned n_face = this->nface();
370  for(unsigned f=0;f<n_face;f++)
371  {
372  face_element_pt(f)->setup_neighbour_info(add_face_data_as_external);
373  face_element_pt(f)->report_info();
374  }
375  }
376 
377 
378 ///Loop over all faces and add their integrated numerical fluxes
379 ///to the residuals
381  DenseMatrix<double> &jacobian,
382  unsigned flag)
383 {
384  //Add up the contributions from each face
385  unsigned n_face = this->nface();
386  for(unsigned f=0;f<n_face;f++)
387  {
388  face_element_pt(f)->add_flux_contributions(residuals,jacobian,flag);
389  }
390 }
391 
392 ///Limit the slope within the element
393  void slope_limit(SlopeLimiter* const &slope_limiter_pt);
394 
395  ///Calculate the averages in the element
396  virtual void calculate_element_averages(double* &average_values)
397  {
398  throw OomphLibError("Default (empty) version called",
399  OOMPH_CURRENT_FUNCTION,
400  OOMPH_EXCEPTION_LOCATION);
401  }
402 
403  ///Calculate the elemental averages
405  {this->calculate_element_averages(this->Average_value);}
406 
407  /// \short Return the average values
408  double &average_value(const unsigned &i)
409  {
410  if(Average_value==0)
411  {
412  throw OomphLibError("Averages not calculated yet",
413  OOMPH_CURRENT_FUNCTION,
414  OOMPH_EXCEPTION_LOCATION);
415  }
416  return Average_value[i];
417  }
418 
419 
420  /// \short Return the average values
421  const double &average_value(const unsigned &i) const
422  {
423  if(Average_value==0)
424  {
425  throw OomphLibError("Averages not calculated yet",
426  OOMPH_CURRENT_FUNCTION,
427  OOMPH_EXCEPTION_LOCATION);
428  }
429  return Average_value[i];
430  }
431 
432 };
433 
434 class DGMesh : public Mesh
435 {
436 
437 
438 public:
439 
440  static double FaceTolerance;
441 
442  DGMesh() : Mesh() { }
443 
444  virtual ~DGMesh() {}
445 
447  const int &face_index,
448  const Vector<double> &s_bulk,
449  FaceElement* &face_element_pt,
450  Vector<double> &s_face)
451  {
452  std::string error_message =
453  "Empty neighbour_finder() has been called.\n";
454  error_message +=
455  "This function is implemented in the base class of a DGMesh.\n";
456  error_message +=
457  "It must be overloaded in a specific DGMesh\n";
458 
459  throw OomphLibError(error_message,
460  OOMPH_CURRENT_FUNCTION,
461  OOMPH_EXCEPTION_LOCATION);
462  }
463 
464 
465  //Setup the face information for all the elements
466  ///If the boolean flag is set to true then the data from neighbouring
467  ///faces will be added as external data to the bulk element.
468  void setup_face_neighbour_info(const bool &add_face_data_as_external=false)
469  {
470  //Loop over all the elements and setup their face neighbour information
471  const unsigned n_element = this->nelement();
472  for(unsigned e=0;e<n_element;e++)
473  {
474  dynamic_cast<DGElement*>(this->element_pt(e))
475  ->setup_face_neighbour_info(add_face_data_as_external);
476  }
477  }
478 
479  //Limit the slopes on the entire mesh
480  void limit_slopes(SlopeLimiter* const &slope_limiter_pt)
481  {
482  //Loop over all the elements and calculate the averages
483  const unsigned n_element = this->nelement();
484  for(unsigned e=0;e<n_element;e++)
485  {
486  dynamic_cast<DGElement*>(this->element_pt(e))
487  ->calculate_averages();
488  }
489 
490  //Now loop over again and limit the values
491  for(unsigned e=0;e<n_element;e++)
492  {
493  dynamic_cast<DGElement*>(this->element_pt(e))
494  ->slope_limit(slope_limiter_pt);
495  }
496  }
497 
498 };
499 
500 
501 //======================================================
502 /// \short Base class for slope limiters
503 //=====================================================
505 {
506  public:
507 
508  ///Empty constructor
510 
511  ///virtual destructor
512  virtual ~SlopeLimiter() {}
513 
514  ///Basic function
515  virtual void limit(const unsigned &i,
516  const Vector<DGElement*> &required_element_pt)
517  {
518  throw OomphLibError("Calling default empty limiter\n",
519  OOMPH_CURRENT_FUNCTION,
520  OOMPH_EXCEPTION_LOCATION);
521  }
522 };
523 
525 {
526  ///\short Constant that is used in the modified min-mod function to
527  ///provide better properties at extrema
528  double M;
529 
530  ///Boolean flag to indicate a MUSCL or straight min-mod limiter
531  bool MUSCL;
532 
533  public:
534 
535  ///\short Constructor takes a value for the modification parameter M
536  ///(default to zero --- classic min mod) and a flag to indicate whether
537  ///we use MUSCL limiting or not --- default false
538  MinModLimiter(const double &m=0.0, const bool &muscl=false) :
539  SlopeLimiter(), M(m), MUSCL(muscl) {}
540 
541  ///Empty destructor
542  virtual ~MinModLimiter() {}
543 
544  ///The basic minmod function
545  double minmod(Vector<double> &args);
546 
547 
548  ///The modified minmod function
549  double minmodB(Vector<double> &args, const double &h);
550 
551  ///The limit function
552  void limit(const unsigned &i,
553  const Vector<DGElement*> &required_element_pt);
554 };
555 
556 
557 
558 }
559 #endif
MinModLimiter(const double &m=0.0, const bool &muscl=false)
Constructor takes a value for the modification parameter M (default to zero — classic min mod) and a...
Definition: dg_elements.h:538
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
Definition: matrices.h:1234
bool mass_matrix_has_been_computed()
Access function for the boolean to indicate whether the mass matrix has been computed.
Definition: dg_elements.h:214
virtual void numerical_flux_at_knot(const unsigned &ipt, const Shape &psi, Vector< double > &flux, DenseMatrix< double > &dflux_du_int, DenseMatrix< double > &dflux_du_ext, unsigned flag)
Calculate the normal numerical flux at the integration point. This is the most general interface that...
Definition: dg_elements.cc:242
bool MUSCL
Boolean flag to indicate a MUSCL or straight min-mod limiter.
Definition: dg_elements.h:531
virtual void dnumerical_flux_du(const Vector< double > &n_out, const Vector< double > &u_int, const Vector< double > &u_ext, DenseMatrix< double > &dflux_du_int, DenseMatrix< double > &dflux_du_ext)
Calculate the derivative of the normal flux, which is the dot product of our approximation to the flu...
Definition: dg_elements.cc:314
Vector< Vector< unsigned > > Neighbour_external_data
Definition: dg_elements.h:67
virtual ~SlopeLimiter()
virtual destructor
Definition: dg_elements.h:512
void calculate_averages()
Calculate the elemental averages.
Definition: dg_elements.h:404
static double FaceTolerance
Definition: dg_elements.h:440
virtual ~DGElement()
Virtual destructor, destroy the mass matrix, if we created it Clean-up storage associated with averag...
Definition: dg_elements.h:206
virtual void limit(const unsigned &i, const Vector< DGElement *> &required_element_pt)
Basic function.
Definition: dg_elements.h:515
void report_info()
Output information about the present element and its neighbour.
Definition: dg_elements.cc:120
virtual void neighbour_finder(FiniteElement *const &bulk_element_pt, const int &face_index, const Vector< double > &s_bulk, FaceElement *&face_element_pt, Vector< double > &s_face)
Definition: dg_elements.h:446
cstr elem_len * i
Definition: cfortran.h:607
Vector< Vector< double > > Neighbour_local_coordinate
Vector of neighbouring local coordinates at the integration points.
Definition: dg_elements.h:59
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
Definition: elements.h:4412
FaceElement * neighbour_face_pt(const unsigned &i)
Access function for neighbouring face information.
Definition: dg_elements.h:87
Vector< FaceElement * > Neighbour_face_pt
Vector of neighbouring face elements at the integration points.
Definition: dg_elements.h:56
A general Finite Element class.
Definition: elements.h:1274
double * Average_value
Pointer to storage for the average values of the of the variables over the element.
Definition: dg_elements.h:180
void add_flux_contributions_to_residuals(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: dg_elements.h:380
A Base class for DGElements.
Definition: dg_elements.h:160
virtual unsigned required_nflux()
Set the number of flux components.
Definition: dg_elements.h:194
virtual Node * construct_boundary_node(const unsigned &n)
Construct the local node n as a boundary node; that is a node that MAY be placed on a mesh boundary a...
Definition: elements.h:2420
double & average_value(const unsigned &i)
Return the average values.
Definition: dg_elements.h:408
void disable_mass_matrix_reuse()
Function that disables the reuse of the mass matrix.
Definition: dg_elements.h:224
e
Definition: cfortran.h:575
DGFaceElement * face_element_pt(const unsigned &i)
Access function for the faces.
Definition: dg_elements.h:343
DGMesh * DG_mesh_pt
Pointer to Mesh, which will be responsible for the neighbour finding.
Definition: dg_elements.h:172
void pre_compute_mass_matrix()
Function that computes and stores the (inverse) mass matrix.
Definition: dg_elements.cc:555
bool Mass_matrix_reuse_is_enabled
Boolean flag to indicate whether to reuse the mass matrix.
Definition: dg_elements.h:183
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
Definition: geom_objects.h:197
virtual ~DGFaceElement()
Empty Destructor.
Definition: dg_elements.h:84
Base class for slope limiters.
Definition: dg_elements.h:504
void output_faces(std::ostream &outfile)
Output the faces of the element.
Definition: dg_elements.h:347
const double & average_value(const unsigned &i) const
Return the average values.
Definition: dg_elements.h:421
virtual void interpolated_u(const Vector< double > &s, Vector< double > &f)
Return the interpolated values of the unknown fluxes.
Definition: dg_elements.cc:179
virtual ~DGMesh()
Definition: dg_elements.h:444
virtual Node * construct_node(const unsigned &n)
Construct the local node n and return a pointer to the newly created node object. ...
Definition: elements.h:2392
virtual void set_mass_matrix_from_element(DGElement *const &element_pt)
Set the mass matrix to point to one in another element.
Definition: dg_elements.h:237
static char t char * s
Definition: cfortran.h:572
bool Can_delete_mass_matrix
Boolean flag to indicate whether the mass matrix can be deleted (i.e. was it created by this element)...
Definition: dg_elements.h:191
virtual void get_interpolation_data(Vector< Data *> &interpolation_data)
Get the data that are used to interpolate the unkowns in the element. These must be returned in order...
Definition: dg_elements.cc:219
void limit_slopes(SlopeLimiter *const &slope_limiter_pt)
Definition: dg_elements.h:480
void setup_face_neighbour_info(const bool &add_face_data_as_external=false)
Definition: dg_elements.h:468
void setup_neighbour_info(const bool &add_neighbour_data_to_bulk)
Definition: dg_elements.cc:46
virtual void calculate_element_averages(double *&average_values)
Calculate the averages in the element.
Definition: dg_elements.h:396
double M
Constant that is used in the modified min-mod function to provide better properties at extrema...
Definition: dg_elements.h:528
SlopeLimiter()
Empty constructor.
Definition: dg_elements.h:509
unsigned nface() const
Return the number of faces.
Definition: dg_elements.h:340
void set_mesh_pt(DGMesh *&mesh_pt)
Definition: dg_elements.h:337
virtual ~MinModLimiter()
Empty destructor.
Definition: dg_elements.h:542
void setup_face_neighbour_info(const bool &add_face_data_as_external)
Definition: dg_elements.h:367
Base class for Discontinuous Galerkin Faces. These are responsible for calculating the normal fluxes ...
Definition: dg_elements.h:53
void construct_nodes_and_faces(DGMesh *const &mesh_pt, TimeStepper *const &time_stepper_pt)
Construct the nodes and faces of the element.
Definition: dg_elements.h:318
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn&#39;t been defined.
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
Definition: elements.h:4515
virtual unsigned flux_index(const unsigned &i) const
Return the index at which the i-th unknown flux is stored.
Definition: dg_elements.h:73
void enable_mass_matrix_reuse()
Function that allows the reuse of the mass matrix.
Definition: dg_elements.h:217
Vector< FaceElement * > Face_element_pt
Vector of pointers to faces of the element.
Definition: dg_elements.h:169
DGElement()
Constructor, initialise the pointers to zero.
Definition: dg_elements.h:199
DenseDoubleMatrix * M_pt
Pointer to storage for a mass matrix that can be recycled if desired.
Definition: dg_elements.h:176
virtual void numerical_flux(const Vector< double > &n_out, const Vector< double > &u_int, const Vector< double > &u_ext, Vector< double > &flux)
Calculate the normal flux, which is the dot product of our approximation to the flux with the outer u...
Definition: dg_elements.h:119
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2146
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219
void construct_boundary_nodes_and_faces(DGMesh *const &mesh_pt, std::vector< bool > &boundary_flag, TimeStepper *const &time_stepper_pt)
Construct all nodes and faces of the element. The vector of booleans boundary should be the same size...
Definition: dg_elements.h:272
void add_flux_contributions(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Add the contribution from integrating the numerical flux.
Definition: dg_elements.cc:392
bool Mass_matrix_has_been_computed
Boolean flag to indicate whether the mass matrix has been computed.
Definition: dg_elements.h:187
DGFaceElement()
Empty Constructor.
Definition: dg_elements.h:81
A general mesh class.
Definition: mesh.h:74
virtual unsigned required_nflux()
Set the number of flux components.
Definition: dg_elements.h:76