Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/common/include/ExtrusionHardcodedIC.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
do
read (unit2, *, iostat=ios2) dummy_x, dummy_y, dummy_z
if (ios2 /= 0) exit
if (dummy_x == x0 .and. dummy_y /= y0) then
if (f_approx_equal(dummy_x, x0) .and. (.not. f_approx_equal(dummy_y, y0))) then
yRows = yRows + 1
else
exit
Expand Down
11 changes: 1 addition & 10 deletions src/common/m_boundary_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ contains
type(integer_field), dimension(1:num_dims,1:2), intent(in) :: bc_type
logical, intent(in) :: old_grid_in
character(LEN=*), intent(in) :: step_dirpath
integer :: dir, loc, i
integer :: dir, loc
character(len=path_len) :: file_path
character(len=10) :: status

Expand Down Expand Up @@ -1612,12 +1612,10 @@ contains
type(integer_field), dimension(1:num_dims,1:2), intent(in) :: bc_type
integer :: dir, loc
character(len=path_len) :: file_loc, file_path
character(len=10) :: status

#ifdef MFC_MPI
integer :: ierr
integer :: file_id
integer :: offset
character(len=7) :: proc_rank_str
logical :: dir_check
integer :: nelements
Expand All @@ -1642,8 +1640,6 @@ contains
file_path = trim(file_loc) // '/bc_' // trim(proc_rank_str) // '.dat'
call MPI_File_open(MPI_COMM_SELF, trim(file_path), MPI_MODE_CREATE + MPI_MODE_WRONLY, MPI_INFO_NULL, file_id, ierr)

offset = 0

! Write bc_types
do dir = 1, num_dims
do loc = 1, 2
Expand Down Expand Up @@ -1678,7 +1674,6 @@ contains
integer :: dir, loc
logical :: file_exist
character(len=path_len) :: file_path
character(len=10) :: status

! Read bc_types

Expand Down Expand Up @@ -1721,12 +1716,10 @@ contains
type(integer_field), dimension(1:num_dims,1:2), intent(inout) :: bc_type
integer :: dir, loc
character(len=path_len) :: file_loc, file_path
character(len=10) :: status

#ifdef MFC_MPI
integer :: ierr
integer :: file_id
integer :: offset
character(len=7) :: proc_rank_str
logical :: dir_check
integer :: nelements
Expand All @@ -1750,8 +1743,6 @@ contains
file_path = trim(file_loc) // '/bc_' // trim(proc_rank_str) // '.dat'
call MPI_File_open(MPI_COMM_SELF, trim(file_path), MPI_MODE_RDONLY, MPI_INFO_NULL, file_id, ierr)

offset = 0

! Read bc_types
do dir = 1, num_dims
do loc = 1, 2
Expand Down
57 changes: 0 additions & 57 deletions src/common/m_finite_differences.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,6 @@ module m_finite_differences

contains

!> Accumulate the finite-difference divergence of a vector field onto a scalar field.
subroutine s_compute_fd_divergence(div, fields, ix_s, iy_s, iz_s)

type(scalar_field), intent(inout) :: div
type(scalar_field), intent(in) :: fields(1:3)
type(int_bounds_info), intent(in) :: ix_s, iy_s, iz_s
integer :: x, y, z !< Generic loop iterators
real(wp) :: divergence

$:GPU_PARALLEL_LOOP(collapse=3, private='[x, y, z, divergence]')
do x = ix_s%beg, ix_s%end
do y = iy_s%beg, iy_s%end
do z = iz_s%beg, iz_s%end
if (x == ix_s%beg) then
divergence = (-3._wp*fields(1)%sf(x, y, z) + 4._wp*fields(1)%sf(x + 1, y, z) - fields(1)%sf(x + 2, y, &
& z))/(x_cc(x + 2) - x_cc(x))
else if (x == ix_s%end) then
divergence = (+3._wp*fields(1)%sf(x, y, z) - 4._wp*fields(1)%sf(x - 1, y, z) + fields(1)%sf(x - 2, y, &
& z))/(x_cc(x) - x_cc(x - 2))
else
divergence = (fields(1)%sf(x + 1, y, z) - fields(1)%sf(x - 1, y, z))/(x_cc(x + 1) - x_cc(x - 1))
end if

