Skip to content

Commit 04ab2fd

Browse files
authored
Update CLimiterDetails.hpp
1 parent 06fe752 commit 04ab2fd

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

SU2_CFD/include/limiters/CLimiterDetails.hpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -88,34 +88,34 @@ struct LimiterHelpers
8888
return max(0.0, min(factor, 1.0));
8989
}
9090

91-
FORCEINLINE static Type R3Function(const Type& proj, const Type& delta, const Type& epsp)
91+
FORCEINLINE static Type r3Function(const Type& proj, const Type& delta, const Type& epsp)
9292
{
93-
Type Dp = fabs(delta); Type Dm = fabs(proj);
94-
if(Dp>(2.0*Dm)) {return 1.0;}
95-
else {
96-
Type y = Dp*Dp*Dp + epsp;
97-
Type S3 = 4.0*Dm*Dm;
98-
return ((y + Dp*S3) / (y + Dm*(delta*delta+S3)));}
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));
9999
}
100100

101-
FORCEINLINE static Type R4Function(const Type& proj, const Type& delta, const Type& epsp)
101+
FORCEINLINE static Type r4Function(const Type& proj, const Type& delta, const Type& epsp)
102102
{
103-
Type Dp = fabs(delta); Type Dm = fabs(proj);
104-
if(Dp>(2.0*Dm)) {return 1.0;}
105-
else {
106-
Type y = Dp*Dp*Dp*Dp + epsp;
107-
Type S4 = 2.0*Dm*(Dp*Dp-2.0*Dm*(Dp-2.0*Dm));
108-
return ((y + Dp*S4) / (y + Dm*(delta*delta*delta+S4)));}
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));
109109
}
110110

111-
FORCEINLINE static Type R5Function(const Type& proj, const Type& delta, const Type& epsp)
111+
FORCEINLINE static Type r5Function(const Type& proj, const Type& delta, const Type& epsp)
112112
{
113-
Type Dp = fabs(delta); Type Dm = fabs(proj);
114-
if(Dp>(2.0*Dm)) {return 1.0;}
115-
else {
116-
Type y = Dp*Dp*Dp*Dp*Dp + epsp;
117-
Type S5 = 8.0*Dm*Dm*(Dp*Dp-2.0*Dm*(Dp-Dm));
118-
return ((y + Dp*S5) / (y + Dm*(delta*delta*delta*delta+S5)));}
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));
119119
}
120120
};
121121

@@ -190,11 +190,11 @@ struct CLimiterDetails<LIMITER::VENKATAKRISHNAN>
190190

191191

192192
/*!
193-
* \brief Nishikawa R3 limiter specialization.
193+
* \brief Nishikawa's R3 limiter specialization.
194194
* \ingroup FvmAlgos
195195
*/
196196
template<>
197-
struct CLimiterDetails<LIMITER::NISHIKAWAR3>
197+
struct CLimiterDetails<LIMITER::NISHIKAWA_R3>
198198
{
199199
su2double epsp;
200200

@@ -208,7 +208,7 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR3>
208208
su2double L = config.GetRefElemLength();
209209
su2double K = config.GetVenkat_LimiterCoeff();
210210
su2double eps1 = fabs(L*K);
211-
epsp = max(eps1*eps1*eps1*eps1, LimiterHelpers<>::epsilon());
211+
epsp = max(pow(eps1, 4), LimiterHelpers<>::epsilon());
212212

213213
}
214214

@@ -223,17 +223,17 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR3>
223223
*/
224224
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
225225
{
226-
return LimiterHelpers<>::R3Function(proj, delta, epsp);
226+
return LimiterHelpers<>::r3Function(proj, delta, epsp);
227227
}
228228
};
229229

230230

231231
/*!
232-
* \brief Nishikawa R4 limiter specialization.
232+
* \brief Nishikawa's R4 limiter specialization.
233233
* \ingroup FvmAlgos
234234
*/
235235
template<>
236-
struct CLimiterDetails<LIMITER::NISHIKAWAR4>
236+
struct CLimiterDetails<LIMITER::NISHIKAWA_R4>
237237
{
238238
su2double epsp;
239239

@@ -247,7 +247,7 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR4>
247247
su2double L = config.GetRefElemLength();
248248
su2double K = config.GetVenkat_LimiterCoeff();
249249
su2double eps1 = fabs(L*K);
250-
epsp = max(eps1*eps1*eps1*eps1*eps1, LimiterHelpers<>::epsilon());
250+
epsp = max(pow(eps1, 5), LimiterHelpers<>::epsilon());
251251

252252
}
253253

@@ -262,17 +262,17 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR4>
262262
*/
263263
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
264264
{
265-
return LimiterHelpers<>::R4Function(proj, delta, epsp);
265+
return LimiterHelpers<>::r4Function(proj, delta, epsp);
266266
}
267267
};
268268

269269

270270
/*!
271-
* \brief Nishikawa R5 limiter specialization.
271+
* \brief Nishikawa's R5 limiter specialization.
272272
* \ingroup FvmAlgos
273273
*/
274274
template<>
275-
struct CLimiterDetails<LIMITER::NISHIKAWAR5>
275+
struct CLimiterDetails<LIMITER::NISHIKAWA_R5>
276276
{
277277
su2double epsp;
278278

@@ -286,7 +286,7 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR5>
286286
su2double L = config.GetRefElemLength();
287287
su2double K = config.GetVenkat_LimiterCoeff();
288288
su2double eps1 = fabs(L*K);
289-
epsp = max(eps1*eps1*eps1*eps1*eps1*eps1, LimiterHelpers<>::epsilon());
289+
epsp = max(pow(eps1, 6), LimiterHelpers<>::epsilon());
290290

291291
}
292292

@@ -301,7 +301,7 @@ struct CLimiterDetails<LIMITER::NISHIKAWAR5>
301301
*/
302302
inline su2double limiterFunction(size_t, su2double proj, su2double delta) const
303303
{
304-
return LimiterHelpers<>::R5Function(proj, delta, epsp);
304+
return LimiterHelpers<>::r5Function(proj, delta, epsp);
305305
}
306306
};
307307

0 commit comments

Comments
 (0)