Peano
Loading...
Searching...
No Matches
MHD.cpp
Go to the documentation of this file.
1#include "MHD.h"
2
3#include "PDE.h"
4#include "InitialData.h"
5
6tarch::logging::Log examples::exahype2::finitevolumes::MHD::_log( "examples::exahype2::finitevolumes::MHD" );
7
8
9
10void examples::exahype2::finitevolumes::MHD::initialCondition(
11 double * NOALIAS Q,
12 const tarch::la::Vector<DIMENSIONS,double>& volumeCentre,
13 const tarch::la::Vector<DIMENSIONS,double>& volumeH
14) {
15 double xd[DIMENSIONS];
16 for (int d=0; d< DIMENSIONS; d++) xd[d] = 0.0;//x[d];
17 double t = 0;
18 alfenwave_(&xd[0], &Q[0], &t);
19 for(int i=0; i<9; i++){
20 assert(std::isfinite(Q[i]));
21 assert(!std::isnan(Q[i]));
22 }
23}
24
25
26
27double examples::exahype2::finitevolumes::MHD::maxEigenvalue(
28 const double * NOALIAS Q, // Q[9+0],
29 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
30 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
31 double t,
32 int normal
33) {
34 logTraceInWith4Arguments( "eigenvalues(...)", faceCentre, volumeH, t, normal );
35 double nv[3] = {0.};
36 double lambda[9];
37 nv[normal] = 1;
38 pdeeigenvalues_(lambda, Q, nv);
39
40 double result = 0;
41 for (int i=0; i<9; i++) {
42 result = std::max( result, std::abs(lambda[i]) );
43 }
44
45 logTraceOut( "eigenvalues(...)" );
46
47 return result;
48}
49
50
51void examples::exahype2::finitevolumes::MHD::flux(
52 const double * NOALIAS Q, // Q[9+0],
53 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
54 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
55 double t,
56 int normal,
57 double * NOALIAS F // F[9]
58) {
59 logTraceInWith4Arguments( "flux(...)", faceCentre, volumeH, t, normal );
60 pdeflux_(F, Q, &normal);
61 logTraceOut( "flux(...)" );
62}
63
64
65void examples::exahype2::finitevolumes::MHD::boundaryConditions(
66 const double * NOALIAS Qinside, // Qinside[9+0]
67 double * NOALIAS Qoutside, // Qoutside[9+0]
68 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
69 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
70 double t,
71 int normal
72) {
73 logTraceInWith4Arguments( "boundaryConditions(...)", faceCentre, volumeH, t, normal );
74 for(int i=0; i< 9; i++)
75 Qoutside[i]=Qinside[i];
76 logTraceOut( "boundaryConditions(...)" );
77}
78
void pdeeigenvalues_(double *lambda, const double *const Q, double *nv)
void pdeflux_(double *Fx, double *Fy, double *Fz, const double *const Q)
void alfenwave_(double *x, double *Q, double *t)