6project = exahype2.Project(
7 [
"tests",
"exahype2",
"aderdg"],
".", executable=
"ADERDG-Limiting"
19max_h = 1.1 * min(size) / (3.0**min_level)
20min_h = max_h / (3.0**max_depth)
23 // Parameters which define a symmetric NACA airfoil
24 constexpr double c = 100.;
25 constexpr double t = 0.12;
32 double yl = x[1] - h[1]/2;
33 double yu = x[1] + h[1]/2;
34 double volumePercentage = 1.0;
36 constexpr int nI = 50; // NumberOfIntegrationMeasurementPoints
37 const double hI = h[0] / nI;
39 for(int i=0; i<nI; i++){
40 double xI = x[0] + i * hI;
41 double yI = 5.0 * t * c * (
42 0.2969 * sqrt ( xI / c )
44 - 0.1015 ) * ( xI / c )
45 + 0.2843 ) * ( xI / c )
46 - 0.3516 ) * ( xI / c )
47 - 0.1260 ) * ( xI / c ) ); // Specific function for a symmetric NACA airfoil
49 if( -yI<yl && yI>yu ){ // fully within the airfoil
50 volumePercentage -= hI ;
52 else if ( yI>yl && yI<yu && -yI<yl ){ // y in cell, -y below
53 volumePercentage -= hI*(yI - yl) / (yu - yl);
55 else if ( -yI<yu && -yI>yl && yI>yu){ // -y in cell, y above
56 volumePercentage -= hI*(yu + yI) / (yu - yl);
58 else if ( yI>yl && yI<yu && -yI<yu && -yI>yl ){ // -y and y both in cell
59 volumePercentage -= hI*( 2*yI ) / (yu - yl);
63 Q[4] = std::max(0.0, std::min(1.0, volumePercentage));
66boundaryCondition =
"""
67 if (normal == 0 && x[0] == DomainOffset[0]) {
74 Qoutside[0] = Qinside[0];
75 Qoutside[1] = Qinside[1];
76 Qoutside[2] = Qinside[2];
77 Qoutside[3] = Qinside[3];
83 const double irho = 1.0 / Q[0];
84 constexpr double Gamma = 1.4;
85 const double p = (Gamma - 1) * (Q[3] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]));
88 F[1] = Q[normal+1] * Q[1] * irho;
89 F[2] = Q[normal+1] * Q[2] * irho;
90 F[3] = Q[normal+1] * irho * (Q[3] + p);
96 const double irho = 1.0 / Q[0];
97 constexpr double Gamma = 1.4;
98 const double p = (Gamma - 1) * (Q[3] - 0.5 * irho * (Q[1]*Q[1]+Q[2]*Q[2]));
100 const double c = std::sqrt(Gamma * p * irho);
101 const double u = Q[normal + 1] * irho;
104aderdg_solver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
109 time_step_relaxation=0.5,
111 auxiliary_variables=1,
112 initial_conditions=init,
113 boundary_conditions=boundaryCondition,
115 eigenvalues=eigenvalues
117 return std::max(std::abs(u-c), std::abs(u+c));""",
119aderdg_solver.add_kernel_optimisations(
120 polynomials=exahype2.solvers.aderdg.ADERDG.Polynomials.Gauss_Lobatto
122project.add_solver(aderdg_solver)
124fv_solver = exahype2.solvers.fv.riemann.GlobalAdaptiveTimeStep(
126 patch_size=2 * order + 1,
129 time_step_relaxation=0.5,
131 auxiliary_variables=1,
133 boundary_conditions=
"""
134 tarch::la::Vector<Dimensions, double> x = faceCentre;\n"""
136 initial_conditions=
"""
137 tarch::la::Vector<Dimensions, double> x = volumeCentre;
138 tarch::la::Vector<Dimensions, double> h = volumeH;\n"""
140 eigenvalues=eigenvalues
147 const double sMax = std::max(*std::max_element(LL, LL+4), *std::max_element(LR, LR+4));
149 const double vL = QL[4];
150 const double vR = QR[4];
153 Assuming anything that can't get into the other is reflected back to me.
154 own + what's reflected from what I send + what was sent to me and not reflected
155 Rl = vl*Fl + vl*Fl*(1-vr) + vr*Fr*vl
156 Rr = vr*Fr + vr*Fr*(1-vl) + vl*Fl*vr
158 for(int i=0; i<4; i++){
159 const double FLe = 0.5*vL*(FL[i]+sMax*QL[i]);
160 const double FRe = 0.5*vR*(FR[i]-sMax*QR[i]);
163 AMDQ[i] = FLe*(2-vR) + vL*FRe;
165 APDQ[i] = FRe*(2-vL) + vR*FLe;
170project.add_solver(fv_solver)
172limiter = exahype2.solvers.limiting.StaticLimiting(
173 name=
"LimitingSolver",
174 regular_solver=aderdg_solver,
175 limiting_solver=fv_solver,
176 limiting_criterion_implementation=
"""return (Q[4] == 1.0);""",
178project.add_solver(limiter)
180project.set_output_path(
"solutions")
182build_mode = peano4.api.output.CompileMode.RELEASE
184project.set_global_simulation_parameters(
185 dimensions=dimensions,
186 offset=offset[0:dimensions],
187 size=size[0:dimensions],
188 min_end_time=end_time,
189 max_end_time=end_time,
190 first_plot_time_stamp=0.0,
191 time_in_between_plots=plot_interval,
192 periodic_BC=[
False,
False],
195project.set_load_balancing(
196 "toolbox::loadbalancing::strategies::SpreadOutOnceGridStagnates",
197 "new ::exahype2::LoadBalancingConfiguration(0.98)",
199project.set_Peano4_installation(
"../../../", build_mode)
200project = project.generate_Peano4_project(
"False")
203project.build(make_clean_first=
True)