Skip to content

Commit 2ce3fcc

Browse files
authored
Merge branch 'develop' into feature_clang-tidy
2 parents 48f4679 + 9fb797a commit 2ce3fcc

7 files changed

Lines changed: 275 additions & 1 deletion

File tree

Common/include/option_structure.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,9 @@ static const MapType<std::string, ENUM_MATRIX_COLORING> MatrixColoring_Map = {
895895
enum class LIMITER {
896896
NONE , /*!< \brief No limiter. */
897897
VENKATAKRISHNAN , /*!< \brief Slope limiter using Venkatakrisnan method (stencil formulation). */
898+
NISHIKAWA_R3 , /*!< \brief Slope limiter using Nishikawa's R3 method (stencil formulation). */
899+
NISHIKAWA_R4 , /*!< \brief Slope limiter using Nishikawa's R4 method (stencil formulation). */
900+
NISHIKAWA_R5 , /*!< \brief Slope limiter using Nishikawa's R5 method (stencil formulation). */
898901
VENKATAKRISHNAN_WANG , /*!< \brief Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation). */
899902
BARTH_JESPERSEN , /*!< \brief Slope limiter using Barth-Jespersen method (stencil formulation). */
900903
VAN_ALBADA_EDGE , /*!< \brief Slope limiter using Van Albada method (edge formulation). */
@@ -904,6 +907,9 @@ enum class LIMITER {
904907
static const MapType<std::string, LIMITER> Limiter_Map = {
905908
MakePair("NONE", LIMITER::NONE)
906909
MakePair("VENKATAKRISHNAN", LIMITER::VENKATAKRISHNAN)
910+
MakePair("NISHIKAWA_R3", LIMITER::NISHIKAWA_R3)
911+
MakePair("NISHIKAWA_R4", LIMITER::NISHIKAWA_R4)
912+
MakePair("NISHIKAWA_R5", LIMITER::NISHIKAWA_R5)
907913
MakePair("VENKATAKRISHNAN_WANG", LIMITER::VENKATAKRISHNAN_WANG)
908914
MakePair("BARTH_JESPERSEN", LIMITER::BARTH_JESPERSEN)
909915
MakePair("VAN_ALBADA_EDGE", LIMITER::VAN_ALBADA_EDGE)

Common/src/CConfig.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6602,6 +6602,18 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
66026602
cout << "Venkatakrishnan slope-limiting method, with constant: " << Venkat_LimiterCoeff << ".\n";
66036603
cout << "The reference element size is: " << RefElemLength << ". " << endl;
66046604
break;
6605+
case LIMITER::NISHIKAWA_R3:
6606+
cout << "Nishikawa's R3 slope-limiting method, with constant: " << Venkat_LimiterCoeff << ".\n";
6607+
cout << "The reference element size is: " << RefElemLength << ". " << endl;
6608+
break;
6609+
case LIMITER::NISHIKAWA_R4:
6610+
cout << "Nishikawa's R4 slope-limiting method, with constant: " << Venkat_LimiterCoeff << ".\n";
6611+
cout << "The reference element size is: " << RefElemLength << ". " << endl;
6612+
break;
6613+
case LIMITER::NISHIKAWA_R5:
6614+
cout << "Nishikawa's R5 slope-limiting method, with constant: " << Venkat_LimiterCoeff << ".\n";
6615+
cout << "The reference element size is: " << RefElemLength << ". " << endl;
6616+
break;
66056617
case LIMITER::VENKATAKRISHNAN_WANG:
66066618
cout << "Venkatakrishnan-Wang slope-limiting method, with constant: " << Venkat_LimiterCoeff << "." << endl;
66076619
break;

SU2_CFD/include/limiters/CLimiterDetails.hpp

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,36 @@ struct LimiterHelpers
8787
Type factor = 0.5*(1.0+dist+sin(PI_NUMBER*dist)/PI_NUMBER);
8888
return max(0.0, min(factor, 1.0));
8989
}
90+
91+
FORCEINLINE static Type r3Function(const Type& proj, const Type& delta, const Type& epsp)
92+
{
93+
Type Dp = fabs(delta);
94+
Type Dm = fabs(proj);
95+
if(Dp>(2.0*Dm)) return 1.0;
96+
Type y = pow(Dp, 3) + epsp;
97+
Type S3 = 4.0*Dm*Dm;
98+
return (y + Dp*S3) / (y + Dm*(delta*delta+S3));
99+
}
100+
101+
FORCEINLINE static Type r4Function(const Type& proj, const Type& delta, const Type& epsp)
102+
{
103+
Type Dp = fabs(delta);
104+
Type Dm = fabs(proj);
105+
if(Dp>(2.0*Dm)) return 1.0;
106+
Type y = pow(Dp, 4) + epsp;
107+
Type S4 = 2.0*Dm*(Dp*Dp-2.0*Dm*(Dp-2.0*Dm));
108+
return (y + Dp*S4) / (y + Dm*(pow(delta,3)+S4));
109+
}
110+
111+
FORCEINLINE static Type r5Function(const Type& proj, const Type& delta, const Type& epsp)
112+
{
113+
Type Dp = fabs(delta);
114+
Type Dm = fabs(proj);
115+
if(Dp>(2.0*Dm)) return 1.0;
116+
Type y = pow(Dp, 5) + epsp;
117+
Type S5 = 8.0*Dm*Dm*(Dp*Dp-2.0*Dm*(Dp-Dm));
118+
return (y + Dp*S5) / (y + Dm*(pow(delta,4)+S5));
119+
}
90120
};
91121

92122

@@ -159,6 +189,119 @@ struct CLimiterDetails<LIMITER::VENKATAKRISHNAN>
159189
};
160190

161191

192+
/*!
193+
* \brief Nishikawa's R3 limiter specialization.
194+
* \ingroup FvmAlgos
195+
*/
196+
template<>
197+
struct CLimiterDetails<LIMITER::NISHIKAWA_R3>
198+
{
199+
su2double epsp;
200+
201+
/*!
202+
* \brief Store the reference lenght based eps^3 parameter,
203+
* limited to a small number to avoid divisions by 0.
204+
*/
205+
template<class... Ts>
206+
inline void preprocess(CGeometry&, const CConfig& config, Ts&...)
207+
{
208+
su2double L = config.GetRefElemLength();
209+
su2double K = config.GetVenkat_LimiterCoeff();
210+
su2double eps1 = fabs(L*K);
211+
epsp = max(pow(eps1, 4), LimiterHelpers<>::epsilon());
212+
}
213+
214+
/*!
215+
* \brief No geometric modification for this kind of limiter.
216+
*/
217+
template<class... Ts>
218+
inline su2double geometricFactor(Ts&...) const {return 1.0;}
219+
220+
/*!
221+
* \brief Smooth function that disables limiting in smooth regions.
222+
*/
223+
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
224+
{
225+
return LimiterHelpers<>::r3Function(proj, delta, epsp);
226+
}
227+
};
228+
229+
230+
/*!
231+
* \brief Nishikawa's R4 limiter specialization.
232+
* \ingroup FvmAlgos
233+
*/
234+
template<>
235+
struct CLimiterDetails<LIMITER::NISHIKAWA_R4>
236+
{
237+
su2double epsp;
238+
239+
/*!
240+
* \brief Store the reference lenght based eps^4 parameter,
241+
* limited to a small number to avoid divisions by 0.
242+
*/
243+
template<class... Ts>
244+
inline void preprocess(CGeometry&, const CConfig& config, Ts&...)
245+
{
246+
su2double L = config.GetRefElemLength();
247+
su2double K = config.GetVenkat_LimiterCoeff();
248+
su2double eps1 = fabs(L*K);
249+
epsp = max(pow(eps1, 5), LimiterHelpers<>::epsilon());
250+
}
251+
252+
/*!
253+
* \brief No geometric modification for this kind of limiter.
254+
*/
255+
template<class... Ts>
256+
inline su2double geometricFactor(Ts&...) const {return 1.0;}
257+
258+
/*!
259+
* \brief Smooth function that disables limiting in smooth regions.
260+
*/
261+
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
262+
{
263+
return LimiterHelpers<>::r4Function(proj, delta, epsp);
264+
}
265+
};
266+
267+
268+
/*!
269+
* \brief Nishikawa's R5 limiter specialization.
270+
* \ingroup FvmAlgos
271+
*/
272+
template<>
273+
struct CLimiterDetails<LIMITER::NISHIKAWA_R5>
274+
{
275+
su2double epsp;
276+
277+
/*!
278+
* \brief Store the reference lenght based eps^5 parameter,
279+
* limited to a small number to avoid divisions by 0.
280+
*/
281+
template<class... Ts>
282+
inline void preprocess(CGeometry&, const CConfig& config, Ts&...)
283+
{
284+
su2double L = config.GetRefElemLength();
285+
su2double K = config.GetVenkat_LimiterCoeff();
286+
su2double eps1 = fabs(L*K);
287+
epsp = max(pow(eps1, 6), LimiterHelpers<>::epsilon());
288+
}
289+
290+
/*!
291+
* \brief No geometric modification for this kind of limiter.
292+
*/
293+
template<class... Ts>
294+
inline su2double geometricFactor(Ts&...) const {return 1.0;}
295+
296+
/*!
297+
* \brief Smooth function that disables limiting in smooth regions.
298+
*/
299+
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
300+
{
301+
return LimiterHelpers<>::r5Function(proj, delta, epsp);
302+
}
303+
};
304+
162305
/*!
163306
* \brief Venkatakrishnan-Wang specialization.
164307
* \ingroup FvmAlgos

SU2_CFD/include/limiters/computeLimiters.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ if (geometry.GetnDim() == 2) {\
8282
INSTANTIATE(LIMITER::VENKATAKRISHNAN);
8383
break;
8484
}
85+
case LIMITER::NISHIKAWA_R3:
86+
{
87+
INSTANTIATE(LIMITER::NISHIKAWA_R3);
88+
break;
89+
}
90+
case LIMITER::NISHIKAWA_R4:
91+
{
92+
INSTANTIATE(LIMITER::NISHIKAWA_R4);
93+
break;
94+
}
95+
case LIMITER::NISHIKAWA_R5:
96+
{
97+
INSTANTIATE(LIMITER::NISHIKAWA_R5);
98+
break;
99+
}
85100
case LIMITER::VENKATAKRISHNAN_WANG:
86101
{
87102
INSTANTIATE(LIMITER::VENKATAKRISHNAN_WANG);

TestCases/euler/ramp/inv_ramp.cfg

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Supersonic flow over a ramp in a channel (regression) %
5+
% Author: Thomas D. Economon, Amit Sachdeva %
6+
% Institution: Stanford University %
7+
% Date: 2023.04.08 %
8+
% File Version 7.5.1 "Blackbird" %
9+
% %
10+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11+
12+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
13+
%
14+
SOLVER= EULER
15+
MATH_PROBLEM= DIRECT
16+
RESTART_SOL= YES
17+
18+
% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------%
19+
%
20+
MACH_NUMBER= 2.0
21+
AOA= 0.0
22+
SIDESLIP_ANGLE= 0.0
23+
FREESTREAM_PRESSURE= 100000.0
24+
FREESTREAM_TEMPERATURE= 300.0
25+
26+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
27+
%
28+
REF_ORIGIN_MOMENT_X = 0.25
29+
REF_ORIGIN_MOMENT_Y = 0.00
30+
REF_ORIGIN_MOMENT_Z = 0.00
31+
REF_LENGTH= 1.0
32+
REF_AREA= 1.0
33+
34+
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
35+
%
36+
MARKER_EULER= ( upper, lower )
37+
MARKER_SUPERSONIC_INLET= ( inlet, 300.0, 100000.0, 695.4290761824674, 0.0, 0.0 )
38+
MARKER_OUTLET= ( outlet, 10000.0 )
39+
MARKER_PLOTTING= ( lower )
40+
MARKER_MONITORING= ( upper, lower )
41+
42+
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
43+
%
44+
NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES
45+
CFL_NUMBER= 1.0
46+
CFL_ADAPT= YES
47+
CFL_ADAPT_PARAM= ( 0.9, 1.1, 1.0, 100.0, 0.8)
48+
ITER= 500
49+
LINEAR_SOLVER= FGMRES
50+
LINEAR_SOLVER_ERROR= 1E-6
51+
LINEAR_SOLVER_ITER= 3
52+
NEWTON_KRYLOV= YES
53+
NEWTON_KRYLOV_IPARAM= (0, 1, 1) % n0, np, ft
54+
NEWTON_KRYLOV_DPARAM= (0.0, 1e-20, -2.0, 1e-5) % r0, tp, rf, e
55+
MGLEVEL= 0
56+
57+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
58+
%
59+
CONV_NUM_METHOD_FLOW= AUSMPLUSUP
60+
MUSCL_FLOW= YES
61+
SLOPE_LIMITER_FLOW= NISHIKAWA_R5
62+
VENKAT_LIMITER_COEFF= 0.5
63+
TIME_DISCRE_FLOW= EULER_IMPLICIT
64+
65+
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
66+
%
67+
CONV_RESIDUAL_MINVAL= -13
68+
CONV_STARTITER= 10
69+
CONV_CAUCHY_ELEMS= 100
70+
CONV_CAUCHY_EPS= 1E-10
71+
72+
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
73+
%
74+
MESH_FILENAME= ramp_unst.su2
75+
MESH_FORMAT= SU2
76+
MESH_OUT_FILENAME= mesh_out.su2
77+
SOLUTION_FILENAME= restart_flow.dat
78+
SOLUTION_ADJ_FILENAME= solution_adj.dat
79+
TABULAR_FORMAT= CSV
80+
CONV_FILENAME= history
81+
RESTART_FILENAME= restart_flowrun.dat
82+
RESTART_ADJ_FILENAME= restart_adj.dat
83+
VOLUME_FILENAME= flow
84+
VOLUME_ADJ_FILENAME= adjoint
85+
GRAD_OBJFUNC_FILENAME= of_grad.dat
86+
SURFACE_FILENAME= surface_flow
87+
SURFACE_ADJ_FILENAME= surface_adjoint
88+
OUTPUT_WRT_FREQ= 250
89+
SCREEN_OUTPUT = (INNER_ITER, RMS_DENSITY, RMS_ENERGY, LIFT, DRAG)
90+

TestCases/parallel_regression.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ def main():
257257
ea_naca64206.test_iter = 10
258258
ea_naca64206.test_vals = [-1.076215, -0.391987, -0.000701, 67775.0]
259259
test_list.append(ea_naca64206)
260+
261+
# SUPERSONIC FLOW PAST A RAMP IN A CHANNEL
262+
ramp = TestCase('ramp')
263+
ramp.cfg_dir = "euler/ramp"
264+
ramp.cfg_file = "inv_ramp.cfg"
265+
ramp.test_iter = 10
266+
ramp.test_vals = [-13.399623, -7.788893, -0.081064, 0.056474] #last 4 columns
267+
test_list.append(ramp)
260268

261269
##########################
262270
### Compressible N-S ###

config_template.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ SLOPE_LIMITER_TURB= VENKATAKRISHNAN
11121112
MUSCL_ADJFLOW= YES
11131113
%
11141114
% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, BARTH_JESPERSEN, VAN_ALBADA_EDGE,
1115-
% SHARP_EDGES, WALL_DISTANCE)
1115+
% SHARP_EDGES, WALL_DISTANCE, NISHIKAWA_R3, NISHIKAWA_R4, NISHIKAWA_R5)
11161116
SLOPE_LIMITER_ADJFLOW= VENKATAKRISHNAN
11171117
%
11181118
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence adjoint equations.

0 commit comments

Comments
 (0)