Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand committed Apr 4, 2024
1 parent 36538a3 commit 14802b0
Show file tree
Hide file tree
Showing 22 changed files with 589 additions and 665 deletions.
28 changes: 14 additions & 14 deletions src/common/include/inline_conversions.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

integer :: q

if (alt_soundspeed) then
blkmod1 = ((gammas(1) + 1d0)*pres + &
pi_infs(1))/gammas(1)
blkmod2 = ((gammas(2) + 1d0)*pres + &
pi_infs(2))/gammas(2)
c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2)))
elseif (model_eqns == 3) then
c = 0d0
!$acc loop seq
do q = 1, num_fluids
c = c + adv(q)*(1d0/gammas(q) + 1d0)* &
(pres + pi_infs(q)/(gammas(q) + 1d0))
end do
if (alt_soundspeed) then
blkmod1 = ((gammas(1) + 1d0)*pres + &
pi_infs(1))/gammas(1)
blkmod2 = ((gammas(2) + 1d0)*pres + &
pi_infs(2))/gammas(2)
c = (1d0/(rho*(adv(1)/blkmod1 + adv(2)/blkmod2)))
elseif (model_eqns == 3) then
c = 0d0
!$acc loop seq
do q = 1, num_fluids
c = c + adv(q)*(1d0/gammas(q) + 1d0)* &
(pres + pi_infs(q)/(gammas(q) + 1d0))
end do
c = c/rho

elseif (((model_eqns == 4) .or. (model_eqns == 2 .and. bubbles))) then
Expand All @@ -46,7 +46,7 @@
else
c = ((H - 5d-1*vel_sum)/gamma)
end if

if (mixture_err .and. c < 0d0) then
c = 100.d0*sgm_eps
else
Expand Down
27 changes: 13 additions & 14 deletions src/common/include/macros.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,32 @@

