Skip to content

Commit

Permalink
Added finite-difference-aware logic to Diagnostics_Second_Derivatives…
Browse files Browse the repository at this point in the history
….F90
  • Loading branch information
feathern committed Jun 26, 2024
1 parent f32a7e2 commit cc6a643
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/Diagnostics/Diagnostics_Second_Derivatives.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Module Diagnostics_Second_Derivatives
Use Diagnostics_Base
Use Structures
Use Spectral_Derivatives
Use Finite_Difference, Only : d_by_dx3d3
Implicit None


Expand Down Expand Up @@ -378,20 +379,31 @@ Subroutine Compute_Second_Derivatives(inbuffer)
!Move to p1b configuration
Call d2buffer%reform()
Call d2buffer%construct('p1a')
Call gridcp%To_Spectral(d2buffer%p1b,d2buffer%p1a)
Call gridcp%dealias_buffer(d2buffer%p1a)
If (chebyshev) Then
Call gridcp%To_Spectral(d2buffer%p1b,d2buffer%p1a)
Call gridcp%dealias_buffer(d2buffer%p1a)
Else
d2buffer%p1a = d2buffer%p1b
Endif
d2buffer%p1b = 0.0
d2buffer%config='p1a'

!Write(6,*)'Steps 4 complete.'

!////////////////////////////////////////////////////////////
! Steps 5-6: Load d2_by_dr2 and d2_by_drdt into the buffer
Do i = 1, nddfields*2
j = i+nddfields*2
Call gridcp%d_by_dr_cp(i,j,d2buffer%p1a,1)
Enddo
Call gridcp%From_Spectral(d2buffer%p1a,d2buffer%p1b)
If (chebyshev) Then
Do i = 1, nddfields*2
j = i+nddfields*2
Call gridcp%d_by_dr_cp(i,j,d2buffer%p1a,1)
Enddo
Call gridcp%From_Spectral(d2buffer%p1a,d2buffer%p1b)
Else
Do i = 1, nddfields*2
j = i+nddfields*2
Call d_by_dx3d3(i,j,d2buffer%p1a,1)
Enddo
Endif
d2buffer%p1a=d2buffer%p1b
Call d2buffer%deconstruct('p1b')

Expand Down

0 comments on commit cc6a643

Please sign in to comment.