From 48ec801fa84647775786c61f9618ee1847d928ba Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 2 Sep 2020 14:02:47 -0300 Subject: [PATCH] USER_PROBLEM: Remove compiler warnings about unused variables. Signed-off-by: Grzegorz Kowal --- sources/user_problem.F90 | 70 +++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/sources/user_problem.F90 b/sources/user_problem.F90 index 588790b..2a693d4 100644 --- a/sources/user_problem.F90 +++ b/sources/user_problem.F90 @@ -106,7 +106,10 @@ module user_problem ! include external procedures and variables ! - use constants , only : pi, pi2 +#if NDIMS == 3 + use constants , only : pi +#endif /* NDIMS == 3 */ + use constants , only : pi2 use coordinates, only : ng => nghosts, ady use equations , only : magnetized, csnd, csnd2 use helpers , only : print_section, print_parameter @@ -456,7 +459,10 @@ module user_problem use blocks , only : block_data use constants , only : pi, pi2 use coordinates, only : nn => bcells - use coordinates, only : ax, ay, az, adx, ady, adz, ylen + use coordinates, only : ax, ay, adx, ady, ylen +#if NDIMS == 3 + use coordinates, only : az, adz +#endif /* NDIMS == 3 */ use equations , only : prim2cons use equations , only : nv, ns use equations , only : idn, ivx, ivy, ivz, ipr, ibx, iby, ibz, ibp, isl @@ -479,8 +485,14 @@ module user_problem real(kind=8) :: xp, yp real(kind=8) :: yrat real(kind=8) :: kv, fv - real(kind=8) :: va, vx = 0.0d+00, vy = 0.0d+00, vz = 0.0d+00, vv - real(kind=8) :: ba, px = 0.0d+00, py = 0.0d+00, pz = 0.0d+00, pp + real(kind=8) :: vx = 0.0d+00, vy = 0.0d+00, vv, va +#if NDIMS == 3 + real(kind=8) :: vz = 0.0d+00 +#endif /* NDIMS == 3 */ + real(kind=8) :: pz = 0.0d+00, pp, ba +#if NDIMS == 3 + real(kind=8) :: px = 0.0d+00, py = 0.0d+00 +#endif /* NDIMS == 3 */ ! local arrays ! @@ -1085,8 +1097,10 @@ module user_problem ! import external procedures and variables ! use coordinates , only : nn => bcells, nb, ne, nbl, neu - use equations , only : nv - use equations , only : ivx, ibx, iby, ibz, ibp + use equations , only : ivx, ibx, iby, ibp +#if NDIMS == 3 + use equations , only : ibz +#endif /* NDIMS == 3 */ ! local variables are not implicit by default ! @@ -1107,8 +1121,14 @@ module user_problem ! integer :: im2, im1, i , ip1, ip2 integer :: jm2, jm1, j , jp1, jp2 - integer :: km2, km1, k = 1, kp1, kp2 - real(kind=8) :: dx, dy, dz, dxy, dxz + integer :: k = 1 +#if NDIMS == 3 + integer :: km2, km1, kp1, kp2 +#endif /* NDIMS == 3 */ + real(kind=8) :: dx, dy, dxy +#if NDIMS == 3 + real(kind=8) :: dz, dxz +#endif /* NDIMS == 3 */ ! !------------------------------------------------------------------------------- ! @@ -1164,7 +1184,7 @@ module user_problem ! make the normal derivative zero ! - qn(1:nv,i,j,k) = qn(1:nv,nb,j,k) + qn(:,i,j,k) = qn(:,nb,j,k) ! prevent the inflow ! @@ -1213,7 +1233,7 @@ module user_problem ! make the normal derivative zero ! - qn(1:nv,i,j,k) = qn(1:nv,ne,j,k) + qn(:,i,j,k) = qn(:,ne,j,k) ! prevent the inflow ! @@ -1238,21 +1258,21 @@ module user_problem if (ic == 1) then do i = nbl, 1, -1 #if NDIMS == 3 - qn(1:nv,i,jl:ju,kl:ku) = qn(1:nv,nb,jl:ju,kl:ku) - qn(ivx ,i,jl:ju,kl:ku) = min(0.0d+00, qn(ivx,nb,jl:ju,kl:ku)) + qn( : ,i,jl:ju,kl:ku) = qn( : ,nb,jl:ju,kl:ku) + qn(ivx,i,jl:ju,kl:ku) = min(qn(ivx,nb,jl:ju,kl:ku), 0.0d+00) #else /* NDIMS == 3 */ - qn(1:nv,i,jl:ju, : ) = qn(1:nv,nb,jl:ju, : ) - qn(ivx ,i,jl:ju, : ) = min(0.0d+00, qn(ivx,nb,jl:ju, : )) + qn( : ,i,jl:ju, : ) = qn( : ,nb,jl:ju, : ) + qn(ivx,i,jl:ju, : ) = min(qn(ivx,nb,jl:ju, : ), 0.0d+00) #endif /* NDIMS == 3 */ end do ! i = nbl, 1, -1 else do i = neu, nn #if NDIMS == 3 - qn(1:nv,i,jl:ju,kl:ku) = qn(1:nv,ne,jl:ju,kl:ku) - qn(ivx ,i,jl:ju,kl:ku) = max(0.0d+00, qn(ivx,ne,jl:ju,kl:ku)) + qn( : ,i,jl:ju,kl:ku) = qn( : ,ne,jl:ju,kl:ku) + qn(ivx,i,jl:ju,kl:ku) = max(qn(ivx,ne,jl:ju,kl:ku), 0.0d+00) #else /* NDIMS == 3 */ - qn(1:nv,i,jl:ju, : ) = qn(1:nv,ne,jl:ju, : ) - qn(ivx ,i,jl:ju, : ) = max(0.0d+00, qn(ivx,ne,jl:ju, : )) + qn( : ,i,jl:ju, : ) = qn( : ,ne,jl:ju, : ) + qn(ivx,i,jl:ju, : ) = max(qn(ivx,ne,jl:ju, : ), 0.0d+00) #endif /* NDIMS == 3 */ end do ! i = neu, nn end if @@ -1312,10 +1332,16 @@ module user_problem ! local variables ! - integer :: im1, i , ip1 - integer :: jm2, jm1, j , jp1, jp2 - integer :: km1, k = 1, kp1 - real(kind=8) :: dx, dy, dz, dyx, dyz + integer :: i, im1, ip1 + integer :: j, jm1, jp1, jm2, jp2 + integer :: k = 1 +#if NDIMS == 3 + integer :: km1, kp1 +#endif /* NDIMS == 3 */ + real(kind=8) :: dx, dy, dyx +#if NDIMS == 3 + real(kind=8) :: dz, dyz +#endif /* NDIMS == 3 */ real(kind=8) :: fl, fr ! !-------------------------------------------------------------------------------