Skip to content

Commit

Permalink
ideal weights done
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisZYJ committed Nov 13, 2024
1 parent fc880fc commit d00d100
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/pre_process/m_checker.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contains

! Common checks for all directions (stretch_x, stretch_y, and stretch_z)
#:for X in ['x', 'y', 'z']
@:PROHIBIT(stretch_${X}$ .and. weno_order == 7, "weno_order = 7 does not support stretched grids")
! @:PROHIBIT(stretch_${X}$ .and. weno_order == 7, "weno_order = 7 does not support stretched grids")
@:PROHIBIT(stretch_${X}$ .and. old_grid, "old_grid and stretch_${X}$ are incompatible")
@:PROHIBIT(stretch_${X}$ .and. f_is_default(a_${X}$), "a_${X}$ must be set with stretch_${X}$ enabled")
@:PROHIBIT(stretch_${X}$ .and. f_is_default(${X}$_a), "${X}$_a must be set with stretch_${X}$ enabled")
Expand Down
120 changes: 67 additions & 53 deletions src/simulation/m_weno.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ module m_weno
real(kind(0d0)), dimension(0:3,4) :: CpR
real(kind(0d0)), dimension(0:3,10) :: Cb

real(kind(0d0)) :: x(1:5) ! Intermediate variables
real(kind(0d0)) :: w(1:8) ! Intermediate variables for overall stencil for ideal weights
real(kind(0d0)) :: x(1:5) ! Intermediate variables for sub-stencils for poly and beta

! END: WENO Coefficients ===================================================

Expand Down Expand Up @@ -494,17 +495,30 @@ contains
else ! WENO7
! Note: WENO7 only supports uniform grid
if (.not. teno) then
! (Balsara & Shu, 2000) Page 11 Section III.a
d_cbL_${XYZ}$ (0, :) = 4d0/35d0
d_cbL_${XYZ}$ (1, :) = 18d0/35d0
d_cbL_${XYZ}$ (2, :) = 12d0/35d0
d_cbL_${XYZ}$ (3, :) = 1d0/35d0
! ! (Balsara & Shu, 2000) Page 11 Section III.a
! d_cbL_${XYZ}$ (0, :) = 4d0/35d0
! d_cbL_${XYZ}$ (1, :) = 18d0/35d0
! d_cbL_${XYZ}$ (2, :) = 12d0/35d0
! d_cbL_${XYZ}$ (3, :) = 1d0/35d0

d_cbR_${XYZ}$ (0, :) = 1d0/35d0
d_cbR_${XYZ}$ (1, :) = 12d0/35d0
d_cbR_${XYZ}$ (2, :) = 18d0/35d0
d_cbR_${XYZ}$ (3, :) = 4d0/35d0
! d_cbR_${XYZ}$ (0, :) = 1d0/35d0
! d_cbR_${XYZ}$ (1, :) = 12d0/35d0
! d_cbR_${XYZ}$ (2, :) = 18d0/35d0
! d_cbR_${XYZ}$ (3, :) = 4d0/35d0

do i = is%beg - 1 + weno_polyn, is%end - 1 - weno_polyn
w = s_cb(i + 4:i - 3:-1) ! Left has the reversed order of both points and coefficients compared to the right
d_cbL_${XYZ}$ (0, i + 1) = ((w(1) - w(5))*(w(2) - w(5))*(w(3) - w(5)))/((w(1) - w(8))*(w(2) - w(8))*(w(3) - w(8)))
d_cbL_${XYZ}$ (1, i + 1) = ((w(1) - w(5))*(w(2) - w(5))*(w(5) - w(8))*(w(1)*w(2) + w(1)*w(3) + w(2)*w(3) - w(1)*w(7) - w(1)*w(8) - w(2)*w(7) - w(2)*w(8) - w(3)*w(7) - w(3)*w(8) + w(7)*w(8) + w(7)**2 + w(8)**2))/((w(1) - w(7))*(w(1) - w(8))*(w(2) - w(7))*(w(2) - w(8))*(w(3) - w(8)))
d_cbL_${XYZ}$ (2, i + 1) = ((w(1) - w(5))*(w(5) - w(7))*(w(5) - w(8))*(w(1)*w(2) - w(1)*w(6) - w(1)*w(7) - w(2)*w(6) - w(1)*w(8) - w(2)*w(7) - w(2)*w(8) + w(6)*w(7) + w(6)*w(8) + w(7)*w(8) + w(1)**2 + w(2)**2))/((w(1) - w(6))*(w(1) - w(7))*(w(1) - w(8))*(w(2) - w(7))*(w(2) - w(8)))
d_cbL_${XYZ}$ (3, i + 1) = ((w(5) - w(6))*(w(5) - w(7))*(w(5) - w(8)))/((w(1) - w(6))*(w(1) - w(7))*(w(1) - w(8)))

