Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"python.defaultInterpreterPath": "${workspaceFolder}/build/venv/bin/python3",

"files.associations": {
"*.f90": "FortranFreeForm",
"*.fpp": "FortranFreeForm",
"*.f90": "fortran-modern",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this help anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove from pr please

"*.fpp": "fortran-modern"
},

"fortran.preferredCase": "lowercase",
Expand Down
36 changes: 19 additions & 17 deletions src/common/m_boundary_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
type(scalar_field), dimension(:, :), allocatable :: bc_buffers
!$acc declare create(bc_buffers)

real(wp) :: bcxb, bcxe, bcyb, bcye, bczb, bcze
type(boundary_bounds) :: bc_bound

#ifdef MFC_MPI
integer, dimension(1:3, -1:1) :: MPI_BC_TYPE_TYPE, MPI_BC_BUFFER_TYPE
Expand All @@ -34,7 +34,7 @@
s_populate_capillary_buffers, &
s_finalize_boundary_common_module

public :: bc_buffers, bcxb, bcxe, bcyb, bcye, bczb, bcze
public :: bc_buffers, bc_bound

#ifdef MFC_MPI
public :: MPI_BC_TYPE_TYPE, MPI_BC_BUFFER_TYPE
Expand All @@ -44,7 +44,7 @@

impure subroutine s_initialize_boundary_common_module()

bcxb = bc_x%beg; bcxe = bc_x%end; bcyb = bc_y%beg; bcye = bc_y%end; bczb = bc_z%beg; bcze = bc_z%end
bc_bound%xb = bc_x%beg; bc_bound%xe = bc_x%end; bc_bound%yb = bc_y%beg; bc_bound%ye = bc_y%end; bc_bound%zb = bc_z%beg; bc_bound%ze = bc_z%end

@:ALLOCATE(bc_buffers(1:num_dims, -1:1))

Expand All @@ -71,16 +71,17 @@
!> The purpose of this procedure is to populate the buffers
!! of the primitive variables, depending on the selected
!! boundary conditions.
impure subroutine s_populate_variables_buffers(q_prim_vf, pb, mv, bc_type)
impure subroutine s_populate_variables_buffers(q_prim_vf, pb, mv, bc_type, bc_bound)

type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
type(boundary_bounds), intent(in) :: bc_bound

integer :: k, l

