12 #define _FIRST_ORDER_UPWIND_ "1" 14 #define _SECOND_ORDER_CENTRAL_ "2" 16 #define _SECOND_ORDER_MUSCL_ "muscl2" 18 #define _THIRD_ORDER_MUSCL_ "muscl3" 20 #define _FOURTH_ORDER_CENTRAL_ "4" 22 #define _FIFTH_ORDER_UPWIND_ "upw5" 24 #define _FIFTH_ORDER_COMPACT_UPWIND_ "cupw5" 26 #define _FIFTH_ORDER_WENO_ "weno5" 28 #define _FIFTH_ORDER_CRWENO_ "crweno5" 30 #define _FIFTH_ORDER_HCWENO_ "hcweno5" 33 #define _CHARACTERISTIC_ "characteristic" 34 #define _COMPONENTS_ "components" 127 #if defined(HAVE_CUDA) 175 typedef struct paramters_muscl {
181 double (*LimiterFunction) (double);
194 typedef struct parameters_weno {
228 #define _WENO_OPTIMAL_WEIGHT_1_ 0.1 230 #define _WENO_OPTIMAL_WEIGHT_2_ 0.6 232 #define _WENO_OPTIMAL_WEIGHT_3_ 0.3 234 #define _CRWENO_OPTIMAL_WEIGHT_1_ 0.2 236 #define _CRWENO_OPTIMAL_WEIGHT_2_ 0.5 238 #define _CRWENO_OPTIMAL_WEIGHT_3_ 0.3 265 #define _WENOWeights_v_JS_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,N) \ 269 double b1, b2, b3, a1, a2, a3, a_sum_inv; \ 270 for (idx=0; idx<N; idx++) { \ 271 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 272 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 273 a1 = c1 / ( (b1+eps) * (b1+eps) ); \ 274 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 275 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 276 a2 = c2 / ( (b2+eps) * (b2+eps) ); \ 277 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 278 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 279 a3 = c3 / ( (b3+eps) * (b3+eps) ); \ 280 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 281 w1[idx] = a1 * a_sum_inv; \ 282 w2[idx] = a2 * a_sum_inv; \ 283 w3[idx] = a3 * a_sum_inv; \ 314 #define _WENOWeights_v_M_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,N) \ 318 double b1, b2, b3, a1, a2, a3, a_sum_inv; \ 319 for (idx=0; idx<N; idx++) { \ 320 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 321 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 322 a1 = c1 / ( (b1+eps) * (b1+eps) ); \ 323 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 324 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 325 a2 = c2 / ( (b2+eps) * (b2+eps) ); \ 326 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 327 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 328 a3 = c3 / ( (b3+eps) * (b3+eps) ); \ 329 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 330 w1[idx] = a1 * a_sum_inv; \ 331 w2[idx] = a2 * a_sum_inv; \ 332 w3[idx] = a3 * a_sum_inv; \ 333 a1 = w1[idx] * (c1 + c1*c1 - 3*c1*w1[idx] + w1[idx]*w1[idx]) / (c1*c1 + w1[idx]*(1.0-2.0*c1)); \ 334 a2 = w2[idx] * (c2 + c2*c2 - 3*c2*w2[idx] + w2[idx]*w2[idx]) / (c2*c2 + w2[idx]*(1.0-2.0*c2)); \ 335 a3 = w3[idx] * (c3 + c3*c3 - 3*c3*w3[idx] + w3[idx]*w3[idx]) / (c3*c3 + w3[idx]*(1.0-2.0*c3)); \ 336 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 337 w1[idx] = a1 * a_sum_inv; \ 338 w2[idx] = a2 * a_sum_inv; \ 339 w3[idx] = a3 * a_sum_inv; \ 370 #define _WENOWeights_v_M_Scalar_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,idx) \ 373 double b1, b2, b3, a1, a2, a3, a_sum_inv; \ 374 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 375 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 376 a1 = c1 / ( (b1+eps) * (b1+eps) ); \ 377 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 378 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 379 a2 = c2 / ( (b2+eps) * (b2+eps) ); \ 380 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 381 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 382 a3 = c3 / ( (b3+eps) * (b3+eps) ); \ 383 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 384 w1[idx] = a1 * a_sum_inv; \ 385 w2[idx] = a2 * a_sum_inv; \ 386 w3[idx] = a3 * a_sum_inv; \ 387 a1 = w1[idx] * (c1 + c1*c1 - 3*c1*w1[idx] + w1[idx]*w1[idx]) / (c1*c1 + w1[idx]*(1.0-2.0*c1)); \ 388 a2 = w2[idx] * (c2 + c2*c2 - 3*c2*w2[idx] + w2[idx]*w2[idx]) / (c2*c2 + w2[idx]*(1.0-2.0*c2)); \ 389 a3 = w3[idx] * (c3 + c3*c3 - 3*c3*w3[idx] + w3[idx]*w3[idx]) / (c3*c3 + w3[idx]*(1.0-2.0*c3)); \ 390 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 391 w1[idx] = a1 * a_sum_inv; \ 392 w2[idx] = a2 * a_sum_inv; \ 393 w3[idx] = a3 * a_sum_inv; \ 426 #define _WENOWeights_v_Z_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,N) \ 430 double b1, b2, b3, a1, a2, a3, a_sum_inv, tau; \ 431 for (idx=0; idx<N; idx++) { \ 432 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 433 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 434 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 435 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 436 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 437 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 438 tau = absolute(b3 - b1); \ 439 a1 = c1 * (1.0 + (tau/(b1+eps)) * (tau/(b1+eps)) ); \ 440 a2 = c2 * (1.0 + (tau/(b2+eps)) * (tau/(b2+eps)) ); \ 441 a3 = c3 * (1.0 + (tau/(b3+eps)) * (tau/(b3+eps)) ); \ 442 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 443 w1[idx] = a1 * a_sum_inv; \ 444 w2[idx] = a2 * a_sum_inv; \ 445 w3[idx] = a3 * a_sum_inv; \ 479 #define _WENOWeights_v_YC_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,N) \ 483 double b1, b2, b3, a1, a2, a3, a_sum_inv, tau; \ 484 for (idx=0; idx<N; idx++) { \ 485 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 486 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 487 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 488 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 489 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 490 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 491 tau = (m3[idx]-4*m2[idx]+6*m1[idx]-4*p1[idx]+p2[idx])*(m3[idx]-4*m2[idx]+6*m1[idx]-4*p1[idx]+p2[idx]); \ 492 a1 = c1 * (1.0 + (tau/(b1+eps)) * (tau/(b1+eps)) ); \ 493 a2 = c2 * (1.0 + (tau/(b2+eps)) * (tau/(b2+eps)) ); \ 494 a3 = c3 * (1.0 + (tau/(b3+eps)) * (tau/(b3+eps)) ); \ 495 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 496 w1[idx] = a1 * a_sum_inv; \ 497 w2[idx] = a2 * a_sum_inv; \ 498 w3[idx] = a3 * a_sum_inv; \ 532 #define _WENOWeights_v_YC_Scalar_(w1,w2,w3,c1,c2,c3,m3,m2,m1,p1,p2,eps,idx) \ 535 double b1, b2, b3, a1, a2, a3, a_sum_inv, tau; \ 536 b1 = thirteen_by_twelve*(m3[idx]-2*m2[idx]+m1[idx])*(m3[idx]-2*m2[idx]+m1[idx]) \ 537 + one_fourth*(m3[idx]-4*m2[idx]+3*m1[idx])*(m3[idx]-4*m2[idx]+3*m1[idx]); \ 538 b2 = thirteen_by_twelve*(m2[idx]-2*m1[idx]+p1[idx])*(m2[idx]-2*m1[idx]+p1[idx]) \ 539 + one_fourth*(m2[idx]-p1[idx])*(m2[idx]-p1[idx]); \ 540 b3 = thirteen_by_twelve*(m1[idx]-2*p1[idx]+p2[idx])*(m1[idx]-2*p1[idx]+p2[idx]) \ 541 + one_fourth*(3*m1[idx]-4*p1[idx]+p2[idx])*(3*m1[idx]-4*p1[idx]+p2[idx]); \ 542 tau = (m3[idx]-4*m2[idx]+6*m1[idx]-4*p1[idx]+p2[idx])*(m3[idx]-4*m2[idx]+6*m1[idx]-4*p1[idx]+p2[idx]); \ 543 a1 = c1 * (1.0 + (tau/(b1+eps)) * (tau/(b1+eps)) ); \ 544 a2 = c2 * (1.0 + (tau/(b2+eps)) * (tau/(b2+eps)) ); \ 545 a3 = c3 * (1.0 + (tau/(b3+eps)) * (tau/(b3+eps)) ); \ 546 a_sum_inv = 1.0 / (a1 + a2 + a3); \ 547 w1[idx] = a1 * a_sum_inv; \ 548 w2[idx] = a2 * a_sum_inv; \ 549 w3[idx] = a3 * a_sum_inv; \ 560 typedef struct compact_scheme {
int Interp1PrimSecondOrderCentral(double *, double *, double *, double *, int, int, void *, void *, int)
2nd order central reconstruction (component-wise) on a uniform grid
int WENOCleanup(void *, int)
int InterpSetLimiterVar(double *, double *, double *, int, void *, void *)
int Interp1PrimFifthOrderCRWENOChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order CRWENO reconstruction (characteristic-based) on a uniform grid
int Interp1PrimFifthOrderCRWENO(double *, double *, double *, double *, int, int, void *, void *, int)
5th order CRWENO reconstruction (component-wise) on a uniform grid
int Interp1PrimSecondOrderMUSCL(double *, double *, double *, double *, int, int, void *, void *, int)
2nd order MUSCL scheme (component-wise) on a uniform grid
int Interp1PrimFifthOrderCompactUpwindChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order compact upwind reconstruction (characteristic-based) on a uniform grid
int WENOInitialize(void *, void *, char *, char *)
int Interp1PrimFifthOrderUpwindChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order upwind reconstruction (characteristic-based) on a uniform grid
int Interp1PrimSecondOrderMUSCLChar(double *, double *, double *, double *, int, int, void *, void *, int)
2nd order MUSCL scheme (characteristic-based) on a uniform grid
int Interp1PrimFifthOrderUpwind(double *, double *, double *, double *, int, int, void *, void *, int)
5th order upwind reconstruction (component-wise) on a uniform grid
Some basic definitions and macros.
int MUSCLInitialize(void *, void *)
int Interp1PrimFifthOrderHCWENO(double *, double *, double *, double *, int, int, void *, void *, int)
5th order hybrid compact-WENO reconstruction (component-wise) on a uniform grid
int CompactSchemeInitialize(void *, void *, char *)
#define _MAX_STRING_SIZE_
int Interp1PrimFirstOrderUpwindChar(double *, double *, double *, double *, int, int, void *, void *, int)
1st order upwind reconstruction (characteristic-based) on a uniform grid
int Interp1PrimFifthOrderWENOChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order WENO reconstruction (characteristic-based) on a uniform grid
int Interp1PrimThirdOrderMUSCLChar(double *, double *, double *, double *, int, int, void *, void *, int)
3rd order MUSCL scheme with Koren's limiter (characteristic-based) on a uniform grid ...
int Interp1PrimFourthOrderCentral(double *, double *, double *, double *, int, int, void *, void *, int)
4th order central reconstruction (component-wise) on a uniform grid
Structure of variables/parameters needed by the WENO-type scheme.
Structure of variables/parameters needed by the compact schemes.
int CompactSchemeCleanup(void *)
int Interp1PrimFifthOrderHCWENOChar(double *, double *, double *, double *, int, int, void *, void *, int)
5th order hybrid compact-WENO reconstruction (characteristic-based) on a uniform grid ...
int Interp1PrimSecondOrderCentralChar(double *, double *, double *, double *, int, int, void *, void *, int)
2nd order central reconstruction (characteristic-based) on a uniform grid
Structure of variables/parameters needed by the MUSCL scheme.
int Interp1PrimFifthOrderCompactUpwind(double *, double *, double *, double *, int, int, void *, void *, int)
5th order compact upwind reconstruction (component-wise) on a uniform grid
int Interp1PrimFourthOrderCentralChar(double *, double *, double *, double *, int, int, void *, void *, int)
4th order central reconstruction (characteristic-based) on a uniform grid
int Interp2PrimSecondOrder(double *, double *, int, void *, void *)
2nd order component-wise interpolation of the 2nd primitive on a uniform grid
int Interp1PrimThirdOrderMUSCL(double *, double *, double *, double *, int, int, void *, void *, int)
3rd order MUSCL scheme with Koren's limiter (component-wise) on a uniform grid
int gpuInterp1PrimFifthOrderWENO(double *, double *, double *, double *, int, int, void *, void *, int)
int Interp1PrimFifthOrderWENO(double *, double *, double *, double *, int, int, void *, void *, int)
5th order WENO reconstruction (component-wise) on a uniform grid
int Interp1PrimFirstOrderUpwind(double *, double *, double *, double *, int, int, void *, void *, int)
1st order upwind reconstruction (component-wise) on a uniform grid