Skip to content

Commit e9e34b0

Browse files
authored
Merge branch 'master' into ci-improvements
2 parents 3bb6621 + ef6998d commit e9e34b0

88 files changed

Lines changed: 2347 additions & 2489 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/2D_forward_facing_step/case.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
"patch_icpp(1)%alpha(1)": 1.0,
7171
# Patch: No slip rectangle
7272
"patch_ib(1)%geometry": 3,
73-
"patch_ib(1)%x_centroid": 11.5 * h,
74-
"patch_ib(1)%y_centroid": 0 * h,
75-
"patch_ib(1)%length_x": 17 * h,
76-
"patch_ib(1)%length_y": 2 * h,
73+
"patch_ib(1)%x_centroid": 9 * h,
74+
"patch_ib(1)%y_centroid": 0.5 * h,
75+
"patch_ib(1)%length_x": 12 * h,
76+
"patch_ib(1)%length_y": h,
7777
"patch_ib(1)%slip": "T",
7878
# Fluids Physical Parameters
7979
"fluid_pp(1)%gamma": 1.0 / (gam_a - 1.0),

src/common/m_compute_levelset.fpp

Lines changed: 0 additions & 625 deletions
This file was deleted.

src/common/m_derived_types.fpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,18 @@ module m_derived_types
180180
type :: t_model
181181
integer :: ntrs ! Number of triangles
182182
type(t_triangle), allocatable :: trs(:) ! Triangles
183+
183184
end type t_model
184185

186+
type :: t_model_array
187+
type(t_model), allocatable :: model
188+
real(wp), allocatable, dimension(:, :, :) :: boundary_v
189+
real(wp), allocatable, dimension(:, :) :: interpolated_boundary_v
190+
integer :: boundary_edge_count
191+
integer :: total_vertices
192+
logical :: interpolate
193+
end type t_model_array
194+
185195
!> Derived type adding initial condition (ic) patch parameters as attributes
186196
!! NOTE: The requirements for the specification of the above parameters
187197
!! are strongly dependent on both the choice of the multicomponent flow
@@ -437,6 +447,8 @@ module m_derived_types
437447
integer, dimension(3) :: ip_grid !< Top left grid point of IP
438448
real(wp), dimension(2, 2, 2) :: interp_coeffs !< Interpolation Coefficients of image point
439449
integer :: ib_patch_id !< ID of the IB Patch the ghost point is part of
450+
real(wp) :: levelset
451+
real(wp), dimension(1:3) :: levelset_norm
440452
logical :: slip
441453
integer, dimension(3) :: DB
442454
end type ghost_point

src/common/m_model.fpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ contains
487487
!! @return True if the point is inside the octree, false otherwise.
488488
impure function f_model_is_inside(model, point, spacing, spc) result(fraction)
489489

490+
! $:GPU_ROUTINE(parallelism='[seq]')
491+
490492
type(t_model), intent(in) :: model
491493
real(wp), dimension(1:3), intent(in) :: point
492494
real(wp), dimension(1:3), intent(in) :: spacing
@@ -499,6 +501,15 @@ contains
499501

500502
real(wp), dimension(1:spc, 1:3) :: ray_origins, ray_dirs
501503

504+
! TODO :: The random number generation prohibits GPU compute due to the subroutine not being able to be called in kernels
505+
! This should be swapped out with something that allows GPU compute. I recommend the fibonacci sphere:
506+
! do i = 1, spc
507+
! phi = acos(1.0 - 2.0*(i-1.0)/(spc-1.0))
508+
! theta = pi * (1.0 + sqrt(5.0)) * (i-1.0)
509+
! ray_dirs(i,:) = [cos(theta)*sin(phi), sin(theta)*sin(phi), cos(phi)]
510+
! ray_origins(i,:) = point
511+
! end do
512+
502513
do i = 1, spc
503514
call random_number(ray_origins(i, :))
504515
ray_origins(i, :) = point + (ray_origins(i, :) - 0.5_wp)*spacing(:)
@@ -739,7 +750,6 @@ contains
739750
interpolate = .false.
740751