! Population of Buffers in x-direction
if (bcxb >= 0) then
if (bc_bound%xb >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 1, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -104,7 +105,7 @@
end do
end if

if (bcxe >= 0) then
if (bc_bound%xe >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 1, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand Down Expand Up @@ -132,7 +133,7 @@

if (n == 0) return

if (bcyb >= 0) then
if (bc_bound%yb >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 2, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -158,7 +159,7 @@
end do
end if

if (bcye >= 0) then
if (bc_bound%ye >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 2, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand Down Expand Up @@ -186,7 +187,7 @@

if (p == 0) return

if (bczb >= 0) then
if (bc_bound%zb >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 3, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -210,7 +211,7 @@
end do
end if

if (bcze >= 0) then
if (bc_bound%ze >= 0) then
call s_mpi_sendrecv_variables_buffers(q_prim_vf, pb, mv, 3, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand Down Expand Up @@ -1156,15 +1157,16 @@

end subroutine s_qbmm_extrapolation

impure subroutine s_populate_capillary_buffers(c_divs, bc_type)
impure subroutine s_populate_capillary_buffers(c_divs, bc_type, bc_bound)

type(scalar_field), dimension(num_dims + 1), intent(inout) :: c_divs
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
type(boundary_bounds), intent(in) :: bc_bound

integer :: k, l

!< x-direction
if (bcxb >= 0) then
if (bc_bound%xb >= 0) then

Check warning on line 1169 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1169

Added line #L1169 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 1, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -1182,7 +1184,7 @@
end do
end if

if (bcxe >= 0) then
if (bc_bound%xe >= 0) then

Check warning on line 1187 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1187

Added line #L1187 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 1, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -1203,7 +1205,7 @@
if (n == 0) return

!< y-direction
if (bcyb >= 0) then
if (bc_bound%yb >= 0) then

Check warning on line 1208 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1208

Added line #L1208 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 2, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -1221,7 +1223,7 @@
end do
end if

if (bcye >= 0) then
if (bc_bound%ye >= 0) then

Check warning on line 1226 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1226

Added line #L1226 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 2, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -1242,7 +1244,7 @@
if (p == 0) return

!< z-direction
if (bczb >= 0) then
if (bc_bound%zb >= 0) then

Check warning on line 1247 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1247

Added line #L1247 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 3, -1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand All @@ -1260,7 +1262,7 @@
end do
end if

if (bcze >= 0) then
if (bc_bound%ze >= 0) then

Check warning on line 1265 in src/common/m_boundary_common.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_boundary_common.fpp#L1265

Added line #L1265 was not covered by tests
call s_mpi_sendrecv_capilary_variables_buffers(c_divs, 3, 1)
else
!$acc parallel loop collapse(2) gang vector default(present)
Expand Down
22 changes: 22 additions & 0 deletions src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ module m_derived_types
type(vec3_dt), allocatable, dimension(:) :: var
end type mpi_io_airfoil_ib_var

!> Derived type for boundary flags
type boundary_bounds
real(wp) :: xb, xe, yb, ye, zb, ze
end type boundary_bounds

!> Derived type annexing integral regions
type integral_parameters
real(wp) :: xmin !< Min. boundary first coordinate direction
Expand Down Expand Up @@ -391,6 +396,22 @@ module m_derived_types
real(wp), dimension(:, :), allocatable :: xyz_to_r_ratios !< List of [xyz]/r for mom source term vector
end type source_spatial_type

!> @brief Type for storing point data
type point_data
real(wp), dimension(:), allocatable :: alpha_rho !< Partial densities
real(wp), dimension(:), allocatable :: alpha !< Volume fractions
real(wp) :: pressure !< Pressure
real(wp), dimension(3) :: vel !< Velocity
real(wp) :: c !< Color function (for surface tension)
real(wp), dimension(:), allocatable :: r !< Bubble radii
real(wp), dimension(:), allocatable :: v !< Bubble radial velocities
real(wp), dimension(:), allocatable :: pb !< Bubble pressures
real(wp), dimension(:), allocatable :: mv !< Mass of vapor
real(wp), dimension(:), allocatable :: nmom !< Moments for QBMM
real(wp), dimension(:), allocatable :: presb !< Node pressures for bubbles
real(wp), dimension(:), allocatable :: massv !< Node masses for bubbles
end type point_data

!> Ghost Point for Immersed Boundaries
type ghost_point
integer, dimension(3) :: loc !< Physical location of the ghost point
Expand All @@ -400,6 +421,7 @@ module m_derived_types
integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
logical :: slip
integer, dimension(3) :: DB
type(point_data) :: ip
end type ghost_point

!> Species parameters
Expand Down
4 changes: 2 additions & 2 deletions src/pre_process/m_perturbation.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contains

impure subroutine s_initialize_perturbation_module()

bcxb = bc_x%beg; bcxe = bc_x%end; bcyb = bc_y%beg; bcye = bc_y%end; bczb = bc_z%beg; bcze = bc_z%end
bc_bound%xb = bc_x%beg; bc_bound%xe = bc_x%end; bc_bound%yb = bc_y%beg; bc_bound%ye = bc_y%end; bc_bound%zb = bc_z%beg; bc_bound%ze = bc_z%end

if (mixlayer_perturb) then
mixlayer_bc_fd = 2
Expand Down Expand Up @@ -624,7 +624,7 @@ contains
do q = 1, elliptic_smoothing_iters

! Communication of buffer regions and apply boundary conditions
call s_populate_variables_buffers(q_prim_vf, pb%sf, mv%sf, bc_type)
call s_populate_variables_buffers(q_prim_vf, pb%sf, mv%sf, bc_type, bc_bound)

! Perform smoothing and store in temp array
if (n == 0) then
Expand Down
54 changes: 27 additions & 27 deletions src/simulation/m_cbc.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ module m_cbc
!$acc declare create(is1, is2, is3)

integer :: dj
integer :: bcxb, bcxe, bcyb, bcye, bczb, bcze
type(boundary_bounds) :: bc_bound !< Boundary flags
integer :: cbc_dir, cbc_loc
integer :: flux_cbc_index
!$acc declare create(dj, bcxb, bcxe, bcyb, bcye, bczb, bcze, cbc_dir, cbc_loc, flux_cbc_index)
!$acc declare create(dj, bc_bound, cbc_dir, cbc_loc, flux_cbc_index)

!! GRCBC inputs for subsonic inflow and outflow conditions consisting of
!! inflow velocities, pressure, density and void fraction as well as
Expand Down Expand Up @@ -392,23 +392,23 @@ contains
! Associating the procedural pointer to the appropriate subroutine
! that will be utilized in the conversion to the mixture variables

bcxb = bc_x%beg
bcxe = bc_x%end
bc_bound%xb = bc_x%beg
bc_bound%xe = bc_x%end

!$acc update device(bcxb, bcxe)
!$acc update device(bc_bound)

if (n > 0) then
bcyb = bc_y%beg
bcye = bc_y%end
bc_bound%yb = bc_y%beg
bc_bound%ye = bc_y%end

!$acc update device(bcyb, bcye)
!$acc update device(bc_bound)
end if

if (p > 0) then
bczb = bc_z%beg
bcze = bc_z%end
bc_bound%zb = bc_z%beg
bc_bound%ze = bc_z%end

!$acc update device(bczb, bcze)
!$acc update device(bc_bound)
end if

! Allocate GRCBC inputs
Expand Down Expand Up @@ -911,14 +911,14 @@ contains

Ma = vel(dir_idx(1))/c

if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_SLIP_WALL) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_SLIP_WALL)) then
if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_SLIP_WALL) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_SLIP_WALL)) then
call s_compute_slip_wall_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_NR_SUB_BUFFER) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_NR_SUB_BUFFER)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_NR_SUB_BUFFER) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_NR_SUB_BUFFER)) then
call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, dYs_ds)
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_NR_SUB_INFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_NR_SUB_INFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_NR_SUB_INFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_NR_SUB_INFLOW)) then
call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
! Add GRCBC for Subsonic Inflow
if (bc_${XYZ}$%grcbc_in) then
Expand All @@ -938,8 +938,8 @@ contains
end do
L(advxe) = rho*c**2._wp*(1._wp + Ma)*(vel(dir_idx(1)) + vel_in(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_in(${CBC_DIR}$) + c*(1._wp + Ma)*(pres - pres_in(${CBC_DIR}$))/Del_in(${CBC_DIR}$)
end if
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_NR_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_NR_SUB_OUTFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_NR_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_NR_SUB_OUTFLOW)) then
call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, dYs_ds)
! Add GRCBC for Subsonic Outflow (Pressure)
if (bc_${XYZ}$%grcbc_out) then
Expand All @@ -950,17 +950,17 @@ contains
L(advxe) = L(advxe) + rho*c**2._wp*(1._wp - Ma)*(vel(dir_idx(1)) + vel_out(${CBC_DIR}$, dir_idx(1))*sign(1, cbc_loc))/Del_out(${CBC_DIR}$)
end if
end if
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_FF_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_FF_SUB_OUTFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_FF_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_FF_SUB_OUTFLOW)) then
call s_compute_force_free_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_CP_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_CP_SUB_OUTFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_CP_SUB_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_CP_SUB_OUTFLOW)) then
call s_compute_constant_pressure_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_SUP_INFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_SUP_INFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_SUP_INFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_SUP_INFLOW)) then
call s_compute_supersonic_inflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
else if ((cbc_loc == -1 .and. bc${XYZ}$b == BC_CHAR_SUP_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc${XYZ}$e == BC_CHAR_SUP_OUTFLOW)) then
else if ((cbc_loc == -1 .and. bc_bound%${XYZ}$b == BC_CHAR_SUP_OUTFLOW) .or. &
(cbc_loc == 1 .and. bc_bound%${XYZ}$e == BC_CHAR_SUP_OUTFLOW)) then
call s_compute_supersonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds, dYs_ds)
end if

Expand Down
Loading
Loading