Skip to content

Commit

Permalink
Fix variable conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrus89 committed May 26, 2023
1 parent fe944ef commit f9cf883
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions components/mpas-ocean/src/shared/mpas_ocn_manufactured_solution.F
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module ocn_manufactured_solution
!--------------------------------------------------------------------

real (kind=RKIND) :: kx, ky
real (kind=RKIND) :: omega
real (kind=RKIND) :: ang_freq
real (kind=RKIND) :: eta0
real (kind=RKIND) :: H0

Expand All @@ -76,7 +76,13 @@ module ocn_manufactured_solution
!
!-----------------------------------------------------------------------

subroutine ocn_manufactured_solution_tend_thick(tend, err)!{{{
subroutine ocn_manufactured_solution_tend_thick(forcingPool, tend, err)!{{{

!-----------------------------------------------------------------
! input variables
!-----------------------------------------------------------------

type (mpas_pool_type), intent(in) :: forcingPool

!-----------------------------------------------------------------
! input/output variables
Expand All @@ -97,24 +103,27 @@ subroutine ocn_manufactured_solution_tend_thick(tend, err)!{{{

integer :: iCell, kmin, kmax, k
real (kind=RKIND) :: phase, time
real (kind=RKIND), pointer :: forcingTimeIncrement

! End preamble
!-------------
! Begin code

if (.not. config_use_manufactured_solution) return

time = daysSinceStartOfSim*86400.0_RKIND
call mpas_pool_get_array(forcingPool, 'forcingTimeIncrement', forcingTimeIncrement)

time = daysSinceStartOfSim*86400.0_RKIND + forcingTimeIncrement

do iCell = 1,nCellsOwned

kmin = minLevelCell(iCell)
kmax = maxLevelCell(iCell)

phase = kx*xCell(iCell) + ky*yCell(iCell) - omega*time
phase = kx*xCell(iCell) + ky*yCell(iCell) - ang_freq*time
do k = kmin, kmax
tend(k,iCell) = tend(k,iCell) + eta0*(-H0*(kx + ky)*sin(phase) &
- omega*cos(phase) &
- ang_freq*cos(phase) &
+ eta0*(kx + ky)*cos(2.0_RKIND*phase))
enddo

Expand All @@ -137,7 +146,13 @@ end subroutine ocn_manufactured_solution_tend_thick!}}}
!> This routine computes the velocity tendency for the manufactured solution
!
!-----------------------------------------------------------------------
subroutine ocn_manufactured_solution_tend_vel(tend, err)!{{{
subroutine ocn_manufactured_solution_tend_vel(forcingPool, tend, err)!{{{

!-----------------------------------------------------------------
! input variables
!-----------------------------------------------------------------

type (mpas_pool_type), intent(in) :: forcingPool

!-----------------------------------------------------------------
! input/output variables
Expand All @@ -158,29 +173,32 @@ subroutine ocn_manufactured_solution_tend_vel(tend, err)!{{{

integer :: iEdge, kmin, kmax, k
real (kind=RKIND) :: phase, u, v, time
real (kind=RKIND), pointer :: forcingTimeIncrement

! End preamble
!-----------------------------------------------------------------
! Begin code

if (.not. config_use_manufactured_solution) return

time = daysSinceStartOfSim*86400.0_RKIND
call mpas_pool_get_array(forcingPool, 'forcingTimeIncrement', forcingTimeIncrement)

time = daysSinceStartOfSim*86400.0_RKIND + forcingTimeIncrement

do iEdge = 1, nEdgesOwned

kmin = minLevelEdgeBot(iEdge)
kmax = maxLevelEdgeTop(iEdge)

phase = kx*xEdge(iEdge) + ky*yEdge(iEdge) - omega*time
phase = kx*xEdge(iEdge) + ky*yEdge(iEdge) - ang_freq*time

do k = kmin, kmax

u = eta0*((-fEdge(iEdge) + gravity*kx)*cos(phase) &
+ omega*sin(phase) &
+ ang_freq*sin(phase) &
- 0.5_RKIND*eta0*(kx + ky)*sin(2.0_RKIND*(phase)))
v = eta0*((fEdge(iEdge) + gravity*ky)*cos(phase) &
+ omega*sin(phase) &
+ ang_freq*sin(phase) &
- 0.5_RKIND*eta0*(kx + ky)*sin(2.0_RKIND*(phase)))

tend(k,iEdge) = tend(k,iEdge) + u*cos(angleEdge(iEdge)) + v*sin(angleEdge(iEdge))
Expand Down Expand Up @@ -233,7 +251,7 @@ subroutine ocn_manufactured_solution_init(domain, err)!{{{
block => block % next
enddo

omega = sqrt(H0*gravity * (kx**2+ky**2))
ang_freq = sqrt(H0*gravity * (kx**2+ky**2))

err = 0

Expand Down

0 comments on commit f9cf883

Please sign in to comment.