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
3 files
+ 94
93
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -2,7 +2,7 @@
Linear Acoustics model class
*/
/** \brief provide matrix which contains rowwise the eigenvectors of linear acoustics problem
\tparam dim the space dimension
\tparam dim the space dimension
\param c speed of sound
\param n unit outer normal vector
\param RT matrix to be filled
@@ -19,50 +19,51 @@ public:
static constexpr int dim = 2;
static constexpr int m = 3;
using RangeField = typename PROBLEM::RangeField;
using RangeField = typename PROBLEM::RangeField;
Model (PROBLEM& p)
: problem(p)
: problem(p)
{
}
template<typename T2, typename T3>
static void eigenvectors (const Dune::FieldVector<T2,dim>& n, Dune::FieldMatrix<T3,m,m>& RT)
{
int c = 1;
template<typename T2, typename T3>
static void eigenvectors (const Dune::FieldVector<T2,dim>& n, Dune::FieldMatrix<T3,m,m>& RT)
{
int c = 1;
RT[0][0] = 0; RT[0][1] = 1; RT[0][2] = -1;
RT[1][0] =-n[1]; RT[1][1] = c*n[0]; RT[1][2] = c*n[0];
RT[2][0] = n[0]; RT[2][1] = c*n[1]; RT[2][2] = c*n[1];
RT[0][0] = 0; RT[1][0] = -n[1]; RT[2][0] = n[0];
RT[0][1] = 1; RT[1][1] = c*n[0]; RT[2][1] = c*n[1];
RT[0][2] = -1; RT[1][2] = c*n[0]; RT[2][2] = c*n[1];
}
}
//one can also provide eigenvectors inverse
template<typename RF>
static void coefficients (Dune::FieldMatrix<RF,m,m>& A)
static void coefficients (Dune::FieldMatrix<RF,m,m>& A)
{
int c2 = 1;
int c2 = 1;
A[0][0] = 0.0; A[0][1] = 1.0; A[0][2] = 1.0;
A[1][0] = c2; A[1][1] = 0.0; A[1][2] = 0.0;
A[2][0] = c2; A[2][1] = 0.0; A[2][2] = 0.0;
}
}
template<typename RF>
static void diagonal (Dune::FieldMatrix<RF,m,m>& D)
static void diagonal (Dune::FieldMatrix<RF,m,m>& D)
{
int c = 1;
int c = 1;
D[0][0] = 0.0; D[0][1] = 0.0; D[0][2] = 0.0;
D[1][0] = 0.0; D[1][1] = c ; D[1][2] = 0.0;
D[2][0] = 0.0; D[2][1] = 0.0; D[2][2] = -c;
}
}
//Flux function
//template<typename RF,typename EG>
template<typename RF>
static void flux (Dune::FieldVector<RF,m>& u, Dune::FieldMatrix<RF,m,dim>& F)
{
static void flux (Dune::FieldVector<RF,m>& u, Dune::FieldMatrix<RF,m,dim>& F)
{
//fetch parameters
/*
// Reference to cell
@@ -74,14 +75,14 @@ public:
auto localcenter = ref_el.position(0,0);
auto c = param.c(cell,localcenter);
*/
int c = 1;
int c = 1;
F[0][0] = u[1] ; F[0][1] = u[2];
F[1][0] = c*c*u[0]; F[1][1] = 0.0;
F[2][0] = 0.0 ; F[2][1] = c*c*u[0];
}
}
PROBLEM& problem;
PROBLEM& problem;
};
/*
Loading