Skip to content

Commit 0041c4a

Browse files
Fixed 3D airfoils
1 parent f0d8d5e commit 0041c4a

3 files changed

Lines changed: 21 additions & 79 deletions

File tree

src/simulation/m_compute_levelset.fpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contains
3838
! 3D Patch Geometries
3939
if (p > 0) then
4040

41-
$:GPU_PARALLEL_LOOP(private='[i,patch_id,patch_geometry]', copy='[gps]', copyin='[patch_ib,Np]')
41+
$:GPU_PARALLEL_LOOP(private='[i,patch_id,patch_geometry]', copy='[gps]', copyin='[patch_ib(1:num_ibs),Np]')
4242
do i = 1, num_gps
4343

4444
patch_id = gps(i)%ib_patch_id
@@ -241,10 +241,10 @@ contains
241241
rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix(:, :)
242242
offset(:) = patch_ib(ib_patch_id)%centroid_offset(:)
243243
244-
z_max = center(3) + lz/2
245-
z_min = center(3) - lz/2
244+
z_max = lz/2
245+
z_min = -lz/2
246246
247-
xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(l) - center(3)] ! get coordinate frame centered on IB
247+
xyz_local = [x_cc(i), y_cc(j), z_cc(l)] - center
248248
xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates
249249
xyz_local = xyz_local - offset ! airfoils are a patch that require a centroid offset
250250

@@ -266,7 +266,7 @@ contains
266266
end do
267267
dist_vec(1) = xyz_local(1) - airfoil_grid_u(global_id)%x
268268
dist_vec(2) = xyz_local(2) - airfoil_grid_u(global_id)%y
269-
dist_vec(3) = 0
269+
dist_vec(3) = 0._wp
270270
dist_surf = global_dist
271271
else
272272
do k = 1, Np
@@ -286,7 +286,7 @@ contains
286286
end do
287287
dist_vec(1) = xyz_local(1) - airfoil_grid_l(global_id)%x
288288
dist_vec(2) = xyz_local(2) - airfoil_grid_l(global_id)%y
289-
dist_vec(3) = 0
289+
dist_vec(3) = 0._wp
290290
dist_surf = global_dist
291291
end if
292292

src/simulation/m_ib_patches.fpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,8 @@ contains
310310
inverse_rotation(:, :) = patch_ib(patch_id)%rotation_matrix_inverse(:, :)
311311
offset(:) = patch_ib(patch_id)%centroid_offset(:)
312312
313-
! rank(dx) is not consistent between pre_process and simulation. This IFDEF prevents compilation errors
314-
#ifdef MFC_PRE_PROCESS
315-
Np1 = int((pa*ca_in/dx)*20)
316-
Np2 = int(((ca_in - pa*ca_in)/dx)*20)
317-
#else
318313
Np1 = int((pa*ca_in/dx(0))*20)
319314
Np2 = int(((ca_in - pa*ca_in)/dx(0))*20)
320-
#endif
321315
Np = Np1 + Np2 + 1
322316
$:GPU_UPDATE(device='[Np]')
323317
@@ -466,17 +460,18 @@ contains
466460
inverse_rotation(:, :) = patch_ib(patch_id)%rotation_matrix_inverse(:, :)
467461
offset(:) = patch_ib(patch_id)%centroid_offset(:)
468462

469-
! rank(dx) is not consistent between pre_process and simulation. This IFDEF prevents compilation errors
463+
z_max = lz/2
464+
z_min = -lz/2
465+
470466
Np1 = int((pa*ca_in/dx(0))*20)
471467
Np2 = int(((ca_in - pa*ca_in)/dx(0))*20)
472468
Np = Np1 + Np2 + 1
473-
474-
z_max = lz/2
475-
z_min = -lz/2
469+
$:GPU_UPDATE(device='[Np]')
476470

477471
if (.not. allocated(airfoil_grid_u)) then
478-
allocate (airfoil_grid_u(1:Np))
479-
allocate (airfoil_grid_l(1:Np))
472+
473+
@:ALLOCATE(airfoil_grid_u(1:Np))
474+
@:ALLOCATE(airfoil_grid_l(1:Np))
480475

481476
airfoil_grid_u(1)%x = 0._wp
482477
airfoil_grid_u(1)%y = 0._wp
@@ -526,10 +521,12 @@ contains
526521

527522
airfoil_grid_l(Np)%x = ca_in
528523
airfoil_grid_l(Np)%y = 0._wp
524+
525+
$:GPU_UPDATE(device='[airfoil_grid_l,airfoil_grid_u]')
529526
end if
530527

