Skip to content

Commit 884a4d9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into nvidia
2 parents cacc6b0 + 5ee319c commit 884a4d9

Some content is hidden

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

66 files changed

+1423
-973
lines changed

.github/workflows/bench.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ jobs:
2424

2525
self:
2626
name: "${{ matrix.name }} (${{ matrix.device }})"
27-
if: ${{ github.repository == 'MFlowCode/MFC' && needs.file-changes.outputs.checkall == 'true' && (
28-
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved') ||
29-
(github.event_name == 'pull_request' && github.event.pull_request.user.login == 'sbryngelson')
30-
) }}
27+
if: ${{ github.repository=='MFlowCode/MFC' && needs.file-changes.outputs.checkall=='true' && ((github.event_name=='pull_request_review' && github.event.review.state=='approved') || (github.event_name=='pull_request' && (github.event.pull_request.user.login=='sbryngelson' || github.event.pull_request.user.login=='wilfonba'))) }}
3128
needs: file-changes
3229
strategy:
3330
fail-fast: false

.typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Gam = "Gam"
1818
strang = "strang"
1919
Strang = "Strang"
2020
TKE = "TKE"
21+
HSA = "HSA"
2122

2223
[files]
2324
extend-exclude = ["docs/documentation/references*", "tests/", "toolchain/cce_simulation_workgroup_256.sh"]

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,10 @@ HANDLE_SOURCES(syscheck OFF)
391391
# * FFTW (optional) Should be linked with an FFTW-like library (fftw/cufftw),
392392
# depending on whether OpenACC is enabled and which compiler is
393393
# being used.
394+
# * LAPACK (optional) Should be linked with LAPACK
394395

395396
function(MFC_SETUP_TARGET)
396-
cmake_parse_arguments(ARGS "OpenACC;MPI;SILO;HDF5;FFTW" "TARGET" "SOURCES" ${ARGN})
397+
cmake_parse_arguments(ARGS "OpenACC;MPI;SILO;HDF5;FFTW;LAPACK" "TARGET" "SOURCES" ${ARGN})
397398

398399
add_executable(${ARGS_TARGET} ${ARGS_SOURCES})
399400
set(IPO_TARGETS ${ARGS_TARGET})
@@ -461,6 +462,11 @@ function(MFC_SETUP_TARGET)
461462
endif()
462463
endif()
463464

465+
if (ARGS_LAPACK)
466+
find_package(LAPACK REQUIRED)
467+
target_link_libraries(${a_target} PRIVATE LAPACK::LAPACK)
468+
endif()
469+
464470
if (MFC_OpenACC AND ARGS_OpenACC)
465471
find_package(OpenACC)
466472

@@ -506,6 +512,12 @@ function(MFC_SETUP_TARGET)
506512
)
507513
endif()
508514
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
515+
# Frontier Unified Memory Support
516+
if (MFC_Unified)
517+
target_compile_options(${ARGS_TARGET}
518+
PRIVATE -DFRONTIER_UNIFIED)
519+
endif()
520+
509521
find_package(hipfort COMPONENTS hip CONFIG REQUIRED)
510522
target_link_libraries(${a_target} PRIVATE hipfort::hip hipfort::hipfort-amdgcn)
511523
endif()
@@ -541,7 +553,7 @@ endif()
541553
if (MFC_POST_PROCESS)
542554
MFC_SETUP_TARGET(TARGET post_process
543555
SOURCES "${post_process_SRCs}"
544-
MPI SILO HDF5 FFTW)
556+
MPI SILO HDF5 FFTW LAPACK)
545557

546558
# -O0 is in response to https://github.com/MFlowCode/MFC-develop/issues/95
547559
target_compile_options(post_process PRIVATE -O0)

