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 bool gridIsConstructed
15) {
16 logTraceInWith3Arguments( "initialCondition(...)", volumeCentre, volumeH, gridIsConstructed );
17
18 double xd[DIMENSIONS];
19 for (int d=0; d< DIMENSIONS; d++) xd[d] = 0.0;//x[d];
20 double t = 0;
21 alfenwave_(&xd[0], &Q[0], &t);
22 for(int i=0; i<9; i++){
23 assert(std::isfinite(Q[i]));
24 assert(!std::isnan(Q[i]));
25 }
26
27 logTraceOut( "initialCondition(...)" );
28}
29
30
31
32double examples::exahype2::finitevolumes::MHD::maxEigenvalue(
33 const double * NOALIAS Q, // Q[9+0],
34 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
35 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
36 double t,
37 int normal
38) {
39 logTraceInWith4Arguments( "eigenvalues(...)", faceCentre, volumeH, t, normal );
40 double nv[3] = {0.};
41 double lambda[9];
42 nv[normal] = 1;
43 pdeeigenvalues_(lambda, Q, nv);
44
45 double result = 0;
46 for (int i=0; i<9; i++) {
47 result = std::max( result, std::abs(lambda[i]) );
48 }
49
50 logTraceOut( "eigenvalues(...)" );
51
52 return result;
53}
54
55
56void examples::exahype2::finitevolumes::MHD::flux(
57 const double * NOALIAS Q, // Q[9+0],
58 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
59 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
60 double t,
61 int normal,
62 double * NOALIAS F // F[9]
63) {
64 logTraceInWith4Arguments( "flux(...)", faceCentre, volumeH, t, normal );
65 pdeflux_(F, Q, &normal);
66 logTraceOut( "flux(...)" );
67}
68
69
70void examples::exahype2::finitevolumes::MHD::boundaryConditions(
71 const double * NOALIAS Qinside, // Qinside[9+0]
72 double * NOALIAS Qoutside, // Qoutside[9+0]
73 const tarch::la::Vector<DIMENSIONS,double>& faceCentre,
74 const tarch::la::Vector<DIMENSIONS,double>& volumeH,
75 double t,
76 int normal
77) {
78 logTraceInWith4Arguments( "boundaryConditions(...)", faceCentre, volumeH, t, normal );
79 for(int i=0; i< 9; i++)
80 Qoutside[i]=Qinside[i];
81 logTraceOut( "boundaryConditions(...)" );
82}
83
void alfenwave_(double *x, double *Q, double *t)
void pdeeigenvalues_(double *lambda, const double *const Q, double *nv)
void pdeflux_(double *Fx, double *Fy, double *Fz, const double *const Q)