741752
do j = 1, boundary_edge_count
742-
743753
l1 = sqrt((boundary_v(j, 2, 1) - boundary_v(j, 1, 1))**2 + &
744754
(boundary_v(j, 2, 2) - boundary_v(j, 1, 2))**2)
745755

@@ -1049,6 +1059,8 @@ contains
10491059
!! @param distance The output levelset distance
10501060
subroutine f_distance_normals_3D(model, point, normals, distance)
10511061

1062+
$:GPU_ROUTINE(parallelism='[seq]')
1063+
10521064
type(t_model), intent(IN) :: model
10531065
real(wp), dimension(1:3), intent(in) :: point
10541066
real(wp), dimension(1:3), intent(out) :: normals
@@ -1112,8 +1124,11 @@ contains
11121124
!! @return Distance which the levelset distance without interpolation
11131125
function f_distance(boundary_v, boundary_edge_count, point) result(distance)
11141126

1127+
$:GPU_ROUTINE(parallelism='[seq]')
1128+
11151129
integer, intent(in) :: boundary_edge_count
1116-
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
1130+
real(wp), intent(in), dimension(:, :, :) :: boundary_v
1131+
! real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
11171132
real(wp), dimension(1:3), intent(in) :: point
11181133

11191134
integer :: i
@@ -1143,8 +1158,10 @@ contains
11431158
!! @param normals Output levelset normals without interpolation
11441159
subroutine f_normals(boundary_v, boundary_edge_count, point, normals)
11451160

1161+
$:GPU_ROUTINE(parallelism='[seq]')
1162+
11461163
integer, intent(in) :: boundary_edge_count
1147-
real(wp), intent(in), dimension(1:boundary_edge_count, 1:3, 1:2) :: boundary_v
1164+
real(wp), intent(in), dimension(:, :, :) :: boundary_v
11481165
real(wp), dimension(1:3), intent(in) :: point
11491166
real(wp), dimension(1:3), intent(out) :: normals
11501167

@@ -1203,8 +1220,10 @@ contains
12031220
!! @return Distance which the levelset distance without interpolation
12041221
function f_interpolated_distance(interpolated_boundary_v, total_vertices, point) result(distance)
12051222

1223+
$:GPU_ROUTINE(parallelism='[seq]')
1224+
12061225
integer, intent(in) :: total_vertices
1207-
real(wp), intent(in), dimension(1:total_vertices, 1:3) :: interpolated_boundary_v
1226+
real(wp), intent(in), dimension(:, :) :: interpolated_boundary_v
12081227
real(wp), dimension(1:3), intent(in) :: point
12091228

12101229
integer :: i !< Loop iterator