if (n > 0) then
if (y == iy_s%beg) then
divergence = divergence + (-3._wp*fields(2)%sf(x, y, z) + 4._wp*fields(2)%sf(x, y + 1, &
& z) - fields(2)%sf(x, y + 2, z))/(y_cc(y + 2) - y_cc(y))
else if (y == iy_s%end) then
divergence = divergence + (+3._wp*fields(2)%sf(x, y, z) - 4._wp*fields(2)%sf(x, y - 1, &
& z) + fields(2)%sf(x, y - 2, z))/(y_cc(y) - y_cc(y - 2))
else
divergence = divergence + (fields(2)%sf(x, y + 1, z) - fields(2)%sf(x, y - 1, &
& z))/(y_cc(y + 1) - y_cc(y - 1))
end if
end if

if (p > 0) then
if (z == iz_s%beg) then
divergence = divergence + (-3._wp*fields(3)%sf(x, y, z) + 4._wp*fields(3)%sf(x, y, &
& z + 1) - fields(3)%sf(x, y, z + 2))/(z_cc(z + 2) - z_cc(z))
else if (z == iz_s%end) then
divergence = divergence + (+3._wp*fields(3)%sf(x, y, z) - 4._wp*fields(3)%sf(x, y, &
& z - 1) + fields(3)%sf(x, y, z - 2))/(z_cc(z) - z_cc(z - 2))
else
divergence = divergence + (fields(3)%sf(x, y, z + 1) - fields(3)%sf(x, y, &
& z - 1))/(z_cc(z + 1) - z_cc(z - 1))
end if
end if

div%sf(x, y, z) = div%sf(x, y, z) + divergence
end do
end do
end do
$:END_GPU_PARALLEL_LOOP()

end subroutine s_compute_fd_divergence

!> Compute the centered finite-difference coefficients for first-order spatial derivatives in the s-coordinate direction (x, y,
!! or z). Supports up to 4th order accuracy.
!! @param fd_coeff_s Finite-diff. coefficients in the s-coordinate direction
Expand Down
2 changes: 1 addition & 1 deletion src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ contains
impure subroutine s_initialize_nonpoly()

integer :: ir
real(wp), dimension(nb) :: chi_vw0, cp_m0, k_m0, rho_m0, x_vw, omegaN, rhol0
real(wp), dimension(nb) :: chi_vw0, cp_m0, k_m0, rho_m0, x_vw, omegaN
real(wp), parameter :: k_poly = 1._wp !< polytropic index used to compute isothermal natural frequency
! Chapman-Enskog transport coefficients for vapor-gas mixture, Ando JAS (2010)

Expand Down
13 changes: 11 additions & 2 deletions src/common/m_helper_basic.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
module m_helper_basic

use m_derived_types
use m_precision_select

implicit none

Expand All @@ -29,7 +30,11 @@ contains
if (present(tol_input)) then
tol = tol_input
else
tol = 1.e-10_wp
if (wp == single_precision) then
tol = 1.e-6_wp
else
tol = 1.e-10_wp
end if
end if

if (a == b) then
Expand Down Expand Up @@ -58,7 +63,11 @@ contains
if (present(tol_input)) then
tol = tol_input
else
tol = 1e-10_wp
if (wp == single_precision) then
tol = 1.e-6_wp
else
tol = 1.e-10_wp
end if
end if

do i = 1, size(b)
Expand Down
22 changes: 10 additions & 12 deletions src/common/m_model.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ contains
real(wp), dimension(1:3), intent(in) :: point
real(wp), dimension(1:3), intent(in) :: spacing
integer, intent(in) :: spc
real(wp) :: phi, theta
real(wp) :: phi
integer :: rand_seed
real(wp) :: fraction
type(t_ray) :: ray
Expand Down Expand Up @@ -779,7 +779,7 @@ contains
real(wp) :: v1(1:3), v2(1:3), v3(1:3)
real(wp) :: e0(1:3), e1(1:3), pv(1:3)
real(wp) :: n(1:3), proj(1:3), norm_vec(1:3)
real(wp) :: d, ndot, denom, norm_mag
real(wp) :: d, denom, norm_mag
real(wp) :: u, v_bary, w
real(wp) :: l00, l01, l11, l20, l21
real(wp) :: edge(1:3), pe(1:3)
Expand Down Expand Up @@ -905,9 +905,9 @@ contains
real(wp), dimension(1:3), intent(out) :: normals
real(wp), intent(out) :: distance
integer :: i
real(wp) :: dist_min, dist, t, norm_mag
real(wp) :: dist_min, dist, t
real(wp) :: v1(1:2), v2(1:2), edge(1:2), pv(1:2)
real(wp) :: edge_len_sq, proj(1:2), norm(1:2), c
real(wp) :: edge_len_sq, proj(1:2), norm(1:2)

