scalar_advection_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// Copyright (C) 2006-2026 Matthias Heil and Andrew Hazel
7// LIC//
8// LIC// This library is free software; you can redistribute it and/or
9// LIC// modify it under the terms of the GNU Lesser General Public
10// LIC// License as published by the Free Software Foundation; either
11// LIC// version 2.1 of the License, or (at your option) any later version.
12// LIC//
13// LIC// This library is distributed in the hope that it will be useful,
14// LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// LIC// Lesser General Public License for more details.
17// LIC//
18// LIC// You should have received a copy of the GNU Lesser General Public
19// LIC// License along with this library; if not, write to the Free Software
20// LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21// LIC// 02110-1301 USA.
22// LIC//
23// LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24// LIC//
25// LIC//====================================================================
26// Header file for scalar advection elements
27
28#ifndef OOMPH_SCALAR_ADVECTION_ELEMENTS_HEADER
29#define OOMPH_SCALAR_ADVECTION_ELEMENTS_HEADER
30
31// Config header
32#ifdef HAVE_CONFIG_H
33#include <oomph-lib-config.h>
34#endif
35
37#include "generic/Qelements.h"
39#include "generic/dg_elements.h"
40
41namespace oomph
42{
43 //==============================================================
44 /// Base class for advection equations
45 //=============================================================
46 template<unsigned DIM>
48 {
49 /// Typedef for a wind function as a possible function of position
51 Vector<double>& wind);
52
53 /// Function pointer to the wind function
55
56 protected:
57 /// A single flux is interpolated
58 inline unsigned nflux() const
59 {
60 return 1;
61 }
62
63 /// Return the flux as a function of the unknown
64 void flux(const Vector<double>& u, DenseMatrix<double>& f);
65
66 /// Return the flux derivatives as a function of the unknowns
68
69 /// Return the wind at a given position
70 inline virtual void get_wind_scalar_adv(const unsigned& ipt,
71 const Vector<double>& s,
72 const Vector<double>& x,
73 Vector<double>& wind) const
74 {
75 // If no wind function has been set, return zero
76 if (Wind_fct_pt == 0)
77 {
78 for (unsigned i = 0; i < DIM; i++)
79 {
80 wind[i] = 0.0;
81 }
82 }
83 else
84 {
85 // Get wind
86 (*Wind_fct_pt)(x, wind);
87 }
88 }
89
90 public:
91 /// Constructor
95
96 /// Access function: Pointer to wind function
101
102 /// Access function: Pointer to wind function. Const version
104 {
105 return Wind_fct_pt;
106 }
107
108 /// The number of unknowns at each node is the number of values
109 unsigned required_nvalue(const unsigned& n) const
110 {
111 return 1;
112 }
113
114 /// Compute the error and norm of solution integrated over the element
115 /// Does not plot the error in the outfile
117 std::ostream& outfile,
119 const double& t,
121 Vector<double>& norm)
122 {
123 // Find the number of fluxes
124 const unsigned n_flux = this->nflux();
125 // Find the number of nodes
126 const unsigned n_node = this->nnode();
127 // Storage for the shape function and derivatives of shape function
130
131 // Find the number of integration points
132 unsigned n_intpt = this->integral_pt()->nweight();
133
134 error.resize(n_flux);
135 norm.resize(n_flux);
136 for (unsigned i = 0; i < n_flux; i++)
137 {
138 error[i] = 0.0;
139 norm[i] = 0.0;
140 }
141
143
144 // Loop over the integration points
145 for (unsigned ipt = 0; ipt < n_intpt; ipt++)
146 {
147 // Get the shape functions at the knot
148 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
149
150 // Get the integral weight
151 double W = this->integral_pt()->weight(ipt) * J;
152
153 // Storage for the local functions
155 Vector<double> interpolated_u(n_flux, 0.0);
156
157 // Loop over the shape functions
158 for (unsigned l = 0; l < n_node; l++)
159 {
160 // Locally cache the shape function
161 const double psi_ = psi(l);
162 for (unsigned i = 0; i < DIM; i++)
163 {
164 interpolated_x[i] += this->nodal_position(l, i) * psi_;
165 }
166
167 for (unsigned i = 0; i < n_flux; i++)
168 {
169 // Calculate the velocity and tangent vector
170 interpolated_u[i] += this->nodal_value(l, i) * psi_;
171 }
172 }
173
174 // Get the global wind
175 Vector<double> wind(DIM);
177
178 // Rescale the position
179 for (unsigned i = 0; i < DIM; i++)
180 {
181 interpolated_x[i] -= wind[i] * t;
182 }
183
184 // Now get the initial condition at this value of x
186 (*initial_condition_pt)(0.0, interpolated_x, exact_u);
187
188 // Loop over the unknowns
189 for (unsigned i = 0; i < n_flux; i++)
190 {
191 error[i] += pow((interpolated_u[i] - exact_u[i]), 2.0) * W;
192 norm[i] += interpolated_u[i] * interpolated_u[i] * W;
193 }
194 }
195 }
196 };
197
198
199 template<unsigned DIM, unsigned NNODE_1D>
201 : public virtual QSpectralElement<DIM, NNODE_1D>,
202 public virtual ScalarAdvectionEquations<DIM>
203 {
204 public:
205 /// Constructor: Call constructors for QElement and
206 /// Advection Diffusion equations
211
212 /// Broken copy constructor
215
216 /// Broken assignment operator
217 // Commented out broken assignment operator because this can lead to a
218 // conflict warning when used in the virtual inheritence hierarchy.
219 // Essentially the compiler doesn't realise that two separate
220 // implementations of the broken function are the same and so, quite
221 // rightly, it shouts.
222 /*void operator=(
223 const QSpectralScalarAdvectionElement<DIM,NNODE_1D>&) = delete;*/
224
225 /// Required # of `values' (pinned or dofs)
226 /// at node n
227 inline unsigned required_nvalue(const unsigned& n) const
228 {
229 return 1;
230 }
231
232 /// Output function:
233 /// x,y,u or x,y,z,u
234 void output(std::ostream& outfile)
235 {
237 }
238
239 /// Output function:
240 /// x,y,u or x,y,z,u at n_plot^DIM plot points
241 void output(std::ostream& outfile, const unsigned& n_plot)
242 {
244 }
245
246
247 /*/// C-style output function:
248 /// x,y,u or x,y,z,u
249 void output(FILE* file_pt)
250 {
251 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt);
252 }
253
254 /// C-style output function:
255 /// x,y,u or x,y,z,u at n_plot^DIM plot points
256 void output(FILE* file_pt, const unsigned &n_plot)
257 {
258 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt,n_plot);
259 }
260
261 /// Output function for an exact solution:
262 /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
263 void output_fct(std::ostream &outfile, const unsigned &n_plot,
264 FiniteElement::SteadyExactSolutionFctPt
265 exact_soln_pt)
266 {
267 ScalarAdvectionEquations<NFLUX,DIM>::
268 output_fct(outfile,n_plot,exact_soln_pt);}
269
270
271 /// Output function for a time-dependent exact solution.
272 /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
273 /// (Calls the steady version)
274 void output_fct(std::ostream &outfile, const unsigned &n_plot,
275 const double& time,
276 FiniteElement::UnsteadyExactSolutionFctPt
277 exact_soln_pt)
278 {
279 ScalarAdvectionEquations<NFLUX,DIM>::
280 output_fct(outfile,n_plot,time,exact_soln_pt);
281 }*/
282
283
284 protected:
285 /// Shape, test functions & derivs. w.r.t. to global coords. Return
286 /// Jacobian.
288 const Vector<double>& s,
289 Shape& psi,
290 DShape& dpsidx,
291 Shape& test,
292 DShape& dtestdx) const;
293
294 /// Shape, test functions & derivs. w.r.t. to global coords. at
295 /// integration point ipt. Return Jacobian.
297 const unsigned& ipt,
298 Shape& psi,
299 DShape& dpsidx,
300 Shape& test,
301 DShape& dtestdx) const;
302 };
303
304 // Inline functions:
305
306
307 //======================================================================
308 /// Define the shape functions and test functions and derivatives
309 /// w.r.t. global coordinates and return Jacobian of mapping.
310 ///
311 /// Galerkin: Test functions = shape functions
312 //======================================================================
313 template<unsigned DIM, unsigned NNODE_1D>
316 Shape& psi,
317 DShape& dpsidx,
318 Shape& test,
319 DShape& dtestdx) const
320 {
321 // Call the geometrical shape functions and derivatives
322 double J = this->dshape_eulerian(s, psi, dpsidx);
323
324 // Set the test functions equal to the shape functions
325 test.shallow_copy_from(psi);
326 dtestdx.shallow_copy_from(dpsidx);
327
328 // Return the jacobian
329 return J;
330 }
331
332
333 //======================================================================
334 /// Define the shape functions and test functions and derivatives
335 /// w.r.t. global coordinates and return Jacobian of mapping.
336 ///
337 /// Galerkin: Test functions = shape functions
338 //======================================================================
339 template<unsigned DIM, unsigned NNODE_1D>
342 Shape& psi,
343 DShape& dpsidx,
344 Shape& test,
345 DShape& dtestdx) const
346 {
347 // Call the geometrical shape functions and derivatives
348 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
349
350 // Set the test functions equal to the shape functions (pointer copy)
351 test.shallow_copy_from(psi);
352 dtestdx.shallow_copy_from(dpsidx);
353
354 // Return the jacobian
355 return J;
356 }
357
358
359 ////////////////////////////////////////////////////////////////////////
360 ////////////////////////////////////////////////////////////////////////
361 ////////////////////////////////////////////////////////////////////////
362
363
364 //=======================================================================
365 /// Face geometry for the QScalarAdvectionElement elements:
366 /// The spatial dimension of the face elements is one lower than that
367 /// of the bulk element but they have the same number of points along
368 /// their 1D edges.
369 //=======================================================================
370 template<unsigned DIM, unsigned NNODE_1D>
372 : public virtual QSpectralElement<DIM - 1, NNODE_1D>
373 {
374 public:
375 /// Constructor: Call the constructor for the
376 /// appropriate lower-dimensional QElement
378 };
379
380
381 //======================================================================
382 /// FaceElement for Discontinuous Galerkin Problems
383 //======================================================================
384 template<class ELEMENT>
385 class DGScalarAdvectionFaceElement : public virtual FaceGeometry<ELEMENT>,
386 public virtual DGFaceElement
387 {
388 public:
389 /// Constructor
391 const int& face_index)
392 : FaceGeometry<ELEMENT>(), DGFaceElement()
393 {
394 // Attach geometric information to the element
395 // N.B. This function also assigns nbulk_value from required_nvalue
396 // of the bulk element.
397 element_pt->build_face_element(face_index, this);
398 }
399
400
401 // There is a single required n_flux
402 unsigned required_nflux()
403 {
404 return 1;
405 }
406
407 /// Calculate the normal flux, so this is the dot product of the
408 /// numerical flux with n_in
410 const Vector<double>& u_int,
411 const Vector<double>& u_ext,
412 Vector<double>& flux)
413 {
414 const unsigned dim = this->nodal_dimension();
416 Vector<double> s, x;
417 // Dummy integration point
418 unsigned ipt = 0;
419 dynamic_cast<ELEMENT*>(this->bulk_element_pt())
420 ->get_wind_scalar_adv(ipt, s, x, Wind);
421
422 // Now we can work this out for standard upwind advection
423 double dot = 0.0;
424 for (unsigned i = 0; i < dim; i++)
425 {
426 dot += Wind[i] * n_out[i];
427 }
428
429 const unsigned n_value = this->required_nflux();
430 if (dot >= 0.0)
431 {
432 for (unsigned n = 0; n < n_value; n++)
433 {
434 flux[n] = dot * u_int[n];
435 }
436 }
437 else
438 {
439 for (unsigned n = 0; n < n_value; n++)
440 {
441 flux[n] = dot * u_ext[n];
442 }
443 }
444
445 // flux[0] = 0.5*(u_int[0]+u_ext[0])*n_out[0];
446 }
447 };
448
449 //=================================================================
450 /// General DGScalarAdvectionClass. Establish the template parameters
451 //===================================================================
452 template<unsigned DIM, unsigned NNODE_1D>
456
457
458 //==================================================================
459 // Specialization for 1D DG Advection element
460 //==================================================================
461 template<unsigned NNODE_1D>
463 : public QSpectralScalarAdvectionElement<1, NNODE_1D>, public DGElement
464 {
465 friend class DGScalarAdvectionFaceElement<
467
469
470 public:
471 // There is a single required n_flux
472 unsigned required_nflux()
473 {
474 return 1;
475 }
476
477 // Calculate averages
478 void calculate_element_averages(double*& average_value)
479 {
481 }
482
483 // Constructor
488
490
492 {
493 // Make the two faces
494 Face_element_pt.resize(2);
495 // Make the face on the left
496 Face_element_pt[0] = new DGScalarAdvectionFaceElement<
498 // Make the face on the right
499 Face_element_pt[1] = new DGScalarAdvectionFaceElement<
501 }
502
503
504 /// Compute the residuals for the Navier--Stokes equations;
505 /// flag=1(or 0): do (or don't) compute the Jacobian as well.
518
519
520 //============================================================================
521 /// Function that returns the current value of the residuals
522 /// multiplied by the inverse mass matrix (virtual so that it can be
523 /// overloaded specific elements in which time and memory saving tricks can
524 /// be applied)
525 //============================================================================
527 {
528 // If there are external data this is not going to work
529 if (nexternal_data() > 0)
530 {
531 std::ostringstream error_stream;
533 << "Cannot use a discontinuous formulation for the mass matrix when\n"
534 << "there are external data.\n "
535 << "Do not call Problem::enable_discontinuous_formulation()\n";
536
537 throw OomphLibError(
539 }
540
541
542 // Now let's assemble stuff
543 const unsigned n_dof = this->ndof();
544
545 // Resize and initialise the vector that will holds the residuals
546 minv_res.resize(n_dof);
547 for (unsigned n = 0; n < n_dof; n++)
548 {
549 minv_res[n] = 0.0;
550 }
551
552 // If we are recycling the mass matrix
553 if (Mass_matrix_reuse_is_enabled && Mass_matrix_has_been_computed)
554 {
555 // Get the residuals
556 this->fill_in_contribution_to_residuals(minv_res);
557 }
558 // Otherwise
559 else
560 {
561 // Temporary mass matrix
563
564 // Get the local mass matrix and residuals
565 this->fill_in_contribution_to_mass_matrix(minv_res, M);
566
567 // Store the diagonal entries
568 Inverse_mass_diagonal.clear();
569 for (unsigned n = 0; n < n_dof; n++)
570 {
571 Inverse_mass_diagonal.push_back(1.0 / M(n, n));
572 }
573
574 // The mass matrix has been computed
575 Mass_matrix_has_been_computed = true;
576 }
577
578 for (unsigned n = 0; n < n_dof; n++)
579 {
580 minv_res[n] *= Inverse_mass_diagonal[n];
581 }
582 }
583 };
584
585
586 //=======================================================================
587 /// Face geometry of the 1D DG elements
588 //=======================================================================
589 template<unsigned NNODE_1D>
591 : public virtual PointElement
592 {
593 public:
595 };
596
597
598 //==================================================================
599 /// Specialisation for 2D DG Elements
600 //==================================================================
601 template<unsigned NNODE_1D>
603 : public QSpectralScalarAdvectionElement<2, NNODE_1D>, public DGElement
604 {
605 friend class DGScalarAdvectionFaceElement<
607
608 public:
609 // Calculate averages
610 void calculate_element_averages(double*& average_value)
611 {
613 }
614
615 // There is a single required n_flux
616 unsigned required_nflux()
617 {
618 return 1;
619 }
620
621 // Constructor
626
628
630 {
631 Face_element_pt.resize(4);
632 Face_element_pt[0] = new DGScalarAdvectionFaceElement<
634 Face_element_pt[1] = new DGScalarAdvectionFaceElement<
636 Face_element_pt[2] = new DGScalarAdvectionFaceElement<
638 Face_element_pt[3] = new DGScalarAdvectionFaceElement<
640 }
641
642
643 /// Compute the residuals for the Navier--Stokes equations;
644 /// flag=1(or 0): do (or don't) compute the Jacobian as well.
657 };
658
659
660 //=======================================================================
661 /// Face geometry of the DG elements
662 //=======================================================================
663 template<unsigned NNODE_1D>
665 : public virtual QSpectralElement<1, NNODE_1D>
666 {
667 public:
669 };
670
671
672 //=============================================================
673 /// Non-spectral version of the classes
674 //============================================================
675 template<unsigned DIM, unsigned NNODE_1D>
676 class QScalarAdvectionElement : public virtual QElement<DIM, NNODE_1D>,
677 public virtual ScalarAdvectionEquations<DIM>
678 {
679 public:
680 /// Constructor: Call constructors for QElement and
681 /// Advection Diffusion equations
686
687 /// Broken copy constructor
690
691 /// Broken assignment operator
692 /*void operator=(
693 const QScalarAdvectionElement<DIM,NNODE_1D>&) = delete;*/
694
695 /// Required # of `values' (pinned or dofs)
696 /// at node n
697 inline unsigned required_nvalue(const unsigned& n) const
698 {
699 return 1;
700 }
701
702 /// Output function:
703 /// x,y,u or x,y,z,u
704 void output(std::ostream& outfile)
705 {
707 }
708
709 /// Output function:
710 /// x,y,u or x,y,z,u at n_plot^DIM plot points
711 void output(std::ostream& outfile, const unsigned& n_plot)
712 {
714 }
715
716
717 /*/// C-style output function:
718 /// x,y,u or x,y,z,u
719 void output(FILE* file_pt)
720 {
721 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt);
722 }
723
724 /// C-style output function:
725 /// x,y,u or x,y,z,u at n_plot^DIM plot points
726 void output(FILE* file_pt, const unsigned &n_plot)
727 {
728 ScalarAdvectionEquations<NFLUX,DIM>::output(file_pt,n_plot);
729 }
730
731 /// Output function for an exact solution:
732 /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
733 void output_fct(std::ostream &outfile, const unsigned &n_plot,
734 FiniteElement::SteadyExactSolutionFctPt
735 exact_soln_pt)
736 {
737 ScalarAdvectionEquations<NFLUX,DIM>::
738 output_fct(outfile,n_plot,exact_soln_pt);}
739
740
741 /// Output function for a time-dependent exact solution.
742 /// x,y,u_exact or x,y,z,u_exact at n_plot^DIM plot points
743 /// (Calls the steady version)
744 void output_fct(std::ostream &outfile, const unsigned &n_plot,
745 const double& time,
746 FiniteElement::UnsteadyExactSolutionFctPt
747 exact_soln_pt)
748 {
749 ScalarAdvectionEquations<NFLUX,DIM>::
750 output_fct(outfile,n_plot,time,exact_soln_pt);
751 }*/
752
753
754 protected:
755 /// Shape, test functions & derivs. w.r.t. to global coords. Return
756 /// Jacobian.
758 const Vector<double>& s,
759 Shape& psi,
760 DShape& dpsidx,
761 Shape& test,
762 DShape& dtestdx) const;
763
764 /// Shape, test functions & derivs. w.r.t. to global coords. at
765 /// integration point ipt. Return Jacobian.
767 const unsigned& ipt,
768 Shape& psi,
769 DShape& dpsidx,
770 Shape& test,
771 DShape& dtestdx) const;
772 };
773
774 // Inline functions:
775
776
777 //======================================================================
778 /// Define the shape functions and test functions and derivatives
779 /// w.r.t. global coordinates and return Jacobian of mapping.
780 ///
781 /// Galerkin: Test functions = shape functions
782 //======================================================================
783 template<unsigned DIM, unsigned NNODE_1D>
786 Shape& psi,
787 DShape& dpsidx,
788 Shape& test,
789 DShape& dtestdx) const
790 {
791 // Call the geometrical shape functions and derivatives
792 double J = this->dshape_eulerian(s, psi, dpsidx);
793
794 // Set the test functions equal to the shape functions
795 test.shallow_copy_from(psi);
796 dtestdx.shallow_copy_from(dpsidx);
797
798 // Return the jacobian
799 return J;
800 }
801
802
803 //======================================================================
804 /// Define the shape functions and test functions and derivatives
805 /// w.r.t. global coordinates and return Jacobian of mapping.
806 ///
807 /// Galerkin: Test functions = shape functions
808 //======================================================================
809 template<unsigned DIM, unsigned NNODE_1D>
812 Shape& psi,
813 DShape& dpsidx,
814 Shape& test,
815 DShape& dtestdx) const
816 {
817 // Call the geometrical shape functions and derivatives
818 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
819
820 // Set the test functions equal to the shape functions (pointer copy)
821 test.shallow_copy_from(psi);
822 dtestdx.shallow_copy_from(dpsidx);
823
824 // Return the jacobian
825 return J;
826 }
827
828
829 ////////////////////////////////////////////////////////////////////////
830 ////////////////////////////////////////////////////////////////////////
831 ////////////////////////////////////////////////////////////////////////
832
833
834 //=======================================================================
835 /// Face geometry for the QScalarAdvectionElement elements:
836 /// The spatial dimension of the face elements is one lower than that
837 /// of the bulk element but they have the same number of points along
838 /// their 1D edges.
839 //=======================================================================
840 template<unsigned DIM, unsigned NNODE_1D>
842 : public virtual QElement<DIM - 1, NNODE_1D>
843 {
844 public:
845 /// Constructor: Call the constructor for the
846 /// appropriate lower-dimensional QElement
848 };
849
850
851 //=================================================================
852 /// General DGScalarAdvectionClass. Establish the template parameters
853 //===================================================================
854 template<unsigned DIM, unsigned NNODE_1D>
856 {
857 };
858
859
860 //==================================================================
861 // Specialization for 1D DG Advection element
862 //==================================================================
863 template<unsigned NNODE_1D>
865 : public QScalarAdvectionElement<1, NNODE_1D>, public DGElement
866 {
867 friend class DGScalarAdvectionFaceElement<
869
870 public:
871 // There is a single required n_flux
872 unsigned required_nflux()
873 {
874 return 1;
875 }
876
877 // Calculate averages
878 void calculate_element_averages(double*& average_value)
879 {
881 }
882
883 // Constructor
888
890
892 {
893 // Make the two faces
894 Face_element_pt.resize(2);
895 // Make the face on the left
896 Face_element_pt[0] =
898 this, -1);
899 // Make the face on the right
900 Face_element_pt[1] =
902 this, +1);
903 }
904
905
906 /// Compute the residuals for the Navier--Stokes equations;
907 /// flag=1(or 0): do (or don't) compute the Jacobian as well.
920 };
921
922
923 //=======================================================================
924 /// Face geometry of the 1D DG elements
925 //=======================================================================
926 template<unsigned NNODE_1D>
928 : public virtual PointElement
929 {
930 public:
932 };
933
934
935 //==================================================================
936 /// Specialisation for 2D DG Elements
937 //==================================================================
938 template<unsigned NNODE_1D>
940 : public QScalarAdvectionElement<2, NNODE_1D>, public DGElement
941 {
942 friend class DGScalarAdvectionFaceElement<
944
945 public:
946 // There is a single required n_flux
947 unsigned required_nflux()
948 {
949 return 1;
950 }
951
952 // Calculate averages
953 void calculate_element_averages(double*& average_value)
954 {
956 }
957
958 // Constructor
963
965
967 {
968 Face_element_pt.resize(4);
969 Face_element_pt[0] =
971 this, 2);
972 Face_element_pt[1] =
974 this, 1);
975 Face_element_pt[2] =
977 this, -2);
978 Face_element_pt[3] =
980 this, -1);
981 }
982
983
984 /// Compute the residuals for the Navier--Stokes equations;
985 /// flag=1(or 0): do (or don't) compute the Jacobian as well.
998 };
999
1000
1001 //=======================================================================
1002 /// Face geometry of the DG elements
1003 //=======================================================================
1004 template<unsigned NNODE_1D>
1006 : public virtual QElement<1, NNODE_1D>
1007 {
1008 public:
1010 };
1011
1012
1013} // namespace oomph
1014
1015#endif
static char t char * s
Definition cfortran.h:568
cstr elem_len * i
Definition cfortran.h:603
char t
Definition cfortran.h:568
A Base class for DGElements.
Base class for Discontinuous Galerkin Faces. These are responsible for calculating the normal fluxes ...
Definition dg_elements.h:50
unsigned required_nflux()
Set the number of flux components.
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
unsigned required_nflux()
Set the number of flux components.
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
General DGScalarAdvectionClass. Establish the template parameters.
FaceElement for Discontinuous Galerkin Problems.
DGScalarAdvectionFaceElement(FiniteElement *const &element_pt, const int &face_index)
Constructor.
unsigned required_nflux()
Set the number of flux components.
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, so this is the dot product of the numerical flux with n_in.
unsigned required_nflux()
Set the number of flux components.
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void get_inverse_mass_matrix_times_residuals(Vector< double > &minv_res)
Function that returns the current value of the residuals multiplied by the inverse mass matrix (virtu...
unsigned required_nflux()
Set the number of flux components.
void calculate_element_averages(double *&average_value)
Calculate the averages in the element.
void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
General DGScalarAdvectionClass. Establish the template parameters.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Definition shape.h:359
Class of matrices containing doubles, and stored as a DenseMatrix<double>, but with solving functiona...
Definition matrices.h:1271
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
Definition elements.h:4630
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
Definition elements.h:4739
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
FaceGeometry class definition: This policy class is used to allow construction of face elements that ...
Definition elements.h:5002
A general Finite Element class.
Definition elements.h:1317
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition elements.h:1967
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
Definition elements.h:2597
virtual double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Return the geometric shape functions and also first derivatives w.r.t. global coordinates at the ipt-...
Definition elements.cc:3355
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition elements.cc:3992
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
Definition elements.h:2615
unsigned nnode() const
Return the number of nodes.
Definition elements.h:2214
double nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. If the node is hanging, the appropriate interpolation is ...
Definition elements.h:2321
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
Definition elements.cc:3328
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
Definition elements.cc:5163
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
Definition elements.h:2488
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
Definition elements.h:1769
Base class for the flux transport equations templated by the dimension DIM. The equations that are so...
virtual void fill_in_generic_residual_contribution_flux_transport(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void calculate_element_averages(double *&average_values)
Compute the average values of the fluxes.
void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
An OomphLibError object which should be thrown when an run-time error is encountered....
Point element has just a single node and a single shape function which is identically equal to one.
Definition elements.h:3443
General QElement class.
Definition Qelements.h:459
Non-spectral version of the classes.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
QScalarAdvectionElement(const QScalarAdvectionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
double dshape_and_dtest_eulerian_flux_transport(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
double dshape_and_dtest_eulerian_at_knot_flux_transport(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. at integration point ipt....
QScalarAdvectionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
General QLegendreElement class.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,u or x,y,z,u at n_plot^DIM plot points.
QSpectralScalarAdvectionElement()
Constructor: Call constructors for QElement and Advection Diffusion equations.
double dshape_and_dtest_eulerian_flux_transport(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. Return Jacobian.
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
QSpectralScalarAdvectionElement(const QSpectralScalarAdvectionElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Output function: x,y,u or x,y,z,u.
double dshape_and_dtest_eulerian_at_knot_flux_transport(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Shape, test functions & derivs. w.r.t. to global coords. at integration point ipt....
Base class for advection equations.
ScalarAdvectionWindFctPt Wind_fct_pt
Function pointer to the wind function.
unsigned required_nvalue(const unsigned &n) const
The number of unknowns at each node is the number of values.
ScalarAdvectionWindFctPt wind_fct_pt() const
Access function: Pointer to wind function. Const version.
ScalarAdvectionWindFctPt & wind_fct_pt()
Access function: Pointer to wind function.
unsigned nflux() const
A single flux is interpolated.
virtual void get_wind_scalar_adv(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &wind) const
Return the wind at a given position.
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt initial_condition_pt, const double &t, Vector< double > &error, Vector< double > &norm)
Compute the error and norm of solution integrated over the element Does not plot the error in the out...
void dflux_du(const Vector< double > &u, RankThreeTensor< double > &df_du)
Return the flux derivatives as a function of the unknowns.
void flux(const Vector< double > &u, DenseMatrix< double > &f)
Return the flux as a function of the unknown.
void(* ScalarAdvectionWindFctPt)(const Vector< double > &x, Vector< double > &wind)
Typedef for a wind function as a possible function of position.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition shape.h:77
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).