Skip to content

Commit

Permalink
Fixed f(x) for PPM
Browse files Browse the repository at this point in the history
  • Loading branch information
adcroft committed Oct 14, 2024
1 parent 618965f commit 3062b7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ALE/Recon1d_PPM_CW.F90
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ real function f(this, k, x)
lmx = 1.0 - xc

! This expression for u_a can overshoot u_r but is good for x<<1
u_a = this%ul(k) + xc * ( du + a6 * xc )
u_a = this%ul(k) + xc * ( du + a6 * lmx )
! This expression for u_b can overshoot u_l but is good for 1-x<<1
u_b = this%ur(k) + lmx * ( - du + a6 * lmx )
u_b = this%ur(k) + lmx * ( - du + a6 * xc )

! Since u_a and u_b are both side-bounded, using weights=0 or 1 will preserve uniformity
wb = 0.5 + sign(0.5, xc - 0.5 ) ! = 1 @ x=0, = 0 @ x=1
Expand Down Expand Up @@ -396,7 +396,9 @@ logical function unit_tests(this, verbose, stdout, stderr)
ur(k) = this%f(k, 1.)
enddo
call test%real_arr(5, ul, (/1.,3.,12.,27.,61./), 'Return left edge')
call test%real_arr(5, um, (/1.,0.25*(6*7-15),0.25*(6*19-39),0.25*(6*37-75),61./), 'Return center')
call test%real_arr(5, ur, (/1.,12.,27.,48.,61./), 'Return right edge')
stop

call this%destroy()
deallocate( um, ul, ur, ull, urr )
Expand Down
4 changes: 2 additions & 2 deletions src/ALE/Recon1d_PPM_H4_2019.F90
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ real function f(this, k, x)
lmx = 1.0 - xc

! This expression for u_a can overshoot u_r but is good for x<<1
u_a = this%ul(k) + xc * ( du + a6 * xc )
u_a = this%ul(k) + xc * ( du + a6 * lmx )
! This expression for u_b can overshoot u_l but is good for 1-x<<1
u_b = this%ur(k) + lmx * ( - du + a6 * lmx )
u_b = this%ur(k) + lmx * ( - du + a6 * xc )

! Since u_a and u_b are both side-bounded, using weights=0 or 1 will preserve uniformity
wb = 0.5 + sign(0.5, xc - 0.5 ) ! = 1 @ x=0, = 0 @ x=1
Expand Down

0 comments on commit 3062b7b

Please sign in to comment.