[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
manufactured_solution.h
1 #ifndef __MANUFACTUREDSOLUTIONFUNCTION_H__
2 #define __MANUFACTUREDSOLUTIONFUNCTION_H__
3 
4 #include <deal.II/lac/vector.h>
5 
6 #include <deal.II/base/function.h>
7 
8 //#include <Sacado.hpp>
9 //
10 //#include "physics/physics.h"
11 //#include "numerical_flux/numerical_flux.h"
12 #include "parameters/all_parameters.h"
13 
14 
15 namespace PHiLiP {
16 
17 
19 
21 template <int dim, typename real>
22 class ManufacturedSolutionFunction : public dealii::Function<dim,real>
23 {
24 // We want the Point to be templated on the type,
25 // however, dealii does not template that part of the Function.
26 // Therefore, we end up overloading the functions and need to "import"
27 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
28 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
29 protected:
30  using dealii::Function<dim,real>::value;
31  using dealii::Function<dim,real>::gradient;
32  using dealii::Function<dim,real>::hessian;
33  using dealii::Function<dim,real>::vector_gradient;
34 
35 public:
36  const unsigned int nstate;
37 
42  explicit ManufacturedSolutionFunction (const unsigned int nstate = 1);
43 
45 
50  virtual real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const = 0;
51 
53 
60  virtual dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const = 0;
61 
63  dealii::Tensor<1,dim,real> gradient_fd (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const;
64 
66 
83  virtual dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const = 0;
84 
86  dealii::SymmetricTensor<2,dim,real> hessian_fd (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const;
87 
89  std::vector<real> stdvector_values (const dealii::Point<dim,real> &point) const;
90 
91 
93  void vector_gradient (const dealii::Point<dim,real> &p,
94  std::vector<dealii::Tensor<1,dim, real> > &gradients) const;
95 
96  // Virtual functions inherited from dealii::Function
97  //
98  // virtual real value (const Point<dim,real> &p,
99  // const unsigned int component = 0) const;
100 
101  // virtual void vector_value (const Point<dim,real> &p,
102  // Vector<real> &values) const;
103 
104  // virtual void value_list (const std::vector<Point<dim,real> > &points,
105  // std::vector<real> &values,
106  // const unsigned int component = 0) const;
107 
108  // virtual void vector_value_list (const std::vector<Point<dim,real> > &points,
109  // std::vector<Vector<real> > &values) const;
110 
111  // virtual void vector_values (const std::vector<Point<dim,real> > &points,
112  // std::vector<std::vector<real> > &values) const;
113 
114  // virtual Tensor<1,dim, real> gradient (const Point<dim,real> &p,
115  // const unsigned int component = 0) const;
116 
117  // virtual void gradient_list (const std::vector<Point<dim,real> > &points,
118  // std::vector<Tensor<1,dim, real> > &gradients,
119  // const unsigned int component = 0) const;
120 
121  // virtual void vector_gradients (const std::vector<Point<dim,real> > &points,
122  // std::vector<std::vector<Tensor<1,dim, real> > > &gradients) const;
123 
124  // virtual void vector_gradient_list (const std::vector<Point<dim,real> > &points,
125  // std::vector<std::vector<Tensor<1,dim, real> > > &gradients) const;
126 
127 protected:
129 
131  std::vector<double> base_values;
132  std::vector<double> amplitudes;
133  std::vector<dealii::Tensor<1,dim,real>> frequencies;
135 };
136 
138 template <int dim, typename real>
140  : public ManufacturedSolutionFunction<dim, real>
141 {
142 // We want the Point to be templated on the type,
143 // however, dealii does not template that part of the Function.
144 // Therefore, we end up overloading the functions and need to "import"
145 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
146 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
147 protected:
148  using dealii::Function<dim,real>::value;
149  using dealii::Function<dim,real>::gradient;
150  using dealii::Function<dim,real>::hessian;
151 
152 public:
154  explicit ManufacturedSolutionZero(const unsigned int nstate = 1)
155  : ManufacturedSolutionFunction<dim,real>(nstate){}
157  real value (const dealii::Point<dim,real> &/*point*/, const unsigned int /*istate*/ = 0) const override;
159  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &/*point*/, const unsigned int /*istate*/ = 0) const override;
161  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &/*point*/, const unsigned int /*istate*/ = 0) const override;
162 };
163 
165 template <int dim, typename real>
167  : public ManufacturedSolutionFunction<dim, real>
168 {
169 // We want the Point to be templated on the type,
170 // however, dealii does not template that part of the Function.
171 // Therefore, we end up overloading the functions and need to "import"
172 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
173 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
174 protected:
175  using dealii::Function<dim,real>::value;
176  using dealii::Function<dim,real>::gradient;
177  using dealii::Function<dim,real>::hessian;
178 
179 public:
181  explicit ManufacturedSolutionSine(const unsigned int nstate = 1)
182  : ManufacturedSolutionFunction<dim,real>(nstate){}
184  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
186  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
188  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
189 };
190 
192 template <int dim, typename real>
194  : public ManufacturedSolutionFunction<dim, real>
195 {
196 // We want the Point to be templated on the type,
197 // however, dealii does not template that part of the Function.
198 // Therefore, we end up overloading the functions and need to "import"
199 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
200 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
201 protected:
202  using dealii::Function<dim,real>::value;
203  using dealii::Function<dim,real>::gradient;
204  using dealii::Function<dim,real>::hessian;
205 public:
207  explicit ManufacturedSolutionCosine(const unsigned int nstate = 1)
208  : ManufacturedSolutionFunction<dim,real>(nstate){}
210  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
212  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
214  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
215 };
216 
218 template <int dim, typename real>
220  : public ManufacturedSolutionFunction<dim, real>
221 {
222 // We want the Point to be templated on the type,
223 // however, dealii does not template that part of the Function.
224 // Therefore, we end up overloading the functions and need to "import"
225 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
226 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
227 protected:
228  using dealii::Function<dim,real>::value;
229  using dealii::Function<dim,real>::gradient;
230  using dealii::Function<dim,real>::hessian;
231 public:
233  explicit ManufacturedSolutionAdd(const unsigned int nstate = 1)
234  : ManufacturedSolutionFunction<dim,real>(nstate){}
236  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
238  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
240  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
241 };
242 
244 template <int dim, typename real>
246  : public ManufacturedSolutionFunction<dim, real>
247 {
248 // We want the Point to be templated on the type,
249 // however, dealii does not template that part of the Function.
250 // Therefore, we end up overloading the functions and need to "import"
251 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
252 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
253 protected:
254  using dealii::Function<dim,real>::value;
255  using dealii::Function<dim,real>::gradient;
256  using dealii::Function<dim,real>::hessian;
257 public:
259  explicit ManufacturedSolutionExp(const unsigned int nstate = 1)
260  : ManufacturedSolutionFunction<dim,real>(nstate){}
262  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
264  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
266  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
267 };
268 
270 template <int dim, typename real>
272  : public ManufacturedSolutionFunction<dim, real>
273 {
274 // We want the Point to be templated on the type,
275 // however, dealii does not template that part of the Function.
276 // Therefore, we end up overloading the functions and need to "import"
277 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
278 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
279 protected:
280  using dealii::Function<dim,real>::value;
281  using dealii::Function<dim,real>::gradient;
282  using dealii::Function<dim,real>::hessian;
283 public:
285  explicit ManufacturedSolutionPoly(const unsigned int nstate = 1)
286  : ManufacturedSolutionFunction<dim,real>(nstate){}
288  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
290  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
292  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
293 };
294 
296 template <int dim, typename real>
298  : public ManufacturedSolutionFunction<dim, real>
299 {
300 // We want the Point to be templated on the type,
301 // however, dealii does not template that part of the Function.
302 // Therefore, we end up overloading the functions and need to "import"
303 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
304 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
305 protected:
306  using dealii::Function<dim,real>::value;
307  using dealii::Function<dim,real>::gradient;
308  using dealii::Function<dim,real>::hessian;
309 public:
311  explicit ManufacturedSolutionEvenPoly(const unsigned int nstate = 1)
312  : ManufacturedSolutionFunction<dim,real>(nstate){}
314  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
316  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
318  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
319 };
320 
322 template <int dim, typename real>
324  : public ManufacturedSolutionFunction<dim, real>
325 {
326 // We want the Point to be templated on the type,
327 // however, dealii does not template that part of the Function.
328 // Therefore, we end up overloading the functions and need to "import"
329 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
330 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
331 protected:
332  using dealii::Function<dim,real>::value;
333  using dealii::Function<dim,real>::gradient;
334  using dealii::Function<dim,real>::hessian;
335 public:
337  explicit ManufacturedSolutionAtan(const unsigned int nstate = 1)
339  {
340  n_shocks.resize(dim);
341  S_j.resize(dim);
342  x_j.resize(dim);
343 
344  for(unsigned int i = 0; i<dim; ++i){
345  n_shocks[i] = 2;
346 
347  S_j[i].resize(n_shocks[i]);
348  x_j[i].resize(n_shocks[i]);
349 
350  // S_j[i][0] = 10;
351  // S_j[i][1] = -10;
352 
353  S_j[i][0] = 50;
354  S_j[i][1] = -50;
355 
356  x_j[i][0] = -1/sqrt(2);
357  x_j[i][1] = 1/sqrt(2);
358 
359  // x_j[i][0] = 1-1/sqrt(2);
360  // x_j[i][1] = 1/sqrt(2);
361  }
362  }
364  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
366  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
368  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
369 
370 private:
371  std::vector<unsigned int> n_shocks;
372  std::vector<std::vector<real>> S_j;
373  std::vector<std::vector<real>> x_j;
374 };
375 
377 template <int dim, typename real>
379  : public ManufacturedSolutionFunction<dim, real>
380 {
381 // We want the Point to be templated on the type,
382 // however, dealii does not template that part of the Function.
383 // Therefore, we end up overloading the functions and need to "import"
384 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
385 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
386 protected:
387  using dealii::Function<dim,real>::value;
388  using dealii::Function<dim,real>::gradient;
389  using dealii::Function<dim,real>::hessian;
390 public:
392  explicit ManufacturedSolutionBoundaryLayer(const unsigned int nstate = 1)
394  , epsilon(nstate)
395  {
396  for(int istate = 0; istate < (int)nstate; ++istate){
397  for (int d=0; d<dim; d++){
398  // epsilon[istate][d] = 0.1; // smooth
399  epsilon[istate][d] = 0.005; // strong
400  }
401  }
402  }
404  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
406  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
408  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
409 
410 private:
412  std::vector<dealii::Tensor<1,dim,real>> epsilon;
413 };
414 
416 template <int dim, typename real>
418  : public ManufacturedSolutionFunction<dim, real>
419 {
420 // We want the Point to be templated on the type,
421 // however, dealii does not template that part of the Function.
422 // Therefore, we end up overloading the functions and need to "import"
423 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
424 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
425 protected:
426  using dealii::Function<dim,real>::value;
427  using dealii::Function<dim,real>::gradient;
428  using dealii::Function<dim,real>::hessian;
429 public:
431  explicit ManufacturedSolutionSShock(const unsigned int nstate = 1)
433  {
434  // setting constant for function
435  // f(x,y) = a * tanh(b*sin(c*y + d) + e*x + f)
436 
437  // Ekelschot
438  // Note: form given does not have brackets around b*(...)
439  // a = 0.75;
440  // b = 2.0;
441  // c = 5.0;
442  // d = 0.0;
443  // e = -6.0;
444  // f = 0.0;
445 
446  double scale_atan = 2.0;
447 
448  // shifted from [-1,1]^2 -> [0,1]
449  a = 0.75;
450  b = 2.0*scale_atan;
451  c = 10.0;
452  d = -5.0;
453  e = -12.0*scale_atan;
454  f = 6.0*scale_atan;
455  }
457  real value(const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
459  dealii::Tensor<1,dim,real> gradient(const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
461  dealii::SymmetricTensor<2,dim,real> hessian(const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
462 
463 private:
466  real a, b, c, d, e, f;
468 };
469 
471 template <int dim, typename real>
473  : public ManufacturedSolutionFunction<dim, real>
474 {
475 // We want the Point to be templated on the type,
476 // however, dealii does not template that part of the Function.
477 // Therefore, we end up overloading the functions and need to "import"
478 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
479 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
480 protected:
481  using dealii::Function<dim,real>::value;
482  using dealii::Function<dim,real>::gradient;
483  using dealii::Function<dim,real>::hessian;
484 public:
486  explicit ManufacturedSolutionQuadratic(const unsigned int nstate = 1)
488  {
489  // assigning the scaling coeffs for hessian diagonals
490  for(unsigned int d = 0; d < dim; ++d){
491  // diag(1, 4, 9, ...)
492  alpha_diag[d] = (d+1)*(d+1);
493  }
494  }
496  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
498  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
500  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
501 
502 private:
503  std::array<real, dim> alpha_diag;
504 };
505 
506 
510 template <int dim, typename real>
512  : public ManufacturedSolutionFunction<dim, real>
513 {
514 // We want the Point to be templated on the type,
515 // however, dealii does not template that part of the Function.
516 // Therefore, we end up overloading the functions and need to "import"
517 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
518 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
519 protected:
520  using dealii::Function<dim,real>::value;
521  using dealii::Function<dim,real>::gradient;
522  using dealii::Function<dim,real>::hessian;
523 public:
525  explicit ManufacturedSolutionExample(const unsigned int nstate = 1)
526  : ManufacturedSolutionFunction<dim,real>(nstate){}
528  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
530  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
532  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
533 };
534 
537 template <int dim, typename real>
539  : public ManufacturedSolutionFunction<dim, real>
540 {
541 // We want the Point to be templated on the type,
542 // however, dealii does not template that part of the Function.
543 // Therefore, we end up overloading the functions and need to "import"
544 // those non-overloaded functions to avoid the warning -Woverloaded-virtual
545 // See: https://stackoverflow.com/questions/18515183/c-overloaded-virtual-function-warning-by-clang
546 protected:
547  using dealii::Function<dim,real>::value;
548  using dealii::Function<dim,real>::gradient;
549  using dealii::Function<dim,real>::hessian;
550 public:
552  explicit ManufacturedSolutionNavahBase(const unsigned int nstate = 4)
554  {
555  // static_assert(dim==2, "ManufacturedSolutionNavahBase() should be created with dim=2");
556  // static_assert(nstate==dim+2, "ManufacturedSolutionNavahBase() should be created with nstate=dim+2");
557 
558  const double pi = atan(1)*4.0;
559  real L = 1.0;
560  c = pi/L;
561  }
563  real value (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
565  dealii::Tensor<1,dim,real> gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
567  dealii::SymmetricTensor<2,dim,real> hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const override;
568 protected:
569  std::array<dealii::Tensor<1,7,double>,5> ncm;
570  real c;
571  real primitive_value(const dealii::Point<dim,real> &point, const unsigned int istate = 0) const;
574  dealii::Tensor<1,dim,real> primitive_gradient (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const;
576  dealii::SymmetricTensor<2,dim,real> primitive_hessian (const dealii::Point<dim,real> &point, const unsigned int istate = 0) const;
577 };
578 
580 template <int dim, typename real>
582  : public ManufacturedSolutionNavahBase<dim, real>
583 {
584 public:
590  explicit ManufacturedSolutionNavah_MS1(const unsigned int nstate = 4)
592  {
593  std::array<dealii::Tensor<1,7,double>,5> ncm;
594  /* MS-1 */
595  ncm[0][0]= 1.0; ncm[0][1]=0.3; ncm[0][2]=-0.2; ncm[0][3]=0.3; ncm[0][4]=1.0; ncm[0][5]=1.0; ncm[0][6]=1.0;
596  ncm[1][0]= 1.0; ncm[1][1]=0.3; ncm[1][2]= 0.3; ncm[1][3]=0.3; ncm[1][4]=3.0; ncm[1][5]=1.0; ncm[1][6]=1.0;
597  ncm[2][0]= 1.0; ncm[2][1]=0.3; ncm[2][2]= 0.3; ncm[2][3]=0.3; ncm[2][4]=1.0; ncm[2][5]=1.0; ncm[2][6]=1.0;
598  ncm[3][0]=18.0; ncm[3][1]=5.0; ncm[3][2]= 5.0; ncm[3][3]=0.5; ncm[3][4]=2.0; ncm[3][5]=1.0; ncm[3][6]=1.0;
599  for(int j=0; j<7; j++) {
600  ncm[4][j] = 0.0;
601  }
602  this->ncm=ncm; // done this way to minimize the use of keyword "this->"
603  }
604 };
605 
607 template <int dim, typename real>
609  : public ManufacturedSolutionNavahBase<dim, real>
610 {
611 public:
617  explicit ManufacturedSolutionNavah_MS2(const unsigned int nstate = 4)
619  {
620  std::array<dealii::Tensor<1,7,double>,5> ncm;
621  /* MS-2 */
622  ncm[0][0]=2.7; ncm[0][1]=0.9; ncm[0][2]=-0.9; ncm[0][3]=1.0; ncm[0][4]=1.5; ncm[0][5]=1.5; ncm[0][6]=1.5;
623  ncm[1][0]=2.0; ncm[1][1]=0.7; ncm[1][2]= 0.7; ncm[1][3]=0.4; ncm[1][4]=1.0; ncm[1][5]=1.0; ncm[1][6]=1.0;
624  ncm[2][0]=2.0; ncm[2][1]=0.4; ncm[2][2]= 0.4; ncm[2][3]=0.4; ncm[2][4]=1.0; ncm[2][5]=1.0; ncm[2][6]=1.0;
625  ncm[3][0]=2.0; ncm[3][1]=1.0; ncm[3][2]= 1.0; ncm[3][3]=0.5; ncm[3][4]=1.0; ncm[3][5]=1.0; ncm[3][6]=1.5;
626  for(int j=0; j<7; j++) {
627  ncm[4][j] = 0.0;
628  }
629  this->ncm=ncm; // done this way to minimize the use of keyword "this->"
630  }
631 };
632 
634 template <int dim, typename real>
636  : public ManufacturedSolutionNavahBase<dim, real>
637 {
638 public:
644  explicit ManufacturedSolutionNavah_MS3(const unsigned int nstate = 4)
646  {
647  std::array<dealii::Tensor<1,7,double>,5> ncm;
648  /* MS-3 */
649  ncm[0][0]= 1.0; ncm[0][1]=0.1; ncm[0][2]=-0.2; ncm[0][3]=0.1; ncm[0][4]=1.0; ncm[0][5]=1.0; ncm[0][6]=1.0;
650  ncm[1][0]= 2.0; ncm[1][1]=0.3; ncm[1][2]= 0.3; ncm[1][3]=0.3; ncm[1][4]=3.0; ncm[1][5]=1.0; ncm[1][6]=1.0;
651  ncm[2][0]= 2.0; ncm[2][1]=0.3; ncm[2][2]= 0.3; ncm[2][3]=0.3; ncm[2][4]=1.0; ncm[2][5]=1.0; ncm[2][6]=1.0;
652  ncm[3][0]=10.0; ncm[3][1]=1.0; ncm[3][2]= 1.0; ncm[3][3]=0.5; ncm[3][4]=2.0; ncm[3][5]=1.0; ncm[3][6]=1.0;
653  for(int j=0; j<7; j++) {
654  ncm[4][j] = 0.0;
655  }
656  this->ncm=ncm; // done this way to minimize the use of keyword "this->"
657  }
658 };
659 
661 template <int dim, typename real>
663  : public ManufacturedSolutionNavahBase<dim, real>
664 {
665 public:
671  explicit ManufacturedSolutionNavah_MS4(const unsigned int nstate = 4)
673  {
674  std::array<dealii::Tensor<1,7,double>,5> ncm;
675  /* MS-4 */
676  ncm[0][0]= 1.0; ncm[0][1]= 0.1; ncm[0][2]= -0.2; ncm[0][3]= 0.1; ncm[0][4]=1.0; ncm[0][5]=1.0; ncm[0][6]=1.0;
677  ncm[1][0]= 2.0; ncm[1][1]= 0.3; ncm[1][2]= 0.3; ncm[1][3]= 0.3; ncm[1][4]=3.0; ncm[1][5]=1.0; ncm[1][6]=1.0;
678  ncm[2][0]= 2.0; ncm[2][1]= 0.3; ncm[2][2]= 0.3; ncm[2][3]= 0.3; ncm[2][4]=1.0; ncm[2][5]=1.0; ncm[2][6]=1.0;
679  ncm[3][0]=10.0; ncm[3][1]= 1.0; ncm[3][2]= 1.0; ncm[3][3]= 0.5; ncm[3][4]=2.0; ncm[3][5]=1.0; ncm[3][6]=1.0;
680  ncm[4][0]= 0.6; ncm[4][1]=-0.03; ncm[4][2]=-0.02; ncm[4][3]=0.02; ncm[4][4]=2.0; ncm[4][5]=1.0; ncm[4][6]=3.0;
681  this->ncm=ncm; // done this way to minimize the use of keyword "this->"
682  }
683 };
684 
686 template <int dim, typename real>
688  : public ManufacturedSolutionNavahBase<dim, real>
689 {
690 public:
696  explicit ManufacturedSolutionNavah_MS5(const unsigned int nstate = 4)
698  {
699  std::array<dealii::Tensor<1,7,double>,5> ncm;
700  /* MS-5 */
701  ncm[0][0]= 1.0; ncm[0][1]= 0.1; ncm[0][2]=-0.2; ncm[0][3]=0.1; ncm[0][4]=1.0; ncm[0][5]=1.0; ncm[0][6]=1.0;
702  ncm[1][0]= 2.0; ncm[1][1]= 0.3; ncm[1][2]= 0.3; ncm[1][3]=0.3; ncm[1][4]=3.0; ncm[1][5]=1.0; ncm[1][6]=1.0;
703  ncm[2][0]= 2.0; ncm[2][1]= 0.3; ncm[2][2]= 0.3; ncm[2][3]=0.3; ncm[2][4]=1.0; ncm[2][5]=1.0; ncm[2][6]=1.0;
704  ncm[3][0]=10.0; ncm[3][1]= 1.0; ncm[3][2]= 1.0; ncm[3][3]=0.5; ncm[3][4]=2.0; ncm[3][5]=1.0; ncm[3][6]=1.0;
705  ncm[4][0]=-6.0; ncm[4][1]=-0.3; ncm[4][2]=-0.2; ncm[4][3]=0.2; ncm[4][4]=2.0; ncm[4][5]=1.0; ncm[4][6]=3.0;
706  this->ncm=ncm; // done this way to minimize the use of keyword "this->"
707  }
708 };
709 
710 
712 
722 template <int dim, typename real>
724 {
727 public:
729  static std::shared_ptr< ManufacturedSolutionFunction<dim,real> >
730  create_ManufacturedSolution(
731  Parameters::AllParameters const *const param,
732  int nstate);
733 
735  static std::shared_ptr< ManufacturedSolutionFunction<dim,real> >
736  create_ManufacturedSolution(
737  ManufacturedSolutionEnum solution_type,
738  int nstate);
739 
740 };
741 
742 } // namespace PHiLiP
743 
744 #endif //__MANUFACTUREDSOLUTIONFUNCTION_H__
ManufacturedSolutionType
Selects the manufactured solution to be used if use_manufactured_source_term=true.
Sum of even order polynomial functions manufactured solution.
virtual dealii::Tensor< 1, dim, real > gradient(const dealii::Point< dim, real > &point, const unsigned int istate=0) const =0
Gradient of the exact manufactured solution.
ManufacturedSolutionSShock(const unsigned int nstate=1)
Constructor.
Navah and Nadarajah free flows manufactured solution: MS5.
std::vector< std::vector< real > > S_j
shock strengths
std::vector< dealii::Tensor< 1, dim, real > > epsilon
Boundary layer strength parameter.
ManufacturedSolutionQuadratic(const unsigned int nstate=1)
Constructor.
virtual real value(const dealii::Point< dim, real > &point, const unsigned int istate=0) const =0
Manufactured solution exact value.
ManufacturedSolutionNavah_MS2(const unsigned int nstate=4)
Manufactured solution used for grid studies to check convergence orders.
ManufacturedSolutionExp(const unsigned int nstate=1)
Constructor.
ManufacturedSolutionSine(const unsigned int nstate=1)
Constructor.
Files for the baseline physics.
Definition: ADTypes.hpp:10
Manufactured solution function factory.
ManufacturedSolutionEvenPoly(const unsigned int nstate=1)
Constructor.
std::array< dealii::Tensor< 1, 7, double >, 5 > ncm
Navah Coefficient Matrix (ncm); placeholder.
ManufacturedSolutionZero(const unsigned int nstate=1)
Constructor.
Main parameter class that contains the various other sub-parameter classes.
std::array< real, dim > alpha_diag
Diagonal hessian component scaling.
Sum of polynomial manufactured solution.
ManufacturedSolutionPoly(const unsigned int nstate=1)
Constructor.
Scalar boundary layer manufactured solution.
ManufacturedSolutionAtan(const unsigned int nstate=1)
Constructor.
Product of cosine waves manufactured solution.
Navah and Nadarajah free flows manufactured solution: MS3.
std::vector< real > stdvector_values(const dealii::Point< dim, real > &point) const
Same as Function::values() except it returns it into a std::vector format.
std::vector< std::vector< real > > x_j
shock positions
Sum of exponential functions manufactured solution.
ManufacturedSolutionNavah_MS1(const unsigned int nstate=4)
ManufacturedSolutionNavah_MS4(const unsigned int nstate=4)
dealii::SymmetricTensor< 2, dim, real > hessian_fd(const dealii::Point< dim, real > &point, const unsigned int istate=0) const
Uses finite-difference to evaluate the hessian.
virtual dealii::SymmetricTensor< 2, dim, real > hessian(const dealii::Point< dim, real > &point, const unsigned int istate=0) const =0
Hessian of the exact manufactured solution.
Navah and Nadarajah free flows manufactured solution: MS1.
Product of sine waves manufactured solution.
std::vector< unsigned int > n_shocks
number of shocks
ManufacturedSolutionExample(const unsigned int nstate=1)
Constructor.
ManufacturedSolutionCosine(const unsigned int nstate=1)
Constructor.
Navah and Nadarajah free flows manufactured solution: MS4.
Hump manufactured solution based on arctangent functions.
Sum of sine waves manufactured solution.
ManufacturedSolutionBoundaryLayer(const unsigned int nstate=1)
Constructor.
std::vector< dealii::Tensor< 1, dim, real > > frequencies
Product of zero waves manufactured solution.
ManufacturedSolutionNavah_MS5(const unsigned int nstate=4)
void vector_gradient(const dealii::Point< dim, real > &p, std::vector< dealii::Tensor< 1, dim, real > > &gradients) const
See dealii::Function<dim,real>::vector_gradient.
ManufacturedSolutionNavah_MS3(const unsigned int nstate=4)
ManufacturedSolutionNavahBase(const unsigned int nstate=4)
Constructor.
ManufacturedSolutionFunction(const unsigned int nstate=1)
Constructor that initializes base_values, amplitudes, frequencies.
Navah and Nadarajah free flows manufactured solution: MS2.
ManufacturedSolutionAdd(const unsigned int nstate=1)
Constructor.
S-Shock manufactured solution.
dealii::Tensor< 1, dim, real > gradient_fd(const dealii::Point< dim, real > &point, const unsigned int istate=0) const
Uses finite-difference to evaluate the gradient.
Quadratic function manufactured solution.