From d0c5833c2b2bc69e725d8e9935068422b43a4ff6 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Mon, 18 Feb 2019 12:46:04 -0300 Subject: [PATCH] USER_PROBLEM: Use helper subroutines to print problem parameters. Signed-off-by: Grzegorz Kowal --- sources/user_problem.F90 | 73 ++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/sources/user_problem.F90 b/sources/user_problem.F90 index 99a9583..39c1f98 100644 --- a/sources/user_problem.F90 +++ b/sources/user_problem.F90 @@ -101,6 +101,7 @@ module user_problem ! use constants , only : pi, pi2 use coordinates, only : ng => nghosts, ady + use helpers , only : print_section, print_parameter use parameters , only : get_parameter use random , only : randomu, randomn @@ -117,7 +118,6 @@ module user_problem ! local variables ! character(len=64) :: perturbation = "noise" - character(len=64) :: sfmts, sfmtf, sfmti integer :: n real(kind=8) :: thh, fc #if NDIMS == 3 @@ -246,50 +246,35 @@ module user_problem end if -! print information about the user problem such as problem name, its -! parameters, etc. +! print information about the user problem setup ! - if (verbose) then - -! print information about the problem -! - write (*,*) - write (*,"(1x,a)") "Problem:" - sfmts = "(4x,a14,9x,'=',2x,a)" - write (*,sfmts) "problem name ", trim(problem) - sfmts = "(6x,a12,9x)" - write (*,sfmts) "parameters: " - sfmtf = "(8x,a10,9x,'=',1es12.4)" - sfmti = "(8x,a10,9x,'=',1i12)" - write (*,sfmtf) "dens ", dens - write (*,sfmtf) "bamp ", bamp - write (*,sfmtf) "bgui ", bgui - write (*,sfmtf) "zeta ", zeta - write (*,sfmtf) "yth ", yth - sfmts = "(8x,a12,7x,'=',2x,a)" - write (*,sfmts) "perturbation", trim(perturbation) - if (pert /= 3) then - write (*,sfmtf) "vper ", vper - end if - if (pert >= 3) then - write (*,sfmtf) "bper ", bper - end if - if (pert >= 1) then - write (*,sfmtf) "kper ", kper - end if - if (pert == 1) then - write (*,sfmti) "nper ", nper - end if - if (pert >= 3) then - write (*,sfmtf) "pth ", pth - end if - if (pert <= 1) then - write (*,sfmtf) "xcut ", xcut - write (*,sfmtf) "ycut ", ycut - write (*,sfmtf) "xdec ", xdec - write (*,sfmtf) "ydec ", ydec - end if - + call print_section(verbose, "Parameters") + call print_parameter(verbose, 'dens' , dens ) + call print_parameter(verbose, 'bamp' , bamp ) + call print_parameter(verbose, 'bgui' , bgui ) + call print_parameter(verbose, 'zeta' , zeta ) + call print_parameter(verbose, 'yth' , yth ) + call print_parameter(verbose, 'perturbation', perturbation) + if (pert /= 3) then + call print_parameter(verbose, 'vper' , vper ) + end if + if (pert >= 3) then + call print_parameter(verbose, 'bper' , bper ) + end if + if (pert >= 1) then + call print_parameter(verbose, 'kper' , kper ) + end if + if (pert == 1) then + call print_parameter(verbose, 'nper' , nper ) + end if + if (pert >= 3) then + call print_parameter(verbose, 'pth' , pth ) + end if + if (pert <= 1) then + call print_parameter(verbose, 'xcut' , xcut ) + call print_parameter(verbose, 'ycut' , ycut ) + call print_parameter(verbose, 'xdec' , xdec ) + call print_parameter(verbose, 'ydec' , ydec ) end if #ifdef PROFILE