docs/documentation/case.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ To restart the simulation from $k$-th time step, see [Restarting Cases](running.
589589
| `omega_wrt(i)` | Logical | Add the $i$-direction vorticity to the database |
590590
| `schlieren_wrt` | Logical | Add the numerical schlieren to the database|
591591
| `qm_wrt` | Logical | Add the Q-criterion to the database|
592+
| `liutex_wrt` | Logical | Add the Liutex to the database|
592593
| `tau_wrt` | Logical | Add the elastic stress components to the database|
593594
| `fd_order` | Integer | Order of finite differences for computing the vorticity and the numerical Schlieren function [1,2,4] |
594595
| `schlieren_alpha(i)` | Real | Intensity of the numerical Schlieren computed via `alpha(i)` |
@@ -628,7 +629,7 @@ If `file_per_process` is true, then pre_process, simulation, and post_process mu
628629
- `output_partial_domain` activates the output of part of the domain specified by `[x,y,z]_output%beg` and `[x,y,z]_output%end`.
629630
This is useful for large domains where only a portion of the domain is of interest.
630631
It is not supported when `precision = 1` and `format = 1`.
631-
It also cannot be enabled with `flux_wrt`, `heat_ratio_wrt`, `pres_inf_wrt`, `c_wrt`, `omega_wrt`, `ib`, `schlieren_wrt`, or `qm_wrt`.
632+
It also cannot be enabled with `flux_wrt`, `heat_ratio_wrt`, `pres_inf_wrt`, `c_wrt`, `omega_wrt`, `ib`, `schlieren_wrt`, `qm_wrt`, or 'liutex_wrt'.
632633

633634
### 8. Acoustic Source {#acoustic-source}
634635

docs/documentation/references.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@
6969
- <a id="Powell94">Powell, K. G. (1994). An approximate Riemann solver for magnetohydrodynamics: (That works in more than one dimension). In Upwind and high-resolution schemes (pp. 570-583). Springer.</a>
7070

7171
- <a id="Cao19">Cao, S., Zhang, Y., Liao, D., Zhong, P., and Wang, K. G. (2019). Shock-induced damage and dynamic fracture in cylindrical bodies submerged in liquid. International Journal of Solids and Structures, 169:55–71. Elsevier.</a>
72+
73+
- <a id="Xu2019">Xu, W., Gao, Y., Deng, Y., Liu, J., and Liu, C. (2019). An explicit expression for the calculation of the Rortex vector. Physics of Fluids, 31(9)..</a>

examples/3D_turb_mixing/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 3D Turbulent Mixing layer (3D)
2+
3+
## Liutex visualization at transitional state
4+
<img src='result.png' height='MAX_HEIGHT'/>

examples/3D_turb_mixing/case.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"omega_wrt(2)": "T",
9797
"omega_wrt(3)": "T",
9898
"qm_wrt": "T",
99+
"liutex_wrt": "T",
99100
# Patch 1
100101
"patch_icpp(1)%geometry": 9,
101102
"patch_icpp(1)%x_centroid": Lx / 2.0,

examples/3D_turb_mixing/result.png

2.01 MB
Loading

src/common/m_boundary_common.fpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ contains
16261626

16271627
impure subroutine s_create_mpi_types(bc_type)
16281628

1629-
type(integer_field), dimension(1:num_dims, -1:1) :: bc_type
1629+
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
16301630

16311631
#ifdef MFC_MPI
16321632
integer :: dir, loc
@@ -1659,9 +1659,9 @@ contains
16591659

16601660
subroutine s_write_serial_boundary_condition_files(q_prim_vf, bc_type, step_dirpath, old_grid_in)
16611661

1662-
type(scalar_field), dimension(sys_size) :: q_prim_vf
1663-
type(integer_field), dimension(1:num_dims, -1:1) :: bc_type
1664-
logical :: old_grid_in
1662+
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
1663+
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
1664+
logical, intent(in) :: old_grid_in
16651665

16661666
character(LEN=*), intent(in) :: step_dirpath
16671667

@@ -1700,8 +1700,8 @@ contains
17001700

17011701
subroutine s_write_parallel_boundary_condition_files(q_prim_vf, bc_type)
17021702

1703-
type(scalar_field), dimension(sys_size) :: q_prim_vf
1704-
type(integer_field), dimension(1:num_dims, -1:1) :: bc_type
1703+
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
1704+
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
17051705

17061706
integer :: dir, loc
17071707
character(len=path_len) :: file_loc, file_path
@@ -1870,7 +1870,7 @@ contains
18701870

18711871
subroutine s_pack_boundary_condition_buffers(q_prim_vf)
18721872

1873-
type(scalar_field), dimension(sys_size) :: q_prim_vf
1873+
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
18741874
integer :: i, j, k
18751875

18761876
do k = 0, p

src/common/m_helper.fpp

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ module m_helper
3737
double_factorial, &
3838
factorial, &
3939
f_cut_on, &
40-
f_cut_off
40+
f_cut_off, &
41+
s_downsample_data, &
42+
s_upsample_data
4143

4244
contains
4345

@@ -625,4 +627,87 @@ contains
625627
626628
end function f_gx
627629
630+
subroutine s_downsample_data(q_cons_vf, q_cons_temp, m_ds, n_ds, p_ds, m_glb_ds, n_glb_ds, p_glb_ds)
631+
632+
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf, q_cons_temp
633+
634+
! Down sampling variables
635+
integer :: i, j, k, l
636+
integer :: ix, iy, iz, x_id, y_id, z_id
637+
integer, intent(inout) :: m_ds, n_ds, p_ds, m_glb_ds, n_glb_ds, p_glb_ds
638+
639+
m_ds = int((m + 1)/3) - 1
640+
n_ds = int((n + 1)/3) - 1
641+
p_ds = int((p + 1)/3) - 1
642+
643+
m_glb_ds = int((m_glb + 1)/3) - 1
644+
n_glb_ds = int((n_glb + 1)/3) - 1
645+
p_glb_ds = int((p_glb + 1)/3) - 1
646+
647+
do i = 1, sys_size
648+
$:GPU_UPDATE(host='[q_cons_vf(i)%sf]')
649+
end do
650+
651+
do l = -1, p_ds + 1
652+
do k = -1, n_ds + 1
653+
do j = -1, m_ds + 1
654+
x_id = 3*j + 1
655+
y_id = 3*k + 1
656+
z_id = 3*l + 1
657+
do i = 1, sys_size
658+
q_cons_temp(i)%sf(j, k, l) = 0
659+
660+
do iz = -1, 1
661+
do iy = -1, 1
662+
do ix = -1, 1
663+
q_cons_temp(i)%sf(j, k, l) = q_cons_temp(i)%sf(j, k, l) &
664+
+ (1._wp/27._wp)*q_cons_vf(i)%sf(x_id + ix, y_id + iy, z_id + iz)
665+
end do
666+
end do
667+
end do
668+
end do
669+
end do
670+
end do
671+
end do
672+
673+
end subroutine s_downsample_data
674+
675+
subroutine s_upsample_data(q_cons_vf, q_cons_temp)
676+
677+
type(scalar_field), intent(inout), dimension(sys_size) :: q_cons_vf, q_cons_temp
678+
integer :: i, j, k, l
679+
integer :: ix, iy, iz
680+
integer :: x_id, y_id, z_id
681+
real(wp), dimension(4) :: temp
682+
683+
do l = 0, p
684+
do k = 0, n
685+
do j = 0, m
686+
do i = 1, sys_size
687+
688+
ix = int(j/3._wp)
689+
iy = int(k/3._wp)
690+
iz = int(l/3._wp)
691+
692+
x_id = j - int(3*ix) - 1
693+
y_id = k - int(3*iy) - 1
694+
z_id = l - int(3*iz) - 1
695+
696+
temp(1) = (2._wp/3._wp)*q_cons_temp(i)%sf(ix, iy, iz) + (1._wp/3._wp)*q_cons_temp(i)%sf(ix + x_id, iy, iz)
697+
temp(2) = (2._wp/3._wp)*q_cons_temp(i)%sf(ix, iy + y_id, iz) + (1._wp/3._wp)*q_cons_temp(i)%sf(ix + x_id, iy + y_id, iz)
698+
temp(3) = (2._wp/3._wp)*temp(1) + (1._wp/3._wp)*temp(2)
699+
700+
temp(1) = (2._wp/3._wp)*q_cons_temp(i)%sf(ix, iy, iz + z_id) + (1._wp/3._wp)*q_cons_temp(i)%sf(ix + x_id, iy, iz + z_id)
701+
temp(2) = (2._wp/3._wp)*q_cons_temp(i)%sf(ix, iy + y_id, iz + z_id) + (1._wp/3._wp)*q_cons_temp(i)%sf(ix + x_id, iy + y_id, iz + z_id)
702+
temp(4) = (2._wp/3._wp)*temp(1) + (1._wp/3._wp)*temp(2)
703+
704+
q_cons_vf(i)%sf(j, k, l) = (2._wp/3._wp)*temp(3) + (1._wp/3._wp)*temp(4)
705+
706+
end do
707+
end do
708+
end do
709+
end do
710+
711+
end subroutine s_upsample_data
712+
628713
end module m_helper

0 commit comments

Comments
 (0)