diff --git a/sources/interpolations.F90 b/sources/interpolations.F90 index f329792..0db9c30 100644 --- a/sources/interpolations.F90 +++ b/sources/interpolations.F90 @@ -231,6 +231,17 @@ module interpolations ! kappa = min(kappa, (1.0d+00 - cfl) / cfl) +! check ngp +! + if (mod(ngp,2) == 0 .or. ngp < 3) then + if (verbose) then + write(error_unit,"('[', a, ']: ', a)") trim(loc), & + "The parameter ngp has to be an odd integer >= 3. "// & + "Resetting to default value of ngp = 5." + end if + ngp = 5 + end if + ! calculate mgp ! mgp = (ngp - 1) / 2 @@ -349,22 +360,12 @@ module interpolations reconstruct_states => reconstruct_gp order = ngp -! check the parameters -! - if (mod(ngp,2) == 0) then - if (verbose) then - write(*,*) - write(*,"(1x,a)") "ERROR!" - write(*,"(1x,a)") "The parameter ngp has to be an odd integer >= 3." - end if - status = 1 - else - ng = 2 - do while(ng < (ngp + 1) / 2) - ng = ng + 2 - end do - nghosts = max(nghosts, ng) - end if + ng = 2 + do while(ng < (ngp + 1) / 2) + ng = ng + 2 + end do + nghosts = max(nghosts, ng) + case ("mgp", "MGP") write(stmp, '(f16.1)') sgp write(name_rec, & @@ -379,35 +380,24 @@ module interpolations ! if (status == 0) call prepare_mgp(status) - interfaces => interfaces_mgp + interfaces => interfaces_mgp + + ng = 2 + do while(ng < (ngp + 1) / 2) + ng = ng + 2 + end do + nghosts = max(nghosts, ng) -! check the parameters -! - if (mod(ngp,2) == 0) then - if (verbose) then - write(*,*) - write(*,"(1x,a)") "ERROR!" - write(*,"(1x,a)") "The parameter ngp has to be an odd integer >= 3." - end if - status = 1 - else - ng = 2 - do while(ng < (ngp + 1) / 2) - ng = ng + 2 - end do - nghosts = max(nghosts, ng) - end if case default if (verbose) then - write(*,*) - write(*,"(1x,a)") "ERROR!" - write(*,"(1x,a)") "The selected reconstruction method is not " // & - "implemented: " // trim(sreconstruction) - write(*,"(1x,a)") "Available methods: 'tvd' 'limo3', 'ppm'," // & - " 'weno3', 'weno5z', 'weno5yc', 'weno5ns'," // & - " 'crweno5z', 'crweno5yc', 'crweno5ns','mp5', " // & - " 'mp7', 'crmp5', 'crmp5ld', 'crmp7', 'gp', 'mgp'." + write(error_unit,"('[', a, ']: ', a)") trim(loc), & + "The selected reconstruction method is not " // & + "implemented: " // trim(sreconstruction) // "." // & + "Available methods: 'tvd' 'limo3', 'ppm'," // & + " 'weno3', 'weno5z', 'weno5yc', 'weno5ns'," // & + " 'crweno5z', 'crweno5yc', 'crweno5ns','mp5', " // & + " 'mp7', 'mp9', 'crmp5', 'crmp5ld', 'crmp7', 'gp', 'mgp'." end if status = 1