dist_min = initial_distance_buffer
normals = 0._wp
Expand Down Expand Up @@ -967,16 +967,15 @@ contains
subroutine s_instantiate_STL_models()

! Variables for IBM+STL
real(wp) :: normals(1:3) !< Boundary normal buffer
integer :: boundary_vertex_count, boundary_edge_count, total_vertices !< Boundary vertex
real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertex buffer
real(wp) :: dx_local, dy_local, dz_local !< Levelset distance buffer
integer :: i, j, k !< Generic loop iterators
real(wp) :: normals(1:3) !< Boundary normal buffer
integer :: boundary_vertex_count, boundary_edge_count !< Boundary vertex
real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertex buffer
real(wp) :: dx_local, dy_local, dz_local !< Levelset distance buffer
integer :: i, j, k !< Generic loop iterators
integer :: patch_id
type(t_bbox) :: bbox, bbox_old
type(t_model) :: model
type(ic_model_parameters) :: params
real(wp) :: eta
real(wp), dimension(1:3) :: point, model_center
real(wp) :: grid_mm(1:3,1:2)
real(wp), dimension(1:4,1:4) :: transform, transform_n
Expand Down Expand Up @@ -1066,11 +1065,10 @@ contains
! Pack and upload flat arrays for GPU (AFTER the loop)
block
integer :: pid, max_ntrs
integer :: max_bv1, max_bv2, max_bv3, max_iv1, max_iv2
integer :: max_bv1, max_bv2, max_bv3

max_ntrs = 0
max_bv1 = 0; max_bv2 = 0; max_bv3 = 0
max_iv1 = 0; max_iv2 = 0

do pid = 1, num_ibs
if (allocated(models(pid)%model)) then
Expand Down
29 changes: 17 additions & 12 deletions src/common/m_mpi_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ contains
type(integer_field), optional, intent(in) :: ib_markers
type(scalar_field), intent(in), optional :: beta
integer, dimension(num_dims) :: sizes_glb, sizes_loc
integer, dimension(1) :: airfoil_glb, airfoil_loc, airfoil_start

#ifdef MFC_MPI
integer :: i, j
Expand Down Expand Up @@ -180,11 +179,11 @@ contains
subroutine s_initialize_mpi_data_ds(q_cons_vf)

type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
integer, dimension(num_dims) :: sizes_glb, sizes_loc
integer, dimension(num_dims) :: sizes_loc
integer, dimension(3) :: sf_start_idx

#ifdef MFC_MPI
integer :: i, j, q, k, l, m_ds, n_ds, p_ds, ierr
integer :: i, m_ds, n_ds, p_ds, ierr

sf_start_idx = (/0, 0, 0/)

Expand Down Expand Up @@ -297,16 +296,22 @@ contains
real(wp), intent(out) :: vcfl_max_glb
real(wp), intent(out) :: Rc_min_glb

icfl_max_glb = icfl_max_loc
vcfl_max_glb = vcfl_max_loc
Rc_min_glb = Rc_min_loc

#ifdef MFC_SIMULATION
#ifdef MFC_MPI
integer :: ierr !< Generic flag used to identify and report MPI errors
block
integer :: ierr

call MPI_REDUCE(icfl_max_loc, icfl_max_glb, 1, mpi_p, MPI_MAX, 0, MPI_COMM_WORLD, ierr)
call MPI_REDUCE(icfl_max_loc, icfl_max_glb, 1, mpi_p, MPI_MAX, 0, MPI_COMM_WORLD, ierr)

if (viscous) then
call MPI_REDUCE(vcfl_max_loc, vcfl_max_glb, 1, mpi_p, MPI_MAX, 0, MPI_COMM_WORLD, ierr)
call MPI_REDUCE(Rc_min_loc, Rc_min_glb, 1, mpi_p, MPI_MIN, 0, MPI_COMM_WORLD, ierr)
end if
if (viscous) then
call MPI_REDUCE(vcfl_max_loc, vcfl_max_glb, 1, mpi_p, MPI_MAX, 0, MPI_COMM_WORLD, ierr)
call MPI_REDUCE(Rc_min_loc, Rc_min_glb, 1, mpi_p, MPI_MIN, 0, MPI_COMM_WORLD, ierr)
end if
end block
#else
icfl_max_glb = icfl_max_loc

Expand Down Expand Up @@ -336,9 +341,9 @@ contains
!> Reduce an array of vectors to their global sums across all MPI ranks.
impure subroutine s_mpi_allreduce_vectors_sum(var_loc, var_glb, num_vectors, vector_length)

