From a9b13d7d8d990b00522197c52e594333148c16cc Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 24 Nov 2021 13:04:10 -0300 Subject: [PATCH 1/4] BOUNDARIES: Initialize ecount. Signed-off-by: Grzegorz Kowal --- sources/boundaries.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/boundaries.F90 b/sources/boundaries.F90 index 2429879..28c53a6 100644 --- a/sources/boundaries.F90 +++ b/sources/boundaries.F90 @@ -1595,7 +1595,7 @@ module boundaries integer :: it, jt, kt #ifdef MPI integer :: sproc = 0, rproc = 0 - integer :: ecount + integer :: ecount = 0 integer :: l, p ! local arrays @@ -2688,7 +2688,7 @@ module boundaries #endif /* NDIMS == 3 */ #ifdef MPI integer :: sproc = 0, rproc = 0 - integer :: ecount + integer :: ecount = 0 integer :: l, p ! local arrays @@ -4019,7 +4019,7 @@ module boundaries #endif /* NDIMS == 3 */ #ifdef MPI integer :: sproc = 0, rproc = 0 - integer :: ecount + integer :: ecount = 0 integer :: l, p ! local arrays From 78ae62528a2a623e82ee103867cd2239d1d27435 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 24 Nov 2021 13:16:59 -0300 Subject: [PATCH 2/4] EVOLUTION: Eliminate uninitialized conditions. Signed-off-by: Grzegorz Kowal --- sources/evolution.F90 | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/sources/evolution.F90 b/sources/evolution.F90 index 4ddc10f..09f9ef7 100644 --- a/sources/evolution.F90 +++ b/sources/evolution.F90 @@ -2456,7 +2456,6 @@ module evolution use blocks , only : block_data, list_data use boundaries , only : boundary_fluxes - use coordinates, only : nb, ne use equations , only : errors, ibp, cmax use helpers , only : print_message use sources , only : update_sources @@ -2465,15 +2464,16 @@ module evolution type(block_data), pointer :: pdata - logical :: test + logical :: test, cond integer :: nrej, i, status - real(kind=8) :: tm, dtm, dh, fc + real(kind=8) :: tm, dtm, fc character(len=*), parameter :: loc = 'EVOLUTION:evolve_ssprk2_m()' !------------------------------------------------------------------------------- ! test = .true. + cond = .true. nrej = 0 ! at the entry point we assume the previous solution of conserved variables U(n) @@ -2593,10 +2593,12 @@ module evolution fc = product(errs(:)**betas(:)) fc = 1.0d+00 + chi * atan((fc - 1.0d+00) / chi) dte = dt * fc + cond = fc > fac .or. nrej >= mrej 100 continue + cond = cond .and. status == 0 - if ((fc > fac .or. nrej >= mrej) .and. status == 0) then + if (cond) then test = .false. errs(3) = errs(2) @@ -2679,7 +2681,6 @@ module evolution use blocks , only : block_data, list_data use boundaries , only : boundary_fluxes - use coordinates, only : nb, ne use equations , only : errors, ibp, cmax use helpers , only : print_message use sources , only : update_sources @@ -2688,7 +2689,7 @@ module evolution type(block_data), pointer :: pdata - logical :: test + logical :: test, cond integer :: nrej, i, status real(kind=8) :: tm, dtm, dh, fc @@ -2700,6 +2701,7 @@ module evolution !------------------------------------------------------------------------------- ! test = .true. + cond = .true. nrej = 0 ! at the entry point we assume the previous solution of conserved variables U(n) @@ -2841,10 +2843,12 @@ module evolution fc = product(errs(:)**betas(:)) fc = 1.0d+00 + chi * atan((fc - 1.0d+00) / chi) dte = dt * fc + cond = fc > fac .or. nrej >= mrej 100 continue + cond = cond .and. status == 0 - if ((fc > fac .or. nrej >= mrej) .and. status == 0) then + if (cond) then test = .false. errs(3) = errs(2) @@ -2934,7 +2938,7 @@ module evolution integer , save :: i1, i2, i3, i4, n, m real(kind=8), save :: f1, f2, f3, f4 - logical :: test + logical :: test, cond integer :: nrej, i, status real(kind=8) :: tm, dtm, dh, fc @@ -2965,6 +2969,7 @@ module evolution end if test = .true. + cond = .true. nrej = 0 ! at the entry point we assume the previous solution of conserved variables U(n) @@ -3155,10 +3160,12 @@ module evolution fc = product(errs(:)**betas(:)) fc = 1.0d+00 + chi * atan((fc - 1.0d+00) / chi) dte = dt * fc + cond = fc > fac .or. nrej >= mrej 100 continue + cond = cond .and. status == 0 - if ((fc > fac .or. nrej >= mrej) .and. status == 0) then + if (cond) then test = .false. errs(3) = errs(2) @@ -3242,8 +3249,8 @@ module evolution type(block_data), pointer :: pdata - logical :: test - integer :: i, l, nrej, status + logical :: test, cond + integer :: i, nrej, status real(kind=8) :: tm, dtm, fc character(len=*), parameter :: loc = 'EVOLUTION:evolve_3sstarplus()' @@ -3251,6 +3258,7 @@ module evolution !------------------------------------------------------------------------------- ! test = .true. + cond = .true. nrej = 0 ! at the entry point we assume the previous solution of conserved variables U(n) @@ -3403,10 +3411,12 @@ module evolution fc = product(errs(:)**betas(:)) fc = 1.0d+00 + chi * atan((fc - 1.0d+00) / chi) dte = dt * fc + cond = fc > fac .or. nrej >= mrej 100 continue + cond = cond .and. status == 0 - if ((fc > fac .or. nrej >= mrej) .and. status == 0) then + if (cond) then test = .false. errs(3) = errs(2) From 2b04148e887884dd25e982373514608534c1672f Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 24 Nov 2021 13:20:03 -0300 Subject: [PATCH 3/4] MESH: Remove unused variables. Signed-off-by: Grzegorz Kowal --- sources/mesh.F90 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/sources/mesh.F90 b/sources/mesh.F90 index 274b379..a1f7ad4 100644 --- a/sources/mesh.F90 +++ b/sources/mesh.F90 @@ -106,8 +106,6 @@ module mesh character(len=64) :: problem = "none" - character(len=*), parameter :: loc = 'MESH::initialize_mesh()' - !------------------------------------------------------------------------------- ! status = 0 @@ -149,7 +147,6 @@ module mesh ! subroutine finalize_mesh(status) - use mpitools , only : master use refinement, only : finalize_refinement implicit none @@ -225,7 +222,7 @@ module mesh #endif /* DEBUG */ use coordinates, only : minlev, maxlev use helpers , only : print_section, print_message - use mpitools , only : master, nproc, nprocs, npmax, nodes, lprocs + use mpitools , only : master, nproc, npmax, nodes, lprocs use refinement , only : check_refinement_criterion implicit none @@ -602,10 +599,8 @@ module mesh #ifdef MPI use blocks , only : block_meta, block_data, list_meta - use blocks , only : get_nleafs, nregs + use blocks , only : get_nleafs use blocks , only : append_datablock, remove_datablock, link_blocks - use coordinates , only : nn => bcells - use equations , only : nv use mpitools , only : nprocs, npmax, nproc, nodes, lprocs use mpitools , only : send_array, receive_array #endif /* MPI */ @@ -1524,10 +1519,6 @@ module mesh use blocks , only : append_datablock, remove_datablock, link_blocks #endif /* MPI */ use coordinates, only : toplev -#ifdef MPI - use coordinates, only : nn => bcells - use equations , only : nv -#endif /* MPI */ use helpers , only : print_message #ifdef MPI use mpitools , only : nprocs, nproc From a395cf8cda73b2c03c24eb03cede237e45263a93 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 24 Nov 2021 13:22:27 -0300 Subject: [PATCH 4/4] SCHEMES: Remove unused variables. Signed-off-by: Grzegorz Kowal --- sources/schemes.F90 | 56 +++++++-------------------------------------- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/sources/schemes.F90 b/sources/schemes.F90 index 04bab96..bdcb003 100644 --- a/sources/schemes.F90 +++ b/sources/schemes.F90 @@ -2797,30 +2797,20 @@ module schemes ! subroutine riemann_hd_iso_roe(ql, qr, ul, ur, fl, fr, cl, cr, f) -! include external procedures -! - use equations, only : idn, ivx, ivy, ivz + use equations, only : idn, ivx, ivz use equations, only : eigensystem_roe -! local variables are not implicit by default -! implicit none -! subroutine arguments -! real(kind=8), dimension(:,:), intent(in) :: ql, qr, ul, ur, fl, fr, cl, cr real(kind=8), dimension(:,:), intent(out) :: f -! local variables -! integer :: nf, i, p real(kind=8) :: sdl, sdr, sds -! local arrays to store the states -! real(kind=8), dimension(size(ql,1)) :: qi, ci, al real(kind=8), dimension(size(ql,1),size(ql,1)) :: li, ri -! + !------------------------------------------------------------------------------- ! ! get the number of fluxes @@ -2918,30 +2908,20 @@ module schemes ! subroutine riemann_hd_adi_roe(ql, qr, ul, ur, fl, fr, cl, cr, f) -! include external procedures -! - use equations, only : idn, ivx, ivy, ivz, ipr, ien + use equations, only : idn, ivx, ivz, ipr, ien use equations, only : eigensystem_roe -! local variables are not implicit by default -! implicit none -! subroutine arguments -! real(kind=8), dimension(:,:), intent(in) :: ql, qr, ul, ur, fl, fr, cl, cr real(kind=8), dimension(:,:), intent(out) :: f -! local variables -! integer :: nf, i, p real(kind=8) :: sdl, sdr, sds -! local arrays to store the states -! real(kind=8), dimension(size(ql,1)) :: qi, ci, al real(kind=8), dimension(size(ql,1),size(ql,1)) :: li, ri -! + !------------------------------------------------------------------------------- ! ! get the number of fluxes @@ -3040,31 +3020,21 @@ module schemes ! subroutine riemann_mhd_iso_roe(ql, qr, ul, ur, fl, fr, cl, cr, f) -! include external procedures -! - use equations, only : idn, ivx, ivy, ivz, imx, imy, imz, ibx, iby, ibz, ibp + use equations, only : idn, ivx, ivz, imx, imy, imz, ibx, iby, ibz, ibp use equations, only : eigensystem_roe -! local variables are not implicit by default -! implicit none -! subroutine arguments -! real(kind=8), dimension(:,:), intent(in) :: ql, qr, ul, ur, fl, fr, cl, cr real(kind=8), dimension(:,:), intent(out) :: f -! local variables -! integer :: nf, i, p real(kind=8) :: sdl, sdr, sds real(kind=8) :: xx, yy -! local arrays to store the states -! real(kind=8), dimension(size(ql,1)) :: qi, ci, al real(kind=8), dimension(size(ql,1),size(ql,1)) :: li, ri -! + !------------------------------------------------------------------------------- ! ! get the number of fluxes @@ -3194,33 +3164,23 @@ module schemes ! subroutine riemann_mhd_adi_roe(ql, qr, ul, ur, fl, fr, cl, cr, f) -! include external procedures -! - use equations, only : idn, ivx, ivy, ivz, imx, imy, imz, ipr, ien + use equations, only : idn, ivx, ivz, imx, imy, imz, ipr, ien use equations, only : ibx, iby, ibz, ibp use equations, only : eigensystem_roe -! local variables are not implicit by default -! implicit none -! subroutine arguments -! real(kind=8), dimension(:,:), intent(in) :: ql, qr, ul, ur, fl, fr, cl, cr real(kind=8), dimension(:,:), intent(out) :: f -! local variables -! integer :: nf, i, p real(kind=8) :: sdl, sdr, sds real(kind=8) :: xx, yy real(kind=8) :: pml, pmr -! local arrays to store the states -! real(kind=8), dimension(size(ql,1)) :: qi, ci, al real(kind=8), dimension(size(ql,1),size(ql,1)) :: li, ri -! + !------------------------------------------------------------------------------- ! ! get the number of fluxes