Skip to content
Snippets Groups Projects

Piotr's Tutorial 7 on hyperbolic problems

Merged Dominic Kempf requested to merge Piotr/tutorial07 into master
4 unresolved threads
2 files
+ 11
22
Compare changes
  • Side-by-side
  • Inline
Files
2
#ifndef ACOUSTICS_RIEMANNPROBLEM
#define ACOUSTICS_RIEMANNPROBLEM
//template<typename GV, typename NUMBER, typename MODEL>
template<typename GV, typename NUMBER>
class Problem
{
public:
//using Model = MODEL;
using RangeField = NUMBER;
//problem specification depends on dimension
@@ -14,23 +13,18 @@ public:
using Range = Dune::FieldVector<NUMBER,m>;
//Problem (MODEL& m)
// : model(m), time(0.0), pi(3.141592653589793238462643)
// {
//}
Problem ()
: time(0.0), pi(3.141592653589793238462643)
{
}
//! speed of sound
template<typename E, typename X>
NUMBER c (const E& e, const X& x) const
{
X xglobal = e.geometry().global(x);
if ( xglobal[1] < 1-(0.6/0.9)*(xglobal[0]-0.1) ) return 1.0;
// if (xglobal[0]>0.5) return 2.0;
return 0.5;
}
@@ -60,18 +54,16 @@ public:
return rhs;
}
//! initial value
//! initial value -> the same as tutorial04
template<typename E, typename X>
Range u0 (const E& e, const X& x) const
{
X xglobal = e.geometry().global(x);
Range u(0.0);
if (xglobal[0]>0.45 && xglobal[0]<0.55 && xglobal[1]>0.3 && xglobal[1]<0.4)
{
u[0] = sin(pi*(xglobal[0]-0.45)/0.1)*sin(pi*(xglobal[0]-0.45)/0.1)*sin(pi*(xglobal[1]-0.3)/0.1)*sin(pi*(xglobal[1]-0.3)/0.1);
u[1] = 0;
u[2] = 0;
}
for (int i=0; i<dim; i++)
u[0] += (xglobal[i]-0.375)*(xglobal[i]-0.375);
u[0] = std::max(0.0,1.0-8.0*sqrt(u[0]));
return u;
}
@@ -81,9 +73,6 @@ public:
time = t;
}
//MODEL& model;
private:
NUMBER time;
Loading