531528
$:GPU_PARALLEL_LOOP(private='[i,j,l,xyz_local,k,f]', copy='[ib_markers_sf]',&
532-
& copyin='[patch_id,center,inverse_rotation,offset,ma,ca_in,airfoil_grid_u,airfoil_grid_l]', collapse=3)
529+
& copyin='[patch_id,center,inverse_rotation,offset,ma,ca_in,airfoil_grid_u,airfoil_grid_l,z_min,z_max]', collapse=3)
533530
do l = 0, p
534531
do j = 0, n
535532
do i = 0, m
@@ -547,7 +544,7 @@ contains
547544
end do
548545
if (f_approx_equal(airfoil_grid_u(k)%x, xyz_local(1))) then
549546
if (xyz_local(2) <= airfoil_grid_u(k)%y) then
550-
!!IB
547+
!IB
551548
ib_markers_sf(i, j, l) = patch_id
552549
end if
553550
else
@@ -570,10 +567,10 @@ contains
570567
else
571568
f = (airfoil_grid_l(k)%x - xyz_local(1))/(airfoil_grid_l(k)%x - airfoil_grid_l(k - 1)%x)
572569
573-
if (xyz_local(2) >= ((1._wp - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then
574-
!!IB
575-
ib_markers_sf(i, j, l) = patch_id
576-
end if
570+
! if (xyz_local(2) >= ((1._wp - f)*airfoil_grid_l(k)%y + f*airfoil_grid_l(k - 1)%y)) then
571+
! !!IB
572+
! ib_markers_sf(i, j, l) = patch_id
573+
! end if
577574
end if
578575
end if
579576
end if

src/simulation/m_start_up.fpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -720,61 +720,6 @@ contains
720720

721721
end if
722722

723-
if (ib) then
724-
725-
do j = 1, num_ibs
726-
if (patch_ib(j)%c > 0) then
727-
728-
allocate (airfoil_grid_u(1:Np))
729-
allocate (airfoil_grid_l(1:Np))
730-
731-
write (file_loc, '(A)') 'airfoil_l.dat'
732-
file_loc = trim(case_dir)//'/restart_data'//trim(mpiiofs)//trim(file_loc)
733-
inquire (FILE=trim(file_loc), EXIST=file_exist)
734-
if (file_exist) then
735-
736-
call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
737-
738-
! Initial displacement to skip at beginning of file
739-
disp = 0
740-
741-
call MPI_FILE_SET_VIEW(ifile, disp, mpi_io_p, MPI_IO_airfoil_IB_DATA%view(1), &
742-
'native', mpi_info_int, ierr)
743-
call MPI_FILE_READ(ifile, MPI_IO_airfoil_IB_DATA%var(1:Np), 3*Np*mpi_io_type, &
744-
mpi_io_p, status, ierr)
745-
746-
end if
747-
748-
write (file_loc, '(A)') 'airfoil_u.dat'
749-
file_loc = trim(case_dir)//'/restart_data'//trim(mpiiofs)//trim(file_loc)
750-
inquire (FILE=trim(file_loc), EXIST=file_exist)
751-
if (file_exist) then
752-
753-
call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
754-
755-
! Initial displacement to skip at beginning of file
756-
disp = 0
757-
758-
call MPI_FILE_SET_VIEW(ifile, disp, mpi_io_p, MPI_IO_airfoil_IB_DATA%view(2), &
759-
'native', mpi_info_int, ierr)
760-
call MPI_FILE_READ(ifile, MPI_IO_airfoil_IB_DATA%var(Np + 1:2*Np), 3*Np*mpi_io_type, &
761-
mpi_io_p, status, ierr)
762-
end if
763-
764-
do i = 1, Np
765-
airfoil_grid_l(i)%x = MPI_IO_airfoil_IB_DATA%var(i)%x
766-
airfoil_grid_l(i)%y = MPI_IO_airfoil_IB_DATA%var(i)%y
767-
end do
768-
769-
do i = 1, Np
770-
airfoil_grid_u(i)%x = MPI_IO_airfoil_IB_DATA%var(Np + i)%x
771-
airfoil_grid_u(i)%y = MPI_IO_airfoil_IB_DATA%var(Np + i)%y
772-
end do
773-
774-
end if
775-
end do
776-
end if
777-
778723
deallocate (x_cb_glb, y_cb_glb, z_cb_glb)
779724

780725
if (bc_io) then

0 commit comments

Comments
 (0)