From 3081ac0d5f88eebb7fa8b346257dfeffc6b7c1cc Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 26 Nov 2021 17:07:31 -0300 Subject: [PATCH 1/2] BOUNDARIES: Fix wrong conditions in block_boundary_specific(). 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 8a47d70..b30c854 100644 --- a/sources/boundaries.F90 +++ b/sources/boundaries.F90 @@ -79,7 +79,7 @@ module boundaries public :: initialize_boundaries, finalize_boundaries, print_boundaries public :: boundary_variables, boundary_fluxes - public :: custom_boundary_x,custom_boundary_y, custom_boundary_z + public :: custom_boundary_x, custom_boundary_y, custom_boundary_z public :: bnd_type, bnd_periodic !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5272,7 +5272,7 @@ module boundaries ! case(bnd_user) - if (associated(custom_boundary_z)) then + if (associated(custom_boundary_x)) then call custom_boundary_x(side(1), jl, ju, kl, ku, & t, dt, x(:), y(:), z(:), qn(:,:,:,:)) else @@ -5455,7 +5455,7 @@ module boundaries ! case(bnd_user) - if (associated(custom_boundary_z)) then + if (associated(custom_boundary_y)) then call custom_boundary_y(side(2), il, iu, kl, ku, & t, dt, x(:), y(:), z(:), qn(:,:,:,:)) else From 82dfcf3c29a420f456c264298bf3808a78be253f Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 26 Nov 2021 17:15:02 -0300 Subject: [PATCH 2/2] USER_PROBLEM: Remove unused stuff. Signed-off-by: Grzegorz Kowal --- sources/user_problem.F90 | 117 ++++----------------------------------- 1 file changed, 12 insertions(+), 105 deletions(-) diff --git a/sources/user_problem.F90 b/sources/user_problem.F90 index b4b0345..86f666e 100644 --- a/sources/user_problem.F90 +++ b/sources/user_problem.F90 @@ -31,17 +31,8 @@ module user_problem implicit none -! default problem parameters -! - real(kind=8), save :: dens = 1.0d+00 - real(kind=8), save :: beta = 1.0d+00 - real(kind=8), save :: pres = 1.0d+00 - real(kind=8), save :: bmag = sqrt(2.0d+00) - private public :: initialize_user_problem, finalize_user_problem - public :: setup_user_problem - public :: user_boundary_x, user_boundary_y, user_boundary_z public :: user_statistics !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -67,11 +58,6 @@ module user_problem ! subroutine initialize_user_problem(problem, rcount, verbose, status) - use equations , only : eos, csnd, csnd2, adiabatic_index - use helpers , only : print_section, print_parameter - use mesh , only : setup_problem - use parameters, only : get_parameter - implicit none character(len=64), intent(in) :: problem @@ -83,28 +69,6 @@ module user_problem ! status = 0 -! get parameters -! - call get_parameter("density", dens) - call get_parameter("beta" , beta) - - if (eos == "iso") then - pres = csnd2 * dens - else - pres = csnd2 * dens / adiabatic_index - end if - bmag = sqrt(2.0d+00 * pres / beta) - -! print information about the user problem setup -! - call print_section(verbose, "Parameters (* - set, otherwise calculated)") - call print_parameter(verbose, '(*) beta (plasma-beta)', beta) - call print_parameter(verbose, '(*) dens' , dens) - call print_parameter(verbose, '( ) pres' , pres) - call print_parameter(verbose, '( ) bmag' , bmag) - call print_parameter(verbose, '(*) csnd' , csnd) - call print_parameter(verbose, '( ) valf' , bmag / sqrt(dens)) - !------------------------------------------------------------------------------- ! end subroutine initialize_user_problem @@ -153,58 +117,13 @@ module user_problem subroutine setup_user_problem(pdata) use blocks , only : block_data - use coordinates, only : nn => bcells - use equations , only : prim2cons - use equations , only : nv - use equations , only : idn, ivx, ivy, ivz, ipr, ibx, iby, ibz, ibp implicit none type(block_data), pointer, intent(inout) :: pdata - integer :: j, k = 1 - - real(kind=8), dimension(nv,nn) :: q, u - !------------------------------------------------------------------------------- ! -! set the variables -! - q(idn,:) = dens - if (ipr > 0) q(ipr,:) = pres - q(ivx,:) = 0.0d+00 - q(ivy,:) = 0.0d+00 - q(ivz,:) = 0.0d+00 - if (ibx > 0) then - q(ibx,:) = bmag - q(iby,:) = 0.0d+00 - q(ibz,:) = 0.0d+00 - q(ibp,:) = 0.0d+00 - end if - -! convert the primitive variables to conservative ones -! - call prim2cons(q(:,:), u(:,:)) - -! iterate over all positions in the YZ plane -! -#if NDIMS == 3 - do k = 1, nn -#endif /* NDIMS == 3 */ - do j = 1, nn - -! copy the primitive variables to the current block -! - pdata%q(:,:,j,k) = q(:,:) - -! copy the conserved variables to the current block -! - pdata%u(:,:,j,k) = u(:,:) - - end do ! j = 1, nn -#if NDIMS == 3 - end do ! k = 1, nn -#endif /* NDIMS == 3 */ !------------------------------------------------------------------------------- ! @@ -284,7 +203,7 @@ module user_problem ! ! Arguments: ! -! ic - the block side along the X direction for the ghost zone update; +! is - the block side along the X direction for the ghost zone update; ! jl, ju - the cell index limits for the Y direction; ! kl, ku - the cell index limits for the Z direction; ! t, dt - time and time increment; @@ -293,17 +212,13 @@ module user_problem ! !=============================================================================== ! - subroutine user_boundary_x(ic, jl, ju, kl, ku, t, dt, x, y, z, qn) + subroutine user_boundary_x(is, jl, ju, kl, ku, t, dt, x, y, z, qn) implicit none - integer , intent(in) :: ic - integer , intent(in) :: jl, ju - integer , intent(in) :: kl, ku + integer , intent(in) :: is, jl, ju, kl, ku real(kind=8) , intent(in) :: t, dt - real(kind=8), dimension(:) , intent(in) :: x - real(kind=8), dimension(:) , intent(in) :: y - real(kind=8), dimension(:) , intent(in) :: z + real(kind=8), dimension(:) , intent(in) :: x, y, z real(kind=8), dimension(:,:,:,:), intent(inout) :: qn !------------------------------------------------------------------------------- @@ -323,7 +238,7 @@ module user_problem ! ! Arguments: ! -! jc - the block side along the Y direction for the ghost zone update; +! js - the block side along the Y direction for the ghost zone update; ! il, iu - the cell index limits for the X direction; ! kl, ku - the cell index limits for the Z direction; ! t, dt - time and time increment; @@ -332,17 +247,13 @@ module user_problem ! !=============================================================================== ! - subroutine user_boundary_y(jc, il, iu, kl, ku, t, dt, x, y, z, qn) + subroutine user_boundary_y(js, il, iu, kl, ku, t, dt, x, y, z, qn) implicit none - integer , intent(in) :: jc - integer , intent(in) :: il, iu - integer , intent(in) :: kl, ku + integer , intent(in) :: js, il, iu, kl, ku real(kind=8) , intent(in) :: t, dt - real(kind=8), dimension(:) , intent(in) :: x - real(kind=8), dimension(:) , intent(in) :: y - real(kind=8), dimension(:) , intent(in) :: z + real(kind=8), dimension(:) , intent(in) :: x, y, z real(kind=8), dimension(:,:,:,:), intent(inout) :: qn !------------------------------------------------------------------------------- @@ -362,7 +273,7 @@ module user_problem ! ! Arguments: ! -! kc - the block side along the Z direction for the ghost zone update; +! ks - the block side along the Z direction for the ghost zone update; ! il, iu - the cell index limits for the X direction; ! jl, ju - the cell index limits for the Y direction; ! t, dt - time and time increment; @@ -371,17 +282,13 @@ module user_problem ! !=============================================================================== ! - subroutine user_boundary_z(kc, il, iu, jl, ju, t, dt, x, y, z, qn) + subroutine user_boundary_z(ks, il, iu, jl, ju, t, dt, x, y, z, qn) implicit none - integer , intent(in) :: kc - integer , intent(in) :: il, iu - integer , intent(in) :: jl, ju + integer , intent(in) :: ks, il, iu,jl, ju real(kind=8) , intent(in) :: t, dt - real(kind=8), dimension(:) , intent(in) :: x - real(kind=8), dimension(:) , intent(in) :: y - real(kind=8), dimension(:) , intent(in) :: z + real(kind=8), dimension(:) , intent(in) :: x, y, z real(kind=8), dimension(:,:,:,:), intent(inout) :: qn !-------------------------------------------------------------------------------