w = s_cb(i - 3:i + 4)
d_cbR_${XYZ}$ (0, i + 1) = ((w(5) - w(6))*(w(5) - w(7))*(w(5) - w(8)))/((w(1) - w(6))*(w(1) - w(7))*(w(1) - w(8)))
d_cbR_${XYZ}$ (1, i + 1) = ((w(1) - w(5))*(w(5) - w(7))*(w(5) - w(8))*(w(1)*w(2) - w(1)*w(6) - w(1)*w(7) - w(2)*w(6) - w(1)*w(8) - w(2)*w(7) - w(2)*w(8) + w(6)*w(7) + w(6)*w(8) + w(7)*w(8) + w(1)**2 + w(2)**2))/((w(1) - w(6))*(w(1) - w(7))*(w(1) - w(8))*(w(2) - w(7))*(w(2) - w(8)))
d_cbR_${XYZ}$ (2, i + 1) = ((w(1) - w(5))*(w(2) - w(5))*(w(5) - w(8))*(w(1)*w(2) + w(1)*w(3) + w(2)*w(3) - w(1)*w(7) - w(1)*w(8) - w(2)*w(7) - w(2)*w(8) - w(3)*w(7) - w(3)*w(8) + w(7)*w(8) + w(7)**2 + w(8)**2))/((w(1) - w(7))*(w(1) - w(8))*(w(2) - w(7))*(w(2) - w(8))*(w(3) - w(8)))
d_cbR_${XYZ}$ (3, i + 1) = ((w(1) - w(5))*(w(2) - w(5))*(w(3) - w(5)))/((w(1) - w(8))*(w(2) - w(8))*(w(3) - w(8)))
end do

! CpL(0,1) = 1d0/12d0
! CpL(0,2) = -5d0/12d0
Expand Down Expand Up @@ -548,49 +562,49 @@ contains
! CpR(3,4) = 1d0/12d0


Cb(0,1) = 547d0/240d0
Cb(0,2) = -3882d0/240d0
Cb(0,3) = 4642d0/240d0
Cb(0,4) = -1854d0/240d0
Cb(0,5) = 7043d0/240d0
Cb(0,6) = -17246d0/240d0
Cb(0,7) = 7042d0/240d0
Cb(0,8) = 11003d0/240d0
Cb(0,9) = -9402d0/240d0
Cb(0,10) = 2107d0/240d0

Cb(1,1) = 267d0/240d0
Cb(1,2) = -1642d0/240d0
Cb(1,3) = 1602d0/240d0
Cb(1,4) = -494d0/240d0
Cb(1,5) = 2843d0/240d0
Cb(1,6) = -5966d0/240d0
Cb(1,7) = 1922d0/240d0
Cb(1,8) = 3443d0/240d0
Cb(1,9) = -2522d0/240d0
Cb(1,10) = 547d0/240d0

Cb(2,1) = 547d0/240d0
Cb(2,2) = -2522d0/240d0
Cb(2,3) = 1922d0/240d0
Cb(2,4) = -494d0/240d0
Cb(2,5) = 3443d0/240d0
Cb(2,6) = -5966d0/240d0
Cb(2,7) = 1602d0/240d0
Cb(2,8) = 2843d0/240d0
Cb(2,9) = -1642d0/240d0
Cb(2,10) = 267d0/240d0

Cb(3,1) = 2107d0/240d0
Cb(3,2) = -9402d0/240d0
Cb(3,3) = 7042d0/240d0
Cb(3,4) = -1854d0/240d0
Cb(3,5) = 11003d0/240d0
Cb(3,6) = -17246d0/240d0
Cb(3,7) = 4642d0/240d0
Cb(3,8) = 7043d0/240d0
Cb(3,9) = -3882d0/240d0
Cb(3,10) = 547d0/240d0
! Cb(0,1) = 547d0/240d0
! Cb(0,2) = -3882d0/240d0
! Cb(0,3) = 4642d0/240d0
! Cb(0,4) = -1854d0/240d0
! Cb(0,5) = 7043d0/240d0
! Cb(0,6) = -17246d0/240d0
! Cb(0,7) = 7042d0/240d0
! Cb(0,8) = 11003d0/240d0
! Cb(0,9) = -9402d0/240d0
! Cb(0,10) = 2107d0/240d0

! Cb(1,1) = 267d0/240d0
! Cb(1,2) = -1642d0/240d0
! Cb(1,3) = 1602d0/240d0
! Cb(1,4) = -494d0/240d0
! Cb(1,5) = 2843d0/240d0
! Cb(1,6) = -5966d0/240d0
! Cb(1,7) = 1922d0/240d0
! Cb(1,8) = 3443d0/240d0
! Cb(1,9) = -2522d0/240d0
! Cb(1,10) = 547d0/240d0

! Cb(2,1) = 547d0/240d0
! Cb(2,2) = -2522d0/240d0
! Cb(2,3) = 1922d0/240d0
! Cb(2,4) = -494d0/240d0
! Cb(2,5) = 3443d0/240d0
! Cb(2,6) = -5966d0/240d0
! Cb(2,7) = 1602d0/240d0
! Cb(2,8) = 2843d0/240d0
! Cb(2,9) = -1642d0/240d0
! Cb(2,10) = 267d0/240d0

! Cb(3,1) = 2107d0/240d0
! Cb(3,2) = -9402d0/240d0
! Cb(3,3) = 7042d0/240d0
! Cb(3,4) = -1854d0/240d0
! Cb(3,5) = 11003d0/240d0
! Cb(3,6) = -17246d0/240d0
! Cb(3,7) = 4642d0/240d0
! Cb(3,8) = 7043d0/240d0
! Cb(3,9) = -3882d0/240d0
! Cb(3,10) = 547d0/240d0

do i = is%beg - 1 + weno_polyn, is%end - 1 - weno_polyn

Expand Down

0 comments on commit d00d100

Please sign in to comment.