From f9cf8839b963e7e267fce427246d34ce242496bd Mon Sep 17 00:00:00 2001 From: Steven Brus Date: Thu, 25 May 2023 22:17:03 -0500 Subject: [PATCH] Fix variable conflict --- .../shared/mpas_ocn_manufactured_solution.F | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_manufactured_solution.F b/components/mpas-ocean/src/shared/mpas_ocn_manufactured_solution.F index c8fc0948f0e5..fbd496d1bd5f 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_manufactured_solution.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_manufactured_solution.F @@ -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 @@ -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 @@ -97,6 +103,7 @@ 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 !------------- @@ -104,17 +111,19 @@ subroutine ocn_manufactured_solution_tend_thick(tend, err)!{{{ 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 @@ -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 @@ -158,6 +173,7 @@ 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 !----------------------------------------------------------------- @@ -165,22 +181,24 @@ subroutine ocn_manufactured_solution_tend_vel(tend, err)!{{{ 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)) @@ -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