#:def ALLOCATE(*args)
@:LOG({'@:ALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
allocate(${', '.join(args)}$)
allocate (${', '.join(args)}$)
#ifndef CRAY_ACC_WAR
!$acc enter data create(${', '.join(args)}$)
!$acc enter data create(${', '.join(args)}$)
#endif
#:enddef ALLOCATE

#:def DEALLOCATE(*args)
@:LOG({'@:DEALLOCATE(${re.sub(' +', ' ', ', '.join(args))}$)'})
deallocate (${', '.join(args)}$)
#ifndef CRAY_ACC_WAR
!$acc exit data delete(${', '.join(args)}$)
!$acc exit data delete(${', '.join(args)}$)
#endif
#:enddef DEALLOCATE


#:def ALLOCATE_GLOBAL(*args)
@:LOG({'@:ALLOCATE_GLOBAL(${re.sub(' +', ' ', ', '.join(args))}$)'})
#ifdef CRAY_ACC_WAR
allocate(${', '.join(('p_' + arg.strip() for arg in args))}$)
allocate (${', '.join(('p_' + arg.strip() for arg in args))}$)
#:for arg in args
${re.sub('\(.*\)','',arg)}$ => ${ 'p_' + re.sub('\(.*\)','',arg.strip()) }$
#:endfor
!$acc enter data create(${', '.join(('p_' + re.sub('\(.*\)','',arg.strip()) for arg in args))}$) &
!$acc& attach(${', '.join(map(lambda x: re.sub('\(.*\)','',x), args))}$)
!$acc enter data create(${', '.join(('p_' + re.sub('\(.*\)','',arg.strip()) for arg in args))}$) &
!$acc& attach(${', '.join(map(lambda x: re.sub('\(.*\)','',x), args))}$)
#else
allocate(${', '.join(args)}$)
!$acc enter data create(${', '.join(args)}$)
allocate (${', '.join(args)}$)
!$acc enter data create(${', '.join(args)}$)
#endif

#:enddef ALLOCATE_GLOBAL
Expand All @@ -49,12 +48,12 @@
!$acc exit data delete(${', '.join(('p_' + arg.strip() for arg in args))}$) &
!$acc& detach(${', '.join(args)}$)
#:for arg in args
nullify( ${arg}$ )
nullify (${arg}$)
#:endfor
deallocate(${', '.join(('p_' + arg.strip() for arg in args))}$)
deallocate (${', '.join(('p_' + arg.strip() for arg in args))}$)
#else
deallocate(${', '.join(args)}$)
!$acc exit data delete(${', '.join(args)}$)
deallocate (${', '.join(args)}$)
!$acc exit data delete(${', '.join(args)}$)
#endif

#:enddef DEALLOCATE_GLOBAL
Expand All @@ -73,7 +72,7 @@
${intype}$, target :: ${', '.join(('p_' + arg.strip() for arg in args))}$
${intype}$, pointer :: ${', '.join(args)}$
#else
${intype}$ :: ${', '.join(args)}$
${intype}$::${', '.join(args)}$
#endif
#:enddef CRAY_DECLARE_GLOBAL_SCALAR

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 @@ -191,7 +191,7 @@ contains
#else
@:ALLOCATE(pb0(nb), mass_n0(nb), mass_v0(nb), Pe_T(nb))
@:ALLOCATE(k_n(nb), k_v(nb), omegaN(nb))
@:ALLOCATE(Re_trans_T(nb), Re_trans_c(nb), Im_trans_T(nb), Im_trans_c(nb))
@:ALLOCATE(Re_trans_T(nb), Re_trans_c(nb), Im_trans_T(nb), Im_trans_c(nb))
#endif
pb0(:) = dflt_real
Expand Down
5 changes: 2 additions & 3 deletions src/common/m_phase_change.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
module m_phase_change

#ifndef MFC_POST_PROCESS

! Dependencies =============================================================

use m_derived_types !< Definitions of the derived types
Expand Down Expand Up @@ -316,8 +316,7 @@ contains
integer :: i, ns !< generic loop iterators

! auxiliary variables for the pT-equilibrium solver
mCP = 0.0d0; mQ = 0.0d0; p_infpT = ps_inf;

mCP = 0.0d0; mQ = 0.0d0; p_infpT = ps_inf;
! Performing tests before initializing the pT-equilibrium
!$acc loop seq
do i = 1, num_fluids
Expand Down
45 changes: 19 additions & 26 deletions src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ module m_variables_conversion
!! In simulation, gammas, pi_infs, and qvs are already declared in m_global_variables
#ifndef MFC_SIMULATION
real(kind(0d0)), allocatable, public, dimension(:) :: gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps
!$acc declare create(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps)
!$acc declare create(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps)
#endif

#ifdef CRAY_ACC_WAR
@:CRAY_DECLARE_GLOBAL(real(kind(0d0)), dimension(:), Gs)
@:CRAY_DECLARE_GLOBAL(integer, dimension(:), bubrs)
@:CRAY_DECLARE_GLOBAL(real(kind(0d0)), dimension(:, :), Res)
!$acc declare link(bubrs, Gs, Res)
!$acc declare link(bubrs, Gs, Res)
#else
real(kind(0d0)), allocatable, dimension(:) :: Gs
integer, allocatable, dimension(:) :: bubrs
real(kind(0d0)), allocatable, dimension(:) :: Gs
integer, allocatable, dimension(:) :: bubrs
real(kind(0d0)), allocatable, dimension(:, :) :: Res
!$acc declare create(bubrs, Gs, Res)
!$acc declare create(bubrs, Gs, Res)
#endif
integer :: is1b, is2b, is3b, is1e, is2e, is3e
!$acc declare create(is1b, is2b, is3b, is1e, is2e, is3e)
Expand Down Expand Up @@ -459,7 +459,7 @@ contains
#ifdef CRAY_ACC_WAR
!DIR$ INLINEALWAYS s_convert_species_to_mixture_variables_acc
#else
!$acc routine seq
!$acc routine seq
#endif

real(kind(0d0)), intent(OUT) :: rho_K, gamma_K, pi_inf_K, qv_K
Expand Down Expand Up @@ -516,17 +516,17 @@ contains
end if

if (any(Re_size > 0)) then

do i = 1, 2
Re_K(i) = dflt_real

if (Re_size(i) > 0) Re_K(i) = 0d0
do j = 1, Re_size(i)

do j = 1, Re_size(i)
Re_K(i) = alpha_K(Re_idx(i, j))/Res(i, j) &
+ Re_K(i)
end do

Re_K(i) = 1d0/max(Re_K(i), sgm_eps)

end do
Expand All @@ -541,7 +541,7 @@ contains
#ifdef CRAY_ACC_WAR
!DIR$ INLINEALWAYS s_convert_species_to_mixture_variables_bubbles_acc
#else
!$acc routine seq
!$acc routine seq
#endif

real(kind(0d0)), intent(INOUT) :: rho_K, gamma_K, pi_inf_K, qv_K
Expand Down Expand Up @@ -626,10 +626,10 @@ contains
end if
end if
#endif
!$acc enter data copyin(ixb, ixe, iyb, iye, izb, ize)
!$acc enter data copyin(is1b, is1e, is2b, is2e, is3b, is3e)
!$acc update device(ixb, ixe, iyb, iye, izb, ize)

!$acc enter data copyin(ixb, ixe, iyb, iye, izb, ize)
!$acc enter data copyin(is1b, is1e, is2b, is2e, is3b, is3e)
!$acc update device(ixb, ixe, iyb, iye, izb, ize)

#ifdef MFC_SIMULATION
@:ALLOCATE_GLOBAL(gammas (1:num_fluids))
Expand All @@ -651,7 +651,6 @@ contains
@:ALLOCATE(Gs (1:num_fluids))
#endif


do i = 1, num_fluids
gammas(i) = fluid_pp(i)%gamma
gs_min(i) = 1.0d0/gammas(i) + 1.0d0
Expand All @@ -662,7 +661,7 @@ contains
qvs(i) = fluid_pp(i)%qv
qvps(i) = fluid_pp(i)%qvp
end do
!$acc update device(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs)
!$acc update device(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs)

#ifdef MFC_SIMULATION

Expand Down Expand Up @@ -890,7 +889,6 @@ contains
#:endif

!$acc parallel loop collapse(3) gang vector default(present) private(alpha_K, alpha_rho_K, Re_K, nRtmp, rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K, R3tmp)

do l = izb, ize
do k = iyb, iye
do j = ixb, ixe
Expand Down Expand Up @@ -932,7 +930,6 @@ contains
#endif
end if


#ifdef MFC_SIMULATION
rho_K = max(rho_K, sgm_eps)
#endif
Expand Down Expand Up @@ -1052,7 +1049,6 @@ contains
real(kind(0d0)) :: G = 0d0
real(kind(0d0)), dimension(2) :: Re_K


integer :: i, j, k, l, q !< Generic loop iterators

#ifndef MFC_SIMULATION
Expand Down Expand Up @@ -1087,8 +1083,6 @@ contains
q_prim_vf(i)%sf(j, k, l)/2d0
end do



! Computing the energy from the pressure
if ((model_eqns /= 4) .and. (bubbles .neqv. .true.)) then
! E = Gamma*P + \rho u u /2 + \pi_inf + (\alpha\rho qv)
Expand Down Expand Up @@ -1280,8 +1274,7 @@ contains
+ pres_K*dir_flg(dir_idx(i))
end do


if(j == 1) then
if (j == 1) then
#ifdef CRAY_PRINT_DEBUG
print *, "cbc debug"
print *, E_K
Expand All @@ -1292,7 +1285,7 @@ contains
! energy flux, u(E+p)
FK_vf(j, k, l, E_idx) = vel_K(dir_idx(1))*(E_K + pres_K)
! comment out above and it will run to completion

! have been using == 2
if (riemann_solver == 1) then
!$acc loop seq
Expand Down
20 changes: 10 additions & 10 deletions src/pre_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,17 @@ subroutine s_check_inputs()
call s_mpi_abort('m, n, and/or p are set to dflt_int.'// &
'Please, correct them')
end if
! in case it is NOT restart
! Constraints on domain boundaries for cylindrical coordinates
! in case it is NOT restart
! Constraints on domain boundaries for cylindrical coordinates
elseif (n == 0 &
.or. &
y_domain%beg /= 0d0 &
.or. &
y_domain%end == dflt_real &
.or. &
y_domain%end < 0d0 &
.or. &
y_domain%beg >= y_domain%end) then
.or. &
y_domain%beg /= 0d0 &
.or. &
y_domain%end == dflt_real &
.or. &
y_domain%end < 0d0 &
.or. &
y_domain%beg >= y_domain%end) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'cyl_coord and n, y_domain%beg, or '// &
'y_domain%end. Exiting ...')
Expand Down
9 changes: 4 additions & 5 deletions src/simulation/m_bubbles.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module m_bubbles
real(kind(0.d0)) :: chi_vw !< Bubble wall properties (Ando 2010)
real(kind(0.d0)) :: k_mw !< Bubble wall properties (Ando 2010)
real(kind(0.d0)) :: rho_mw !< Bubble wall properties (Ando 2010)
!$acc declare create(chi_vw, k_mw, rho_mw)
!$acc declare create(chi_vw, k_mw, rho_mw)

#ifdef CRAY_ACC_WAR
!> @name Bubble dynamic source terms
Expand All @@ -37,10 +37,10 @@ module m_bubbles
!$acc declare link(bub_r_src, bub_v_src, bub_p_src, bub_m_src)

type(scalar_field) :: divu !< matrix for div(u)
!$acc declare create(divu)
!$acc declare create(divu)

@:CRAY_DECLARE_GLOBAL(integer, dimension(:), rs, vs, ms, ps)
!$acc declare link(rs, vs, ms, ps)
!$acc declare link(rs, vs, ms, ps)
#else
real(kind(0d0)), allocatable, dimension(:, :, :) :: bub_adv_src
real(kind(0d0)), allocatable, dimension(:, :, :, :) :: bub_r_src, bub_v_src, bub_p_src, bub_m_src
Expand All @@ -50,9 +50,8 @@ module m_bubbles
!$acc declare create(divu)

integer, allocatable, dimension(:) :: rs, vs, ms, ps
!$acc declare create(rs, vs, ms, ps)
!$acc declare create(rs, vs, ms, ps)
#endif


contains

Expand Down
Loading

0 comments on commit 14802b0

Please sign in to comment.