@@ -132,33 +132,30 @@ module m_cbc
132132 integer :: dj
133133 integer :: bcxb, bcxe, bcyb, bcye, bczb, bcze
134134 integer :: cbc_dir, cbc_loc
135- !$acc declare create(dj, bcxb, bcxe, bcyb, bcye, bczb, bcze, cbc_dir, cbc_loc)
135+ !$acc declare create(dj, bcxb, bcxe, bcyb, bcye, bczb, bcze, cbc_dir, cbc_loc)
136136
137137 real (kind (0d0 )) :: ux_in, ux_out, vx_in, vx_out, wx_in, wx_out, presx_in, presx_out, Delx_in, Delx_out
138-
138+
139139 real (kind (0d0 )) :: uy_in, uy_out, vy_in, vy_out, wy_in, wy_out, presy_in, presy_out, Dely_in, Dely_out
140-
140+
141141 real (kind (0d0 )) :: uz_in, uz_out, vz_in, vz_out, wz_in, wz_out, presz_in, presz_out, Delz_in, Delz_out
142-
142+
143143!$acc declare create(ux_in, ux_out, vx_in, vx_out, wx_in, wx_out, presx_in, presx_out, Delx_in, Delx_out)
144144!$acc declare create(uy_in, uy_out, vy_in, vy_out, wy_in, wy_out, presy_in, presy_out, Dely_in, Dely_out)
145145!$acc declare create(uz_in, uz_out, vz_in, vz_out, wz_in, wz_out, presz_in, presz_out, Delz_in, Delz_out)
146146
147-
148147#ifdef CRAY_ACC_WAR
149148 @:CRAY_DECLARE_GLOBAL(real (kind (0d0 )), dimension (:, :, :), alpha_rhox_in, alphax_in)
150149 @:CRAY_DECLARE_GLOBAL(real (kind (0d0 )), dimension (:, :, :), alpha_rhoy_in, alphay_in)
151150 @:CRAY_DECLARE_GLOBAL(real (kind (0d0 )), dimension (:, :, :), alpha_rhoz_in, alphaz_in)
152- !$acc declare link(alpha_rhox_in, alphax_in, alpha_rhoy_in, alphay_in, alpha_rhoz_in, alphaz_in)
151+ !$acc declare link(alpha_rhox_in, alphax_in, alpha_rhoy_in, alphay_in, alpha_rhoz_in, alphaz_in)
153152#else
154- real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhox_in, alphax_in
155- real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhoy_in, alphay_in
156- real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhoz_in, alphaz_in
157- !$acc declare create(alpha_rhox_in, alphax_in, alpha_rhoy_in, alphay_in, alpha_rhoz_in, alphaz_in)
153+ real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhox_in, alphax_in
154+ real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhoy_in, alphay_in
155+ real (kind (0d0 )), allocatable, dimension (:) :: alpha_rhoz_in, alphaz_in
156+ !$acc declare create(alpha_rhox_in, alphax_in, alpha_rhoy_in, alphay_in, alpha_rhoz_in, alphaz_in)
158157#endif
159158
160-
161-
162159#ifndef CRAY_ACC_WAR
163160!$acc declare create(q_prim_rsx_vf, q_prim_rsy_vf, q_prim_rsz_vf, F_rsx_vf, F_src_rsx_vf,flux_rsx_vf, flux_src_rsx_vf, &
164161!$acc F_rsy_vf, F_src_rsy_vf,flux_rsy_vf, flux_src_rsy_vf, F_rsz_vf, F_src_rsz_vf,flux_rsz_vf, flux_src_rsz_vf,Re, &
@@ -456,39 +453,39 @@ contains
456453
457454 #:for CBC_DIR, XYZ in [(1 , ' x' ), (2 , ' y' ), (3 , ' z' )]
458455
459- if (${CBC_DIR}$ == 1 ) then
460- u${XYZ}$_in = bc_${XYZ}$%u_in
461- v${XYZ}$_in = bc_${XYZ}$%v_in
462- w${XYZ}$_in = bc_${XYZ}$%w_in
456+ if (${CBC_DIR}$ == 1 ) then
457+ u${XYZ}$_in = bc_${XYZ}$%u_in
458+ v${XYZ}$_in = bc_${XYZ}$%v_in
459+ w${XYZ}$_in = bc_${XYZ}$%w_in
463460 u${XYZ}$_out = bc_${XYZ}$%u_out
464- v${XYZ}$_out = bc_${XYZ}$%v_out
461+ v${XYZ}$_out = bc_${XYZ}$%v_out
465462 w${XYZ}$_out = bc_${XYZ}$%w_out
466463 Del${XYZ}$_in = maxval (dx)
467464 Del${XYZ}$_out = maxval (dx)
468- else if (${CBC_DIR}$ == 2 ) then
465+ else if (${CBC_DIR}$ == 2 ) then
469466
470- u${XYZ}$_in = bc_${XYZ}$%v_in
471- v${XYZ}$_in = bc_${XYZ}$%u_in
472- w${XYZ}$_in = bc_${XYZ}$%w_in
467+ u${XYZ}$_in = bc_${XYZ}$%v_in
468+ v${XYZ}$_in = bc_${XYZ}$%u_in
469+ w${XYZ}$_in = bc_${XYZ}$%w_in
473470 u${XYZ}$_out = bc_${XYZ}$%v_out
474- v${XYZ}$_out = bc_${XYZ}$%u_out
475- w${XYZ}$_out = bc_${XYZ}$%w_out
476- if (n > 0 ) then
471+ v${XYZ}$_out = bc_${XYZ}$%u_out
472+ w${XYZ}$_out = bc_${XYZ}$%w_out
473+ if (n > 0 ) then
477474 Del${XYZ}$_in = maxval (dy)
478475 Del${XYZ}$_out = maxval (dy)
479476 end if
480- else if (${CBC_DIR}$ == 3 ) then
481- u${XYZ}$_in = bc_${XYZ}$%w_in
482- v${XYZ}$_in = bc_${XYZ}$%u_in
483- w${XYZ}$_in = bc_${XYZ}$%v_in
477+ else if (${CBC_DIR}$ == 3 ) then
478+ u${XYZ}$_in = bc_${XYZ}$%w_in
479+ v${XYZ}$_in = bc_${XYZ}$%u_in
480+ w${XYZ}$_in = bc_${XYZ}$%v_in
484481 u${XYZ}$_out = bc_${XYZ}$%w_out
485- v${XYZ}$_out = bc_${XYZ}$%u_out
486- w${XYZ}$_out = bc_${XYZ}$%v_out
487- if (p > 0 ) then
482+ v${XYZ}$_out = bc_${XYZ}$%u_out
483+ w${XYZ}$_out = bc_${XYZ}$%v_out
484+ if (p > 0 ) then
488485 Del${XYZ}$_in = maxval (dz)
489486 Del${XYZ}$_out = maxval (dz)
490487 end if
491- end if
488+ end if
492489
493490 pres${XYZ}$_in = bc_${XYZ}$%pres_in
494491 pres${XYZ}$_out = bc_${XYZ}$%pres_out
@@ -499,9 +496,8 @@ contains
499496 !$acc update device(u${XYZ}$_in, v${XYZ}$_in, w${XYZ}$_in, u${XYZ}$_out, v${XYZ}$_out, w${XYZ}$_out)
500497 !$acc update device(pres${XYZ}$_in, pres${XYZ}$_out, alpha_rho${XYZ}$_in, alpha${XYZ}$_in)
501498 !$acc update device(Del${XYZ}_in, Del${XYZ}_out)
502-
503- #:endfor
504499
500+ #:endfor
505501
506502 end subroutine s_initialize_cbc_module
507503
@@ -939,39 +935,39 @@ contains
939935 lambda(2 ) = vel(dir_idx(1 ))
940936 lambda(3 ) = vel(dir_idx(1 )) + c
941937
942- Ma = vel(dir_idx(1 )) / c
938+ Ma = vel(dir_idx(1 ))/ c
943939
944940 if ((cbc_loc == - 1 .and. bc${XYZ}$b == - 5 ) .or. (cbc_loc == 1 .and. bc${XYZ}$e == - 5 )) then
945941 call s_compute_slip_wall_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
946942 else if ((cbc_loc == - 1 .and. bc${XYZ}$b == - 6 ) .or. (cbc_loc == 1 .and. bc${XYZ}$e == - 6 )) then
947943 call s_compute_nonreflecting_subsonic_buffer_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
948944 else if ((cbc_loc == - 1 .and. bc${XYZ}$b == - 7 ) .or. (cbc_loc == 1 .and. bc${XYZ}$e == - 7 )) then
949945 call s_compute_nonreflecting_subsonic_inflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
950-
951- if (bc_${XYZ}$%grcbc_in) then
952- !$acc loop seq
946+
947+ if (bc_${XYZ}$%grcbc_in) then
948+ !$acc loop seq
953949 do i = 2 , momxb
954- L(2 ) = c** 3d0 * Ma * (alpha_rho(i- 1 ) - alpha_rho${XYZ}$_in(i- 1 )) / Del${XYZ}$_in - c * Ma * (pres - pres${XYZ}$_in) / Del${XYZ}$_in
950+ L(2 ) = c** 3d0 * Ma * (alpha_rho(i - 1 ) - alpha_rho${XYZ}$_in(i - 1 ))/ Del${XYZ}$_in - c* Ma * (pres - pres${XYZ}$_in)/ Del${XYZ}$_in
955951 end do
956- if (n > 0 ) then
957- L(momxb + 1 ) = c * Ma * (vel(dir_idx(2 )) - v${XYZ}$_in) / Del${XYZ}$_in
958- if (p > 0 ) then
959- L(momxb + 2 ) = c * Ma * (vel(dir_idx(3 )) - w${XYZ}$_in) / Del${XYZ}$_in
960- end if
961- end if
962- !$acc loop seq
952+ if (n > 0 ) then
953+ L(momxb + 1 ) = c* Ma * (vel(dir_idx(2 )) - v${XYZ}$_in)/ Del${XYZ}$_in
954+ if (p > 0 ) then
955+ L(momxb + 2 ) = c* Ma * (vel(dir_idx(3 )) - w${XYZ}$_in)/ Del${XYZ}$_in
956+ end if
957+ end if
958+ !$acc loop seq
963959 do i = E_idx, advxe - 1
964- L(i) = c * Ma * (adv(i + 1 - E_idx) - alpha${XYZ}$_in(i + 1 - E_idx)) / Del${XYZ}$_in
965- end do
966- L(advxe) = rho* c** 2d0 * (1d0 + Ma)* (vel(dir_idx(1 )) + u${XYZ}$_in * sign (1 , cbc_loc)) / Del${XYZ}$_in + c* (1d0 + Ma)* (pres - pres${XYZ}$_in) / Del${XYZ}$_in
967- end if
960+ L(i) = c* Ma * (adv(i + 1 - E_idx) - alpha${XYZ}$_in(i + 1 - E_idx))/ Del${XYZ}$_in
961+ end do
962+ L(advxe) = rho* c** 2d0 * (1d0 + Ma)* (vel(dir_idx(1 )) + u${XYZ}$_in* sign (1 , cbc_loc))/ Del${XYZ}$_in + c* (1d0 + Ma)* (pres - pres${XYZ}$_in)/ Del${XYZ}$_in
963+ end if
968964 else if ((cbc_loc == - 1 .and. bc${XYZ}$b == - 8 ) .or. (cbc_loc == 1 .and. bc${XYZ}$e == - 8 )) then
969965 call s_compute_nonreflecting_subsonic_outflow_L(lambda, L, rho, c, mf, dalpha_rho_ds, dpres_ds, dvel_ds, dadv_ds)
970-
971- if (bc_${XYZ}$%grcbc_out) then
972- L(advxe) = c* (1d0 - Ma)* (pres - pres${XYZ}$_out) / Del${XYZ}$_out
973- if (bc_${XYZ}$%grcbc_vel_out) then
974- L(advxe) = L(advxe) + rho* c** 2d0 * (1d0 - Ma)* (vel(dir_idx(1 )) + u${XYZ}$_out * sign (1 , cbc_loc)) / Del${XYZ}$_out
966+
967+ if (bc_${XYZ}$%grcbc_out) then
968+ L(advxe) = c* (1d0 - Ma)* (pres - pres${XYZ}$_out)/ Del${XYZ}$_out
969+ if (bc_${XYZ}$%grcbc_vel_out) then
970+ L(advxe) = L(advxe) + rho* c** 2d0 * (1d0 - Ma)* (vel(dir_idx(1 )) + u${XYZ}$_out* sign (1 , cbc_loc))/ Del${XYZ}$_out
975971 end if
976972 end if
977973
0 commit comments