integer, intent(in) :: num_vectors, vector_length
real(wp), dimension(:,:), intent(in) :: var_loc
real(wp), dimension(:,:), intent(out) :: var_glb
integer, intent(in) :: num_vectors, vector_length
real(wp), dimension(:,:), intent(in) :: var_loc
real(wp), dimension(:,:), intent(inout) :: var_glb

#ifdef MFC_MPI
integer :: ierr !< Generic flag used to identify and report MPI errors
Expand Down
10 changes: 9 additions & 1 deletion src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ contains
real(wp), optional, intent(out) :: G_K
real(wp) :: alpha_K_sum
integer :: i, j !< Generic loop iterators

rho_K = 0._wp
gamma_K = 0._wp
pi_inf_K = 0._wp
qv_K = 0._wp
Re_K = dflt_real
if (present(G_K)) G_K = 0._wp

#ifdef MFC_SIMULATION
! Constrain partial densities and volume fractions within physical bounds
if (num_fluids == 1 .and. bubbles_euler) then
Expand Down Expand Up @@ -1315,7 +1323,7 @@ contains
disc = term**2 - 4*c**2*B(norm)**2/(rho*h + B2)
end if

#ifdef DEBUG
#ifdef MFC_DEBUG
if (disc < 0._wp) then
print *, 'rho, c, Bx, By, Bz, h, term, disc:', rho, c, B(1), B(2), B(3), h, term, disc
call s_mpi_abort('Error: negative discriminant in s_compute_fast_magnetosonic_speed')
Expand Down
2 changes: 0 additions & 2 deletions src/post_process/m_data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ impure subroutine s_read_serial_data_files(t_step)
character(LEN=len_trim(case_dir) + 2*name_len) :: t_step_dir
character(LEN=len_trim(case_dir) + 3*name_len) :: file_loc
character(LEN=int(floor(log10(real(sys_size, wp)))) + 1) :: file_num
character(LEN=len_trim(case_dir) + 2*name_len) :: t_step_ib_dir
logical :: dir_check
logical :: file_check
integer :: i
Expand Down Expand Up @@ -258,7 +257,6 @@ impure subroutine s_read_parallel_data_files(t_step)
integer(KIND=MPI_OFFSET_KIND) :: NVARS_MOK
integer(KIND=MPI_OFFSET_KIND) :: MOK
integer(kind=MPI_OFFSET_KIND) :: offset
real(wp) :: delx, dely, delz
character(LEN=path_len + 2*name_len) :: file_loc
logical :: file_exist
character(len=10) :: t_step_string
Expand Down
11 changes: 5 additions & 6 deletions src/post_process/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,12 @@ contains
integer, dimension(MPI_STATUS_SIZE) :: status
integer(KIND=MPI_OFFSET_KIND) :: disp
integer :: view
logical :: lg_bub_file, file_exist
logical :: file_exist
integer, dimension(2) :: gsizes, lsizes, start_idx_part
integer :: ifile
integer :: ierr
real(wp) :: file_time, file_dt
integer :: file_num_procs, file_tot_part, tot_part
integer :: file_num_procs, file_tot_part
integer :: i
integer, dimension(:), allocatable :: proc_bubble_counts
real(wp), dimension(1:1,1:lag_io_vars) :: lag_io_null
Expand Down Expand Up @@ -868,22 +868,21 @@ contains
integer :: id

#ifdef MFC_MPI
real(wp), dimension(20) :: inputvals
real(wp) :: time_real
integer, dimension(MPI_STATUS_SIZE) :: status
integer(KIND=MPI_OFFSET_KIND) :: disp
integer :: view
logical :: lg_bub_file, file_exist
logical :: file_exist
integer, dimension(2) :: gsizes, lsizes, start_idx_part
integer :: ifile, ierr, tot_data, valid_data, nBub
integer :: ifile, ierr, nBub
real(wp) :: file_time, file_dt
integer :: file_num_procs, file_tot_part
integer, dimension(:), allocatable :: proc_bubble_counts
real(wp), dimension(1:1,1:lag_io_vars) :: dummy
character(LEN=4*name_len), dimension(num_procs) :: meshnames
integer, dimension(num_procs) :: meshtypes
real(wp) :: dummy_data
integer :: i, j
integer :: i
real(wp), dimension(:), allocatable :: bub_id
real(wp), dimension(:), allocatable :: px, py, pz, ppx, ppy, ppz, vx, vy, vz
real(wp), dimension(:), allocatable :: radius, rvel, rnot, rmax, rmin, dphidt
Expand Down
Loading
Loading