3 from .equation
import Equation
9 raise Exception(
"SWE must be in 2 dimensions")
16 constexpr double grav = 9.81;
18 const double u = Q[1 + normal] / Q[0];
19 const double c = std::sqrt(grav * Q[0]);
21 return std::fmax(std::abs(u + c), std::abs(u - c));
26 double ih = 1.0 / Q[0];
29 F[1] = Q[1 + normal] * Q[1] * ih;
30 F[2] = Q[1 + normal] * Q[2] * ih;
36 constexpr double grav = 9.81;
37 BTimesDeltaQ[0] = 0.0;
40 BTimesDeltaQ[1] = grav * Q[0] * (deltaQ[0] + deltaQ[3]);
41 BTimesDeltaQ[2] = 0.0;
44 BTimesDeltaQ[1] = 0.0;
45 BTimesDeltaQ[2] = grav * Q[0] * (deltaQ[0] + deltaQ[3]);
48 BTimesDeltaQ[3] = 0.0;
53 //Compute max eigenvalue over face
55 for(int xy=0; xy<Order+1; xy++){
56 smax = std::max(smax, maxEigenvalue(&QL[xy*4], x, h, t, dt, direction));
57 smax = std::max(smax, maxEigenvalue(&QR[xy*4], x, h, t, dt, direction));
60 for(int xy=0; xy<Order+1; xy++){
62 // h gets added term from bathimetry, u and v are regular Rusanov, b does not change
63 FL[xy*4+0] = 0.5*(FL[xy*4+0]+FR[xy*4+0] + smax*(QL[xy*4+0]+QL[xy*4+3]-QR[xy*4+0]-QR[xy*4+3]) );
64 FL[xy*4+1] = 0.5*(FL[xy*4+1]+FR[xy*4+1] + smax*(QL[xy*4+1]-QR[xy*4+1]) );
65 FL[xy*4+2] = 0.5*(FL[xy*4+2]+FR[xy*4+2] + smax*(QL[xy*4+2]-QR[xy*4+2]) );
68 FR[xy*4+0] = FL[xy*4+0];
69 FR[xy*4+1] = FL[xy*4+1];
70 FR[xy*4+2] = FL[xy*4+2];
73 //Contribution from NCP
74 FL[xy*4+direction+1] += 0.5*9.81*0.5*(QL[xy*4+0]+QR[xy*4+0])*(QR[xy*4+3]+QR[xy*4+0]-QL[xy*4+3]-QL[xy*4+0]);
75 FR[xy*4+direction+1] -= 0.5*9.81*0.5*(QL[xy*4+0]+QR[xy*4+0])*(QR[xy*4+3]+QR[xy*4+0]-QL[xy*4+3]-QL[xy*4+0]);
83 raise Exception(
"SWE must be in 2 dimensions")
90 constexpr double grav = 9.81;
92 const double u = Q[1 + normal] / Q[0];
93 const double c = std::sqrt(grav * Q[0]);
95 return std::fmax(std::abs(u + c), std::abs(u - c));
100 constexpr double grav = 9.81;
101 double ih = 1.0 / Q[0];
103 F[0] = Q[1 + normal];
104 F[1] = Q[1 + normal] * Q[1] * ih;
105 F[2] = Q[1 + normal] * Q[2] * ih;
107 F[normal+1] += 0.5 * grav * Q[0] * Q[0];
int num_auxiliary_variables
def __init__(self, dimensions=2)
def __init__(self, dimensions=2)