USER_PROBLEM: Add user refinement criterion.

The criterion sets only those blocks for refinement that lie at
a distance specified by the parameter 'yref' from the current sheet.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2024-09-15 11:14:02 -03:00
parent 4429843c95
commit fd87018ebd

View File

@ -57,6 +57,7 @@ module user_problem
real(kind=8), save :: ycut = 1.00d+99
real(kind=8), save :: xdec = 1.00d+00
real(kind=8), save :: ydec = 1.00d+00
real(kind=8), save :: yref = 1.00d-01
real(kind=8), dimension(:), allocatable :: kx, ky, kz, ux, uy, uz, ph
@ -98,6 +99,7 @@ module user_problem
use helpers , only : print_section, print_parameter, print_message
use mesh , only : setup_problem
use parameters , only : get_parameter
use refinement , only : user_criterion
use random , only : reset_seeds, randuni, randsym
implicit none
@ -193,6 +195,7 @@ module user_problem
call get_parameter("ycut", ycut)
call get_parameter("xdec", xdec)
call get_parameter("ydec", ydec)
call get_parameter("yref", yref)
! choose the perturbation type
!
@ -406,10 +409,12 @@ module user_problem
call print_parameter(verbose, '(*) ycut' , ycut)
call print_parameter(verbose, '(*) ydec' , ydec)
end if
call print_parameter(verbose, '(*) yref' , yref)
setup_problem => setup_user_problem
custom_boundary_x => user_boundary_x
custom_boundary_y => user_boundary_y
user_criterion => refinement_criterion
status = 0
@ -1245,6 +1250,42 @@ module user_problem
!-------------------------------------------------------------------------------
!
end subroutine user_statistics
!
!===============================================================================
!
! function REFINEMENT_CRITERION:
! -----------------------------
!
! Function finds the maximum values of the vorticity magnitude
! for the current data block.
!
! Arguments:
!
! pdata - pointer to the data block for which error is calculated;
!
!===============================================================================
!
function refinement_criterion(pdata) result(crit)
use blocks, only : block_data
implicit none
type(block_data), pointer, intent(in) :: pdata
real(kind=4) :: crit
!-------------------------------------------------------------------------------
!
crit = 0.0e+00
if (min(abs(pdata%meta%ymin), abs(pdata%meta%ymax)) <= yref) crit = 1.0e+00
return
!-------------------------------------------------------------------------------
!
end function refinement_criterion
!===============================================================================
!