src/common/m_mpi_common.fpp

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,11 @@ contains
124124
125125
!! @param q_cons_vf Conservative variables
126126
!! @param ib_markers track if a cell is within the immersed boundary
127-
!! @param levelset closest distance from every cell to the IB
128-
!! @param levelset_norm normalized vector from every cell to the closest point to the IB
129127
!! @param beta Eulerian void fraction from lagrangian bubbles
130-
impure subroutine s_initialize_mpi_data(q_cons_vf, ib_markers, levelset, levelset_norm, beta)
128+
impure subroutine s_initialize_mpi_data(q_cons_vf, ib_markers, beta)
131129
132130
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
133131
type(integer_field), optional, intent(in) :: ib_markers
134-
type(levelset_field), optional, intent(IN) :: levelset
135-
type(levelset_norm_field), optional, intent(IN) :: levelset_norm
136132
type(scalar_field), intent(in), optional :: beta
137133
138134
integer, dimension(num_dims) :: sizes_glb, sizes_loc
@@ -203,73 +199,13 @@ contains
203199
end if
204200
#endif
205201
202+
#ifndef MFC_PRE_PROCESS
206203
if (present(ib_markers)) then
207-
208-
#ifdef MFC_PRE_PROCESS
209-
MPI_IO_IB_DATA%var%sf => ib_markers%sf
210-
MPI_IO_levelset_DATA%var%sf => levelset%sf
211-
MPI_IO_levelsetnorm_DATA%var%sf => levelset_norm%sf
212-
#else
213204
MPI_IO_IB_DATA%var%sf => ib_markers%sf(0:m, 0:n, 0:p)
214205
215-
#ifndef MFC_POST_PROCESS
216-
MPI_IO_levelset_DATA%var%sf => levelset%sf(0:m, 0:n, 0:p, 1:num_ibs)
217-
MPI_IO_levelsetnorm_DATA%var%sf => levelset_norm%sf(0:m, 0:n, 0:p, 1:num_ibs, 1:3)
218-
#endif
219-
220-
#endif
221206
call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, &
222207
MPI_ORDER_FORTRAN, MPI_INTEGER, MPI_IO_IB_DATA%view, ierr)
223208
call MPI_TYPE_COMMIT(MPI_IO_IB_DATA%view, ierr)
224-
225-
#ifndef MFC_POST_PROCESS
226-
call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, &
227-
MPI_ORDER_FORTRAN, mpi_p, MPI_IO_levelset_DATA%view, ierr)
228-
call MPI_TYPE_CREATE_SUBARRAY(num_dims, sizes_glb, sizes_loc, start_idx, &
229-
MPI_ORDER_FORTRAN, mpi_p, MPI_IO_levelsetnorm_DATA%view, ierr)
230-
231-
call MPI_TYPE_COMMIT(MPI_IO_levelset_DATA%view, ierr)
232-
call MPI_TYPE_COMMIT(MPI_IO_levelsetnorm_DATA%view, ierr)
233-
#endif
234-
end if
235-
236-
#ifndef MFC_POST_PROCESS
237-
if (present(ib_markers)) then
238-
do j = 1, num_ibs
239-
if (patch_ib(j)%c > 0) then
240-
241-
#ifdef MFC_PRE_PROCESS
242-
allocate (MPI_IO_airfoil_IB_DATA%var(1:2*Np))
243-
#endif
244-
245-
airfoil_glb(1) = 3*Np*num_procs
246-
airfoil_loc(1) = 3*Np
247-
airfoil_start(1) = 3*proc_rank*Np
248-
249-
#ifdef MFC_PRE_PROCESS
250-
do i = 1, Np
251-
MPI_IO_airfoil_IB_DATA%var(i)%x = airfoil_grid_l(i)%x
252-
MPI_IO_airfoil_IB_DATA%var(i)%y = airfoil_grid_l(i)%y
253-
end do
254-
#endif
255-
256-
call MPI_TYPE_CREATE_SUBARRAY(1, airfoil_glb, airfoil_loc, airfoil_start, &
257-
MPI_ORDER_FORTRAN, mpi_p, MPI_IO_airfoil_IB_DATA%view(1), ierr)
258-
call MPI_TYPE_COMMIT(MPI_IO_airfoil_IB_DATA%view(1), ierr)
259-
260-
#ifdef MFC_PRE_PROCESS
261-
do i = 1, Np
262-
MPI_IO_airfoil_IB_DATA%var(Np + i)%x = airfoil_grid_u(i)%x
263-
MPI_IO_airfoil_IB_DATA%var(Np + i)%y = airfoil_grid_u(i)%y
264-
end do
265-
#endif
266-
call MPI_TYPE_CREATE_SUBARRAY(1, airfoil_glb, airfoil_loc, airfoil_start, &
267-
MPI_ORDER_FORTRAN, mpi_p, MPI_IO_airfoil_IB_DATA%view(2), ierr)
268-
call MPI_TYPE_COMMIT(MPI_IO_airfoil_IB_DATA%view(2), ierr)
269-
270-
end if
271-
end do
272-
273209
end if
274210
#endif
275211

0 commit comments

Comments
 (0)