Returns the HLLD numerical flux for MHD equations. The scheme uses four cells to estimate the flux at the interface. Cell2 and Cell3 are the first neighbours on the left and right sides. Cell1 and Cell4 are the second neighbours on the left and right sides.
26 real rhoL=0., rhoR=0.;
28 real preL=0., preR=0.;
39 dx = Cell2.
size(AxisNo);
40 real r, Limit, LeftSlope = 0., RightSlope = 0.;
53 r = RightSlope/LeftSlope;
55 LeftAverage.setValue(i, Cell2.
average(i) + 0.5*Limit*LeftSlope);
59 LeftAverage.setValue(i, Cell2.
average(i));
67 r = RightSlope/LeftSlope;
69 RightAverage.setValue(i, Cell3.
average(i) - 0.5*Limit*LeftSlope);
73 RightAverage.setValue(i, Cell3.
average(i));
81 rhoL = LeftAverage.value(1);
82 rhoR = RightAverage.value(1);
85 for (
int i=1;i<=3;i++)
87 VL.setValue( i, LeftAverage.value (i+1));
88 VR.setValue( i, RightAverage.value(i+1));
89 BL.setValue( i, LeftAverage.value (i+6));
90 BR.setValue( i, RightAverage.value(i+6));
94 eL = LeftAverage.value(5);
95 eR = RightAverage.value(5);
98 preL = (
Gamma -1.)*(eL - 0.5*(VL*VL)/rhoL - 0.5*(BL*BL));
99 preR = (
Gamma -1.)*(eR - 0.5*(VR*VR)/rhoR - 0.5*(BR*BR));
102 bkL =
power2(BL.value(AxisNo))/rhoL;
103 bkR =
power2(BR.value(AxisNo))/rhoR;
105 aL =
Gamma*preL/rhoL;
106 aR =
Gamma*preR/rhoR;
112 cfL = sqrt(0.5*(aL + bL + sqrt(
power2(aL + bL) - 4.0*aL*bkL)));
113 cfR = sqrt(0.5*(aR + bR + sqrt(
power2(aR + bR) - 4.0*aR*bkR)));
116 SL =
Min((VL.value(AxisNo))/rhoL, (VR.value(AxisNo))/rhoR) -
Max(cfL,cfR);
117 SR =
Max((VL.value(AxisNo))/rhoL, (VR.value(AxisNo))/rhoR) +
Max(cfL,cfR);
122 FL =
FluxX(LeftAverage);
123 FR =
FluxX(RightAverage);
124 }
else if(AxisNo ==2){
126 FL =
FluxY(LeftAverage);
127 FR =
FluxY(RightAverage);
130 FL =
FluxZ(LeftAverage);
131 FR =
FluxZ(RightAverage);
135 U =
stateUstar(LeftAverage, RightAverage, preL, preR, SL, SR, SM, SLS, SRS,AxisNo);
144 Result.setValue(i, FL.value(i));
146 else if(SLS>=0. && SL<0.)
147 Result.setValue(i, FL.value(i) + SL*(U.value(i,1) - LeftAverage.value(i)));
149 else if(SM>=0. && SLS<0.)
150 Result.setValue(i, FL.value(i) + SLS*U.value(i,3) - (SLS - SL)*U.value(i,1) - SL*LeftAverage.value(i));
152 else if(SRS>=0. && SM<0.)
153 Result.setValue(i, FR.value(i) + SRS*U.value(i,4) - (SRS - SR)*U.value(i,2) - SR*RightAverage.value(i));
155 else if(SR>=0. && SRS<0.)
156 Result.setValue(i, FR.value(i) + SR*(U.value(i,2) - RightAverage.value(i)));
159 Result.setValue(i, FR.value(i));
#define power2(x)
Definition: Carmen.h:70
real EigenvalueZ
Definition: Parameters.cpp:160
Vector FluxY(const Vector &Avg)
Returns the physical flux of MHD equations in Y direction.
Definition: PhysicalFluxMHD.cpp:58
int QuantityNb
Definition: Parameters.cpp:171
Standard class for every vector in Carmen.
Definition: Vector.h:29
Vector ArtificialViscosity(const Vector &Cell1, const Vector &Cell2, real dx, int AxisNo)
Returns the artificial diffusion source terms in the cell UserCell.
Definition: ArtificialViscosity.cpp:11
#define Min(x, y)
Definition: Carmen.h:62
real Gamma
Definition: Parameters.cpp:109
Vector Limiter(const Vector u, const Vector v)
Returns the value of the slope limiter between the slopes u and v.
Definition: Limiter.cpp:56
bool Diffusivity
Definition: Parameters.cpp:121
Vector FluxX(const Vector &Avg)
Returns the physical flux of MHD equations in X direction.
Definition: PhysicalFluxMHD.cpp:8
real size(const int AxisNo) const
Returns the cell size in the direction AxisNo.
Definition: Cell.h:1095
void fluxCorrection(Vector &Flux, const Vector &AvgL, const Vector &AvgR, int AxisNo)
This function apply the divergence-free correction to the numerical flux.
Definition: FluxCorrection.cpp:9
real average(const int QuantityNo) const
Returns the component no. QuantityNo of the cell-average value.
Definition: Cell.h:1128
Standard class for every matrix in Carmen.
Definition: Matrix.h:28
Vector FluxZ(const Vector &Avg)
Returns the physical flux of MHD equations in Z direction.
Definition: PhysicalFluxMHD.cpp:106
#define Abs(x)
Definition: Carmen.h:78
real EigenvalueY
Definition: Parameters.cpp:159
real EigenvalueX
Definition: Parameters.cpp:158
#define Max(x, y)
Definition: Carmen.h:54
Matrix stateUstar(const Vector &AvgL, const Vector &AvgR, const real prel, const real prer, real &slopeLeft, real &slopeRight, real &slopeM, real &slopeLeftStar, real &slopeRightStar, int AxisNo)
Returns the intermediary states of HLLD numerical flux for MHD equations.
Definition: IntermediaryStates.cpp:12
#define real
Definition: PreProcessor.h:31