88
99module m_boundary_common
1010 use m_derived_types !< Definitions of the derived types
11-
1211 use m_global_parameters !< Definitions of the global parameters
13-
1412 use m_mpi_proxy
15-
1613 use m_constants
17-
1814 use m_delay_file_access
19-
2015 use m_compile_specific
2116
2217 implicit none
@@ -70,6 +65,7 @@ contains
7065 end do
7166 end if
7267 end subroutine s_initialize_boundary_common_module
68+
7369 !> The purpose of this procedure is to populate the buffers of the primitive variables, depending on the selected boundary
7470 !! conditions.
7571 impure subroutine s_populate_variables_buffers (bc_type , q_prim_vf , pb_in , mv_in )
@@ -269,6 +265,7 @@ contains
269265 #:endif
270266 ! END: Population of Buffers in z- direction
271267 end subroutine s_populate_variables_buffers
268+
272269 !> @brief Fills ghost cells by copying the nearest boundary cell value along the specified direction.
273270 subroutine s_ghost_cell_extrapolation (q_prim_vf , bc_dir , bc_loc , k , l )
274271 $:GPU_ROUTINE(function_name= ' s_ghost_cell_extrapolation' , parallelism= ' [seq]' , cray_inline= True)
@@ -321,6 +318,7 @@ contains
321318 end if
322319 end if
323320 end subroutine s_ghost_cell_extrapolation
321+
324322 !> @brief Applies reflective (symmetry) boundary conditions by mirroring primitive variables and flipping the normal velocity
325323 !! component.
326324 subroutine s_symmetry (q_prim_vf , bc_dir , bc_loc , k , l , pb_in , mv_in )
@@ -347,7 +345,7 @@ contains
347345 if (elasticity) then
348346 do i = 1 , shear_BC_flip_num
349347 q_prim_vf(shear_BC_flip_indices(1 , i))%sf(- j, k, l) = - q_prim_vf(shear_BC_flip_indices(1 , &
350- & i))%sf(j - 1 , k, l)
348+ & i))%sf(j - 1 , k, l)
351349 end do
352350 end if
353351
@@ -381,7 +379,7 @@ contains
381379 if (elasticity) then
382380 do i = 1 , shear_BC_flip_num
383381 q_prim_vf(shear_BC_flip_indices(1 , i))%sf(m + j, k, l) = - q_prim_vf(shear_BC_flip_indices(1 , &
384- & i))%sf(m - (j - 1 ), k, l)
382+ & i))%sf(m - (j - 1 ), k, l)
385383 end do
386384 end if
387385
@@ -416,7 +414,7 @@ contains
416414 if (elasticity) then
417415 do i = 1 , shear_BC_flip_num
418416 q_prim_vf(shear_BC_flip_indices(2 , i))%sf(k, - j, l) = - q_prim_vf(shear_BC_flip_indices(2 , i))%sf(k, &
419- & j - 1 , l)
417+ & j - 1 , l)
420418 end do
421419 end if
422420
@@ -450,7 +448,7 @@ contains
450448 if (elasticity) then
451449 do i = 1 , shear_BC_flip_num
452450 q_prim_vf(shear_BC_flip_indices(2 , i))%sf(k, n + j, l) = - q_prim_vf(shear_BC_flip_indices(2 , &
453- & i))%sf(k, n - (j - 1 ), l)
451+ & i))%sf(k, n - (j - 1 ), l)
454452 end do
455453 end if
456454
@@ -486,7 +484,7 @@ contains
486484 if (elasticity) then
487485 do i = 1 , shear_BC_flip_num
488486 q_prim_vf(shear_BC_flip_indices(3 , i))%sf(k, l, - j) = - q_prim_vf(shear_BC_flip_indices(3 , i))%sf(k, &
489- & l, j - 1 )
487+ & l, j - 1 )
490488 end do
491489 end if
492490
@@ -520,7 +518,7 @@ contains
520518 if (elasticity) then
521519 do i = 1 , shear_BC_flip_num
522520 q_prim_vf(shear_BC_flip_indices(3 , i))%sf(k, l, p + j) = - q_prim_vf(shear_BC_flip_indices(3 , &
523- & i))%sf(k, l, p - (j - 1 ))
521+ & i))%sf(k, l, p - (j - 1 ))
524522 end do
525523 end if
526524
@@ -542,6 +540,7 @@ contains
542540 end if
543541 end if
544542 end subroutine s_symmetry
543+
545544 !> @brief Applies periodic boundary conditions by copying values from the opposite domain boundary.
546545 subroutine s_periodic (q_prim_vf , bc_dir , bc_loc , k , l , pb_in , mv_in )
547546 $:GPU_ROUTINE(parallelism= ' [seq]' )
@@ -661,6 +660,7 @@ contains
661660 end if
662661 end if
663662 end subroutine s_periodic
663+
664664 !> @brief Applies axis boundary conditions for cylindrical coordinates by reflecting values across the axis with azimuthal phase
665665 !! shift.
666666 subroutine s_axis (q_prim_vf , pb_in , mv_in , k , l )
@@ -709,6 +709,7 @@ contains
709709 end do
710710 end if
711711 end subroutine s_axis
712+
712713 !> @brief Applies slip wall boundary conditions by extrapolating scalars and reflecting the wall- normal velocity component.
713714 subroutine s_slip_wall (q_prim_vf , bc_dir , bc_loc , k , l )
714715 $:GPU_ROUTINE(function_name= ' s_slip_wall' ,parallelism= ' [seq]' , cray_inline= True)
@@ -785,6 +786,7 @@ contains
785786 end if
786787 end if
787788 end subroutine s_slip_wall
789+
788790 !> @brief Applies no- slip wall boundary conditions by reflecting and negating all velocity components at the wall.
789791 subroutine s_no_slip_wall (q_prim_vf , bc_dir , bc_loc , k , l )
790792 $:GPU_ROUTINE(function_name= ' s_no_slip_wall' ,parallelism= ' [seq]' , cray_inline= True)
@@ -886,6 +888,7 @@ contains
886888 end if
887889 end if
888890 end subroutine s_no_slip_wall
891+
889892 !> @brief Applies Dirichlet boundary conditions by prescribing ghost cell values from stored boundary buffers.
890893 subroutine s_dirichlet (q_prim_vf , bc_dir , bc_loc , k , l )
891894 $:GPU_ROUTINE(function_name= ' s_dirichlet' ,parallelism= ' [seq]' , cray_inline= True)
@@ -946,6 +949,7 @@ contains
946949 call s_ghost_cell_extrapolation(q_prim_vf, bc_dir, bc_loc, k, l)
947950#endif
948951 end subroutine s_dirichlet
952+
949953 !> @brief Extrapolates QBMM bubble pressure and mass- vapor variables into ghost cells by copying boundary values.
950954 subroutine s_qbmm_extrapolation (bc_dir , bc_loc , k , l , pb_in , mv_in )
951955 $:GPU_ROUTINE(parallelism= ' [seq]' )
@@ -1016,6 +1020,7 @@ contains
10161020 end if
10171021 end if
10181022 end subroutine s_qbmm_extrapolation
1023+
10191024 !> @brief Populates ghost cell buffers for the color function and its divergence used in capillary surface tension.
10201025 impure subroutine s_populate_capillary_buffers (c_divs , bc_type )
10211026 type(scalar_field), dimension (num_dims + 1 ), intent (inout ) :: c_divs
@@ -1147,6 +1152,7 @@ contains
11471152 end if
11481153 #:endif
11491154 end subroutine s_populate_capillary_buffers
1155+
11501156 !> @brief Applies periodic boundary conditions to the color function and its divergence fields.
11511157 subroutine s_color_function_periodic (c_divs , bc_dir , bc_loc , k , l )
11521158 $:GPU_ROUTINE(function_name= ' s_color_function_periodic' , parallelism= ' [seq]' , cray_inline= True)
@@ -1199,6 +1205,7 @@ contains
11991205 end if
12001206 end if
12011207 end subroutine s_color_function_periodic
1208+
12021209 !> @brief Applies reflective boundary conditions to the color function and its divergence fields.
12031210 subroutine s_color_function_reflective (c_divs , bc_dir , bc_loc , k , l )
12041211 $:GPU_ROUTINE(function_name= ' s_color_function_reflective' , parallelism= ' [seq]' , cray_inline= True)
@@ -1275,6 +1282,7 @@ contains
12751282 end if
12761283 end if
12771284 end subroutine s_color_function_reflective
1285+
12781286 !> @brief Extrapolates the color function and its divergence into ghost cells by copying boundary values.
12791287 subroutine s_color_function_ghost_cell_extrapolation (c_divs , bc_dir , bc_loc , k , l )
12801288 $:GPU_ROUTINE(function_name= ' s_color_function_ghost_cell_extrapolation' , parallelism= ' [seq]' , cray_inline= True)
@@ -1327,6 +1335,7 @@ contains
13271335 end if
13281336 end if
13291337 end subroutine s_color_function_ghost_cell_extrapolation
1338+
13301339 !> @brief Populates ghost cell buffers for the Jacobian scalar field used in the IGR elliptic solver.
13311340 impure subroutine s_populate_F_igr_buffers (bc_type , jac_sf )
13321341 type(integer_field), dimension (1 :num_dims, 1 :2 ), intent (in ) :: bc_type
@@ -1491,6 +1500,7 @@ contains
14911500 end if
14921501 #:endif
14931502 end subroutine s_populate_F_igr_buffers
1503+
14941504 !> @brief Creates MPI derived datatypes for boundary condition type arrays and buffer arrays used in parallel I/ O.
14951505 impure subroutine s_create_mpi_types (bc_type )
14961506 type(integer_field), dimension (1 :num_dims, 1 :2 ), intent (in ) :: bc_type
@@ -1506,7 +1516,7 @@ contains
15061516 sf_extents_loc = shape (bc_type(dir, loc)%sf)
15071517
15081518 call MPI_TYPE_CREATE_SUBARRAY(num_dims, sf_extents_loc, sf_extents_loc, sf_start_idx, MPI_ORDER_FORTRAN, &
1509- & MPI_INTEGER, MPI_BC_TYPE_TYPE(dir, loc), ierr)
1519+ & MPI_INTEGER, MPI_BC_TYPE_TYPE(dir, loc), ierr)
15101520 call MPI_TYPE_COMMIT(MPI_BC_TYPE_TYPE(dir, loc), ierr)
15111521 end do
15121522 end do
@@ -1517,12 +1527,13 @@ contains
15171527 sf_extents_loc = shape (bc_buffers(dir, loc)%sf)
15181528
15191529 call MPI_TYPE_CREATE_SUBARRAY(num_dims, sf_extents_loc* mpi_io_type, sf_extents_loc* mpi_io_type, sf_start_idx, &
1520- & MPI_ORDER_FORTRAN, mpi_io_p, MPI_BC_BUFFER_TYPE(dir, loc), ierr)
1530+ & MPI_ORDER_FORTRAN, mpi_io_p, MPI_BC_BUFFER_TYPE(dir, loc), ierr)
15211531 call MPI_TYPE_COMMIT(MPI_BC_BUFFER_TYPE(dir, loc), ierr)
15221532 end do
15231533 end do
15241534#endif
15251535 end subroutine s_create_mpi_types
1536+
15261537 !> @brief Writes boundary condition type and buffer data to serial (unformatted) restart files.
15271538 subroutine s_write_serial_boundary_condition_files (q_prim_vf , bc_type , step_dirpath , old_grid_in )
15281539 type(scalar_field), dimension (sys_size), intent (in ) :: q_prim_vf
@@ -1559,6 +1570,7 @@ contains
15591570 end do
15601571 close (1 )
15611572 end subroutine s_write_serial_boundary_condition_files
1573+
15621574 !> @brief Writes boundary condition type and buffer data to per- rank parallel files using MPI I/ O.
15631575 subroutine s_write_parallel_boundary_condition_files (q_prim_vf , bc_type )
15641576 type(scalar_field), dimension (sys_size), intent (in ) :: q_prim_vf
@@ -1621,6 +1633,7 @@ contains
16211633 call MPI_File_close(file_id, ierr)
16221634#endif
16231635 end subroutine s_write_parallel_boundary_condition_files
1636+
16241637 !> @brief Reads boundary condition type and buffer data from serial (unformatted) restart files.
16251638 subroutine s_read_serial_boundary_condition_files (step_dirpath , bc_type )
16261639 character (LEN=* ), intent (in ) :: step_dirpath
@@ -1662,6 +1675,7 @@ contains
16621675 end do
16631676 close (1 )
16641677 end subroutine s_read_serial_boundary_condition_files
1678+
16651679 !> @brief Reads boundary condition type and buffer data from per- rank parallel files using MPI I/ O.
16661680 subroutine s_read_parallel_boundary_condition_files (bc_type )
16671681 type(integer_field), dimension (1 :num_dims, 1 :2 ), intent (inout ) :: bc_type
@@ -1724,6 +1738,7 @@ contains
17241738 call MPI_File_close(file_id, ierr)
17251739#endif
17261740 end subroutine s_read_parallel_boundary_condition_files
1741+
17271742 !> @brief Packs primitive variable boundary slices into bc_buffers arrays for serialization.
17281743 subroutine s_pack_boundary_condition_buffers (q_prim_vf )
17291744 type(scalar_field), dimension (sys_size), intent (in ) :: q_prim_vf
@@ -1764,6 +1779,7 @@ contains
17641779 end if
17651780 #:endif
17661781 end subroutine s_pack_boundary_condition_buffers
1782+
17671783 !> @brief Initializes the per- cell boundary condition type arrays with the global default BC values.
17681784 subroutine s_assign_default_bc_type (bc_type )
17691785 type(integer_field), dimension (1 :num_dims, 1 :2 ), intent (in ) :: bc_type
@@ -1787,6 +1803,7 @@ contains
17871803 end if
17881804 #:endif
17891805 end subroutine s_assign_default_bc_type
1806+
17901807 !> The purpose of this subroutine is to populate the buffers of the grid variables, which are constituted of the cell- boundary
17911808 !! locations and cell- width distributions, based on the boundary conditions.
17921809 subroutine s_populate_grid_variables_buffers
@@ -1971,6 +1988,7 @@ contains
19711988 ! END: Population of Buffers in z- direction
19721989#endif
19731990 end subroutine s_populate_grid_variables_buffers
1991+
19741992 !> @brief Deallocates boundary condition buffer arrays allocated during module initialization.
19751993 subroutine s_finalize_boundary_common_module ()
19761994 if (bc_io) then
0 commit comments